js-yaml
Advanced tools
Comparing version 2.1.0 to 2.1.1
115
HISTORY.md
@@ -0,11 +1,18 @@ | ||
2.1.1 / 2013-10-02 | ||
------------------ | ||
- Dumper now respects deprecated booleans syntax from YAML 1.0/1.1 | ||
- Fixed reader bug in JSON-like sequences/mappings. | ||
2.1.0 / 2013-06-05 | ||
------------------ | ||
* Add standard YAML schemas: Failsafe (`FAILSAFE_SCHEMA`), | ||
- Add standard YAML schemas: Failsafe (`FAILSAFE_SCHEMA`), | ||
JSON (`JSON_SCHEMA`) and Core (`CORE_SCHEMA`). | ||
* Rename `DEFAULT_SCHEMA` to `DEFAULT_FULL_SCHEMA` | ||
- Rename `DEFAULT_SCHEMA` to `DEFAULT_FULL_SCHEMA` | ||
and `SAFE_SCHEMA` to `DEFAULT_SAFE_SCHEMA`. | ||
* Bug fix: export `NIL` constant from the public interface. | ||
* Add `skipInvalid` dumper option. | ||
* Use `safeLoad` for `require` extension. | ||
- Bug fix: export `NIL` constant from the public interface. | ||
- Add `skipInvalid` dumper option. | ||
- Use `safeLoad` for `require` extension. | ||
@@ -16,3 +23,3 @@ | ||
* Close security issue in !!js/function constructor. | ||
- Close security issue in !!js/function constructor. | ||
Big thanks to @nealpoole for security audit. | ||
@@ -24,3 +31,3 @@ | ||
* Updated .npmignore to reduce package size | ||
- Updated .npmignore to reduce package size | ||
@@ -31,3 +38,3 @@ | ||
* Fixed dumping of empty arrays ans objects. ([] and {} instead of null) | ||
- Fixed dumping of empty arrays ans objects. ([] and {} instead of null) | ||
@@ -38,3 +45,3 @@ | ||
* Fixed input validation: tabs are printable characters. | ||
- Fixed input validation: tabs are printable characters. | ||
@@ -45,3 +52,3 @@ | ||
* Fixed error, when options not passed to function cass | ||
- Fixed error, when options not passed to function cass | ||
@@ -52,5 +59,5 @@ | ||
* Full rewrite. New architecture. Fast one-stage parsing. | ||
* Changed custom types API. | ||
* Added YAML dumper. | ||
- Full rewrite. New architecture. Fast one-stage parsing. | ||
- Changed custom types API. | ||
- Added YAML dumper. | ||
@@ -61,3 +68,3 @@ | ||
* Fixed utf-8 files loading. | ||
- Fixed utf-8 files loading. | ||
@@ -68,4 +75,4 @@ | ||
* Pull out hand-written shims. Use ES5-Shims for old browsers support. See #44. | ||
* Fix timstamps incorectly parsed in local time when no time part specified. | ||
- Pull out hand-written shims. Use ES5-Shims for old browsers support. See #44. | ||
- Fix timstamps incorectly parsed in local time when no time part specified. | ||
@@ -76,4 +83,4 @@ | ||
* Fixes `TypeError: 'undefined' is not an object` under Safari. Thanks Phuong. | ||
* Fix timestamps incorrectly parsed in local time. Thanks @caolan. Closes #46. | ||
- Fixes `TypeError: 'undefined' is not an object` under Safari. Thanks Phuong. | ||
- Fix timestamps incorrectly parsed in local time. Thanks @caolan. Closes #46. | ||
@@ -84,7 +91,7 @@ | ||
* `y`, `yes`, `n`, `no`, `on`, `off` are not converted to Booleans anymore. | ||
- `y`, `yes`, `n`, `no`, `on`, `off` are not converted to Booleans anymore. | ||
Fixes #42. | ||
* `require(filename)` now returns a single document and throws an Error if | ||
- `require(filename)` now returns a single document and throws an Error if | ||
file contains more than one document. | ||
* CLI was merged back from js-yaml.bin | ||
- CLI was merged back from js-yaml.bin | ||
@@ -95,3 +102,3 @@ | ||
* Fix export of `addConstructor()`. Closes #39. | ||
- Fix export of `addConstructor()`. Closes #39. | ||
@@ -102,4 +109,4 @@ | ||
* Removed AMD parts - too buggy to use. Need help to rewrite from scratch | ||
* Removed YUI compressor warning (renamed `double` variable). Closes #40. | ||
- Removed AMD parts - too buggy to use. Need help to rewrite from scratch | ||
- Removed YUI compressor warning (renamed `double` variable). Closes #40. | ||
@@ -110,3 +117,3 @@ | ||
* Workagound for .npmignore fuckup under windows. Thanks to airportyh. | ||
- Workagound for .npmignore fuckup under windows. Thanks to airportyh. | ||
@@ -117,5 +124,5 @@ | ||
* Fixes str[] for oldIEs support. | ||
* Adds better has change support for browserified demo. | ||
* improves compact output of Error. Closes #33. | ||
- Fixes str[] for oldIEs support. | ||
- Adds better has change support for browserified demo. | ||
- improves compact output of Error. Closes #33. | ||
@@ -126,4 +133,4 @@ | ||
* jsyaml executable moved to separate module. | ||
* adds `compact` stringification of Errors. | ||
- jsyaml executable moved to separate module. | ||
- adds `compact` stringification of Errors. | ||
@@ -134,9 +141,9 @@ | ||
* Fixes ug with block style scalars. Closes #26. | ||
* All sources are passing JSLint now. | ||
* Fixes bug in Safari. Closes #28. | ||
* Fixes bug in Opers. Closes #29. | ||
* Improves browser support. Closes #20. | ||
* Added jsyaml executable. | ||
* Added !!js/function support. Closes #12. | ||
- Fixes ug with block style scalars. Closes #26. | ||
- All sources are passing JSLint now. | ||
- Fixes bug in Safari. Closes #28. | ||
- Fixes bug in Opers. Closes #29. | ||
- Improves browser support. Closes #20. | ||
- Added jsyaml executable. | ||
- Added !!js/function support. Closes #12. | ||
@@ -147,9 +154,9 @@ | ||
* Added AMD support for browserified version. | ||
* Wrapped browserified js-yaml into closure. | ||
* Fixed the resolvement of non-specific tags. Closes #17. | ||
* Added permalinks for online demo YAML snippets. Now we have YPaste service, lol. | ||
* Added !!js/regexp and !!js/undefined types. Partially solves #12. | ||
* Fixed !!set mapping. | ||
* Fixed month parse in dates. Closes #19. | ||
- Added AMD support for browserified version. | ||
- Wrapped browserified js-yaml into closure. | ||
- Fixed the resolvement of non-specific tags. Closes #17. | ||
- Added permalinks for online demo YAML snippets. Now we have YPaste service, lol. | ||
- Added !!js/regexp and !!js/undefined types. Partially solves #12. | ||
- Fixed !!set mapping. | ||
- Fixed month parse in dates. Closes #19. | ||
@@ -160,7 +167,7 @@ | ||
* Removed JS.Class dependency. Closes #3. | ||
* Added browserified version. Closes #13. | ||
* Added live demo of browserified version. | ||
* Ported some of the PyYAML tests. See #14. | ||
* Fixed timestamp bug when fraction was given. | ||
- Removed JS.Class dependency. Closes #3. | ||
- Added browserified version. Closes #13. | ||
- Added live demo of browserified version. | ||
- Ported some of the PyYAML tests. See #14. | ||
- Fixed timestamp bug when fraction was given. | ||
@@ -171,5 +178,5 @@ | ||
* Fixed crash on docs without ---. Closes #8. | ||
* Fixed miltiline string parse | ||
* Fixed tests/comments for using array as key | ||
- Fixed crash on docs without ---. Closes #8. | ||
- Fixed miltiline string parse | ||
- Fixed tests/comments for using array as key | ||
@@ -180,3 +187,3 @@ | ||
* Fixed short file read (<4k). Closes #9. | ||
- Fixed short file read (<4k). Closes #9. | ||
@@ -187,2 +194,2 @@ | ||
* First public release | ||
- First public release |
@@ -58,2 +58,8 @@ 'use strict'; | ||
var DEPRECATED_BOOLEANS_SYNTAX = [ | ||
'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON', | ||
'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF' | ||
]; | ||
function kindOf(object) { | ||
@@ -171,2 +177,8 @@ var kind = typeof object; | ||
// Ensure compatibility with YAML 1.0/1.1 loaders. | ||
// TODO: This check should be moved into boolean type definition. | ||
if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) { | ||
isQuoted = true; | ||
} | ||
if (0 === object.length || | ||
@@ -173,0 +185,0 @@ CHAR_SPACE === object.charCodeAt(0) || |
@@ -711,2 +711,3 @@ 'use strict'; | ||
keyNode = result; | ||
skipSeparationSpace(true, nodeIndent); | ||
@@ -941,2 +942,6 @@ if ((isExplicitPair || line === _line) && CHAR_COLON === character) { | ||
// | ||
// Explicit notation case. There are two separate blocks: | ||
// first for the key (denoted by "?") and second for the value (denoted by ":") | ||
// | ||
if ((CHAR_QUESTION === character || | ||
@@ -971,6 +976,7 @@ CHAR_COLON === character) && | ||
// | ||
// Implicit notation case. Flow-style node as the key first, then ":", and the value. | ||
// | ||
} else if (composeNode(nodeIndent, CONTEXT_FLOW_OUT, false, true)) { | ||
if (line === _line) { | ||
// TODO: Remove this cycle when the flow readers will consume | ||
// trailing whitespaces like the block readers. | ||
while (CHAR_SPACE === character || | ||
@@ -1019,5 +1025,8 @@ CHAR_TAB === character) { | ||
} else { | ||
break; | ||
break; // Reading is done. Go to the epilogue. | ||
} | ||
// | ||
// Common reading code for both explicit and implicit notations. | ||
// | ||
if (line === _line || lineIndent > nodeIndent) { | ||
@@ -1037,5 +1046,2 @@ if (composeNode(nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { | ||
// TODO: It is needed only for flow node readers. It should be removed | ||
// when the flow readers will consume trailing whitespaces as well as | ||
// the block readers. | ||
skipSeparationSpace(true, -1); | ||
@@ -1051,2 +1057,7 @@ } | ||
// | ||
// Epilogue. | ||
// | ||
// Special case: last mapping's node contains only the key in explicit notation. | ||
if (atExplicitKey) { | ||
@@ -1056,2 +1067,3 @@ storeMappingPair(_result, keyTag, keyNode, null); | ||
// Expose the resulting mapping. | ||
if (detected) { | ||
@@ -1058,0 +1070,0 @@ tag = _tag; |
@@ -54,4 +54,4 @@ 'use strict'; | ||
kind: 'function', | ||
representer: representJavascriptFunction, | ||
representer: representJavascriptFunction | ||
} | ||
}); |
@@ -33,5 +33,5 @@ 'use strict'; | ||
uppercase: function () { return 'NULL'; }, | ||
camelcase: function () { return 'Null'; }, | ||
camelcase: function () { return 'Null'; } | ||
} | ||
} | ||
}); |
{ | ||
"name" : "js-yaml", | ||
"version" : "2.1.0", | ||
"version" : "2.1.1", | ||
"description" : "YAML 1.2 parser and serializer", | ||
@@ -5,0 +5,0 @@ "keywords" : ["yaml", "parser", "serializer", "pyyaml"], |
@@ -73,3 +73,3 @@ JS-YAML - YAML 1.2 parser and serializer for JavaScript | ||
files. You can load them just with `require`. That's mostly equivalent to | ||
calling `load()` on fetched content of a file. Just with one string! | ||
calling `safeLoad()` on fetched content of a file. Just with one string! | ||
@@ -101,3 +101,3 @@ ``` javascript | ||
warnings. | ||
- `schema` _(default: `DEFAULT_FULL_SCHEMA`)_ - specifies a schema to use. | ||
- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ - specifies a schema to use. | ||
- `FAILSAFE_SCHEMA` - only strings, arrays and plain objects: | ||
@@ -104,0 +104,0 @@ http://www.yaml.org/spec/1.2/spec.html#id2802346 |
115771
2872