Skip to content

Commit

Permalink
bool tag matches core schema now
Browse files Browse the repository at this point in the history
  • Loading branch information
ixti committed Jul 1, 2012
1 parent 66e35c9 commit 59104de
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
7 changes: 7 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
0.4.0 / In development
----------------------

* `y`, `yes`, `n`, `no`, `on`, `off` are not converted to Booleans anymore.
Fixes #42.


0.3.7 / 2012-02-28
------------------

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ JS-YAML - YAML 1.1 parser for JavaScript
This is a native port of [PyYAML](http://pyyaml.org/), the most advanced YAML parser.
Now you can use all modern YAML feature right in JavaScript. Originally snapshoted version - PyYAML 3.10 (2011-05-30).


## Braking changes in 0.3.x -> 0.4.x

- `y`, `yes`, `n`, `no`, `on`, `off` are not converted to Booleans anymore.
Decision to drop support of such "magic" was made after speaking with YAML
core developers: from now on we try to keep as minimal subset of rules as
possible to keep things obvious. Booleans are following YAML 1.2 core schema
now: http://www.yaml.org/spec/1.2/spec.html#id2804923


## Installation

### YAML module for node.js
Expand Down
6 changes: 2 additions & 4 deletions lib/js-yaml/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ Resolver.yamlImplicitResolvers = {};
Resolver.addImplicitResolver = BaseResolver.addImplicitResolver;

Resolver.addImplicitResolver('tag:yaml.org,2002:bool',
new RegExp('^(?:y|yes|Yes|YES|n|no|No|NO' +
'|true|True|TRUE|false|False|FALSE' +
'|on|On|ON|off|Off|OFF)$'),
['y', 'Y', 'n', 'N', 't', 'T', 'f', 'F', 'o', 'O']);
new RegExp('^(?:true|True|TRUE|false|False|FALSE)$'),
['t', 'T', 'f', 'F']);

Resolver.addImplicitResolver('tag:yaml.org,2002:float',
new RegExp('^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' +
Expand Down
4 changes: 1 addition & 3 deletions test/functional/data/bool.data
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
- yes
- NO
- True
- on
- false

0 comments on commit 59104de

Please sign in to comment.