diff options
| author | Misko Hevery | 2010-08-11 12:04:02 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-08-11 12:04:02 -0700 |
| commit | 044ecb91c10753c14e1521f95b5f0cd52ff5bf87 (patch) | |
| tree | ebe410987103d4b3193315f985c3d3564121d2a3 /src/formatters.js | |
| parent | 3d5719cd44868f89352ebbedd0e1b1f2575520cb (diff) | |
| download | angular.js-044ecb91c10753c14e1521f95b5f0cd52ff5bf87.tar.bz2 | |
clean up for better obfuscation
Diffstat (limited to 'src/formatters.js')
| -rw-r--r-- | src/formatters.js | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/src/formatters.js b/src/formatters.js index ca1ce83e..9122489f 100644 --- a/src/formatters.js +++ b/src/formatters.js @@ -3,31 +3,28 @@ function toString(obj) {return (isDefined(obj) && obj !== null) ? "" + obj : obj var NUMBER = /^\s*[-+]?\d*(\.\d*)?\s*$/; -extend(angularFormatter, { - 'noop':formatter(identity, identity), - 'json':formatter(toJson, fromJson), - 'boolean':formatter(toString, toBoolean), - 'number':formatter(toString, - function(obj){ - if (isString(obj) && NUMBER.exec(obj)) { - return obj ? 1*obj : null; - } - throw "Not a number"; - }), +angularFormatter.noop = formatter(identity, identity); +angularFormatter.json = formatter(toJson, fromJson); +angularFormatter['boolean'] = formatter(toString, toBoolean); +angularFormatter.number = formatter(toString, function(obj){ + if (isString(obj) && NUMBER.exec(obj)) { + return obj ? 1*obj : null; + } + throw "Not a number"; +}); - 'list':formatter( - function(obj) { return obj ? obj.join(", ") : obj; }, - function(value) { - var list = []; - foreach((value || '').split(','), function(item){ - item = trim(item); - if (item) list.push(item); - }); - return list; - } - ), +angularFormatter.list = formatter( + function(obj) { return obj ? obj.join(", ") : obj; }, + function(value) { + var list = []; + foreach((value || '').split(','), function(item){ + item = trim(item); + if (item) list.push(item); + }); + return list; + } +); - 'trim':formatter( - function(obj) { return obj ? trim("" + obj) : ""; } - ) -}); +angularFormatter.trim = formatter( + function(obj) { return obj ? trim("" + obj) : ""; } +); |
