justjohn/twig.js — pull request #62 by m-abs (2013-02-09 01:00:28+00:00)
Title: Filter functions didn't handle undefined values very well.

https://github.com/justjohn/twig.js/issues/60
Filter functions excepts merge have been updated to handle undefined

"json_encode" return "null" on undefined or null variables, because that
what PHP's json_encode function does and it makes more sense.

"length" return 0

"date" return undefined, it might make sense to return todays date,
because that's how the Twig.lib.date handles it.

All others return undefined if they get an undefined value.

I've added test cases for the cases where an undefined value is parsed
to each of the function.