Git Product home page Git Product logo

js-yaml's Introduction

JS-YAML - YAML 1.2 parser / writer for JavaScript

CI NPM version

Online Demo

This is an implementation of YAML, a human-friendly data serialization language. Started as PyYAML port, it was completely rewritten from scratch. Now it's very fast, and supports 1.2 spec.

Installation

YAML module for node.js

npm install js-yaml

CLI executable

If you want to inspect your YAML files from CLI, install js-yaml globally:

npm install -g js-yaml

Usage

usage: js-yaml [-h] [-v] [-c] [-t] file

Positional arguments:
  file           File with YAML document(s)

Optional arguments:
  -h, --help     Show this help message and exit.
  -v, --version  Show program's version number and exit.
  -c, --compact  Display errors in compact mode
  -t, --trace    Show stack trace on error

API

Here we cover the most 'useful' methods. If you need advanced details (creating your own tags), see examples for more info.

const yaml = require('js-yaml');
const fs   = require('fs');

// Get document, or throw exception on error
try {
  const doc = yaml.load(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
  console.log(doc);
} catch (e) {
  console.log(e);
}

load (string [ , options ])

Parses string as single YAML document. Returns either a plain object, a string, a number, null or undefined, or throws YAMLException on error. By default, does not support regexps, functions and undefined.

options:

  • filename (default: null) - string to be used as a file path in error/warning messages.
  • onWarning (default: null) - function to call on warning messages. Loader will call this function with an instance of YAMLException for each warning.
  • schema (default: DEFAULT_SCHEMA) - specifies a schema to use.
  • json (default: false) - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.

NOTE: This function does not understand multi-document sources, it throws exception on those.

NOTE: JS-YAML does not support schema-specific tag resolution restrictions. So, the JSON schema is not as strictly defined in the YAML specification. It allows numbers in any notation, use Null and NULL as null, etc. The core schema also has no such restrictions. It allows binary notation for integers.

loadAll (string [, iterator] [, options ])

Same as load(), but understands multi-document sources. Applies iterator to each document if specified, or returns array of documents.

const yaml = require('js-yaml');

yaml.loadAll(data, function (doc) {
  console.log(doc);
});

dump (object [ , options ])

Serializes object as a YAML document. Uses DEFAULT_SCHEMA, so it will throw an exception if you try to dump regexps or functions. However, you can disable exceptions by setting the skipInvalid option to true.

options:

  • indent (default: 2) - indentation width to use (in spaces).
  • noArrayIndent (default: false) - when true, will not add an indentation level to array elements
  • skipInvalid (default: false) - do not throw on invalid types (like function in the safe schema) and skip pairs and single values with such types.
  • flowLevel (default: -1) - specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere
  • styles - "tag" => "style" map. Each tag may have own set of styles.
  • schema (default: DEFAULT_SCHEMA) specifies a schema to use.
  • sortKeys (default: false) - if true, sort keys when dumping YAML. If a function, use the function to sort the keys.
  • lineWidth (default: 80) - set max line width. Set -1 for unlimited width.
  • noRefs (default: false) - if true, don't convert duplicate objects into references
  • noCompatMode (default: false) - if true don't try to be compatible with older yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
  • condenseFlow (default: false) - if true flow sequences will be condensed, omitting the space between a, b. Eg. '[a,b]', and omitting the space between key: value and quoting the key. Eg. '{"a":b}' Can be useful when using yaml for pretty URL query params as spaces are %-encoded.
  • quotingType (' or ", default: ') - strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters.
  • forceQuotes (default: false) - if true, all non-key strings will be quoted even if they normally don't need to.
  • replacer - callback function (key, value) called recursively on each key/value in source object (see replacer docs for JSON.stringify).

The following table show availlable styles (e.g. "canonical", "binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml output is shown on the right side after => (default setting) or ->:

!!null
  "canonical"   -> "~"
  "lowercase"   => "null"
  "uppercase"   -> "NULL"
  "camelcase"   -> "Null"
  "empty"       -> ""

!!int
  "binary"      -> "0b1", "0b101010", "0b1110001111010"
  "octal"       -> "0o1", "0o52", "0o16172"
  "decimal"     => "1", "42", "7290"
  "hexadecimal" -> "0x1", "0x2A", "0x1C7A"

!!bool
  "lowercase"   => "true", "false"
  "uppercase"   -> "TRUE", "FALSE"
  "camelcase"   -> "True", "False"

!!float
  "lowercase"   => ".nan", '.inf'
  "uppercase"   -> ".NAN", '.INF'
  "camelcase"   -> ".NaN", '.Inf'

Example:

dump(object, {
  'styles': {
    '!!null': 'canonical' // dump null as ~
  },
  'sortKeys': true        // sort object keys
});

Supported YAML types

The list of standard YAML tags and corresponding JavaScript types. See also YAML tag discussion and YAML types repository.

!!null ''                   # null
!!bool 'yes'                # bool
!!int '3...'                # number
!!float '3.14...'           # number
!!binary '...base64...'     # buffer
!!timestamp 'YYYY-...'      # date
!!omap [ ... ]              # array of key-value pairs
!!pairs [ ... ]             # array or array pairs
!!set { ... }               # array of objects with given keys and null values
!!str '...'                 # string
!!seq [ ... ]               # array
!!map { ... }               # object

JavaScript-specific tags

See js-yaml-js-types for extra types.

Caveats

Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects or arrays as keys, and stringifies (by calling toString() method) them at the moment of adding them.

---
? [ foo, bar ]
: - baz
? { foo: bar }
: - baz
  - baz
{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] }

Also, reading of properties on implicit block mapping keys is not supported yet. So, the following YAML document cannot be loaded.

&anchor foo:
  foo: bar
  *anchor: duplicate key
  baz: bat
  *anchor: duplicate key

js-yaml for enterprise

Available as part of the Tidelift Subscription

The maintainers of js-yaml and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

js-yaml's People

Contributors

aengl avatar aepsilon avatar dervus avatar djchie avatar dod38fr avatar dplepage avatar dubzzz avatar dustyrockpyle avatar eseliger avatar isaacs avatar ixti avatar kcivey avatar kirill89 avatar lwassermann avatar martijncuppens avatar mikeralphson avatar monken avatar murtazajafferji avatar mxl avatar paolochiodi avatar realityking avatar rjmunro avatar rlidwka avatar rockitbaby avatar roryokane avatar scrooloose avatar shinnn avatar shockey avatar tcr avatar zentner-kyle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-yaml's Issues

Wrong mark of error on multiple documents

expected a single document in the stream
 in "<unicode string>", line 2, column 1:
    pid: '/home/www/pids/thin.pid'
wait: 12.34
listen: {host: localhost, port: 3000}
modules: ['users', 'i18n']
users: &crew
  puzrin:
    role: manager
  ixti:
    role: developer
authors: *crew
require:
  - logger
  - debugger
dbg-mode: true
# some comments
non-ascii-ключ: значение # more comments
folded: >
  Multi
  line
  text
literal: |
  More
  samples
...

---
multiple: docs

    ^
but found another document
 in "<unicode string>", line 27, column 1:
    ---
multiple: docs

    ^

Cannost install js-yaml

Just tried on a clean install. Randomly-tested other modules are OK:

almad@namtar /tmp $ node --version
v0.6.10
almad@namtar /tmp $ npm --version
1.1.0-3
almad@namtar /tmp $ npm install js-yaml
npm http GET https://registry.npmjs.org/js-yaml
npm http 200 https://registry.npmjs.org/js-yaml
npm http GET https://registry.npmjs.org/js-yaml/-/js-yaml-1.0.3.tgz
npm http 200 https://registry.npmjs.org/js-yaml/-/js-yaml-1.0.3.tgz
npm http GET https://registry.npmjs.org/argparse
npm http 200 https://registry.npmjs.org/argparse
npm http GET https://registry.npmjs.org/argparse/-/argparse-0.1.7.tgz
npm http 200 https://registry.npmjs.org/argparse/-/argparse-0.1.7.tgz
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/underscore.string
npm http 200 https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/underscore/-/underscore-1.3.3.tgz
npm http 200 https://registry.npmjs.org/underscore.string
npm http GET https://registry.npmjs.org/underscore.string/-/underscore.string-2.1.1.tgz
npm http 200 https://registry.npmjs.org/underscore/-/underscore-1.3.3.tgz
npm http 200 https://registry.npmjs.org/underscore.string/-/underscore.string-2.1.1.tgz
npm ERR! error installing [email protected]

npm ERR! Error: ENOENT, no such file or directory '/tmp/node_modules/js-yaml/bin/js-yaml.js'
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Linux 3.2.1-gentoo-r2
npm ERR! command "node" "/home/almad/.nvm/v0.6.10/bin/npm" "install" "js-yaml"
npm ERR! cwd /tmp
npm ERR! node -v v0.6.10
npm ERR! npm -v 1.1.0-3
npm ERR! path /tmp/node_modules/js-yaml/bin/js-yaml.js
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory '/tmp/node_modules/js-yaml/bin/js-yaml.js'
npm ERR! errno {}
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /tmp/npm-debug.log
npm not ok
almad@namtar /tmp $ 

Can not install 1.0.0 on MacOS

js-yaml used to install nicely for me (npm install) until version 0.3.7.
I just tried today to run a simple npm install js-yaml and noticed that the latest version was 1.0.0, and I'm getting the following error in the console:


npm http GET https://registry.npmjs.org/js-yaml
npm http 304 https://registry.npmjs.org/js-yaml
npm http GET https://registry.npmjs.org/argparse
npm http 304 https://registry.npmjs.org/argparse
npm http GET https://registry.npmjs.org/underscore.string
npm http GET https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/underscore.string
npm http 304 https://registry.npmjs.org/underscore
npm ERR! error installing [email protected]
npm ERR! Error: ENOENT, no such file or directory '/Users/patrickbrosset/ariatemplates-captainbrosset/node_modules/js-yaml/bin/js-yaml.js'
npm ERR! Report this *entire* log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Darwin 11.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "js-yaml"
npm ERR! cwd /Users/patrickbrosset/ariatemplates-captainbrosset
npm ERR! node -v v0.6.7
npm ERR! npm -v 1.1.0-beta-10
npm ERR! path /Users/patrickbrosset/ariatemplates-captainbrosset/node_modules/js-yaml/bin/js-yaml.js
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory '/Users/patrickbrosset/ariatemplates-captainbrosset/node_modules/js-yaml/bin/js-yaml.js'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/patrickbrosset/ariatemplates-captainbrosset/npm-debug.log
npm not ok

Setup is MacOS 10.7.4

Running npm install [email protected] runs fine though.

Support for ?

This doesn't seem to be supported in js-yaml:

? - Detroit Tigers
  - Chicago cubs
:
  - 2001-07-23

? [ New York Yankees,
    Atlanta Braves ]
: [ 2001-07-02, 2001-08-12,
    2001-08-14 ]

Error: Cannot find module './lib/js-yaml.js'

I just installed "js-yaml" with "npm install js-yaml". It doesn't work because the file "./lib/js-yaml.js" isn't there. I had to take it from the git repo and paste it into my dir "node_modules/js-yaml/lib" to make it work. Great job for the native port though!

Wrong parse bug

I found a bug

Keys or values y evaluate as true (yes), the same bug with n:

bugs:
  x: 1 # ok
  y: 2 # buggy, expect key 'y'
  n: 3 # buggy, expect key 'n'
  yesValue: y # buggy, expect string 'y'
  noValue: n # buggy, expect string 'n'
   

->

{ bugs: 
   { x: 1,
     true: 2,
     false: 3,
     yesValue: true,
     noValue: false } }

Browser support

It could be useful to run JS-YAML in browser. For example, to do nice looking debug dumps for complex data.

"double" is reserved keyword

Hi!

Yahoo compressor noticed me that "double" is reserved keyword, js still works, but it's not cool.

An example:

Scanner.prototype.scanFlowScalar = function scanFlowScalar(style) {
  var double, chunks, length, code, startMark, quote, endMark;
  ...

and in other parts of the code.

js-yaml.js not found

I'm running latest Ubuntu version.

I installed the proposed fix from master tree, (related to issue #34, #35 and #36) I still receive the error Error: ENOENT, no such file or directory '..//node_modules/js-yaml/bin/js-yaml.js'

error output from standard package:

npm ERR! error installing [email protected]

npm ERR! Error: ENOENT, no such file or directory '../../node_modules/js-yaml/bin/js-yaml.js'
npm ERR! You may report this log at:
npm ERR! http://bugs.debian.org/npm
npm ERR! or use
npm ERR! reportbug --attach ../../npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.2.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install" "js-yaml"
npm ERR! cwd
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! path ../../node_modules/js-yaml/bin/js-yaml.js
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory '../../node_modules/js-yaml/bin/js-yaml.js'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! ../../npm-debug.log

error output from tarball master:

npm ERR! error installing [email protected]

npm ERR! Error: ENOENT, no such file or directory '../../node_modules/js-yaml/bin/js-yaml.js'
npm ERR! You may report this log at:
npm ERR! http://bugs.debian.org/npm
npm ERR! or use
npm ERR! reportbug --attach ../../npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.2.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install" "https://github.com/nodeca/js-yaml/tarball/master"
npm ERR! cwd ../..
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! path ../../node_modules/js-yaml/bin/js-yaml.js
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory '../../node_modules/js-yaml/bin/js-yaml.js'
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! ../../npm-debug.log
npm not ok

Replace all shims with underscore

Instead of using shims, we must use Underscore (right in the library), so the browserified version will become in two options: with underscore bundled (for hardcore standalone version) and without (when user is using underscore already).

That will probably solve any problems with different browsers.

Function.bind not guaranteed

The browser version dies in safari (probably also IE!) as Function.prototype.bind does not exist. I've fixed it for my use case using underscore's bind function as I had underscore knocking around anyway, but this isn't a long term solution.

Parse failed when no document start present

Parser fais when document have no --- start node:

TypeError: Cannot read property '!!' of undefined
    at [object Object].parseNode (/home/ixti/projects/js-yaml/lib/js-yaml/parser.js:375:44)
    at [object Object].parseBlockNodeOrIndentlessSequence (/home/ixti/projects/js-yaml/lib/js-yaml/parser.js:324:17)
    at [object Object].parseBlockMappingValue (/home/ixti/projects/js-yaml/lib/js-yaml/parser.js:561:23)
    at [object Object].state (/home/ixti/projects/js-yaml/node_modules/jsclass/src/core.js:56:19)
    at [object Object].checkEvent (/home/ixti/projects/js-yaml/lib/js-yaml/parser.js:110:32)
    at [object Object].composeNode (/home/ixti/projects/js-yaml/lib/js-yaml/composer.js:89:14)
    at [object Object].composeMappingNode (/home/ixti/projects/js-yaml/lib/js-yaml/composer.js:190:24)
    at [object Object].composeNode (/home/ixti/projects/js-yaml/lib/js-yaml/composer.js:115:19)
    at [object Object].composeMappingNode (/home/ixti/projects/js-yaml/lib/js-yaml/composer.js:190:24)
    at [object Object].composeNode (/home/ixti/projects/js-yaml/lib/js-yaml/composer.js:115:19)

Literal and Folded Style on documents throws ParserError

This valid YAML should be parseable into 3 documents:

---
a:
  When parsed,
  these three lines
  SHOULD NOT retain linebreaks.
b: |
  When parsed,
  these three lines
  SHOULD retain linebreaks.

---
When parsed,
these three lines
SHOULD NOT retain linebreaks.
--- |
When parsed,
these three lines
SHOULD retain linebreaks.

But yaml.loadAll throws a ParserError exception when the third document (beginning with --- |) is reached.

According to the YAML 1.2 spec, Literal and Folded Style on documents is valid YAML, but most parsers fail to support either.

Can you add support for this?

[browserified] Fails on IE7 (and IE6)

While support of IE6 is close to necrophilia, IE7 is still one of the things that make our days not so shiny. By some reason js-yaml ignores new-line breaks on IE7.

This works:

{ foo: bar, baz: 123 }

And this one doesn't:

foo: bar
baz: 123

To demonstrate problem closer:

- foo
- bar

Becomes:

[ 'foo - baz' ]

Also, integers are becomes integers ONLY with strict type casting:

{ foo: !!int 123, bar: 123 }

The above will become:

{ foo: 123, bar: '123' }

Incorrect utf-8 handling on require('file.yaml')

When js-yaml loads long files with multibyte utf-8 symbols sometimes it brokes characters (replaces valid unicode char by two error marks)

yaml = require('js-yaml')
data_broken = require('mydata.yaml')
data_correct = yaml.load( fs.readFileSync('mydata.yaml') )

Probably it happens when utf-8 symbol lays exactly on read buffer boundary and byte reader splits it on two incorrect parts.

jsyaml.addConstructor fails (at least in browserified versions)

I’m trying to add a constructor for custom tags using

jsyaml.addConstructor(
  '!sometag',
  function(node) { return "test"} );

This fails with "(Loader || _loader.Loader).addConstructor is not a function". I checked _loader.Loader using Firebug, and it indeed does not have that function. If it’s not a bug, do you have any hints on what I am doing wrong?

Add UTF-16 support.

Encoding should be automatically guessed when reading from the file. Right now it's hardcoded to read as UTF-8 only. Need to "guess" which UTF to use by first byte of the buffer: http://pyyaml.org/browser/pyyaml/trunk/lib3/yaml/reader.py#L122

It needs to raise an exception on invalid UTF bytes:

yaml.reader.ReaderError: 'utf8' codec can't decode byte #xff: invalid start byte
  in "invalid-utf8-byte.loader-error", position 4119

Non-specific "!" tags should resolve to !!str

! 12

resolves to !!int when scalar nodes with a non-specific "!" tags should always resolve to !!str according to recommendation in spec (paragraph 3.3.2)

It is recommended that nodes having the “!” non-specific tag should be resolved as “tag:yaml.org,2002:seq”, “tag:yaml.org,2002:map” or “tag:yaml.org,2002:str” depending on the node’s kind.

require() returns single-element array

When I do something like var c = require('config.yaml'); I get a single-element array with the YAML-derived data structure as the element. I guess that's more or less as documented, but it seems strange. I would have expected that I'd get just the data structure, with no extra array around it. Having to use a [0] to get to the actual data is an annoyance. Is there some point I'm missing?

That is, I'd hoped to get

{"property1":"value1","property2":"value2"}

but instead I get

[{"property1":"value1","property2":"value2"}]

NPM package broken on Windows

On Windows, for some reason after installing the module, some required files aren't present, in particular js-yaml.js and lib/js-yaml.js, which cause the library to not work at all.

JSON to YAML converter

First of all thanks for a good lib! YAML is so much better than JSON.

A question: would it be easy to include a JSON to YAML converter?

So you can do conversion in both directions kinda like: http://js2coffee.org/

RequireJS Working Example?

I'm struggling to get this working with requireJS. I've tried the examples in the README with no luck.

Here is my control case:

define([
  'require',
  'jquery',
  'mustache',
  'js-yaml.min',
], function(require, $){

  var JB = { 
    init : function(boot){
      var doc = jsyaml.load('greeting: hello\nname: world');
      console.log(doc); // this works fine.

      //require('js-yaml.min'); // this works both uncommented and commented.

      var singleDoc = require('http://127.0.0.1/~jade/javascripts/require-js/tags.yaml').shift();
      console.log(singleDoc); 
      // This does not work
      // Uncaught Error: Module name 'http://127.0.0.1/~jade/javascripts/require-js/tags.yaml' has not been loaded yet for context: _
      // http://requirejs.org/docs/errors.html#notloaded

      if(typeof boot === "function") boot();
    } 
  };

  return JB;
});

As per the error documentation (http://requirejs.org/docs/errors.html#notloaded) I have tried to load the tags.yaml first in the define statement. The tags.yaml loads fine but since its not javascript, It returns a syntax error.

Any help would be appreciated, thanks.

Problems redirecting stdout to file

Works

ϟ js-yaml ./client/locales/en.yaml          

{ credits: 
   { roles: 
      { art_director: 'Art director',
        associate_producer: 'Associate producer',
        producers: 'Producers',
        colourist: 'Colourist',
        costume_designer: 'Costume designer',
        director: 'Director',
        director_of_photography: 'Director of photography',
        editor: 'Editor',
        music: 'Music',
        producer: 'Producer',
        titles_and_poster: 'Titles and poster',
        screenwriter: 'Screenwriter',
        sound_designer: 'Sound designer',
        writer: 'Writer',
        sound_recorder_and_design_and_mix: 'Sound recorder, design, and mix',
        sound_design_and_mix: 'Sound design and mix"',
        original_music_composer_and_orchestrator_and_conductor: 'Original music composer, orchestrator, and conductor',
        original_score_composer_and_performer: 'Original score, composer, and performer' } },
  production_companies: 'Production companies',
  production_company: 'Production company',
  shooting_format: 'Shooting format',
  release_date: 'Release date',
  funding_agencies: 'Funding agencies',
  distribution_and_sales: 'Distribution and sales',
  genre: 'Genre',
  languages: 'languages',
  language: 'Language',
  runtime: 'Runtime' }

Fails

ϟ js-yaml ./client/locales/en.yaml > test.js

.... open ./test.js...

{ credits: 
   { roles: 
      { art_director: �[32m'Art director'�[39m,
        associate_producer: �[32m'Associate producer'�[39m,
        producers: �[32m'Producers'�[39m,
        colourist: �[32m'Colourist'�[39m,
        costume_designer: �[32m'Costume designer'�[39m,
        director: �[32m'Director'�[39m,
        director_of_photography: �[32m'Director of photography'�[39m,
        editor: �[32m'Editor'�[39m,
        music: �[32m'Music'�[39m,
        producer: �[32m'Producer'�[39m,
        titles_and_poster: �[32m'Titles and poster'�[39m,
        screenwriter: �[32m'Screenwriter'�[39m,
        sound_designer: �[32m'Sound designer'�[39m,
        writer: �[32m'Writer'�[39m,
        sound_recorder_and_design_and_mix: �[32m'Sound recorder, design, and mix'�[39m,
        sound_design_and_mix: �[32m'Sound design and mix"'�[39m,
        original_music_composer_and_orchestrator_and_conductor: �[32m'Original music composer, orchestrator, and conductor'�[39m,
        original_score_composer_and_performer: �[32m'Original score, composer, and performer'�[39m } },
  production_companies: �[32m'Production companies'�[39m,
  production_company: �[32m'Production company'�[39m,
  shooting_format: �[32m'Shooting format'�[39m,
  release_date: �[32m'Release date'�[39m,
  funding_agencies: �[32m'Funding agencies'�[39m,
  distribution_and_sales: �[32m'Distribution and sales'�[39m,
  genre: �[32m'Genre'�[39m,
  languages: �[32m'languages'�[39m,
  language: �[32m'Language'�[39m,
  runtime: �[32m'Runtime'�[39m }

Key 'y' becomes 'true'

If we have an object with 'y' property, like

point: 
    x: 19
    y: 5

it becomes

point: { x: 19, true: 5 }

Looks really strange, but maybe it's not a bug ( later I found a discussion)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.