nodeca/js-yaml — pull request #79 by dhcole (2013-06-06 16:00:05+00:00)
Title: Quote boolean values when dumping strings

Source of regex: http://yaml.org/type/bool.html

Since yaml has a set of boolean values that JS treats as strings, and those values would otherwise be simple strings not requiring quotes, when dumping these values from a JS object to yaml, they lose their quotes, which a yaml parser reads as a boolean.

The current behavior is this:

```
{"label": "no"} => label: no
```

Which causes an unintentional recasting of the data type from string to boolean.

I think the expected behavior should be this:

```
{"label": "no"} => label: "no"
```

This pull request tests for a string boolean value based on the yaml spec and quotes if found.

Actual JS booleans would be unaffected, as they would be unquoted `true` or `false` values.