documentcloud/underscore — pull request #702 by factormystic (2012-08-13 22:15:11+00:00)
Title: _.escape should handle null and undefined values

Added two failing tests to demonstrate the problem, and added fix to _.escape (check parameter with _.isEmpty before string coercion).

Basically I'm running into a case where json objects coming out of a database are valid as null, but being escaped as "null", a string. The preferable string representation of a null value is an empty string. Undefined comes along as a freebie (same problem, same solution).