schmittjoh/twig.js — pull request #24 by jonathaningram (2012-03-08 00:00:53+00:00)
Title: Ensure that invalid values cannot be passed to twig.attr

Apologies for the apparent large diff:

1. I removed trailing white spaces.
2. Looks like I might be using a different version of plovr (`plovr.jar` created using steps at http://plovr.com/download.html)

The most important part of the commit is:

In `twig.js`:

```js
if (!goog.isArray(obj) && !goog.isObject(obj)) {
return null;
}
```

and in `twig_tests.html`:

```js
assertNull(twig.attr(null, "baz"));
assertNull(twig.attr(undefined, "baz"));
assertNull(twig.attr(true, "baz"));
assertNull(twig.attr(false, "baz"));
assertNull(twig.attr(NaN, "baz"));
assertNull(twig.attr(Infinity, "baz"));
assertNull(twig.attr(-Infinity, "baz"));
assertNull(twig.attr("", "baz"));
assertNull(twig.attr({}, "baz"));
assertNull(twig.attr([], "baz"));
assertEquals("bill", twig.attr({baz: "bill"}, "baz"));
```