diff --git a/README.md b/README.md index 8ce1d9af..a5bdcba9 100644 --- a/README.md +++ b/README.md @@ -55,24 +55,29 @@ The first has the simplest API and "just works", the second gets you all the bel A [command-line tool](https://eemeli.org/yaml/#command-line-tool) is also included. +### Parse & Stringify + ```js import { parse, stringify } from 'yaml' -// or -import YAML from 'yaml' -// or -const YAML = require('yaml') ``` -### Parse & Stringify - - [`parse(str, reviver?, options?): value`](https://eemeli.org/yaml/#yaml-parse) - [`stringify(value, replacer?, options?): string`](https://eemeli.org/yaml/#yaml-stringify) ### Documents + +```js +import { + Document, + isDocument, + parseAllDocuments, + parseDocument +} from 'yaml' +``` + - [`Document`](https://eemeli.org/yaml/#documents) - [`constructor(value, replacer?, options?)`](https://eemeli.org/yaml/#creating-documents) - - [`#anchors`](https://eemeli.org/yaml/#working-with-anchors) - [`#contents`](https://eemeli.org/yaml/#content-nodes) - [`#directives`](https://eemeli.org/yaml/#stream-directives) - [`#errors`](https://eemeli.org/yaml/#errors) @@ -83,6 +88,15 @@ const YAML = require('yaml') ### Content Nodes + +```js +import { + isAlias, isCollection, isMap, isNode, + isPair, isScalar, isSeq, Scalar, + visit, visitAsync, YAMLMap, YAMLSeq +} from 'yaml' +``` + - [`isAlias(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types) - [`isCollection(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types) - [`isMap(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types) @@ -93,13 +107,18 @@ const YAML = require('yaml') - [`new Scalar(value)`](https://eemeli.org/yaml/#scalar-values) - [`new YAMLMap()`](https://eemeli.org/yaml/#collections) - [`new YAMLSeq()`](https://eemeli.org/yaml/#collections) -- [`doc.createAlias(node, name?): Alias`](https://eemeli.org/yaml/#working-with-anchors) +- [`doc.createAlias(node, name?): Alias`](https://eemeli.org/yaml/#creating-nodes) - [`doc.createNode(value, options?): Node`](https://eemeli.org/yaml/#creating-nodes) - [`doc.createPair(key, value): Pair`](https://eemeli.org/yaml/#creating-nodes) - [`visit(node, visitor)`](https://eemeli.org/yaml/#finding-and-modifying-nodes) +- [`visitAsync(node, visitor)`](https://eemeli.org/yaml/#finding-and-modifying-nodes) ### Parsing YAML +```js +import { Composer, Lexer, Parser } from 'yaml' +``` + - [`new Lexer().lex(src)`](https://eemeli.org/yaml/#lexer) - [`new Parser(onNewLine?).parse(src)`](https://eemeli.org/yaml/#parser) - [`new Composer(options?).compose(tokens)`](https://eemeli.org/yaml/#composer) diff --git a/docs/01_intro.md b/docs/01_intro.md index 6a4cfafb..2600daec 100644 --- a/docs/01_intro.md +++ b/docs/01_intro.md @@ -86,15 +86,15 @@ import { } from 'yaml' ``` -- [`isNode(foo): boolean`](#identifying-nodes) +- [`is*(foo): boolean`](#identifying-node-types) - [`new Scalar(value)`](#scalar-values) - [`new YAMLMap()`](#collections) - [`new YAMLSeq()`](#collections) - [`doc.createAlias(node, name?): Alias`](#creating-nodes) - [`doc.createNode(value, options?): Node`](#creating-nodes) - [`doc.createPair(key, value): Pair`](#creating-nodes) -- [`visit(node, visitor)`](#modifying-nodes) -- [`visitAsync(node, visitor)`](#modifying-nodes) +- [`visit(node, visitor)`](#finding-and-modifying-nodes) +- [`visitAsync(node, visitor)`](#finding-and-modifying-nodes)