Closed puzrin closed 8 years ago
Boolean values now ok, but using "enabled" as hash name still not. Thanks for fixes.
"enabled" as well as "disabled" don't work because they are true/false tokens. Not sure this is standard..
@dresende, yes, enabled
and disabled
evaluate into boolean when they are used as value nodes (by YAML spec). But they are allowed to be used as keys of hashes as well as booleans. So this is absolutely valid YAML:
true: guess what
false: bools are valid
enabled: to be hash keys
disabled: even in JS
above should be parsed to JS object (according to YAML specs):
{
true: 'guess what',
false: 'bools are valid',
'enabled': 'to be hash keys',
'disabled': 'even in JS'
}
I can't find 'enabled' in any YAML spec... guess it is not standard.
@connec you are right, my bad. Valid boolean values are described here: http://yaml.org/type/bool.html But the point of issue was about using such values as keywords. So for example it's absolutely valid to use "on" as a key in a mapping, and it should become boolean true. Here's an example, how they should be parsed:
Example file:
when replace enable & false to another words - starts working.