blob: f2d5d33ec3fe02c5fd52cda17207a8d0a5bf6a5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
function formater(format, parse) {return {'format':format, 'parse':parse || format};}
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) {
var list = [];
foreach(value.split(','), function(item){
item = trim(item);
if (item) list.push(item);
});
return list;
}
),
'trim':formater(
function(obj) { return obj ? $.trim("" + obj) : ""; }
)
});
|