@tabnas/yaml 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/yaml.d.ts +7 -0
- package/dist/yaml.js +2688 -0
- package/dist/yaml.js.map +1 -0
- package/package.json +53 -0
- package/src/tsconfig.json +15 -0
- package/src/yaml.ts +2479 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 jsonicjs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @tabnas/yaml
|
|
2
|
+
|
|
3
|
+
A [Tabnas](https://github.com/tabnas/parser) grammar plugin that parses
|
|
4
|
+
a core subset of YAML into plain JavaScript values, built on the
|
|
5
|
+
relaxed-JSON [`jsonic`](https://github.com/tabnas/jsonic) grammar.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@tabnas/yaml)
|
|
8
|
+
[](https://github.com/tabnas/yaml/blob/main/LICENSE)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @tabnas/yaml @tabnas/jsonic @tabnas/parser
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`@tabnas/jsonic` (>= 2) and `@tabnas/parser` (>= 2) are peer
|
|
18
|
+
dependencies.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
|
|
23
|
+
Register the plugin on a Tabnas engine that already has the `jsonic`
|
|
24
|
+
grammar, then parse:
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
const { Tabnas } = require('@tabnas/parser')
|
|
28
|
+
const { jsonic } = require('@tabnas/jsonic')
|
|
29
|
+
const { Yaml } = require('@tabnas/yaml')
|
|
30
|
+
|
|
31
|
+
const j = new Tabnas().use(jsonic).use(Yaml)
|
|
32
|
+
|
|
33
|
+
j.parse("name: Alice\nitems:\n - one\n - two\n") // => { name: 'Alice', items: ['one', 'two'] }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
The docs follow the [Diátaxis](https://diataxis.fr) four-quadrant
|
|
40
|
+
structure:
|
|
41
|
+
|
|
42
|
+
- [Tutorial](doc/tutorial.md) — parse your first document, step by step.
|
|
43
|
+
- [How-to guide](doc/guide.md) — focused task recipes (flow collections,
|
|
44
|
+
block scalars, anchors, multi-document streams, the `meta` option).
|
|
45
|
+
- [Reference](doc/reference.md) — the public API, every option, and the
|
|
46
|
+
full list of accepted syntax.
|
|
47
|
+
- [Concepts](doc/concepts.md) — how the plugin extends the engine, and
|
|
48
|
+
why.
|
|
49
|
+
|
|
50
|
+
The Go port lives in [`../go`](../go) with its own
|
|
51
|
+
[docs](../go/doc/).
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Grammar diagram
|
|
55
|
+
|
|
56
|
+
The installed grammar as a railroad/syntax diagram, generated from the
|
|
57
|
+
live grammar with [`@tabnas/railroad`](https://github.com/tabnas/railroad):
|
|
58
|
+
|
|
59
|
+

|
|
60
|
+
|
|
61
|
+
ASCII version: [`doc/grammar.txt`](doc/grammar.txt).
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
MIT. Copyright (c) Richard Rodger.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../src/yaml.ts"],"version":"6.0.3"}
|