You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
630 B
31 lines
630 B
var sub = function(val) { |
|
if (val.length == 0 || val == undefined) { |
|
return; |
|
} |
|
if (val.length > 17) { |
|
return val.substring(0, 17) + "..."; |
|
} else { |
|
return val.substring(0, 1); |
|
} |
|
} |
|
var filters = { |
|
toFloat: function (value) { |
|
return parseFloat(value) |
|
}, |
|
toStr: function (value) { |
|
return value.toString() |
|
}, |
|
toNum: function (value) { |
|
return value.toNumber() |
|
}, |
|
} |
|
var spl = function(str){ |
|
return str.split(","); |
|
} |
|
module.exports = { |
|
toFloat: filters.toFloat, |
|
toStr: filters.toStr, |
|
toNum: filters.toNum,//暴露接口调用 |
|
sub: sub, |
|
spl: spl |
|
}; |