0.3.1 • Published 3 years ago

yaml-js v0.3.1

Weekly downloads
114,290
License
WTFPL
Repository
github
Last release
3 years ago

⚠️Abandoned

This project is now abandoned and the repository archived. The license should allow you to fork and do whatever you want, in case you cannot migrate to a different YAML library.

Fun history fact: when I made the port there wasn't another pure JS YAML parser - the initial commit for this repo was just a couple of days before the initial release of js-yaml!

yaml-js

yaml-js is a YAML loader and dumper, ported pretty much line-for-line from PyYAML. The goal for the project is to maintain a reliable and specification-complete YAML processor in pure Javascript, with CoffeeScript source code. You can try it out here.

Loading is stable and well-used, and passes the yaml-spec test suite, which fairly thoroughly covers the YAML 'core' schema.

Dumping is present but very lightly tested (auto-tests only, no significant usage). The output should therefore be correct YAML, however formatting is currently entirely untested.

How Do I Get It?

npm install yaml-js

How Do I Use It?

// Server (e.g. node.js)
var yaml = require('yaml-js');

// Browser
// <script src='yaml.min.js'></script>

// Loading
console.log(yaml.load(
  '---\n' +
  'phrase1:\n' +
  '  - hello\n' +
  '  - &world world\n' +
  'phrase2:\n' +
  '  - goodbye\n' +
  '  - *world\n' +
  'phrase3: >\n' +
  '  What is up\n' +
  '  in this place.'
));
// { phrase1: [ 'hello', 'world' ],
//   phrase2: [ 'goodbye', 'world' ],
//   phrase3: 'What is up in this place.' }

// Dumping
console.log(yaml.dump({
  phrase1: [ 'hello',   'world' ],
  phrase2: [ 'goodbye', 'world' ],
  phrase3: 'What is up in this place.'
}));
// phrase1: [hello, world]
// phrase2: [goodbye, world]
// phrase3: What is up in this place.

API summary

MethodDescription
loadParse the first YAML document in a stream and produce the corresponding Javascript object.
dumpSerialize a Javascript object into a YAML stream.
load_allParse all YAML documents in a stream and produce the corresponing Javascript objects.
dump_allSerialize a sequence of Javascript objects into a YAML stream.
scanScan a YAML stream and produce tokens.
parseParse a YAML stream and produce events.
composeParse the first YAML document in a stream and produce the corresponding representation tree.
compose_allParse all YAML documents in a stream and produce corresponding representation trees.
emitEmit YAML parsing events into a stream.
serializeSerialize a representation tree into a YAML stream.
serialize_allSerialize a sequence of representation trees into a YAML stream.

License

WTFPL

@monogoto.io/node-red-contrib-monogoto-customer@monogoto.io/node-red-contrib-monogoto-operator@kadr/staticprojifybeet-cli@infinitebrahmanuniverse/nolb-yam@everything-registry/sub-chunk-3196yawn-yamlyaml-runneryamlircyaml-syntaxvue-i18n-filevue-i18ns-testwcq-vuewebpack-rails-i18ntinyjs-resource-loadertiledmap-loaderterraform-artillerytest-public-protradingdata2vscode-solidity-servervizz.microservice-clientswagger-schema-utilsswagger-spec-to-pdfswagger-api-inspectorswagger-editor-biswagger-editor-binaryswagger-editor-npm-packageswaggerize-express-api-compositionswaglintswagger-yamlswagger2-zyrails-translations-webpack-pluginreact-swagger-uiresin-commit-linterresumed-cliresume-cliread-metadatarecinkreclass-docrigidreact-rails-translationrucolarun-jstsolidity-language-serverstatischstatic-generator-static@mojob/mj-components@mojob/application-process@leontastic/gatsby@fidian/tv4-cli@gr2m/yawn-yamlco-passportrcfgrubix-swagger-ui@rancher/dashboard-frameworkeslint-config-jonyonson@w3sec/cloud-config-parser@llllvvuu/vscode-solidity-langserver@snyk/cloud-config-parser@the-ksquare-group/resume-cli@swagger-api/apidom-lsadsk-fury-adapter-swaggerform2yaml@anthonyjdella/customized-resume-clifury-adapter-oas3-parserfury-adapter-swaggerfury-adapter-swagger-fork@apielements/openapi2-parser@apielements/openapi3-parserflow2schemafileo@artilleryio/platform-fargateapim-swagger-editorapim-swagger-editor-casapim-uiapim-swagger-editor-gasanvil.concatanvil.templateanvil.tokengetcomicbagofclibalm-climodel-first@buxlabs/html-enginegulp-resolverefshatchjsnode-red-contrib-engagebrap-ssghuginnhuginn-asset-bundlerhuginn-tag-cloudhulkhubot-riffraffp-lvl2-gendiffouaisopenframe-tangrambash-autocompletermohawk-templatinggap.js
0.3.1-0

3 years ago

0.3.1

3 years ago

0.2.3

6 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

7 years ago

0.1.5

7 years ago

0.1.4

8 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

10 years ago

0.0.8

11 years ago

0.0.7

11 years ago

0.0.6

11 years ago

0.0.5

12 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago