You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
522 B
21 lines
522 B
2 years ago
|
import { parse } from 'yaml'
|
||
|
import fs from 'fs'
|
||
|
|
||
|
console.log("Parsing the manual file...")
|
||
|
|
||
|
parse('3.14159')
|
||
|
// 3.14159
|
||
|
|
||
|
parse('[ true, false, maybe, null ]\n')
|
||
|
// [ true, false, 'maybe', null ]
|
||
|
|
||
|
const file = fs.readFileSync('./manual/index.yml', 'utf8')
|
||
|
const parsed = parse(file)
|
||
|
// { YAML:
|
||
|
// [ 'A human-readable data serialization language',
|
||
|
// 'https://en.wikipedia.org/wiki/YAML' ],
|
||
|
// yaml:
|
||
|
// [ 'A complete JavaScript implementation',
|
||
|
// 'https://www.npmjs.com/package/yaml' ] }
|
||
|
|
||
|
console.log(parsed)
|