@travetto/yaml
Advanced tools
Comparing version 1.0.0-rc.9 to 1.0.0
@@ -9,2 +9,3 @@ { | ||
}, | ||
"title": "YAML", | ||
"description": "Simple YAML support, provides only clean subset of yaml", | ||
@@ -18,3 +19,3 @@ "homepage": "https://travetto.io", | ||
"dependencies": { | ||
"@travetto/base": "^1.0.0-rc.8" | ||
"@travetto/base": "^1.0.0" | ||
}, | ||
@@ -31,4 +32,4 @@ "license": "MIT", | ||
}, | ||
"version": "1.0.0-rc.9", | ||
"gitHead": "cbb74e652d4277ec98c98098b931d6503a586af2" | ||
"version": "1.0.0", | ||
"gitHead": "7579e30893669f4136472c7d0a327a9cfdd1c804" | ||
} |
102
README.md
@@ -1,6 +0,100 @@ | ||
travetto: Yaml | ||
=== | ||
<!-- This file was generated by the framweork and should not be modified directly --> | ||
<!-- Please modify https://github.com/travetto/travetto/tree/master/module/yaml/README.js and execute "npm run docs" to rebuild --> | ||
# YAML | ||
## Simple YAML support, provides only clean subset of yaml | ||
In the desire to provide a minimal footprint, the framework provides a minimal YAML parser/serializer to handle standard configuration structure. | ||
**Install: @travetto/yaml** | ||
```bash | ||
npm install @travetto/yaml | ||
``` | ||
[`YamlUtil`](./src/api.ts) is the main access point for this module, and will expose two method, `parse` and `serialize`. | ||
In the desire to provide a minimal footprint, the framework provides a minimal [YAML](https://en.wikipedia.org/wiki/YAML) parser/serializer to handle standard configuration structure. | ||
[YamlUtil](https://github.com/travetto/travetto/tree/master/module/yaml/src/util.ts#L7) is the main access point for this module, and will expose two method, `parse` and `serialize`. | ||
**Code: Simple YAML Parsing** | ||
```typescript | ||
import { YamlUtil } from '@travetto/yaml/src/util'; | ||
const obj = YamlUtil.parse(` | ||
name: Source | ||
age: 20 | ||
fields: | ||
sub: | ||
- a | ||
- b | ||
- c | ||
sub2: [1,2,3] | ||
sub3: {"k":5, "v":20} | ||
`); | ||
console.log(JSON.stringify(obj, null, 2)); | ||
``` | ||
**Terminal: Simple YAML Parsing** | ||
```bash | ||
$ alt/docs/src/parse.ts -r @travetto/boot/register alt/docs/src/parse.ts | ||
{ | ||
"name": "Source", | ||
"age": 20, | ||
"fields": { | ||
"sub": [ | ||
"a", | ||
"b", | ||
"c" | ||
], | ||
"sub2": [ | ||
1, | ||
2, | ||
3 | ||
], | ||
"sub3": { | ||
"k": 5, | ||
"v": 20 | ||
} | ||
} | ||
} | ||
``` | ||
**Code: Simple YAML Serialization** | ||
```typescript | ||
import { YamlUtil } from '@travetto/yaml/src/util'; | ||
const text = YamlUtil.serialize({ | ||
name: 'Source', | ||
age: 20, | ||
fields: { | ||
sub: [ | ||
'a', | ||
'b', | ||
'c' | ||
], | ||
sub2: [1, 2, 3], | ||
sub3: { k: 5, v: 20 } | ||
} | ||
}); | ||
console.log(text); | ||
``` | ||
**Terminal: Simple YAML Serialization** | ||
```bash | ||
$ alt/docs/src/serialize.ts -r @travetto/boot/register alt/docs/src/serialize.ts | ||
name: Source | ||
age: 20 | ||
fields: | ||
sub: | ||
- a | ||
- b | ||
- c | ||
sub2: | ||
- 1 | ||
- 2 | ||
- 3 | ||
sub3: | ||
k: 5 | ||
v: 20 | ||
``` | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
24600
12
659
0
14
Updated@travetto/base@^1.0.0