@cobol-ts/yaml-jsyaml 0.0.14 → 0.0.16

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.
Files changed (2) hide show
  1. package/README.md +23 -1
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,3 +1,25 @@
1
1
  # @cobol-ts/yaml-jsyaml
2
2
 
3
- The `js-yaml` implementation of `@cobol-ts/yaml`. Parses with JSON schema and rejects duplicate mapping keys.
3
+ Implement the YAML parsing port with `js-yaml` and its JSON schema.
4
+
5
+ Parser failures become `ErrorsOr.errors`; duplicate keys are rejected and mapping values are still untrusted.
6
+
7
+ ## Usage
8
+
9
+ ```typescript
10
+ import {jsYamlParser} from '@cobol-ts/yaml-jsyaml'
11
+
12
+ const result = jsYamlParser.parse('enabled: true')
13
+ if ('errors' in result) throw new Error(result.errors.join('\n'))
14
+ // result.value remains unknown until validated by its consumer
15
+ ```
16
+
17
+ It uses `JSON_SCHEMA` to avoid implicit YAML date objects, and `json: false` so duplicate mapping keys are errors. It converts thrown parser errors into `ErrorsOr` instead of throwing them to callers.
18
+
19
+ ## Source and tests
20
+
21
+ **Public entry points:** [js.yaml.ts](./src/js.yaml.ts).
22
+
23
+ **Tests:** [js.yaml.spec.ts](src/js.yaml.spec.ts)
24
+
25
+ **Related:** [@cobol-ts/yaml](../yaml/README.md) · [@cobol-ts/file-catalogue](../../config/file-catalogue/README.md).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cobol-ts/yaml-jsyaml",
3
3
  "description": "js-yaml adapter for the generic YAML parsing interface",
4
- "version": "0.0.14",
4
+ "version": "0.0.16",
5
5
  "main": "dist/index",
6
6
  "types": "dist/index",
7
7
  "browserslist": {
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "js-yaml": "^4.1.0",
21
- "@cobol-ts/yaml": "0.0.14",
22
- "@cobol-ts/errors": "0.0.14"
21
+ "@cobol-ts/yaml": "0.0.16",
22
+ "@cobol-ts/errors": "0.0.16"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/js-yaml": "^4.0.9",