Sha256: c90cbc09c05ed0a31f7445fa54ab1372cd2dcbc69d5000891a24924056ed6202
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
var Handlebars = {}; // BEGIN(BROWSER) Handlebars.Exception = function(message) { this.message = message; }; // Build out our basic SafeString type Handlebars.SafeString = function(string) { this.string = string; }; Handlebars.SafeString.prototype.toString = function() { return this.string.toString(); }; (function() { var escape = { "<": "<", ">": ">", }; var badChars = /&(?!\w+;)|[<>]/g; var possible = /[&<>]/ var escapeChar = function(chr) { return escape[chr] || "&" }; Handlebars.Utils = { escapeExpression: function(string) { // don't escape SafeStrings, since they're already safe if (string instanceof Handlebars.SafeString) { return string.toString(); } else if (string == null || string === false) { return ""; } if(!possible.test(string)) { return string; } return string.replace(badChars, escapeChar); }, isEmpty: function(value) { if (typeof value === "undefined") { return true; } else if (value === null) { return true; } else if (value === false) { return true; } else if(Object.prototype.toString.call(value) === "[object Array]" && value.length === 0) { return true; } else { return false; } } }; })(); // END(BROWSER) exports.Utils = Handlebars.Utils; exports.SafeString = Handlebars.SafeString; exports.Exception = Handlebars.Exception;
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spade-0.0.1 | packages/handlebars/lib/handlebars/utils.js |