aboutsummaryrefslogtreecommitdiffstats
path: root/src/Formatters.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/Formatters.js')
-rw-r--r--src/Formatters.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Formatters.js b/src/Formatters.js
new file mode 100644
index 00000000..74126feb
--- /dev/null
+++ b/src/Formatters.js
@@ -0,0 +1,14 @@
+function formater(format, parse) {return {'format':format, 'parse':parse};}
+function toString(obj) {return ""+obj;};
+extend(angularFormatter, {
+ 'noop':formater(identity, identity),
+ 'boolean':formater(toString, toBoolean),
+ 'number':formater(toString, function(obj){return 1*obj;}),
+
+ 'list':formater(
+ function(obj) { return obj ? obj.join(", ") : obj; },
+ function(value) {
+ return value ? _(_(value.split(',')).map(jQuery.trim)).select(_.identity) : value;
+ }
+ )
+});