X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Funderscore.string%2FtoNumber.js;fp=node_modules%2Funderscore.string%2FtoNumber.js;h=92d47dda1b67ec9ee6772ca829b296036f4eacd6;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/underscore.string/toNumber.js b/node_modules/underscore.string/toNumber.js new file mode 100644 index 000000000..92d47dda1 --- /dev/null +++ b/node_modules/underscore.string/toNumber.js @@ -0,0 +1,5 @@ +module.exports = function toNumber(num, precision) { + if (num == null) return 0; + var factor = Math.pow(10, isFinite(precision) ? precision : 0); + return Math.round(num * factor) / factor; +};