aboutsummaryrefslogtreecommitdiffstats
path: root/src/Formatters.js
blob: 74126feb970974eeac47d72534d6103fa17ef93e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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;
    }
  )  
});