PATH:
usr
/
local
/
lib
/
node_modules
/
bower
/
lib
/
node_modules
/
mout
/
src
/
number
define(['../lang/toNumber'], function (toNumber) { /** * Converts number into currency format */ function currencyFormat(val, nDecimalDigits, decimalSeparator, thousandsSeparator) { val = toNumber(val); nDecimalDigits = nDecimalDigits == null? 2 : nDecimalDigits; decimalSeparator = decimalSeparator == null? '.' : decimalSeparator; thousandsSeparator = thousandsSeparator == null? ',' : thousandsSeparator; //can't use enforce precision since it returns a number and we are //doing a RegExp over the string var fixed = val.toFixed(nDecimalDigits), //separate begin [$1], middle [$2] and decimal digits [$4] parts = new RegExp('^(-?\\d{1,3})((?:\\d{3})+)(\\.(\\d{'+ nDecimalDigits +'}))?$').exec( fixed ); if(parts){ //val >= 1000 || val <= -1000 return parts[1] + parts[2].replace(/\d{3}/g, thousandsSeparator + '$&') + (parts[4] ? decimalSeparator + parts[4] : ''); }else{ return fixed.replace('.', decimalSeparator); } } return currencyFormat; });
[-] MAX_INT.js
[edit]
[-] toInt.js
[edit]
[+]
..
[-] MAX_SAFE_INTEGER.js
[edit]
[-] nth.js
[edit]
[-] sign.js
[edit]
[-] toUInt31.js
[edit]
[-] pad.js
[edit]
[-] rol.js
[edit]
[-] MAX_UINT.js
[edit]
[-] enforcePrecision.js
[edit]
[-] isNaN.js
[edit]
[-] abbreviate.js
[edit]
[-] currencyFormat.js
[edit]
[-] toUInt.js
[edit]
[-] MIN_INT.js
[edit]
[-] ordinal.js
[edit]
[-] ror.js
[edit]