Comparing version 1.10.0 to 1.10.1
@@ -0,1 +1,9 @@ | ||
### 1.10.1 | ||
- Fix #239: Add de-AT localization. Thanks @gwynjudd. | ||
- Fix #242: Added de-LI localisation. Thanks @gwynjudd. | ||
- Fix #243: en-IE localization. Thanks @gwynjudd. | ||
- Fix #246: Added it-CH localization. Thanks @gwynjudd. | ||
- Fix #265: Revert Error thrown when invalid input. Thanks @BenjaminVanRyseghem. | ||
### 1.10.0 | ||
@@ -2,0 +10,0 @@ |
@@ -105,2 +105,42 @@ /*! | ||
* language : German | ||
* locale: Austria | ||
* author : Tim McIntosh (StayinFront NZ) | ||
*/ | ||
(function () { | ||
'use strict'; | ||
var language = { | ||
langLocaleCode: 'de-AT', | ||
cultureCode: 'de-AT', | ||
delimiters: { | ||
thousands: ' ', | ||
decimal: ',' | ||
}, | ||
abbreviations: { | ||
thousand: 'k', | ||
million: 'm', | ||
billion: 'b', | ||
trillion: 't' | ||
}, | ||
ordinal: function () { | ||
return '.'; | ||
}, | ||
currency: { | ||
symbol: '€' | ||
} | ||
}; | ||
// Node | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = language; | ||
} | ||
// Browser | ||
if (typeof window !== 'undefined' && window.numbro && window.numbro.culture) { | ||
window.numbro.culture(language.cultureCode, language); | ||
} | ||
}.call(typeof window === 'undefined' ? this : window)); | ||
/*! | ||
* numbro.js language configuration | ||
* language : German | ||
* locale: Switzerland | ||
@@ -208,2 +248,52 @@ * author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky) | ||
* numbro.js language configuration | ||
* language : German | ||
* locale: Liechtenstein | ||
* author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky) | ||
*/ | ||
(function () { | ||
'use strict'; | ||
var language = { | ||
langLocaleCode: 'de-LI', | ||
cultureCode: 'de-LI', | ||
delimiters: { | ||
thousands: '\'', | ||
decimal: '.' | ||
}, | ||
abbreviations: { | ||
thousand: 'k', | ||
million: 'm', | ||
billion: 'b', | ||
trillion: 't' | ||
}, | ||
ordinal: function () { | ||
return '.'; | ||
}, | ||
currency: { | ||
symbol: 'CHF', | ||
position: 'postfix' | ||
}, | ||
defaults: { | ||
currencyFormat: ',4 a' | ||
}, | ||
formats: { | ||
fourDigits: '4 a', | ||
fullWithTwoDecimals: ',0.00 $', | ||
fullWithTwoDecimalsNoCurrency: ',0.00', | ||
fullWithNoDecimals: ',0 $' | ||
} | ||
}; | ||
// CommonJS | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = language; | ||
} | ||
// Browser | ||
if (typeof window !== 'undefined' && window.numbro && window.numbro.culture) { | ||
window.numbro.culture(language.cultureCode, language); | ||
} | ||
}.call(typeof window === 'undefined' ? this : window)); | ||
/*! | ||
* numbro.js language configuration | ||
* language : English | ||
@@ -316,2 +406,46 @@ * locale: Australia | ||
/*! | ||
+ * numbro.js language configuration | ||
* language : English | ||
* locale: Ireland | ||
* author : Tim McIntosh (StayinFront NZ) | ||
*/ | ||
(function () { | ||
'use strict'; | ||
var language = { | ||
langLocaleCode: 'en-IE', | ||
cultureCode: 'en-IE', | ||
delimiters: { | ||
thousands: ',', | ||
decimal: '.' | ||
}, | ||
abbreviations: { | ||
thousand: 'k', | ||
million: 'm', | ||
billion: 'b', | ||
trillion: 't' | ||
}, | ||
ordinal: function (number) { | ||
var b = number % 10; | ||
return (~~(number % 100 / 10) === 1) ? 'th' : | ||
(b === 1) ? 'st' : | ||
(b === 2) ? 'nd' : | ||
(b === 3) ? 'rd' : 'th'; | ||
}, | ||
currency: { | ||
symbol: '€' | ||
} | ||
}; | ||
// Node | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = language; | ||
} | ||
// Browser | ||
if (typeof window !== 'undefined' && window.numbro && window.numbro.culture) { | ||
window.numbro.culture('en-gb', language); | ||
} | ||
}.call(typeof window === 'undefined' ? this : window)); | ||
/*! | ||
* numbro.js language configuration | ||
@@ -973,2 +1107,42 @@ * language : English | ||
* language : Italian | ||
* locale: Switzerland | ||
* author : Tim McIntosh (StayinFront NZ) | ||
*/ | ||
(function () { | ||
'use strict'; | ||
var language = { | ||
langLocaleCode: 'it-CH', | ||
cultureCode: 'it-CH', | ||
delimiters: { | ||
thousands: '\'', | ||
decimal: '.' | ||
}, | ||
abbreviations: { | ||
thousand: 'mila', | ||
million: 'mil', | ||
billion: 'b', | ||
trillion: 't' | ||
}, | ||
ordinal: function () { | ||
return '°'; | ||
}, | ||
currency: { | ||
symbol: 'CHF' | ||
} | ||
}; | ||
// Node | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = language; | ||
} | ||
// Browser | ||
if (typeof window !== 'undefined' && window.numbro && window.numbro.culture) { | ||
window.numbro.culture('it-CH', language); | ||
} | ||
}.call(typeof window === 'undefined' ? this : window)); | ||
/*! | ||
* numbro.js language configuration | ||
* language : Italian | ||
* locale: Italy | ||
@@ -975,0 +1149,0 @@ * author : Giacomo Trombi : http://cinquepunti.it |
@@ -24,2 +24,12 @@ /*! | ||
* language : German | ||
* locale: Austria | ||
* author : Tim McIntosh (StayinFront NZ) | ||
*/ | ||
function(){"use strict";var a={langLocaleCode:"de-AT",cultureCode:"de-AT",delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"€"}}; | ||
// Node | ||
"undefined"!=typeof module&&module.exports&&(module.exports=a), | ||
// Browser | ||
"undefined"!=typeof window&&window.numbro&&window.numbro.culture&&window.numbro.culture(a.cultureCode,a)}.call("undefined"==typeof window?this:window),/*! | ||
* numbro.js language configuration | ||
* language : German | ||
* locale: Switzerland | ||
@@ -46,2 +56,12 @@ * author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky) | ||
* numbro.js language configuration | ||
* language : German | ||
* locale: Liechtenstein | ||
* author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky) | ||
*/ | ||
function(){"use strict";var a={langLocaleCode:"de-LI",cultureCode:"de-LI",delimiters:{thousands:"'",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"CHF",position:"postfix"},defaults:{currencyFormat:",4 a"},formats:{fourDigits:"4 a",fullWithTwoDecimals:",0.00 $",fullWithTwoDecimalsNoCurrency:",0.00",fullWithNoDecimals:",0 $"}}; | ||
// CommonJS | ||
"undefined"!=typeof module&&module.exports&&(module.exports=a), | ||
// Browser | ||
"undefined"!=typeof window&&window.numbro&&window.numbro.culture&&window.numbro.culture(a.cultureCode,a)}.call("undefined"==typeof window?this:window),/*! | ||
* numbro.js language configuration | ||
* language : English | ||
@@ -66,2 +86,12 @@ * locale: Australia | ||
"undefined"!=typeof window&&window.numbro&&window.numbro.culture&&window.numbro.culture(a.cultureCode,a)}.call("undefined"==typeof window?this:window),/*! | ||
+ * numbro.js language configuration | ||
* language : English | ||
* locale: Ireland | ||
* author : Tim McIntosh (StayinFront NZ) | ||
*/ | ||
function(){"use strict";var a={langLocaleCode:"en-IE",cultureCode:"en-IE",delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"€"}}; | ||
// Node | ||
"undefined"!=typeof module&&module.exports&&(module.exports=a), | ||
// Browser | ||
"undefined"!=typeof window&&window.numbro&&window.numbro.culture&&window.numbro.culture("en-gb",a)}.call("undefined"==typeof window?this:window),/*! | ||
* numbro.js language configuration | ||
@@ -205,2 +235,12 @@ * language : English | ||
* language : Italian | ||
* locale: Switzerland | ||
* author : Tim McIntosh (StayinFront NZ) | ||
*/ | ||
function(){"use strict";var a={langLocaleCode:"it-CH",cultureCode:"it-CH",delimiters:{thousands:"'",decimal:"."},abbreviations:{thousand:"mila",million:"mil",billion:"b",trillion:"t"},ordinal:function(){return"°"},currency:{symbol:"CHF"}}; | ||
// Node | ||
"undefined"!=typeof module&&module.exports&&(module.exports=a), | ||
// Browser | ||
"undefined"!=typeof window&&window.numbro&&window.numbro.culture&&window.numbro.culture("it-CH",a)}.call("undefined"==typeof window?this:window),/*! | ||
* numbro.js language configuration | ||
* language : Italian | ||
* locale: Italy | ||
@@ -207,0 +247,0 @@ * author : Giacomo Trombi : http://cinquepunti.it |
@@ -1,1 +0,1 @@ | ||
exports["cs-CZ"]=require("./cs-CZ.js"),exports["da-DK"]=require("./da-DK.js"),exports["de-CH"]=require("./de-CH.js"),exports["de-DE"]=require("./de-DE.js"),exports["en-AU"]=require("./en-AU.js"),exports["en-GB"]=require("./en-GB.js"),exports["en-NZ"]=require("./en-NZ.js"),exports["en-ZA"]=require("./en-ZA.js"),exports["es-AR"]=require("./es-AR.js"),exports["es-ES"]=require("./es-ES.js"),exports["et-EE"]=require("./et-EE.js"),exports["fa-IR"]=require("./fa-IR.js"),exports["fi-FI"]=require("./fi-FI.js"),exports["fil-PH"]=require("./fil-PH.js"),exports["fr-CA"]=require("./fr-CA.js"),exports["fr-CH"]=require("./fr-CH.js"),exports["fr-FR"]=require("./fr-FR.js"),exports["he-IL"]=require("./he-IL.js"),exports["hu-HU"]=require("./hu-HU.js"),exports["it-IT"]=require("./it-IT.js"),exports["ja-JP"]=require("./ja-JP.js"),exports["ko-KR"]=require("./ko-KR.js"),exports["lv-LV"]=require("./lv-LV.js"),exports["nb-NO"]=require("./nb-NO.js"),exports["nl-BE"]=require("./nl-BE.js"),exports["nl-NL"]=require("./nl-NL.js"),exports["pl-PL"]=require("./pl-PL.js"),exports["pt-BR"]=require("./pt-BR.js"),exports["pt-PT"]=require("./pt-PT.js"),exports["ro-RO"]=require("./ro-RO.js"),exports["ru-RU"]=require("./ru-RU.js"),exports["ru-UA"]=require("./ru-UA.js"),exports["sk-SK"]=require("./sk-SK.js"),exports["sv-SE"]=require("./sv-SE.js"),exports["th-TH"]=require("./th-TH.js"),exports["tr-TR"]=require("./tr-TR.js"),exports["uk-UA"]=require("./uk-UA.js"),exports["zh-CN"]=require("./zh-CN.js"),exports["zh-TW"]=require("./zh-TW.js"); | ||
exports["cs-CZ"]=require("./cs-CZ.js"),exports["da-DK"]=require("./da-DK.js"),exports["de-AT"]=require("./de-AT.js"),exports["de-CH"]=require("./de-CH.js"),exports["de-DE"]=require("./de-DE.js"),exports["de-LI"]=require("./de-LI.js"),exports["en-AU"]=require("./en-AU.js"),exports["en-GB"]=require("./en-GB.js"),exports["en-IE"]=require("./en-IE.js"),exports["en-NZ"]=require("./en-NZ.js"),exports["en-ZA"]=require("./en-ZA.js"),exports["es-AR"]=require("./es-AR.js"),exports["es-ES"]=require("./es-ES.js"),exports["et-EE"]=require("./et-EE.js"),exports["fa-IR"]=require("./fa-IR.js"),exports["fi-FI"]=require("./fi-FI.js"),exports["fil-PH"]=require("./fil-PH.js"),exports["fr-CA"]=require("./fr-CA.js"),exports["fr-CH"]=require("./fr-CH.js"),exports["fr-FR"]=require("./fr-FR.js"),exports["he-IL"]=require("./he-IL.js"),exports["hu-HU"]=require("./hu-HU.js"),exports["it-CH"]=require("./it-CH.js"),exports["it-IT"]=require("./it-IT.js"),exports["ja-JP"]=require("./ja-JP.js"),exports["ko-KR"]=require("./ko-KR.js"),exports["lv-LV"]=require("./lv-LV.js"),exports["nb-NO"]=require("./nb-NO.js"),exports["nl-BE"]=require("./nl-BE.js"),exports["nl-NL"]=require("./nl-NL.js"),exports["pl-PL"]=require("./pl-PL.js"),exports["pt-BR"]=require("./pt-BR.js"),exports["pt-PT"]=require("./pt-PT.js"),exports["ro-RO"]=require("./ro-RO.js"),exports["ru-RU"]=require("./ru-RU.js"),exports["ru-UA"]=require("./ru-UA.js"),exports["sk-SK"]=require("./sk-SK.js"),exports["sv-SE"]=require("./sv-SE.js"),exports["th-TH"]=require("./th-TH.js"),exports["tr-TR"]=require("./tr-TR.js"),exports["uk-UA"]=require("./uk-UA.js"),exports["zh-CN"]=require("./zh-CN.js"),exports["zh-TW"]=require("./zh-TW.js"); |
/*! | ||
* numbro.js | ||
* version : 1.10.0 | ||
* version : 1.10.1 | ||
* author : Företagsplatsen AB | ||
@@ -17,3 +17,3 @@ * license : MIT | ||
var numbro, | ||
VERSION = '1.10.0', | ||
VERSION = '1.10.1', | ||
binarySuffixes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'], | ||
@@ -723,8 +723,6 @@ decimalSuffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | ||
input = input.value(); | ||
} else if (input === 0 || typeof input === 'undefined') { | ||
input = 0; | ||
} else if (typeof input === 'string' || typeof input === 'number') { | ||
input = numbro.fn.unformat(input); | ||
} else { | ||
throw new Error('Invalid input'); | ||
input = NaN; | ||
} | ||
@@ -731,0 +729,0 @@ |
/*! | ||
* numbro.js | ||
* version : 1.10.0 | ||
* version : 1.10.1 | ||
* author : Företagsplatsen AB | ||
@@ -107,3 +107,3 @@ * license : MIT | ||
************************************/ | ||
var t,u="1.10.0",v=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],w=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],x={general:{scale:1024,suffixes:w,marker:"bd"},binary:{scale:1024,suffixes:v,marker:"b"},decimal:{scale:1e3,suffixes:w,marker:"d"}}, | ||
var t,u="1.10.1",v=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],w=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],x={general:{scale:1024,suffixes:w,marker:"bd"},binary:{scale:1024,suffixes:v,marker:"b"},decimal:{scale:1e3,suffixes:w,marker:"d"}}, | ||
// general must be before the others because it reuses their characters! | ||
@@ -118,2 +118,2 @@ y=[x.general,x.binary,x.decimal], | ||
// default culture | ||
G={delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$",position:"prefix"},defaults:{currencyFormat:",0000 a"},formats:{fourDigits:"0000 a",fullWithTwoDecimals:"$ ,0.00",fullWithTwoDecimalsNoCurrency:",0.00"}};t=function(b){if(t.isNumbro(b))b=b.value();else if(0===b||"undefined"==typeof b)b=0;else{if("string"!=typeof b&&"number"!=typeof b)throw new Error("Invalid input");b=t.fn.unformat(b)}return new a(Number(b))},t.version=u,t.isNumbro=function(b){return b instanceof a},t.setLanguage=function(a,b){console.warn("`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead");var c=a,d=a.split("-")[0],e=null;A[c]||(Object.keys(A).forEach(function(a){e||a.split("-")[0]!==d||(e=a)}),c=e||b||"en-US"),p(c)},t.setCulture=function(a,b){var c=a,d=a.split("-")[1],e=null;z[c]||(d&&Object.keys(z).forEach(function(a){e||a.split("-")[1]!==d||(e=a)}),c=e||b||"en-US"),p(c)},t.language=function(a,b){if(console.warn("`language` is deprecated since version 1.6.0. Use `culture` instead"),!a)return B;if(a&&!b){if(!A[a])throw new Error("Unknown language : "+a);p(a)}return!b&&A[a]||o(a,b),t},t.culture=function(a,b){if(!a)return B;if(a&&!b){if(!z[a])throw new Error("Unknown culture : "+a);p(a)}return!b&&z[a]||o(a,b),t},t.languageData=function(a){if(console.warn("`languageData` is deprecated since version 1.6.0. Use `cultureData` instead"),!a)return A[B];if(!A[a])throw new Error("Unknown language : "+a);return A[a]},t.cultureData=function(a){if(!a)return z[B];if(!z[a])throw new Error("Unknown culture : "+a);return z[a]},t.culture("en-US",G),t.languages=function(){return console.warn("`languages` is deprecated since version 1.6.0. Use `cultures` instead"),A},t.cultures=function(){return z},t.zeroFormat=function(a){C="string"==typeof a?a:null},t.defaultFormat=function(a){D="string"==typeof a?a:"0.0"},t.defaultCurrencyFormat=function(a){E="string"==typeof a?a:"0$"},t.validate=function(a,b){var c,d,e,f,g,h,i,j;if("string"!=typeof a&&(a+="",console.warn&&console.warn("Numbro.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a=a.replace(/^[+-]?/,""),a.match(/^\d+$/))return!0;if(""===a)return!1;try{i=t.cultureData(b)}catch(k){i=t.cultureData(t.culture())}return e=i.currency.symbol,g=i.abbreviations,c=i.delimiters.decimal,d="."===i.delimiters.thousands?"\\.":i.delimiters.thousands,j=a.match(/^[^\d\.\,]+/),null!==j&&(a=a.substr(1),j[0]!==e)?!1:(j=a.match(/[^\d]+$/),null!==j&&(a=a.slice(0,-1),j[0]!==g.thousand&&j[0]!==g.million&&j[0]!==g.billion&&j[0]!==g.trillion)?!1:(h=new RegExp(d+"{2}"),a.match(/[^\d.,]/g)?!1:(f=a.split(c),f.length>2?!1:f.length<2?!!f[0].match(/^\d+.*\d$/)&&!f[0].match(h):""===f[0]?!f[0].match(h)&&!!f[1].match(/^\d+$/):1===f[0].length?!!f[0].match(/^\d+$/)&&!f[0].match(h)&&!!f[1].match(/^\d+$/):!!f[0].match(/^\d+.*\d$/)&&!f[0].match(h)&&!!f[1].match(/^\d+$/))))},t.loadLanguagesInNode=function(){console.warn("`loadLanguagesInNode` is deprecated since version 1.6.0. Use `loadCulturesInNode` instead"),t.loadCulturesInNode()},t.loadCulturesInNode=function(){var a=require("./languages");for(var b in a)b&&t.culture(b,a[b])},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){if(null===this||"undefined"==typeof this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof a)throw new TypeError(a+" is not a function");var c,d,e=this.length>>>0,f=!1;for(1<arguments.length&&(d=b,f=!0),c=0;e>c;++c)this.hasOwnProperty(c)&&(f?d=a(d,this[c],c,this):(d=this[c],f=!0));if(!f)throw new TypeError("Reduce of empty array with no initial value");return d}),t.fn=a.prototype={clone:function(){return t(this)},format:function(a,b){return f(this,a?a:D,void 0!==b?b:Math.round)},formatCurrency:function(a,b){return h(this,z[B].currency.symbol,a?a:E,void 0!==b?b:Math.round)},formatForeignCurrency:function(a,b,c){return i(this,a,b?b:E,void 0!==c?c:Math.round)},unformat:function(a){if("number"==typeof a)return a;if("string"==typeof a){var b=g(this,a);return isNaN(b)?void 0:b}},binaryByteUnits:function(){return m(this._value,x.binary.suffixes,x.binary.scale).suffix},byteUnits:function(){return m(this._value,x.general.suffixes,x.general.scale).suffix},decimalByteUnits:function(){return m(this._value,x.decimal.suffixes,x.decimal.scale).suffix},value:function(){return this._value},valueOf:function(){return this._value},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b){return a+c*b}var c=s.call(null,this._value,a);return this._value=[this._value,a].reduce(b,0)/c,this},subtract:function(a){function b(a,b){return a-c*b}var c=s.call(null,this._value,a);return this._value=[a].reduce(b,this._value*c)/c,this},multiply:function(a){function b(a,b){var c=s(a,b),d=a*c;return d*=b*c,d/=c*c}return this._value=[this._value,a].reduce(b,1),this},divide:function(a){function b(a,b){var c=s(a,b);return a*c/(b*c)}return this._value=[this._value,a].reduce(b),this},difference:function(a){return Math.abs(t(this._value).subtract(a).value())}},q()&&t.loadCulturesInNode(),F?module.exports=t:("undefined"==typeof ender&&(this.numbro=t),"function"==typeof define&&define.amd&&define([],function(){return t}))}).call("undefined"==typeof window?this:window); | ||
G={delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$",position:"prefix"},defaults:{currencyFormat:",0000 a"},formats:{fourDigits:"0000 a",fullWithTwoDecimals:"$ ,0.00",fullWithTwoDecimalsNoCurrency:",0.00"}};t=function(b){return b=t.isNumbro(b)?b.value():"string"==typeof b||"number"==typeof b?t.fn.unformat(b):NaN,new a(Number(b))},t.version=u,t.isNumbro=function(b){return b instanceof a},t.setLanguage=function(a,b){console.warn("`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead");var c=a,d=a.split("-")[0],e=null;A[c]||(Object.keys(A).forEach(function(a){e||a.split("-")[0]!==d||(e=a)}),c=e||b||"en-US"),p(c)},t.setCulture=function(a,b){var c=a,d=a.split("-")[1],e=null;z[c]||(d&&Object.keys(z).forEach(function(a){e||a.split("-")[1]!==d||(e=a)}),c=e||b||"en-US"),p(c)},t.language=function(a,b){if(console.warn("`language` is deprecated since version 1.6.0. Use `culture` instead"),!a)return B;if(a&&!b){if(!A[a])throw new Error("Unknown language : "+a);p(a)}return!b&&A[a]||o(a,b),t},t.culture=function(a,b){if(!a)return B;if(a&&!b){if(!z[a])throw new Error("Unknown culture : "+a);p(a)}return!b&&z[a]||o(a,b),t},t.languageData=function(a){if(console.warn("`languageData` is deprecated since version 1.6.0. Use `cultureData` instead"),!a)return A[B];if(!A[a])throw new Error("Unknown language : "+a);return A[a]},t.cultureData=function(a){if(!a)return z[B];if(!z[a])throw new Error("Unknown culture : "+a);return z[a]},t.culture("en-US",G),t.languages=function(){return console.warn("`languages` is deprecated since version 1.6.0. Use `cultures` instead"),A},t.cultures=function(){return z},t.zeroFormat=function(a){C="string"==typeof a?a:null},t.defaultFormat=function(a){D="string"==typeof a?a:"0.0"},t.defaultCurrencyFormat=function(a){E="string"==typeof a?a:"0$"},t.validate=function(a,b){var c,d,e,f,g,h,i,j;if("string"!=typeof a&&(a+="",console.warn&&console.warn("Numbro.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a=a.replace(/^[+-]?/,""),a.match(/^\d+$/))return!0;if(""===a)return!1;try{i=t.cultureData(b)}catch(k){i=t.cultureData(t.culture())}return e=i.currency.symbol,g=i.abbreviations,c=i.delimiters.decimal,d="."===i.delimiters.thousands?"\\.":i.delimiters.thousands,j=a.match(/^[^\d\.\,]+/),null!==j&&(a=a.substr(1),j[0]!==e)?!1:(j=a.match(/[^\d]+$/),null!==j&&(a=a.slice(0,-1),j[0]!==g.thousand&&j[0]!==g.million&&j[0]!==g.billion&&j[0]!==g.trillion)?!1:(h=new RegExp(d+"{2}"),a.match(/[^\d.,]/g)?!1:(f=a.split(c),f.length>2?!1:f.length<2?!!f[0].match(/^\d+.*\d$/)&&!f[0].match(h):""===f[0]?!f[0].match(h)&&!!f[1].match(/^\d+$/):1===f[0].length?!!f[0].match(/^\d+$/)&&!f[0].match(h)&&!!f[1].match(/^\d+$/):!!f[0].match(/^\d+.*\d$/)&&!f[0].match(h)&&!!f[1].match(/^\d+$/))))},t.loadLanguagesInNode=function(){console.warn("`loadLanguagesInNode` is deprecated since version 1.6.0. Use `loadCulturesInNode` instead"),t.loadCulturesInNode()},t.loadCulturesInNode=function(){var a=require("./languages");for(var b in a)b&&t.culture(b,a[b])},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){if(null===this||"undefined"==typeof this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof a)throw new TypeError(a+" is not a function");var c,d,e=this.length>>>0,f=!1;for(1<arguments.length&&(d=b,f=!0),c=0;e>c;++c)this.hasOwnProperty(c)&&(f?d=a(d,this[c],c,this):(d=this[c],f=!0));if(!f)throw new TypeError("Reduce of empty array with no initial value");return d}),t.fn=a.prototype={clone:function(){return t(this)},format:function(a,b){return f(this,a?a:D,void 0!==b?b:Math.round)},formatCurrency:function(a,b){return h(this,z[B].currency.symbol,a?a:E,void 0!==b?b:Math.round)},formatForeignCurrency:function(a,b,c){return i(this,a,b?b:E,void 0!==c?c:Math.round)},unformat:function(a){if("number"==typeof a)return a;if("string"==typeof a){var b=g(this,a);return isNaN(b)?void 0:b}},binaryByteUnits:function(){return m(this._value,x.binary.suffixes,x.binary.scale).suffix},byteUnits:function(){return m(this._value,x.general.suffixes,x.general.scale).suffix},decimalByteUnits:function(){return m(this._value,x.decimal.suffixes,x.decimal.scale).suffix},value:function(){return this._value},valueOf:function(){return this._value},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b){return a+c*b}var c=s.call(null,this._value,a);return this._value=[this._value,a].reduce(b,0)/c,this},subtract:function(a){function b(a,b){return a-c*b}var c=s.call(null,this._value,a);return this._value=[a].reduce(b,this._value*c)/c,this},multiply:function(a){function b(a,b){var c=s(a,b),d=a*c;return d*=b*c,d/=c*c}return this._value=[this._value,a].reduce(b,1),this},divide:function(a){function b(a,b){var c=s(a,b);return a*c/(b*c)}return this._value=[this._value,a].reduce(b),this},difference:function(a){return Math.abs(t(this._value).subtract(a).value())}},q()&&t.loadCulturesInNode(),F?module.exports=t:("undefined"==typeof ender&&(this.numbro=t),"function"==typeof define&&define.amd&&define([],function(){return t}))}).call("undefined"==typeof window?this:window); |
exports['cs-CZ'] = require('./cs-CZ.js'); | ||
exports['da-DK'] = require('./da-DK.js'); | ||
exports['de-AT'] = require('./de-AT.js'); | ||
exports['de-CH'] = require('./de-CH.js'); | ||
exports['de-DE'] = require('./de-DE.js'); | ||
exports['de-LI'] = require('./de-LI.js'); | ||
exports['en-AU'] = require('./en-AU.js'); | ||
exports['en-GB'] = require('./en-GB.js'); | ||
exports['en-IE'] = require('./en-IE.js'); | ||
exports['en-NZ'] = require('./en-NZ.js'); | ||
@@ -20,2 +23,3 @@ exports['en-ZA'] = require('./en-ZA.js'); | ||
exports['hu-HU'] = require('./hu-HU.js'); | ||
exports['it-CH'] = require('./it-CH.js'); | ||
exports['it-IT'] = require('./it-IT.js'); | ||
@@ -22,0 +26,0 @@ exports['ja-JP'] = require('./ja-JP.js'); |
/*! | ||
* numbro.js | ||
* version : 1.10.0 | ||
* version : 1.10.1 | ||
* author : Företagsplatsen AB | ||
@@ -17,3 +17,3 @@ * license : MIT | ||
var numbro, | ||
VERSION = '1.10.0', | ||
VERSION = '1.10.1', | ||
binarySuffixes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'], | ||
@@ -723,8 +723,6 @@ decimalSuffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], | ||
input = input.value(); | ||
} else if (input === 0 || typeof input === 'undefined') { | ||
input = 0; | ||
} else if (typeof input === 'string' || typeof input === 'number') { | ||
input = numbro.fn.unformat(input); | ||
} else { | ||
throw new Error('Invalid input'); | ||
input = NaN; | ||
} | ||
@@ -731,0 +729,0 @@ |
{ | ||
"name": "numbro", | ||
"version": "1.10.0", | ||
"version": "1.10.1", | ||
"description": "Format and manipulate numbers.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://numbrojs.com", |
308171
100
7498