From e6f73a4ff0a15ef7b5336d5a1e63d9c48031dc93 Mon Sep 17 00:00:00 2001 From: Benjamin Van Ryseghem Date: Wed, 15 Apr 2015 17:09:17 +0200 Subject: [PATCH 01/47] Fixes dependencies --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 97446b49..38c532b7 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "grunt": "latest", "grunt-contrib-uglify": "latest", "grunt-contrib-jshint": "latest", - "grunt-contrib-nodeunit": "~0.1.2", - "grunt-contrib-concat": "~0.3.0" + "grunt-contrib-nodeunit": "latest", + "grunt-contrib-concat": "latest" }, "scripts": { "test": "grunt" From 0768d46387e9a6b849e9132c6ae3bc1c2f09d039 Mon Sep 17 00:00:00 2001 From: Benjamin Van Ryseghem Date: Wed, 15 Apr 2015 17:12:27 +0200 Subject: [PATCH 02/47] Fixes commented version --- min/numbro.min.js | 4 ++-- numbro.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/min/numbro.min.js b/min/numbro.min.js index bccadc4d..0893fc31 100644 --- a/min/numbro.min.js +++ b/min/numbro.min.js @@ -1,8 +1,8 @@ /*! * numbro.js - * version : 1.0.0 + * version : 1.0.4 * author : Företagsplatsen AB * license : MIT * http://www.foretagsplatsen.se */ -(function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10,b);return f=(c(a*g)/g).toFixed(b),d&&(e=new RegExp("0{1,"+d+"}$"),f=f.replace(e,"")),f}function c(a,b,c){var d;return d=b.indexOf("$")>-1?e(a,b,c):b.indexOf("%")>-1?f(a,b,c):b.indexOf(":")>-1?g(a,b):i(a._value,b,c)}function d(a,b){var c,d,e,f,g,i=b,j=["KB","MB","GB","TB","PB","EB","ZB","YB"],k=!1;if(b.indexOf(":")>-1)a._value=h(b);else if(b===q)a._value=0;else{for("."!==o[p].delimiters.decimal&&(b=b.replace(/\./g,"").replace(o[p].delimiters.decimal,".")),c=new RegExp("[^a-zA-Z]"+o[p].abbreviations.thousand+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),d=new RegExp("[^a-zA-Z]"+o[p].abbreviations.million+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),e=new RegExp("[^a-zA-Z]"+o[p].abbreviations.billion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),f=new RegExp("[^a-zA-Z]"+o[p].abbreviations.trillion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),g=0;g<=j.length&&!(k=b.indexOf(j[g])>-1?Math.pow(1024,g+1):!1);g++);a._value=(k?k:1)*(i.match(c)?Math.pow(10,3):1)*(i.match(d)?Math.pow(10,6):1)*(i.match(e)?Math.pow(10,9):1)*(i.match(f)?Math.pow(10,12):1)*(b.indexOf("%")>-1?.01:1)*((b.split("-").length+Math.min(b.split("(").length-1,b.split(")").length-1))%2?1:-1)*Number(b.replace(/[^0-9\.]+/g,"")),a._value=k?Math.ceil(a._value):a._value}return a._value}function e(a,b,c){var d,e,f=b,g=f.indexOf("$"),h=f.indexOf("("),j=f.indexOf("-"),k="",l="";if(-1===f.indexOf("$")?"infix"===o[p].currency.position?(l=o[p].currency.symbol,o[p].currency.spaceSeparated&&(l=" "+l+" ")):o[p].currency.spaceSeparated&&(k=" "):f.indexOf(" $")>-1?(k=" ",f=f.replace(" $","")):f.indexOf("$ ")>-1?(k=" ",f=f.replace("$ ","")):f=f.replace("$",""),e=i(a._value,f,c,l),-1===b.indexOf("$"))switch(o[p].currency.position){case"postfix":e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,k+o[p].currency.symbol),e=e.join("")):e=e+k+o[p].currency.symbol;break;case"infix":break;default:e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=Math.max(h,j)+1,e.splice(d,0,o[p].currency.symbol+k),e=e.join("")):e=o[p].currency.symbol+k+e}else 1>=g?e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=1,(h>g||j>g)&&(d=0),e.splice(d,0,o[p].currency.symbol+k),e=e.join("")):e=o[p].currency.symbol+k+e:e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,k+o[p].currency.symbol),e=e.join("")):e=e+k+o[p].currency.symbol;return e}function f(a,b,c){var d,e="",f=100*a._value;return b.indexOf(" %")>-1?(e=" ",b=b.replace(" %","")):b=b.replace("%",""),d=i(f,b,c),d.indexOf(")")>-1?(d=d.split(""),d.splice(-1,0,e+"%"),d=d.join("")):d=d+e+"%",d}function g(a){var b=Math.floor(a._value/60/60),c=Math.floor((a._value-60*b*60)/60),d=Math.round(a._value-60*b*60-60*c);return b+":"+(10>c?"0"+c:c)+":"+(10>d?"0"+d:d)}function h(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}function i(a,c,d,e){var f,g,h,i,j,k,l,m,n,r,s,t,u,v,w=!1,x=!1,y=!1,z="",A=!1,B=!1,C=!1,D=!1,E=!1,F="",G="",H=Math.abs(a),I=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],J="",K=!1,L=!1,M=-1,N=-1,O="";if(0===a&&null!==q)return q;if(isFinite(a)){if(-1!==c.indexOf("-")&&(K=!0),c.indexOf("(")>-1?(w=!0,c=c.slice(1,-1)):c.indexOf("+")>-1&&(x=!0,c=c.replace(/\+/g,"")),c.indexOf("a")>-1){if(r=c.split(".")[0].match(/0/g)||[],r=r.length,A=c.indexOf("aK")>=0,B=c.indexOf("aM")>=0,C=c.indexOf("aB")>=0,D=c.indexOf("aT")>=0,E=A||B||C||D,c.indexOf(" a")>-1?(z=" ",c=c.replace(" a","")):c=c.replace("a",""),j=Math.floor(Math.log(H)/Math.LN10)+1,l=j%3,l=0===l?3:l,r>=l&&(k=Math.floor(Math.log(H)/Math.LN10)+1-r,m=3*~~((Math.min(r,j)-l)/3),H/=Math.pow(10,m),-1===c.indexOf(".")&&r>3))for(c+="[.]",v=0===k?0:3*~~(k/3)-k,v=0>v?v+3:v,f=0;v>f;f++)c+="0";Math.floor(Math.log(Math.abs(a))/Math.LN10)+1!==r&&(H>=Math.pow(10,12)&&!E||D?(z+=o[p].abbreviations.trillion,a/=Math.pow(10,12)):H=Math.pow(10,9)&&!E||C?(z+=o[p].abbreviations.billion,a/=Math.pow(10,9)):H=Math.pow(10,6)&&!E||B?(z+=o[p].abbreviations.million,a/=Math.pow(10,6)):(H=Math.pow(10,3)&&!E||A)&&(z+=o[p].abbreviations.thousand,a/=Math.pow(10,3)))}if(c.indexOf("b")>-1)for(c.indexOf(" b")>-1?(F=" ",c=c.replace(" b","")):c=c.replace("b",""),i=0;i<=I.length;i++)if(g=Math.pow(1024,i),h=Math.pow(1024,i+1),a>=g&&h>a){F+=I[i],g>0&&(a/=g);break}return c.indexOf("o")>-1&&(c.indexOf(" o")>-1?(G=" ",c=c.replace(" o","")):c=c.replace("o",""),G+=o[p].ordinal(a)),c.indexOf("[.]")>-1&&(y=!0,c=c.replace("[.]",".")),n=a.toString().split(".")[0],s=c.split(".")[1],u=c.indexOf(","),s?(s.indexOf("[")>-1?(s=s.replace("]",""),s=s.split("["),J=b(a,s[0].length+s[1].length,d,s[1].length)):J=b(a,s.length,d),n=J.split(".")[0],J.split(".")[1].length?(t=e?z+e:o[p].delimiters.decimal,J=t+J.split(".")[1]):J="",y&&0===Number(J.slice(1))&&(J="")):n=b(a,null,d),n.indexOf("-")>-1&&(n=n.slice(1),L=!0),u>-1&&(n=n.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+o[p].delimiters.thousands)),0===c.indexOf(".")&&(n=""),M=c.indexOf("("),N=c.indexOf("-"),O=N>M?(w&&L?"(":"")+(K&&L||!w&&L?"-":""):(K&&L||!w&&L?"-":"")+(w&&L?"(":""),O+(!L&&x?"+":"")+n+J+(G?G:"")+(z&&!e?z:"")+(F?F:"")+(w&&L?")":"")}return""+a}function j(a,b){o[a]=b}function k(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)}function l(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var c=k(a),d=k(b);return c>d?c:d},-(1/0))}var m,n="1.6.0",o={},p="en-US",q=null,r="0,0",s="0$",t="undefined"!=typeof module&&module.exports;m=function(b){return m.isNumbro(b)?b=b.value():0===b||"undefined"==typeof b?b=0:Number(b)||(b=m.fn.unformat(b)),new a(Number(b))},m.version=n,m.isNumbro=function(b){return b instanceof a},m.language=function(a,b){if(!a)return p;if(a&&!b){if(!o[a])throw new Error("Unknown language : "+a);p=a;var c=o[a].defaults;c&&c.format&&m.defaultFormat(c.format),c&&c.currencyFormat&&m.defaultCurrencyFormat(c.currencyFormat)}return(b||!o[a])&&j(a,b),m},m.setLanguage=function(a,b){var c=a,d=a.split("-")[0],e=null;o[c]||(Object.keys(o).forEach(function(a){e||a.split("-")[0]!==d||(e=a)}),c=e||b||"en-US"),m.language(c)},m.languageData=function(a){if(!a)return o[p];if(!o[a])throw new Error("Unknown language : "+a);return o[a]},m.language("en-US",{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"}}),m.zeroFormat=function(a){q="string"==typeof a?a:null},m.defaultFormat=function(a){r="string"==typeof a?a:"0.0"},m.defaultCurrencyFormat=function(a){s="string"==typeof a?a:"0$"},m.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.match(/^\d+$/))return!0;if(""===a)return!1;try{i=m.languageData(b)}catch(k){i=m.languageData(m.language())}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):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+$/))))},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){"use strict";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(1c;++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}),m.fn=a.prototype={clone:function(){return m(this)},format:function(a,b){return c(this,a?a:r,void 0!==b?b:Math.round)},formatCurrency:function(a,b){return e(this,a?a:s,void 0!==b?b:Math.round)},unformat:function(a){return"[object Number]"===Object.prototype.toString.call(a)?a:d(this,a?a:r)},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,d,e){return a+c*b}var c=l.call(null,this._value,a);return this._value=[this._value,a].reduce(b,0)/c,this},subtract:function(a){function b(a,b,d,e){return a-c*b}var c=l.call(null,this._value,a);return this._value=[a].reduce(b,this._value*c)/c,this},multiply:function(a){function b(a,b,c,d){var e=l(a,b);return a*e*b*e/(e*e)}return this._value=[this._value,a].reduce(b,1),this},divide:function(a){function b(a,b,c,d){var e=l(a,b);return a*e/(b*e)}return this._value=[this._value,a].reduce(b),this},difference:function(a){return Math.abs(m(this._value).subtract(a).value())}},t&&(module.exports=m),"undefined"==typeof ender&&(this.numbro=m),"function"==typeof define&&define.amd&&define([],function(){return m})}).call(this); \ No newline at end of file +(function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10,b);return f=(c(a*g)/g).toFixed(b),d&&(e=new RegExp("0{1,"+d+"}$"),f=f.replace(e,"")),f}function c(a,b,c){var d;return d=b.indexOf("$")>-1?e(a,b,c):b.indexOf("%")>-1?f(a,b,c):b.indexOf(":")>-1?g(a,b):i(a._value,b,c)}function d(a,b){var c,d,e,f,g,i=b,j=["KB","MB","GB","TB","PB","EB","ZB","YB"],k=!1;if(b.indexOf(":")>-1)a._value=h(b);else if(b===q)a._value=0;else{for("."!==o[p].delimiters.decimal&&(b=b.replace(/\./g,"").replace(o[p].delimiters.decimal,".")),c=new RegExp("[^a-zA-Z]"+o[p].abbreviations.thousand+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),d=new RegExp("[^a-zA-Z]"+o[p].abbreviations.million+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),e=new RegExp("[^a-zA-Z]"+o[p].abbreviations.billion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),f=new RegExp("[^a-zA-Z]"+o[p].abbreviations.trillion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),g=0;g<=j.length&&!(k=b.indexOf(j[g])>-1?Math.pow(1024,g+1):!1);g++);a._value=(k?k:1)*(i.match(c)?Math.pow(10,3):1)*(i.match(d)?Math.pow(10,6):1)*(i.match(e)?Math.pow(10,9):1)*(i.match(f)?Math.pow(10,12):1)*(b.indexOf("%")>-1?.01:1)*((b.split("-").length+Math.min(b.split("(").length-1,b.split(")").length-1))%2?1:-1)*Number(b.replace(/[^0-9\.]+/g,"")),a._value=k?Math.ceil(a._value):a._value}return a._value}function e(a,b,c){var d,e,f=b,g=f.indexOf("$"),h=f.indexOf("("),j=f.indexOf("-"),k="",l="";if(-1===f.indexOf("$")?"infix"===o[p].currency.position?(l=o[p].currency.symbol,o[p].currency.spaceSeparated&&(l=" "+l+" ")):o[p].currency.spaceSeparated&&(k=" "):f.indexOf(" $")>-1?(k=" ",f=f.replace(" $","")):f.indexOf("$ ")>-1?(k=" ",f=f.replace("$ ","")):f=f.replace("$",""),e=i(a._value,f,c,l),-1===b.indexOf("$"))switch(o[p].currency.position){case"postfix":e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,k+o[p].currency.symbol),e=e.join("")):e=e+k+o[p].currency.symbol;break;case"infix":break;default:e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=Math.max(h,j)+1,e.splice(d,0,o[p].currency.symbol+k),e=e.join("")):e=o[p].currency.symbol+k+e}else 1>=g?e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=1,(h>g||j>g)&&(d=0),e.splice(d,0,o[p].currency.symbol+k),e=e.join("")):e=o[p].currency.symbol+k+e:e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,k+o[p].currency.symbol),e=e.join("")):e=e+k+o[p].currency.symbol;return e}function f(a,b,c){var d,e="",f=100*a._value;return b.indexOf(" %")>-1?(e=" ",b=b.replace(" %","")):b=b.replace("%",""),d=i(f,b,c),d.indexOf(")")>-1?(d=d.split(""),d.splice(-1,0,e+"%"),d=d.join("")):d=d+e+"%",d}function g(a){var b=Math.floor(a._value/60/60),c=Math.floor((a._value-60*b*60)/60),d=Math.round(a._value-60*b*60-60*c);return b+":"+(10>c?"0"+c:c)+":"+(10>d?"0"+d:d)}function h(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}function i(a,c,d,e){var f,g,h,i,j,k,l,m,n,r,s,t,u,v,w=!1,x=!1,y=!1,z="",A=!1,B=!1,C=!1,D=!1,E=!1,F="",G="",H=Math.abs(a),I=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],J="",K=!1,L=!1,M=-1,N=-1,O="";if(0===a&&null!==q)return q;if(isFinite(a)){if(-1!==c.indexOf("-")&&(K=!0),c.indexOf("(")>-1?(w=!0,c=c.slice(1,-1)):c.indexOf("+")>-1&&(x=!0,c=c.replace(/\+/g,"")),c.indexOf("a")>-1){if(r=c.split(".")[0].match(/0/g)||[],r=r.length,A=c.indexOf("aK")>=0,B=c.indexOf("aM")>=0,C=c.indexOf("aB")>=0,D=c.indexOf("aT")>=0,E=A||B||C||D,c.indexOf(" a")>-1?(z=" ",c=c.replace(" a","")):c=c.replace("a",""),j=Math.floor(Math.log(H)/Math.LN10)+1,l=j%3,l=0===l?3:l,r>=l&&(k=Math.floor(Math.log(H)/Math.LN10)+1-r,m=3*~~((Math.min(r,j)-l)/3),H/=Math.pow(10,m),-1===c.indexOf(".")&&r>3))for(c+="[.]",v=0===k?0:3*~~(k/3)-k,v=0>v?v+3:v,f=0;v>f;f++)c+="0";Math.floor(Math.log(Math.abs(a))/Math.LN10)+1!==r&&(H>=Math.pow(10,12)&&!E||D?(z+=o[p].abbreviations.trillion,a/=Math.pow(10,12)):H=Math.pow(10,9)&&!E||C?(z+=o[p].abbreviations.billion,a/=Math.pow(10,9)):H=Math.pow(10,6)&&!E||B?(z+=o[p].abbreviations.million,a/=Math.pow(10,6)):(H=Math.pow(10,3)&&!E||A)&&(z+=o[p].abbreviations.thousand,a/=Math.pow(10,3)))}if(c.indexOf("b")>-1)for(c.indexOf(" b")>-1?(F=" ",c=c.replace(" b","")):c=c.replace("b",""),i=0;i<=I.length;i++)if(g=Math.pow(1024,i),h=Math.pow(1024,i+1),a>=g&&h>a){F+=I[i],g>0&&(a/=g);break}return c.indexOf("o")>-1&&(c.indexOf(" o")>-1?(G=" ",c=c.replace(" o","")):c=c.replace("o",""),G+=o[p].ordinal(a)),c.indexOf("[.]")>-1&&(y=!0,c=c.replace("[.]",".")),n=a.toString().split(".")[0],s=c.split(".")[1],u=c.indexOf(","),s?(s.indexOf("[")>-1?(s=s.replace("]",""),s=s.split("["),J=b(a,s[0].length+s[1].length,d,s[1].length)):J=b(a,s.length,d),n=J.split(".")[0],J.split(".")[1].length?(t=e?z+e:o[p].delimiters.decimal,J=t+J.split(".")[1]):J="",y&&0===Number(J.slice(1))&&(J="")):n=b(a,null,d),n.indexOf("-")>-1&&(n=n.slice(1),L=!0),u>-1&&(n=n.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+o[p].delimiters.thousands)),0===c.indexOf(".")&&(n=""),M=c.indexOf("("),N=c.indexOf("-"),O=N>M?(w&&L?"(":"")+(K&&L||!w&&L?"-":""):(K&&L||!w&&L?"-":"")+(w&&L?"(":""),O+(!L&&x?"+":"")+n+J+(G?G:"")+(z&&!e?z:"")+(F?F:"")+(w&&L?")":"")}return""+a}function j(a,b){o[a]=b}function k(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)}function l(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var c=k(a),d=k(b);return c>d?c:d},-(1/0))}var m,n="1.0.4",o={},p="en-US",q=null,r="0,0",s="0$",t="undefined"!=typeof module&&module.exports;m=function(b){return m.isNumbro(b)?b=b.value():0===b||"undefined"==typeof b?b=0:Number(b)||(b=m.fn.unformat(b)),new a(Number(b))},m.version=n,m.isNumbro=function(b){return b instanceof a},m.language=function(a,b){if(!a)return p;if(a&&!b){if(!o[a])throw new Error("Unknown language : "+a);p=a;var c=o[a].defaults;c&&c.format&&m.defaultFormat(c.format),c&&c.currencyFormat&&m.defaultCurrencyFormat(c.currencyFormat)}return(b||!o[a])&&j(a,b),m},m.setLanguage=function(a,b){var c=a,d=a.split("-")[0],e=null;o[c]||(Object.keys(o).forEach(function(a){e||a.split("-")[0]!==d||(e=a)}),c=e||b||"en-US"),m.language(c)},m.languageData=function(a){if(!a)return o[p];if(!o[a])throw new Error("Unknown language : "+a);return o[a]},m.language("en-US",{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"}}),m.zeroFormat=function(a){q="string"==typeof a?a:null},m.defaultFormat=function(a){r="string"==typeof a?a:"0.0"},m.defaultCurrencyFormat=function(a){s="string"==typeof a?a:"0$"},m.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.match(/^\d+$/))return!0;if(""===a)return!1;try{i=m.languageData(b)}catch(k){i=m.languageData(m.language())}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):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+$/))))},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){"use strict";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(1c;++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}),m.fn=a.prototype={clone:function(){return m(this)},format:function(a,b){return c(this,a?a:r,void 0!==b?b:Math.round)},formatCurrency:function(a,b){return e(this,a?a:s,void 0!==b?b:Math.round)},unformat:function(a){return"[object Number]"===Object.prototype.toString.call(a)?a:d(this,a?a:r)},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,d,e){return a+c*b}var c=l.call(null,this._value,a);return this._value=[this._value,a].reduce(b,0)/c,this},subtract:function(a){function b(a,b,d,e){return a-c*b}var c=l.call(null,this._value,a);return this._value=[a].reduce(b,this._value*c)/c,this},multiply:function(a){function b(a,b,c,d){var e=l(a,b);return a*e*b*e/(e*e)}return this._value=[this._value,a].reduce(b,1),this},divide:function(a){function b(a,b,c,d){var e=l(a,b);return a*e/(b*e)}return this._value=[this._value,a].reduce(b),this},difference:function(a){return Math.abs(m(this._value).subtract(a).value())}},t&&(module.exports=m),"undefined"==typeof ender&&(this.numbro=m),"function"==typeof define&&define.amd&&define([],function(){return m})}).call(this); \ No newline at end of file diff --git a/numbro.js b/numbro.js index bbe67a52..3ec5bd22 100644 --- a/numbro.js +++ b/numbro.js @@ -1,6 +1,6 @@ /*! * numbro.js - * version : 1.0.0 + * version : 1.0.4 * author : Företagsplatsen AB * license : MIT * http://www.foretagsplatsen.se From 228afd3f73755a6cdcbf1d1aa19bbc05df4a5084 Mon Sep 17 00:00:00 2001 From: phil Date: Tue, 14 Apr 2015 16:04:42 -0400 Subject: [PATCH 03/47] Test with node 0.12 add node 0.12 to be tested by travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 384c4072..1b186414 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: node_js node_js: - - "0.10" + - "0.12" + - "0.10" before_script: - npm install -g grunt-cli script: grunt travis --verbose \ No newline at end of file From 3727a9b89e38ffc918d19e8c30b5289f47f9c27b Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Tue, 14 Apr 2015 21:27:27 -0400 Subject: [PATCH 04/47] Also run tests for io.js --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 1b186414..06f6c8ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: node_js node_js: - "0.12" - "0.10" + - "iojs" before_script: - npm install -g grunt-cli script: grunt travis --verbose \ No newline at end of file From 49a131b08cc8ad86a5a60f1fcd8164b70daeed98 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 21:25:52 -0400 Subject: [PATCH 05/47] Remove trailing whitespace, convert line endings... Use Unix line endings throughout the project to be consistent. --- languages.js | 60 ++++++++++++++++++++-------------------- languages/da-DK.js | 2 +- languages/de-DE.js | 2 +- languages/de-ch.js | 4 +-- languages/en-GB.js | 2 +- languages/es-AR.js | 4 +-- languages/es-ES.js | 2 +- languages/et-EE.js | 2 +- languages/fi-FI.js | 2 +- languages/fr-CH.js | 2 +- languages/fr-FR.js | 2 +- languages/it-IT.js | 2 +- languages/ja-JP.js | 2 +- languages/nb-NO.js | 2 +- languages/nl-BE.js | 2 +- languages/nl-NL.js | 2 +- languages/pl-PL.js | 2 +- languages/pt-BR.js | 2 +- languages/pt-PT.js | 2 +- languages/ru-RU.js | 6 ++-- languages/ru-UA.js | 4 +-- languages/th-TH.js | 2 +- languages/tr-TR.js | 2 +- languages/uk-UA.js | 4 +-- languages/zh-CN.js | 2 +- tests/numbro/misc.js | 16 +++++------ tests/numbro/validate.js | 2 +- 27 files changed, 69 insertions(+), 69 deletions(-) diff --git a/languages.js b/languages.js index 6600d3ab..f83946b8 100644 --- a/languages.js +++ b/languages.js @@ -43,7 +43,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : danish denmark (dk) * author : Michael Storgaard : https://github.com/mstorgaard @@ -87,7 +87,7 @@ this.numbro.language('da-DK', language); } }()); -/*! +/*! * numbro.js language configuration * language : German (de) – generally useful in Germany, Austria, Luxembourg, Belgium * author : Marco Krage : https://github.com/sinky @@ -131,11 +131,11 @@ this.numbro.language('de-DE', language); } }()); -/*! +/*! * numbro.js language configuration * language : German in Switzerland (de-ch) * author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky) - */ + */ (function () { var language = { delimiters: { @@ -175,7 +175,7 @@ this.numbro.language('de-CH', language); } }()); -/*! +/*! * numbro.js language configuration * language : english united kingdom (uk) * author : Dan Ristic : https://github.com/dristic @@ -223,7 +223,7 @@ this.numbro.language('en-GB', language); } }()); -/*! +/*! * numbro.js language configuration * language : spanish * author : Hernan Garcia : https://github.com/hgarcia @@ -244,7 +244,7 @@ var b = number % 10; return (b === 1 || b === 3) ? 'er' : (b === 2) ? 'do' : - (b === 7 || b === 0) ? 'mo' : + (b === 7 || b === 0) ? 'mo' : (b === 8) ? 'vo' : (b === 9) ? 'no' : 'to'; }, @@ -273,7 +273,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : spanish Spain * author : Hernan Garcia : https://github.com/hgarcia @@ -323,7 +323,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : Estonian * author : Illimar Tambek : https://github.com/ragulka @@ -371,7 +371,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : Finnish * author : Sami Saada : https://github.com/samitheberber @@ -460,7 +460,7 @@ this.numbro.language('fr-CA', language); } }()); -/*! +/*! * numbro.js language configuration * language : french (fr-ch) * author : Adam Draper : https://github.com/adamwdraper @@ -505,7 +505,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : french (fr) * author : Adam Draper : https://github.com/adamwdraper @@ -593,7 +593,7 @@ this.numbro.language('hu-HU', language); } }()); -/*! +/*! * numbro.js language configuration * language : italian Italy (it) * author : Giacomo Trombi : http://cinquepunti.it @@ -637,7 +637,7 @@ this.numbro.language('it-IT', language); } }()); -/*! +/*! * numbro.js language configuration * language : japanese * author : teppeis : https://github.com/teppeis @@ -726,7 +726,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : norwegian * author : Benjamin Van Ryseghem @@ -767,7 +767,7 @@ this.numbro.language('nb-NO', language); } }()); -/*! +/*! * numbro.js language configuration * language : belgium-dutch (be-nl) * author : Dieter Luypaert : https://github.com/moeriki @@ -812,7 +812,7 @@ this.numbro.language('nl-BE', language); } }()); -/*! +/*! * numbro.js language configuration * language : netherlands-dutch (nl-nl) * author : Dave Clayton : https://github.com/davedx @@ -857,7 +857,7 @@ this.numbro.language('nl-NL', language); } }()); -/*! +/*! * numbro.js language configuration * language : polish (pl) * author : Dominik Bulaj : https://github.com/dominikbulaj @@ -901,7 +901,7 @@ this.numbro.language('pl-PL', language); } }()); -/*! +/*! * numbro.js language configuration * language : portuguese brazil (pt-br) * author : Ramiro Varandas Jr : https://github.com/ramirovjr @@ -945,7 +945,7 @@ this.numbro.language('pt-BR', language); } }()); -/*! +/*! * numbro.js language configuration * language : portuguese (pt-pt) * author : Diogo Resende : https://github.com/dresende @@ -990,7 +990,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : russian (ru) * author : Anatoli Papirovski : https://github.com/apapirovski @@ -1008,10 +1008,10 @@ trillion: 't' }, ordinal: function () { - // not ideal, but since in Russian it can taken on + // not ideal, but since in Russian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return '.'; + return '.'; }, currency: { symbol: 'руб.', @@ -1054,10 +1054,10 @@ trillion: 't' }, ordinal: function () { - // not ideal, but since in Russian it can taken on + // not ideal, but since in Russian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return '.'; + return '.'; }, currency: { symbol: '\u20B4', @@ -1170,7 +1170,7 @@ this.numbro.language('sv-SE', language); } }()); -/*! +/*! * numbro.js language configuration * language : thai (th) * author : Sathit Jittanupat : https://github.com/jojosati @@ -1215,7 +1215,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : turkish (tr) * author : Ecmel Ercan : https://github.com/ecmel, Erhan Gundogan : https://github.com/erhangundogan, Burak Yiğit Kaya: https://github.com/BYK @@ -1309,10 +1309,10 @@ trillion: 'блн' }, ordinal: function () { - // not ideal, but since in Ukrainian it can taken on + // not ideal, but since in Ukrainian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return ''; + return ''; }, currency: { symbol: '\u20B4', @@ -1339,7 +1339,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : simplified chinese * author : badplum : https://github.com/badplum diff --git a/languages/da-DK.js b/languages/da-DK.js index 29dcd5be..c49f4bd0 100644 --- a/languages/da-DK.js +++ b/languages/da-DK.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : danish denmark (dk) * author : Michael Storgaard : https://github.com/mstorgaard diff --git a/languages/de-DE.js b/languages/de-DE.js index 86378ea3..eca5ffaf 100644 --- a/languages/de-DE.js +++ b/languages/de-DE.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : German (de) – generally useful in Germany, Austria, Luxembourg, Belgium * author : Marco Krage : https://github.com/sinky diff --git a/languages/de-ch.js b/languages/de-ch.js index 016f399e..6e1c3d7d 100644 --- a/languages/de-ch.js +++ b/languages/de-ch.js @@ -1,8 +1,8 @@ -/*! +/*! * numbro.js language configuration * language : German in Switzerland (de-ch) * author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky) - */ + */ (function () { var language = { delimiters: { diff --git a/languages/en-GB.js b/languages/en-GB.js index b00981c7..5401c3c7 100644 --- a/languages/en-GB.js +++ b/languages/en-GB.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : english united kingdom (uk) * author : Dan Ristic : https://github.com/dristic diff --git a/languages/es-AR.js b/languages/es-AR.js index 0e022e73..7e7525c8 100644 --- a/languages/es-AR.js +++ b/languages/es-AR.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : spanish * author : Hernan Garcia : https://github.com/hgarcia @@ -19,7 +19,7 @@ var b = number % 10; return (b === 1 || b === 3) ? 'er' : (b === 2) ? 'do' : - (b === 7 || b === 0) ? 'mo' : + (b === 7 || b === 0) ? 'mo' : (b === 8) ? 'vo' : (b === 9) ? 'no' : 'to'; }, diff --git a/languages/es-ES.js b/languages/es-ES.js index cbd33271..58b0b0be 100644 --- a/languages/es-ES.js +++ b/languages/es-ES.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : spanish Spain * author : Hernan Garcia : https://github.com/hgarcia diff --git a/languages/et-EE.js b/languages/et-EE.js index 82b38f57..8df069a0 100644 --- a/languages/et-EE.js +++ b/languages/et-EE.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : Estonian * author : Illimar Tambek : https://github.com/ragulka diff --git a/languages/fi-FI.js b/languages/fi-FI.js index 14c46638..704e6999 100644 --- a/languages/fi-FI.js +++ b/languages/fi-FI.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : Finnish * author : Sami Saada : https://github.com/samitheberber diff --git a/languages/fr-CH.js b/languages/fr-CH.js index 2d66dd2f..d2068797 100644 --- a/languages/fr-CH.js +++ b/languages/fr-CH.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : french (fr-ch) * author : Adam Draper : https://github.com/adamwdraper diff --git a/languages/fr-FR.js b/languages/fr-FR.js index 9c9f14e1..9b484633 100644 --- a/languages/fr-FR.js +++ b/languages/fr-FR.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : french (fr) * author : Adam Draper : https://github.com/adamwdraper diff --git a/languages/it-IT.js b/languages/it-IT.js index 7d4eaa25..c2158433 100644 --- a/languages/it-IT.js +++ b/languages/it-IT.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : italian Italy (it) * author : Giacomo Trombi : http://cinquepunti.it diff --git a/languages/ja-JP.js b/languages/ja-JP.js index ba6830c4..2f6aa462 100644 --- a/languages/ja-JP.js +++ b/languages/ja-JP.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : japanese * author : teppeis : https://github.com/teppeis diff --git a/languages/nb-NO.js b/languages/nb-NO.js index ae24bb46..a4a96a34 100644 --- a/languages/nb-NO.js +++ b/languages/nb-NO.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : norwegian * author : Benjamin Van Ryseghem diff --git a/languages/nl-BE.js b/languages/nl-BE.js index e4c9cc81..262bf4ee 100644 --- a/languages/nl-BE.js +++ b/languages/nl-BE.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : belgium-dutch (be-nl) * author : Dieter Luypaert : https://github.com/moeriki diff --git a/languages/nl-NL.js b/languages/nl-NL.js index 730595ff..feaf9e9f 100644 --- a/languages/nl-NL.js +++ b/languages/nl-NL.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : netherlands-dutch (nl-nl) * author : Dave Clayton : https://github.com/davedx diff --git a/languages/pl-PL.js b/languages/pl-PL.js index c20b0c79..875f1b6e 100644 --- a/languages/pl-PL.js +++ b/languages/pl-PL.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : polish (pl) * author : Dominik Bulaj : https://github.com/dominikbulaj diff --git a/languages/pt-BR.js b/languages/pt-BR.js index 062b3a36..4a639a2c 100644 --- a/languages/pt-BR.js +++ b/languages/pt-BR.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : portuguese brazil (pt-br) * author : Ramiro Varandas Jr : https://github.com/ramirovjr diff --git a/languages/pt-PT.js b/languages/pt-PT.js index 067c5ce4..fce0c10f 100644 --- a/languages/pt-PT.js +++ b/languages/pt-PT.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : portuguese (pt-pt) * author : Diogo Resende : https://github.com/dresende diff --git a/languages/ru-RU.js b/languages/ru-RU.js index a5be11e7..fb2dbeea 100644 --- a/languages/ru-RU.js +++ b/languages/ru-RU.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : russian (ru) * author : Anatoli Papirovski : https://github.com/apapirovski @@ -16,10 +16,10 @@ trillion: 't' }, ordinal: function () { - // not ideal, but since in Russian it can taken on + // not ideal, but since in Russian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return '.'; + return '.'; }, currency: { symbol: 'руб.', diff --git a/languages/ru-UA.js b/languages/ru-UA.js index 6fec19f3..89ec7666 100644 --- a/languages/ru-UA.js +++ b/languages/ru-UA.js @@ -14,10 +14,10 @@ trillion: 't' }, ordinal: function () { - // not ideal, but since in Russian it can taken on + // not ideal, but since in Russian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return '.'; + return '.'; }, currency: { symbol: '\u20B4', diff --git a/languages/th-TH.js b/languages/th-TH.js index 267f8a14..b5b3bf0b 100644 --- a/languages/th-TH.js +++ b/languages/th-TH.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : thai (th) * author : Sathit Jittanupat : https://github.com/jojosati diff --git a/languages/tr-TR.js b/languages/tr-TR.js index eb5fcd17..2bf39c04 100644 --- a/languages/tr-TR.js +++ b/languages/tr-TR.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : turkish (tr) * author : Ecmel Ercan : https://github.com/ecmel, Erhan Gundogan : https://github.com/erhangundogan, Burak Yiğit Kaya: https://github.com/BYK diff --git a/languages/uk-UA.js b/languages/uk-UA.js index 32206cfa..594c0e55 100644 --- a/languages/uk-UA.js +++ b/languages/uk-UA.js @@ -14,10 +14,10 @@ trillion: 'блн' }, ordinal: function () { - // not ideal, but since in Ukrainian it can taken on + // not ideal, but since in Ukrainian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return ''; + return ''; }, currency: { symbol: '\u20B4', diff --git a/languages/zh-CN.js b/languages/zh-CN.js index a6835f47..6b3e0058 100644 --- a/languages/zh-CN.js +++ b/languages/zh-CN.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : simplified chinese * author : badplum : https://github.com/badplum diff --git a/tests/numbro/misc.js b/tests/numbro/misc.js index 5e1a3d80..6372818c 100644 --- a/tests/numbro/misc.js +++ b/tests/numbro/misc.js @@ -89,35 +89,35 @@ exports.misc = { test.done(); }, - + languageData: function(test) { test.expect(10); - + var cOld = '$', cNew = '!', formatTestVal = function() { return numbro('100').format('$0,0') }, oldCurrencyVal = cOld + '100', newCurrencyVal = cNew + '100'; - + test.strictEqual(numbro.languageData().currency.symbol, cOld, 'Current language currency is ' + cOld); test.strictEqual(numbro.languageData('en-US').currency.symbol, cOld, 'English language currency is ' + cOld); - + numbro.languageData().currency.symbol = cNew; test.strictEqual(numbro.languageData().currency.symbol, cNew, 'Current language currency is changed to ' + cNew); test.strictEqual(formatTestVal(), newCurrencyVal, 'Format uses new currency'); - + numbro.languageData().currency.symbol = cOld; test.strictEqual(numbro.languageData().currency.symbol, '$', 'Current language currency is reset to ' + cOld); test.strictEqual(formatTestVal(), oldCurrencyVal, 'Format uses old currency'); - + numbro.languageData('en-US').currency.symbol = cNew; test.strictEqual(numbro.languageData().currency.symbol, cNew, 'English language currency is changed to ' + cNew); test.strictEqual(formatTestVal(), newCurrencyVal, 'Format uses new currency'); - + numbro.languageData('en-US').currency.symbol = cOld; test.strictEqual(numbro.languageData().currency.symbol, cOld, 'English language currency is reset to ' + cOld); test.strictEqual(formatTestVal(), oldCurrencyVal, 'Format uses old currency'); - + test.done(); } }; \ No newline at end of file diff --git a/tests/numbro/validate.js b/tests/numbro/validate.js index dc4e8dd8..95bb7687 100644 --- a/tests/numbro/validate.js +++ b/tests/numbro/validate.js @@ -21,7 +21,7 @@ exports.validate = { ['1.000,123', false], ['1000.', false], ['1000,', false], - ['10..00', false], + ['10..00', false], ['10,,00', false], ['10, 00', false] ]; From c27699968edeafa5d26cb3679c25702a3b45438a Mon Sep 17 00:00:00 2001 From: Phil Ostler Date: Tue, 19 Aug 2014 21:53:45 +0100 Subject: [PATCH 06/47] Changes Danish currency symbol to 'kr' * 'DKK' is currency code and not the symbol * See http://www.xe.com/symbols.php --- languages/da-DK.js | 4 ++-- tests/languages/da-dk.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/languages/da-DK.js b/languages/da-DK.js index c49f4bd0..2365c941 100644 --- a/languages/da-DK.js +++ b/languages/da-DK.js @@ -19,7 +19,7 @@ return '.'; }, currency: { - symbol: 'DKK', + symbol: 'kr', position: 'postfix' }, defaults: { @@ -41,4 +41,4 @@ if (typeof window !== 'undefined' && this.numbro && this.numbro.language) { this.numbro.language('da-DK', language); } -}()); \ No newline at end of file +}()); diff --git a/tests/languages/da-dk.js b/tests/languages/da-dk.js index f4c9fc55..ec2385c4 100644 --- a/tests/languages/da-dk.js +++ b/tests/languages/da-dk.js @@ -47,10 +47,10 @@ exports['language:da-dk'] = { test.expect(4); var tests = [ - [1000.234,'$0,0.00','DKK1.000,23'], - [-1000.234,'($0,0)','(DKK1.000)'], - [-1000.234,'$0.00','-DKK1000,23'], - [1230974,'($0.00a)','DKK1,23mio'] + [1000.234,'$0,0.00','kr1.000,23'], + [-1000.234,'($0,0)','(kr1.000)'], + [-1000.234,'$0.00','-kr1000,23'], + [1230974,'($0.00a)','kr1,23mio'] ]; for (var i = 0; i < tests.length; i++) { @@ -83,11 +83,11 @@ exports['language:da-dk'] = { var tests = [ ['10.000,123',10000.123], ['(0,12345)',-0.12345], - ['(DKK1,23mio)',-1230000], + ['(kr1,23mio)',-1230000], ['10k',10000], ['-10k',-10000], ['23.',23], - ['DK10.000,00',10000], + ['kr10.000,00',10000], ['-76%',-0.76], ['2:23:57',8637] ]; From 5978e2bee1c6698b6377e6e8426194f0bc472a3a Mon Sep 17 00:00:00 2001 From: Ahmad Date: Fri, 9 Jan 2015 21:13:09 +0330 Subject: [PATCH 07/47] Add farsi language support --- languages/fa-ir.js | 34 +++++++++++++ tests/languages/fa-ir.js | 101 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 languages/fa-ir.js create mode 100644 tests/languages/fa-ir.js diff --git a/languages/fa-ir.js b/languages/fa-ir.js new file mode 100644 index 00000000..0a398908 --- /dev/null +++ b/languages/fa-ir.js @@ -0,0 +1,34 @@ +/*! + * numeral.js language configuration + * language : Farsi Iran + * author : neo13 : https://github.com/neo13 + */ +(function () { + var language = { + delimiters: { + thousands: '،', + decimal: '.' + }, + abbreviations: { + thousand: 'هزار', + million: 'میلیون', + billion: 'میلیارد', + trillion: 'تریلیون' + }, + ordinal: function (number) { + return 'ام'; + }, + currency: { + symbol: '﷼' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('en-gb', language); + } +}()); diff --git a/tests/languages/fa-ir.js b/tests/languages/fa-ir.js new file mode 100644 index 00000000..b459d961 --- /dev/null +++ b/tests/languages/fa-ir.js @@ -0,0 +1,101 @@ +var numeral = require('../../numeral'), + language = require('../../languages/fa-ir'); + +numeral.language('fa-ir', language); + +exports['language:fa-ir'] = { + setUp: function (callback) { + numeral.language('fa-ir'); + callback(); + }, + + tearDown: function (callback) { + numeral.language('en'); + callback(); + }, + + format: function (test) { + test.expect(16); + + var tests = [ + [10000,'0,0.0000','10،000.0000'], + [10000.23,'0,0','10،000'], + [-10000,'0,0.0','-10،000.0'], + [10000.1234,'0.000','10000.123'], + [-10000,'(0,0.0000)','(10،000.0000)'], + [-0.23,'.00','-.23'], + [-0.23,'(.00)','(.23)'], + [0.23,'0.00000','0.23000'], + [1230974,'0.0a','1.2میلیون'], + [1460,'0a','1هزار'], + [-104000,'0a','-104هزار'], + [1,'0o','1ام'], + [52,'0o','52ام'], + [23,'0o','23ام'], + [100,'0o','100ام'], + [1,'0[.]0','1'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + currency: function (test) { + test.expect(4); + + var tests = [ + [1000.234,'$0,0.00','﷼1،000.23'], + [-1000.234,'($0,0)','(﷼1،000)'], + [-1000.234,'$0.00','-﷼1000.23'], + [1230974,'($0.00a)','﷼1.23میلیون'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + percentages: function (test) { + test.expect(4); + + var tests = [ + [1,'0%','100%'], + [0.974878234,'0.000%','97.488%'], + [-0.43,'0%','-43%'], + [0.43,'(0.000%)','43.000%'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + unformat: function (test) { + test.expect(9); + + var tests = [ + ['10,000.123',10000.123], + ['(0.12345)',-0.12345], + ['(£1.23میلیون)',-1230000], + ['10هزار',10000], + ['-10هزار',-10000], + ['23ام',23], + ['£10,000.00',10000], + ['-76%',-0.76], + ['2:23:57',8637] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral().unformat(tests[i][0]), tests[i][1], tests[i][0]); + } + + test.done(); + } +}; From e875868cfe3dcd985c7d5a65b60f504dcb8df58c Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 23:07:57 -0400 Subject: [PATCH 08/47] Rename with proper capital locale --- languages/{fa-ir.js => fa-IR.js} | 0 tests/languages/{fa-ir.js => fa-IR.js} | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) rename languages/{fa-ir.js => fa-IR.js} (100%) rename tests/languages/{fa-ir.js => fa-IR.js} (94%) diff --git a/languages/fa-ir.js b/languages/fa-IR.js similarity index 100% rename from languages/fa-ir.js rename to languages/fa-IR.js diff --git a/tests/languages/fa-ir.js b/tests/languages/fa-IR.js similarity index 94% rename from tests/languages/fa-ir.js rename to tests/languages/fa-IR.js index b459d961..e028f907 100644 --- a/tests/languages/fa-ir.js +++ b/tests/languages/fa-IR.js @@ -1,11 +1,11 @@ var numeral = require('../../numeral'), - language = require('../../languages/fa-ir'); + language = require('../../languages/fa-IR'); -numeral.language('fa-ir', language); +numeral.language('fa-IR', language); -exports['language:fa-ir'] = { +exports['language:fa-IR'] = { setUp: function (callback) { - numeral.language('fa-ir'); + numeral.language('fa-IR'); callback(); }, From a7501aaace5ae6085fe2697f6399c73ec336f075 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 23:10:37 -0400 Subject: [PATCH 09/47] Register for proper lang-locale code --- languages/fa-IR.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/fa-IR.js b/languages/fa-IR.js index 0a398908..d37d72b0 100644 --- a/languages/fa-IR.js +++ b/languages/fa-IR.js @@ -29,6 +29,6 @@ } // Browser if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { - this.numeral.language('en-gb', language); + this.numeral.language('fa-IR', language); } }()); From 936bd8f1fabc74ed0a23f2eb9d25e9f004916717 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 23:11:29 -0400 Subject: [PATCH 10/47] Rename numeral to numbro Also update en language code to en-US in test --- languages/fa-IR.js | 6 +++--- tests/languages/fa-IR.js | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/languages/fa-IR.js b/languages/fa-IR.js index d37d72b0..5fef3768 100644 --- a/languages/fa-IR.js +++ b/languages/fa-IR.js @@ -1,5 +1,5 @@ /*! - * numeral.js language configuration + * numbro.js language configuration * language : Farsi Iran * author : neo13 : https://github.com/neo13 */ @@ -28,7 +28,7 @@ module.exports = language; } // Browser - if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { - this.numeral.language('fa-IR', language); + if (typeof window !== 'undefined' && this.numbro && this.numbro.language) { + this.numbro.language('fa-IR', language); } }()); diff --git a/tests/languages/fa-IR.js b/tests/languages/fa-IR.js index e028f907..07fc5fdc 100644 --- a/tests/languages/fa-IR.js +++ b/tests/languages/fa-IR.js @@ -1,16 +1,16 @@ -var numeral = require('../../numeral'), +var numbro = require('../../numbro'), language = require('../../languages/fa-IR'); -numeral.language('fa-IR', language); +numbro.language('fa-IR', language); exports['language:fa-IR'] = { setUp: function (callback) { - numeral.language('fa-IR'); + numbro.language('fa-IR'); callback(); }, tearDown: function (callback) { - numeral.language('en'); + numbro.language('en-US'); callback(); }, @@ -37,7 +37,7 @@ exports['language:fa-IR'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -54,7 +54,7 @@ exports['language:fa-IR'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -71,7 +71,7 @@ exports['language:fa-IR'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -93,7 +93,7 @@ exports['language:fa-IR'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral().unformat(tests[i][0]), tests[i][1], tests[i][0]); + test.strictEqual(numbro().unformat(tests[i][0]), tests[i][1], tests[i][0]); } test.done(); From d1e07a69f9aa63c6eed2a90c8b387e66b5454135 Mon Sep 17 00:00:00 2001 From: mjmaix Date: Mon, 14 Jul 2014 22:32:52 +0800 Subject: [PATCH 11/47] Added support for fil-ph Philippine peso This is different from Tagalog-Philippine peso (tl-ph). --- languages/fil-ph.js | 38 ++++++++++++++ tests/languages/fil-ph.js | 101 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 languages/fil-ph.js create mode 100644 tests/languages/fil-ph.js diff --git a/languages/fil-ph.js b/languages/fil-ph.js new file mode 100644 index 00000000..95369f65 --- /dev/null +++ b/languages/fil-ph.js @@ -0,0 +1,38 @@ +/*! + * numeral.js language configuration + * language : filipino philippines (ph) + * author : Michael Abadilla : https://github.com/mjmaix + */ +(function () { + var language = { + 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' && this.numeral && this.numeral.language) { + this.numeral.language('fil-ph', language); + } +}()); diff --git a/tests/languages/fil-ph.js b/tests/languages/fil-ph.js new file mode 100644 index 00000000..715015ea --- /dev/null +++ b/tests/languages/fil-ph.js @@ -0,0 +1,101 @@ +var numeral = require('../../numeral'), + language = require('../../languages/fil-ph'); + +numeral.language('fil-ph', language); + +exports['language:fil-ph'] = { + setUp: function (callback) { + numeral.language('fil-ph'); + callback(); + }, + + tearDown: function (callback) { + numeral.language('en'); + callback(); + }, + + format: function (test) { + test.expect(16); + + var tests = [ + [10000,'0,0.0000','10,000.0000'], + [10000.23,'0,0','10,000'], + [-10000,'0,0.0','-10,000.0'], + [10000.1234,'0.000','10000.123'], + [-10000,'(0,0.0000)','(10,000.0000)'], + [-0.23,'.00','-.23'], + [-0.23,'(.00)','(.23)'], + [0.23,'0.00000','0.23000'], + [1230974,'0.0a','1.2m'], + [1460,'0a','1k'], + [-104000,'0a','-104k'], + [1,'0o','1st'], + [52,'0o','52nd'], + [23,'0o','23rd'], + [100,'0o','100th'], + [1,'0[.]0','1'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + currency: function (test) { + test.expect(4); + + var tests = [ + [1000.234,'$0,0.00','₱1,000.23'], + [-1000.234,'($0,0)','(₱1,000)'], + [-1000.234,'$0.00','-₱1000.23'], + [1230974,'($0.00a)','₱1.23m'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + percentages: function (test) { + test.expect(4); + + var tests = [ + [1,'0%','100%'], + [0.974878234,'0.000%','97.488%'], + [-0.43,'0%','-43%'], + [0.43,'(0.000%)','43.000%'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + unformat: function (test) { + test.expect(9); + + var tests = [ + ['10,000.123',10000.123], + ['(0.12345)',-0.12345], + ['(₱1.23m)',-1230000], + ['10k',10000], + ['-10k',-10000], + ['23rd',23], + ['₱10,000.00',10000], + ['-76%',-0.76], + ['2:23:57',8637] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral().unformat(tests[i][0]), tests[i][1], tests[i][0]); + } + + test.done(); + } +}; From d8776970f2b892dc87ddf18efb8da8db04ab5feb Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 23:18:45 -0400 Subject: [PATCH 12/47] Rename with proper locale capitalization --- languages/{fil-ph.js => fil-PH.js} | 2 +- tests/languages/{fil-ph.js => fil-PH.js} | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) rename languages/{fil-ph.js => fil-PH.js} (94%) rename tests/languages/{fil-ph.js => fil-PH.js} (94%) diff --git a/languages/fil-ph.js b/languages/fil-PH.js similarity index 94% rename from languages/fil-ph.js rename to languages/fil-PH.js index 95369f65..932fe4cc 100644 --- a/languages/fil-ph.js +++ b/languages/fil-PH.js @@ -33,6 +33,6 @@ } // Browser if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { - this.numeral.language('fil-ph', language); + this.numeral.language('fil-PH', language); } }()); diff --git a/tests/languages/fil-ph.js b/tests/languages/fil-PH.js similarity index 94% rename from tests/languages/fil-ph.js rename to tests/languages/fil-PH.js index 715015ea..896715d5 100644 --- a/tests/languages/fil-ph.js +++ b/tests/languages/fil-PH.js @@ -1,11 +1,11 @@ var numeral = require('../../numeral'), - language = require('../../languages/fil-ph'); + language = require('../../languages/fil-PH'); -numeral.language('fil-ph', language); +numeral.language('fil-PH', language); -exports['language:fil-ph'] = { +exports['language:fil-PH'] = { setUp: function (callback) { - numeral.language('fil-ph'); + numeral.language('fil-PH'); callback(); }, From 1d2f53483aaf27492377d16aac196c19ffcb03fc Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 23:23:30 -0400 Subject: [PATCH 13/47] Rename numeral to numbro Also update en language code to en-US in test --- languages/fil-PH.js | 6 +++--- tests/languages/fil-PH.js | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/languages/fil-PH.js b/languages/fil-PH.js index 932fe4cc..6471ac62 100644 --- a/languages/fil-PH.js +++ b/languages/fil-PH.js @@ -1,5 +1,5 @@ /*! - * numeral.js language configuration + * numbro.js language configuration * language : filipino philippines (ph) * author : Michael Abadilla : https://github.com/mjmaix */ @@ -32,7 +32,7 @@ module.exports = language; } // Browser - if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { - this.numeral.language('fil-PH', language); + if (typeof window !== 'undefined' && this.numbro && this.numbro.language) { + this.numbro.language('fil-PH', language); } }()); diff --git a/tests/languages/fil-PH.js b/tests/languages/fil-PH.js index 896715d5..063282b2 100644 --- a/tests/languages/fil-PH.js +++ b/tests/languages/fil-PH.js @@ -1,16 +1,16 @@ -var numeral = require('../../numeral'), +var numbro = require('../../numbro'), language = require('../../languages/fil-PH'); -numeral.language('fil-PH', language); +numbro.language('fil-PH', language); exports['language:fil-PH'] = { setUp: function (callback) { - numeral.language('fil-PH'); + numbro.language('fil-PH'); callback(); }, tearDown: function (callback) { - numeral.language('en'); + numbro.language('en-US'); callback(); }, @@ -37,7 +37,7 @@ exports['language:fil-PH'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -54,7 +54,7 @@ exports['language:fil-PH'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -71,7 +71,7 @@ exports['language:fil-PH'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -93,7 +93,7 @@ exports['language:fil-PH'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral().unformat(tests[i][0]), tests[i][1], tests[i][0]); + test.strictEqual(numbro().unformat(tests[i][0]), tests[i][1], tests[i][0]); } test.done(); From 12e7b24558bdc2ef29c930c951284d538cb3845b Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Thu, 16 Apr 2015 19:09:49 -0400 Subject: [PATCH 14/47] Make markdown files more readable when viewing as plain text Shorten several line to be within length 100. Some lines it made sense to leave because they contain long links and cannot be broken up nicely. --- CHANGELOG-Numeraljs.md | 4 +++- CHANGELOG.md | 3 ++- README.md | 9 ++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG-Numeraljs.md b/CHANGELOG-Numeraljs.md index 475091ba..c2c47725 100644 --- a/CHANGELOG-Numeraljs.md +++ b/CHANGELOG-Numeraljs.md @@ -1,4 +1,6 @@ -_This is the historical changelog for the [`numeral-js` project](https://github.com/adamwdraper/Numeral-js), which `numbro` is built upon. The `numbro` changelog is at [CHANGELOG.md](CHANGELOG.md)._ +_This is the historical changelog for the [`numeral-js` +project](https://github.com/adamwdraper/Numeral-js), which `numbro` is built upon. The `numbro` +changelog is at [CHANGELOG.md](CHANGELOG.md)._ ### 1.5.3 diff --git a/CHANGELOG.md b/CHANGELOG.md index bb6c1c2a..95595881 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,4 +4,5 @@ Fork `numeraljs` v1.5.3, renaming everything to `numbro` ---- -_For changes before `numbro` forked [`numeral-js`](https://github.com/adamwdraper/Numeral-js), see [CHANGELOG-Numeraljs.md](CHANGELOG-Numeraljs.md)._ +_For changes before `numbro` forked [`numeral-js`](https://github.com/adamwdraper/Numeral-js), see +[CHANGELOG-Numeraljs.md](CHANGELOG-Numeraljs.md)._ diff --git a/README.md b/README.md index c2243d6d..eb368e16 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,10 @@ Please submit all pull requests to the `develop` branch. 7. Submit a pull request to the `develop` branch. -### Languages +### Languages -Languages names follows the Microsoft culture name convention as found [here](https://msdn.microsoft.com/en-us/library/ee825488.aspx). +Languages names follows the Microsoft culture name convention as found +[here](https://msdn.microsoft.com/en-us/library/ee825488.aspx). ### Language translations will not be merged without unit tests. @@ -50,7 +51,9 @@ See [CHANGELOG.md](CHANGELOG.md). # Acknowlegements -`numbro` is forked from [Adam Draper](https://github.com/adamwdraper)'s project [Numeral.js](http://numeraljs.com/), which was in turn inspired by and heavily borrowed from [Moment.js](http://momentjs.com). +`numbro` is forked from [Adam Draper](https://github.com/adamwdraper)'s project +[Numeral.js](http://numeraljs.com/), which was in turn inspired by and heavily borrowed from +[Moment.js](http://momentjs.com). # License From a00199db585743691ef79ef7862f4938726a94eb Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Thu, 16 Apr 2015 19:30:05 -0400 Subject: [PATCH 15/47] Update readme to reflect discussion in #12 and #16 --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index eb368e16..405b3d44 100644 --- a/README.md +++ b/README.md @@ -27,17 +27,19 @@ Please submit all pull requests to the `develop` branch. 4. Add your tests to the files in `/tests` -5. To test your tests, run `grunt` +5. To test your tests, run `grunt test` -6. When all your tests are passing, run `grunt build` to minify all files - -7. Submit a pull request to the `develop` branch. +6. When all your tests are passing, submit a pull request to the `develop` branch. ### Languages Languages names follows the Microsoft culture name convention as found -[here](https://msdn.microsoft.com/en-us/library/ee825488.aspx). +[here](https://msdn.microsoft.com/en-us/library/ee825488.aspx). If Microsoft does not have a code +for the country/locale combination, use the format `lang-locale` where the language code is a 2 +letter abbreviation from the list of [ISO 639-1 language +codes](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) and the `localecode` is from the list +of [ISO 3166-1 country codes](http://en.wikipedia.org/wiki/ISO_3166-1) ### Language translations will not be merged without unit tests. From 83ce7ff68dc9fffbd0d9283d7a8338bb46305032 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Thu, 16 Apr 2015 19:35:36 -0400 Subject: [PATCH 16/47] Move current built files to dist directory --- languages.js => dist/languages.js | 0 {min => dist/min}/languages.min.js | 0 {min => dist/min}/languages/cs-CZ.min.js | 0 {min => dist/min}/languages/da-DK.min.js | 0 {min => dist/min}/languages/de-DE.min.js | 0 {min => dist/min}/languages/de-ch.min.js | 0 {min => dist/min}/languages/en-GB.min.js | 0 {min => dist/min}/languages/es-AR.min.js | 0 {min => dist/min}/languages/es-ES.min.js | 0 {min => dist/min}/languages/et-EE.min.js | 0 {min => dist/min}/languages/fi-FI.min.js | 0 {min => dist/min}/languages/fr-CA.min.js | 0 {min => dist/min}/languages/fr-CH.min.js | 0 {min => dist/min}/languages/fr-FR.min.js | 0 {min => dist/min}/languages/hu-HU.min.js | 0 {min => dist/min}/languages/it-IT.min.js | 0 {min => dist/min}/languages/ja-JP.min.js | 0 {min => dist/min}/languages/lv-LV.min.js | 0 {min => dist/min}/languages/nb-NO.min.js | 0 {min => dist/min}/languages/nl-BE.min.js | 0 {min => dist/min}/languages/nl-NL.min.js | 0 {min => dist/min}/languages/pl-PL.min.js | 0 {min => dist/min}/languages/pt-BR.min.js | 0 {min => dist/min}/languages/pt-PT.min.js | 0 {min => dist/min}/languages/ru-RU.min.js | 0 {min => dist/min}/languages/ru-UA.min.js | 0 {min => dist/min}/languages/sk-SK.min.js | 0 {min => dist/min}/languages/sv-SE.min.js | 0 {min => dist/min}/languages/th-TH.min.js | 0 {min => dist/min}/languages/tr-TR.min.js | 0 {min => dist/min}/languages/uk-UA.min.js | 0 {min => dist/min}/languages/zh-CN.min.js | 0 {min => dist/min}/numbro.min.js | 0 {min => dist/min}/numeral.min.js | 0 34 files changed, 0 insertions(+), 0 deletions(-) rename languages.js => dist/languages.js (100%) rename {min => dist/min}/languages.min.js (100%) rename {min => dist/min}/languages/cs-CZ.min.js (100%) rename {min => dist/min}/languages/da-DK.min.js (100%) rename {min => dist/min}/languages/de-DE.min.js (100%) rename {min => dist/min}/languages/de-ch.min.js (100%) rename {min => dist/min}/languages/en-GB.min.js (100%) rename {min => dist/min}/languages/es-AR.min.js (100%) rename {min => dist/min}/languages/es-ES.min.js (100%) rename {min => dist/min}/languages/et-EE.min.js (100%) rename {min => dist/min}/languages/fi-FI.min.js (100%) rename {min => dist/min}/languages/fr-CA.min.js (100%) rename {min => dist/min}/languages/fr-CH.min.js (100%) rename {min => dist/min}/languages/fr-FR.min.js (100%) rename {min => dist/min}/languages/hu-HU.min.js (100%) rename {min => dist/min}/languages/it-IT.min.js (100%) rename {min => dist/min}/languages/ja-JP.min.js (100%) rename {min => dist/min}/languages/lv-LV.min.js (100%) rename {min => dist/min}/languages/nb-NO.min.js (100%) rename {min => dist/min}/languages/nl-BE.min.js (100%) rename {min => dist/min}/languages/nl-NL.min.js (100%) rename {min => dist/min}/languages/pl-PL.min.js (100%) rename {min => dist/min}/languages/pt-BR.min.js (100%) rename {min => dist/min}/languages/pt-PT.min.js (100%) rename {min => dist/min}/languages/ru-RU.min.js (100%) rename {min => dist/min}/languages/ru-UA.min.js (100%) rename {min => dist/min}/languages/sk-SK.min.js (100%) rename {min => dist/min}/languages/sv-SE.min.js (100%) rename {min => dist/min}/languages/th-TH.min.js (100%) rename {min => dist/min}/languages/tr-TR.min.js (100%) rename {min => dist/min}/languages/uk-UA.min.js (100%) rename {min => dist/min}/languages/zh-CN.min.js (100%) rename {min => dist/min}/numbro.min.js (100%) rename {min => dist/min}/numeral.min.js (100%) diff --git a/languages.js b/dist/languages.js similarity index 100% rename from languages.js rename to dist/languages.js diff --git a/min/languages.min.js b/dist/min/languages.min.js similarity index 100% rename from min/languages.min.js rename to dist/min/languages.min.js diff --git a/min/languages/cs-CZ.min.js b/dist/min/languages/cs-CZ.min.js similarity index 100% rename from min/languages/cs-CZ.min.js rename to dist/min/languages/cs-CZ.min.js diff --git a/min/languages/da-DK.min.js b/dist/min/languages/da-DK.min.js similarity index 100% rename from min/languages/da-DK.min.js rename to dist/min/languages/da-DK.min.js diff --git a/min/languages/de-DE.min.js b/dist/min/languages/de-DE.min.js similarity index 100% rename from min/languages/de-DE.min.js rename to dist/min/languages/de-DE.min.js diff --git a/min/languages/de-ch.min.js b/dist/min/languages/de-ch.min.js similarity index 100% rename from min/languages/de-ch.min.js rename to dist/min/languages/de-ch.min.js diff --git a/min/languages/en-GB.min.js b/dist/min/languages/en-GB.min.js similarity index 100% rename from min/languages/en-GB.min.js rename to dist/min/languages/en-GB.min.js diff --git a/min/languages/es-AR.min.js b/dist/min/languages/es-AR.min.js similarity index 100% rename from min/languages/es-AR.min.js rename to dist/min/languages/es-AR.min.js diff --git a/min/languages/es-ES.min.js b/dist/min/languages/es-ES.min.js similarity index 100% rename from min/languages/es-ES.min.js rename to dist/min/languages/es-ES.min.js diff --git a/min/languages/et-EE.min.js b/dist/min/languages/et-EE.min.js similarity index 100% rename from min/languages/et-EE.min.js rename to dist/min/languages/et-EE.min.js diff --git a/min/languages/fi-FI.min.js b/dist/min/languages/fi-FI.min.js similarity index 100% rename from min/languages/fi-FI.min.js rename to dist/min/languages/fi-FI.min.js diff --git a/min/languages/fr-CA.min.js b/dist/min/languages/fr-CA.min.js similarity index 100% rename from min/languages/fr-CA.min.js rename to dist/min/languages/fr-CA.min.js diff --git a/min/languages/fr-CH.min.js b/dist/min/languages/fr-CH.min.js similarity index 100% rename from min/languages/fr-CH.min.js rename to dist/min/languages/fr-CH.min.js diff --git a/min/languages/fr-FR.min.js b/dist/min/languages/fr-FR.min.js similarity index 100% rename from min/languages/fr-FR.min.js rename to dist/min/languages/fr-FR.min.js diff --git a/min/languages/hu-HU.min.js b/dist/min/languages/hu-HU.min.js similarity index 100% rename from min/languages/hu-HU.min.js rename to dist/min/languages/hu-HU.min.js diff --git a/min/languages/it-IT.min.js b/dist/min/languages/it-IT.min.js similarity index 100% rename from min/languages/it-IT.min.js rename to dist/min/languages/it-IT.min.js diff --git a/min/languages/ja-JP.min.js b/dist/min/languages/ja-JP.min.js similarity index 100% rename from min/languages/ja-JP.min.js rename to dist/min/languages/ja-JP.min.js diff --git a/min/languages/lv-LV.min.js b/dist/min/languages/lv-LV.min.js similarity index 100% rename from min/languages/lv-LV.min.js rename to dist/min/languages/lv-LV.min.js diff --git a/min/languages/nb-NO.min.js b/dist/min/languages/nb-NO.min.js similarity index 100% rename from min/languages/nb-NO.min.js rename to dist/min/languages/nb-NO.min.js diff --git a/min/languages/nl-BE.min.js b/dist/min/languages/nl-BE.min.js similarity index 100% rename from min/languages/nl-BE.min.js rename to dist/min/languages/nl-BE.min.js diff --git a/min/languages/nl-NL.min.js b/dist/min/languages/nl-NL.min.js similarity index 100% rename from min/languages/nl-NL.min.js rename to dist/min/languages/nl-NL.min.js diff --git a/min/languages/pl-PL.min.js b/dist/min/languages/pl-PL.min.js similarity index 100% rename from min/languages/pl-PL.min.js rename to dist/min/languages/pl-PL.min.js diff --git a/min/languages/pt-BR.min.js b/dist/min/languages/pt-BR.min.js similarity index 100% rename from min/languages/pt-BR.min.js rename to dist/min/languages/pt-BR.min.js diff --git a/min/languages/pt-PT.min.js b/dist/min/languages/pt-PT.min.js similarity index 100% rename from min/languages/pt-PT.min.js rename to dist/min/languages/pt-PT.min.js diff --git a/min/languages/ru-RU.min.js b/dist/min/languages/ru-RU.min.js similarity index 100% rename from min/languages/ru-RU.min.js rename to dist/min/languages/ru-RU.min.js diff --git a/min/languages/ru-UA.min.js b/dist/min/languages/ru-UA.min.js similarity index 100% rename from min/languages/ru-UA.min.js rename to dist/min/languages/ru-UA.min.js diff --git a/min/languages/sk-SK.min.js b/dist/min/languages/sk-SK.min.js similarity index 100% rename from min/languages/sk-SK.min.js rename to dist/min/languages/sk-SK.min.js diff --git a/min/languages/sv-SE.min.js b/dist/min/languages/sv-SE.min.js similarity index 100% rename from min/languages/sv-SE.min.js rename to dist/min/languages/sv-SE.min.js diff --git a/min/languages/th-TH.min.js b/dist/min/languages/th-TH.min.js similarity index 100% rename from min/languages/th-TH.min.js rename to dist/min/languages/th-TH.min.js diff --git a/min/languages/tr-TR.min.js b/dist/min/languages/tr-TR.min.js similarity index 100% rename from min/languages/tr-TR.min.js rename to dist/min/languages/tr-TR.min.js diff --git a/min/languages/uk-UA.min.js b/dist/min/languages/uk-UA.min.js similarity index 100% rename from min/languages/uk-UA.min.js rename to dist/min/languages/uk-UA.min.js diff --git a/min/languages/zh-CN.min.js b/dist/min/languages/zh-CN.min.js similarity index 100% rename from min/languages/zh-CN.min.js rename to dist/min/languages/zh-CN.min.js diff --git a/min/numbro.min.js b/dist/min/numbro.min.js similarity index 100% rename from min/numbro.min.js rename to dist/min/numbro.min.js diff --git a/min/numeral.min.js b/dist/min/numeral.min.js similarity index 100% rename from min/numeral.min.js rename to dist/min/numeral.min.js From 94e6f1f89a55335f6106f018c7f54ae659f3644d Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Thu, 16 Apr 2015 19:58:34 -0400 Subject: [PATCH 17/47] Update build to output to dist directory Also, reordered the config to improve readability. --- Gruntfile.js | 56 +++++++++++++++++++++------------------------------- package.json | 2 +- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ec308401..50e71483 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,44 +1,36 @@ var fs = require('fs'); +var path = require('path'); module.exports = function(grunt) { - var minifiedFiles = { - 'min/numbro.min.js' : [ - 'numbro.js' - ], - 'min/languages.min.js': [ - 'languages.js' - ] - }; - - // all the lang files need to be added manually - fs.readdirSync('./languages').forEach(function (path) { - var file = path.slice(0, -3), - destination = 'min/languages/' + file + '.min.js', - src = ['languages/' + path]; - - minifiedFiles[destination] = src; - }); - grunt.initConfig({ - nodeunit : { - all : ['tests/**/*.js'] + concat: { + languages: { + src: [ + 'languages/**/*.js', + ], + dest: 'dist/languages.js', + }, }, uglify: { my_target: { - files: minifiedFiles + files: [ + { src: [ 'dist/languages.js' ], dest: 'dist/min/languages.min.js', }, + { src: [ 'numbro.js' ], dest: 'dist/min/numbro.min.js', }, + ].concat( fs.readdirSync('./languages').map(function (fileName) { + var lang = path.basename(fileName, '.js'); + return { + src: [path.join('languages/', fileName)], + dest: path.join('dist/min/languages/', lang + '.min.js'), + }; + })) }, options: { - preserveComments: 'some' - } + preserveComments: 'some', + }, }, - concat: { - languages: { - src: [ - 'languages/**/*.js' - ], - dest: 'languages.js' - } + nodeunit: { + all: ['tests/**/*.js'], }, jshint: { all: [ @@ -78,10 +70,8 @@ module.exports = function(grunt) { 'nodeunit' ]); - // P grunt.registerTask('build', [ - 'jshint', - 'nodeunit', + 'test', 'concat', 'uglify' ]); diff --git a/package.json b/package.json index 38c532b7..be7823e9 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "grunt-contrib-concat": "latest" }, "scripts": { - "test": "grunt" + "test": "grunt test" }, "ender": "./ender.js", "_id": "numbro@1.0.4", From e93965858b833626f7b3994b6b20b54c0873d217 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Fri, 17 Apr 2015 00:23:08 -0400 Subject: [PATCH 18/47] Automate tag release to github, npm, bower... Using grunt-confirm to help avoid accidental releases --- Gruntfile.js | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++- package.json | 14 ++++++------- 2 files changed, 64 insertions(+), 8 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 50e71483..2304f251 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,6 +4,8 @@ var path = require('path'); module.exports = function(grunt) { grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + concat: { languages: { src: [ @@ -29,6 +31,40 @@ module.exports = function(grunt) { preserveComments: 'some', }, }, + bump: { + options: { + files: [ + 'package.json', + 'bower.json', + 'component.json', + ], + updateConfigs: ['pkg'], + commit: false, + createTag: false, + push: false, + }, + }, + confirm: { + release: { + options: { + question: 'Are you sure you want to publish a new release' + + ' with version <%= pkg.version %>? (yes/no)', + continue: function(answer) { + return answer.toLowerCase() === 'yes'; + } + } + } + }, + release:{ + options: { + bump: false, + additionalFiles: [ + 'bower.json', + 'component.json', + ], + tagName: 'v<%= version %>', + }, + }, nodeunit: { all: ['tests/**/*.js'], }, @@ -60,6 +96,10 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-bump'); + grunt.loadNpmTasks('grunt-confirm'); + grunt.loadNpmTasks('grunt-release'); + grunt.registerTask('default', [ 'test' @@ -76,6 +116,22 @@ module.exports = function(grunt) { 'uglify' ]); + // wrap grunt-release with confirmation + [ + 'patch', + 'minor', + 'major', + 'prerelease' + ].forEach(function (detail) { + grunt.registerTask('publish:'+detail, [ + 'bump:'+detail, + 'confirm:release', + 'release', + ]); + }); + grunt.registerTask('publish', ['publish:patch']); + + // Travis CI task. grunt.registerTask('travis', ['test']); -}; \ No newline at end of file +}; diff --git a/package.json b/package.json index be7823e9..b546c133 100644 --- a/package.json +++ b/package.json @@ -34,17 +34,17 @@ } ], "devDependencies": { - "uglify-js": "latest", "grunt": "latest", - "grunt-contrib-uglify": "latest", + "grunt-bump": "latest", + "grunt-confirm": "latest", + "grunt-contrib-concat": "latest", "grunt-contrib-jshint": "latest", "grunt-contrib-nodeunit": "latest", - "grunt-contrib-concat": "latest" + "grunt-contrib-uglify": "latest", + "grunt-release": "latest", + "uglify-js": "latest" }, "scripts": { "test": "grunt test" - }, - "ender": "./ender.js", - "_id": "numbro@1.0.4", - "_from": "numbro" + } } From 45a7272a77d2cf279af11fbb05e450cea334e1df Mon Sep 17 00:00:00 2001 From: Benjamin Van Ryseghem Date: Sat, 18 Apr 2015 17:24:32 +0200 Subject: [PATCH 19/47] Update LICENSE Update copyrights --- LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index f9810c58..e8709e87 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014 Adam Draper +Copyright (c) 2015 Företagsplatsen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation @@ -19,4 +19,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +OTHER DEALINGS IN THE SOFTWARE. From e4cddccf3c38958d2d245e0d5cc1e0a181c09a6c Mon Sep 17 00:00:00 2001 From: Benjamin Van Ryseghem Date: Sat, 18 Apr 2015 18:22:38 +0200 Subject: [PATCH 20/47] Update README.md Update travis link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 405b3d44..4d93e461 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A javascript library for formatting and manipulating numbers. # Travis Build Status -Master [![Build Status](https://api.travis-ci.org/foretagsplatsen/numbro.png)](https://travis-ci.org/foretagsplatsen/numbro) +Master [![Build Status](https://travis-ci.org/foretagsplatsen/numbro.svg?branch=master)](https://travis-ci.org/foretagsplatsen/numbro) Develop [![Build Status](https://travis-ci.org/foretagsplatsen/numbro.png?branch=develop)](https://travis-ci.org/foretagsplatsen/numbro) From 279ef50672bffbbd91a694e134869ac8f4ab1a01 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Mon, 20 Apr 2015 12:59:58 -0400 Subject: [PATCH 21/47] Allow for 'y' as a valid confirmation --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 2304f251..0cc7e96c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -50,7 +50,7 @@ module.exports = function(grunt) { question: 'Are you sure you want to publish a new release' + ' with version <%= pkg.version %>? (yes/no)', continue: function(answer) { - return answer.toLowerCase() === 'yes'; + return ['yes', 'y'].indexOf(answer.toLowerCase()) !== -1; } } } From cfb4835516de6dd36d983668d38824572754dfb9 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Mon, 20 Apr 2015 12:43:14 -0400 Subject: [PATCH 22/47] Also update version numbers in `numbro.js` Regex here is the same as from grunt-bump, except allows for '=' assignment instead of just object definition with ':' https://github.com/vojtajina/grunt-bump/blob/5e8e187f994a3375a2cf289e171be753733969d7/tasks/bump.js#L60 --- Gruntfile.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 0cc7e96c..8b3e5f35 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -37,11 +37,14 @@ module.exports = function(grunt) { 'package.json', 'bower.json', 'component.json', + 'numbro.js', ], updateConfigs: ['pkg'], commit: false, createTag: false, push: false, + globalReplace: true, + regExp: new RegExp('([\'|\"]?version[\'|\"]?[ ]*[:=][ ]*[\'|\"]?)(\\d+\\.\\d+\\.\\d+(-\\.\\d+)?(-\\d+)?)[\\d||A-a|.|-]*([\'|\"]?)') }, }, confirm: { From c3bb885855ba76b643ddc285fc64909892d7bb0b Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Mon, 20 Apr 2015 21:39:53 -0400 Subject: [PATCH 23/47] Separate bump from publish task to allow for changelog... edits. Maybe in the future can prompt for changelog entry and have the whole release process automated with one command. --- Gruntfile.js | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8b3e5f35..eba101e9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -61,10 +61,7 @@ module.exports = function(grunt) { release:{ options: { bump: false, - additionalFiles: [ - 'bower.json', - 'component.json', - ], + commit: false, tagName: 'v<%= version %>', }, }, @@ -120,19 +117,10 @@ module.exports = function(grunt) { ]); // wrap grunt-release with confirmation - [ - 'patch', - 'minor', - 'major', - 'prerelease' - ].forEach(function (detail) { - grunt.registerTask('publish:'+detail, [ - 'bump:'+detail, - 'confirm:release', - 'release', - ]); - }); - grunt.registerTask('publish', ['publish:patch']); + grunt.registerTask('publish', [ + 'confirm:release', + 'release', + ]); // Travis CI task. From 3385258d2068f6bb3bdb888ff7af932c496d8c4f Mon Sep 17 00:00:00 2001 From: Benjamin Van Ryseghem Date: Wed, 15 Apr 2015 17:09:17 +0200 Subject: [PATCH 24/47] Fixes dependencies --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 97446b49..38c532b7 100644 --- a/package.json +++ b/package.json @@ -38,8 +38,8 @@ "grunt": "latest", "grunt-contrib-uglify": "latest", "grunt-contrib-jshint": "latest", - "grunt-contrib-nodeunit": "~0.1.2", - "grunt-contrib-concat": "~0.3.0" + "grunt-contrib-nodeunit": "latest", + "grunt-contrib-concat": "latest" }, "scripts": { "test": "grunt" From 8d6b3d3df5951e32a9efeac2a5b53af6b5377134 Mon Sep 17 00:00:00 2001 From: Benjamin Van Ryseghem Date: Wed, 15 Apr 2015 17:12:27 +0200 Subject: [PATCH 25/47] Fixes commented version --- min/numbro.min.js | 4 ++-- numbro.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/min/numbro.min.js b/min/numbro.min.js index bccadc4d..0893fc31 100644 --- a/min/numbro.min.js +++ b/min/numbro.min.js @@ -1,8 +1,8 @@ /*! * numbro.js - * version : 1.0.0 + * version : 1.0.4 * author : Företagsplatsen AB * license : MIT * http://www.foretagsplatsen.se */ -(function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10,b);return f=(c(a*g)/g).toFixed(b),d&&(e=new RegExp("0{1,"+d+"}$"),f=f.replace(e,"")),f}function c(a,b,c){var d;return d=b.indexOf("$")>-1?e(a,b,c):b.indexOf("%")>-1?f(a,b,c):b.indexOf(":")>-1?g(a,b):i(a._value,b,c)}function d(a,b){var c,d,e,f,g,i=b,j=["KB","MB","GB","TB","PB","EB","ZB","YB"],k=!1;if(b.indexOf(":")>-1)a._value=h(b);else if(b===q)a._value=0;else{for("."!==o[p].delimiters.decimal&&(b=b.replace(/\./g,"").replace(o[p].delimiters.decimal,".")),c=new RegExp("[^a-zA-Z]"+o[p].abbreviations.thousand+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),d=new RegExp("[^a-zA-Z]"+o[p].abbreviations.million+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),e=new RegExp("[^a-zA-Z]"+o[p].abbreviations.billion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),f=new RegExp("[^a-zA-Z]"+o[p].abbreviations.trillion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),g=0;g<=j.length&&!(k=b.indexOf(j[g])>-1?Math.pow(1024,g+1):!1);g++);a._value=(k?k:1)*(i.match(c)?Math.pow(10,3):1)*(i.match(d)?Math.pow(10,6):1)*(i.match(e)?Math.pow(10,9):1)*(i.match(f)?Math.pow(10,12):1)*(b.indexOf("%")>-1?.01:1)*((b.split("-").length+Math.min(b.split("(").length-1,b.split(")").length-1))%2?1:-1)*Number(b.replace(/[^0-9\.]+/g,"")),a._value=k?Math.ceil(a._value):a._value}return a._value}function e(a,b,c){var d,e,f=b,g=f.indexOf("$"),h=f.indexOf("("),j=f.indexOf("-"),k="",l="";if(-1===f.indexOf("$")?"infix"===o[p].currency.position?(l=o[p].currency.symbol,o[p].currency.spaceSeparated&&(l=" "+l+" ")):o[p].currency.spaceSeparated&&(k=" "):f.indexOf(" $")>-1?(k=" ",f=f.replace(" $","")):f.indexOf("$ ")>-1?(k=" ",f=f.replace("$ ","")):f=f.replace("$",""),e=i(a._value,f,c,l),-1===b.indexOf("$"))switch(o[p].currency.position){case"postfix":e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,k+o[p].currency.symbol),e=e.join("")):e=e+k+o[p].currency.symbol;break;case"infix":break;default:e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=Math.max(h,j)+1,e.splice(d,0,o[p].currency.symbol+k),e=e.join("")):e=o[p].currency.symbol+k+e}else 1>=g?e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=1,(h>g||j>g)&&(d=0),e.splice(d,0,o[p].currency.symbol+k),e=e.join("")):e=o[p].currency.symbol+k+e:e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,k+o[p].currency.symbol),e=e.join("")):e=e+k+o[p].currency.symbol;return e}function f(a,b,c){var d,e="",f=100*a._value;return b.indexOf(" %")>-1?(e=" ",b=b.replace(" %","")):b=b.replace("%",""),d=i(f,b,c),d.indexOf(")")>-1?(d=d.split(""),d.splice(-1,0,e+"%"),d=d.join("")):d=d+e+"%",d}function g(a){var b=Math.floor(a._value/60/60),c=Math.floor((a._value-60*b*60)/60),d=Math.round(a._value-60*b*60-60*c);return b+":"+(10>c?"0"+c:c)+":"+(10>d?"0"+d:d)}function h(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}function i(a,c,d,e){var f,g,h,i,j,k,l,m,n,r,s,t,u,v,w=!1,x=!1,y=!1,z="",A=!1,B=!1,C=!1,D=!1,E=!1,F="",G="",H=Math.abs(a),I=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],J="",K=!1,L=!1,M=-1,N=-1,O="";if(0===a&&null!==q)return q;if(isFinite(a)){if(-1!==c.indexOf("-")&&(K=!0),c.indexOf("(")>-1?(w=!0,c=c.slice(1,-1)):c.indexOf("+")>-1&&(x=!0,c=c.replace(/\+/g,"")),c.indexOf("a")>-1){if(r=c.split(".")[0].match(/0/g)||[],r=r.length,A=c.indexOf("aK")>=0,B=c.indexOf("aM")>=0,C=c.indexOf("aB")>=0,D=c.indexOf("aT")>=0,E=A||B||C||D,c.indexOf(" a")>-1?(z=" ",c=c.replace(" a","")):c=c.replace("a",""),j=Math.floor(Math.log(H)/Math.LN10)+1,l=j%3,l=0===l?3:l,r>=l&&(k=Math.floor(Math.log(H)/Math.LN10)+1-r,m=3*~~((Math.min(r,j)-l)/3),H/=Math.pow(10,m),-1===c.indexOf(".")&&r>3))for(c+="[.]",v=0===k?0:3*~~(k/3)-k,v=0>v?v+3:v,f=0;v>f;f++)c+="0";Math.floor(Math.log(Math.abs(a))/Math.LN10)+1!==r&&(H>=Math.pow(10,12)&&!E||D?(z+=o[p].abbreviations.trillion,a/=Math.pow(10,12)):H=Math.pow(10,9)&&!E||C?(z+=o[p].abbreviations.billion,a/=Math.pow(10,9)):H=Math.pow(10,6)&&!E||B?(z+=o[p].abbreviations.million,a/=Math.pow(10,6)):(H=Math.pow(10,3)&&!E||A)&&(z+=o[p].abbreviations.thousand,a/=Math.pow(10,3)))}if(c.indexOf("b")>-1)for(c.indexOf(" b")>-1?(F=" ",c=c.replace(" b","")):c=c.replace("b",""),i=0;i<=I.length;i++)if(g=Math.pow(1024,i),h=Math.pow(1024,i+1),a>=g&&h>a){F+=I[i],g>0&&(a/=g);break}return c.indexOf("o")>-1&&(c.indexOf(" o")>-1?(G=" ",c=c.replace(" o","")):c=c.replace("o",""),G+=o[p].ordinal(a)),c.indexOf("[.]")>-1&&(y=!0,c=c.replace("[.]",".")),n=a.toString().split(".")[0],s=c.split(".")[1],u=c.indexOf(","),s?(s.indexOf("[")>-1?(s=s.replace("]",""),s=s.split("["),J=b(a,s[0].length+s[1].length,d,s[1].length)):J=b(a,s.length,d),n=J.split(".")[0],J.split(".")[1].length?(t=e?z+e:o[p].delimiters.decimal,J=t+J.split(".")[1]):J="",y&&0===Number(J.slice(1))&&(J="")):n=b(a,null,d),n.indexOf("-")>-1&&(n=n.slice(1),L=!0),u>-1&&(n=n.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+o[p].delimiters.thousands)),0===c.indexOf(".")&&(n=""),M=c.indexOf("("),N=c.indexOf("-"),O=N>M?(w&&L?"(":"")+(K&&L||!w&&L?"-":""):(K&&L||!w&&L?"-":"")+(w&&L?"(":""),O+(!L&&x?"+":"")+n+J+(G?G:"")+(z&&!e?z:"")+(F?F:"")+(w&&L?")":"")}return""+a}function j(a,b){o[a]=b}function k(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)}function l(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var c=k(a),d=k(b);return c>d?c:d},-(1/0))}var m,n="1.6.0",o={},p="en-US",q=null,r="0,0",s="0$",t="undefined"!=typeof module&&module.exports;m=function(b){return m.isNumbro(b)?b=b.value():0===b||"undefined"==typeof b?b=0:Number(b)||(b=m.fn.unformat(b)),new a(Number(b))},m.version=n,m.isNumbro=function(b){return b instanceof a},m.language=function(a,b){if(!a)return p;if(a&&!b){if(!o[a])throw new Error("Unknown language : "+a);p=a;var c=o[a].defaults;c&&c.format&&m.defaultFormat(c.format),c&&c.currencyFormat&&m.defaultCurrencyFormat(c.currencyFormat)}return(b||!o[a])&&j(a,b),m},m.setLanguage=function(a,b){var c=a,d=a.split("-")[0],e=null;o[c]||(Object.keys(o).forEach(function(a){e||a.split("-")[0]!==d||(e=a)}),c=e||b||"en-US"),m.language(c)},m.languageData=function(a){if(!a)return o[p];if(!o[a])throw new Error("Unknown language : "+a);return o[a]},m.language("en-US",{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"}}),m.zeroFormat=function(a){q="string"==typeof a?a:null},m.defaultFormat=function(a){r="string"==typeof a?a:"0.0"},m.defaultCurrencyFormat=function(a){s="string"==typeof a?a:"0$"},m.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.match(/^\d+$/))return!0;if(""===a)return!1;try{i=m.languageData(b)}catch(k){i=m.languageData(m.language())}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):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+$/))))},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){"use strict";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(1c;++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}),m.fn=a.prototype={clone:function(){return m(this)},format:function(a,b){return c(this,a?a:r,void 0!==b?b:Math.round)},formatCurrency:function(a,b){return e(this,a?a:s,void 0!==b?b:Math.round)},unformat:function(a){return"[object Number]"===Object.prototype.toString.call(a)?a:d(this,a?a:r)},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,d,e){return a+c*b}var c=l.call(null,this._value,a);return this._value=[this._value,a].reduce(b,0)/c,this},subtract:function(a){function b(a,b,d,e){return a-c*b}var c=l.call(null,this._value,a);return this._value=[a].reduce(b,this._value*c)/c,this},multiply:function(a){function b(a,b,c,d){var e=l(a,b);return a*e*b*e/(e*e)}return this._value=[this._value,a].reduce(b,1),this},divide:function(a){function b(a,b,c,d){var e=l(a,b);return a*e/(b*e)}return this._value=[this._value,a].reduce(b),this},difference:function(a){return Math.abs(m(this._value).subtract(a).value())}},t&&(module.exports=m),"undefined"==typeof ender&&(this.numbro=m),"function"==typeof define&&define.amd&&define([],function(){return m})}).call(this); \ No newline at end of file +(function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10,b);return f=(c(a*g)/g).toFixed(b),d&&(e=new RegExp("0{1,"+d+"}$"),f=f.replace(e,"")),f}function c(a,b,c){var d;return d=b.indexOf("$")>-1?e(a,b,c):b.indexOf("%")>-1?f(a,b,c):b.indexOf(":")>-1?g(a,b):i(a._value,b,c)}function d(a,b){var c,d,e,f,g,i=b,j=["KB","MB","GB","TB","PB","EB","ZB","YB"],k=!1;if(b.indexOf(":")>-1)a._value=h(b);else if(b===q)a._value=0;else{for("."!==o[p].delimiters.decimal&&(b=b.replace(/\./g,"").replace(o[p].delimiters.decimal,".")),c=new RegExp("[^a-zA-Z]"+o[p].abbreviations.thousand+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),d=new RegExp("[^a-zA-Z]"+o[p].abbreviations.million+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),e=new RegExp("[^a-zA-Z]"+o[p].abbreviations.billion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),f=new RegExp("[^a-zA-Z]"+o[p].abbreviations.trillion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),g=0;g<=j.length&&!(k=b.indexOf(j[g])>-1?Math.pow(1024,g+1):!1);g++);a._value=(k?k:1)*(i.match(c)?Math.pow(10,3):1)*(i.match(d)?Math.pow(10,6):1)*(i.match(e)?Math.pow(10,9):1)*(i.match(f)?Math.pow(10,12):1)*(b.indexOf("%")>-1?.01:1)*((b.split("-").length+Math.min(b.split("(").length-1,b.split(")").length-1))%2?1:-1)*Number(b.replace(/[^0-9\.]+/g,"")),a._value=k?Math.ceil(a._value):a._value}return a._value}function e(a,b,c){var d,e,f=b,g=f.indexOf("$"),h=f.indexOf("("),j=f.indexOf("-"),k="",l="";if(-1===f.indexOf("$")?"infix"===o[p].currency.position?(l=o[p].currency.symbol,o[p].currency.spaceSeparated&&(l=" "+l+" ")):o[p].currency.spaceSeparated&&(k=" "):f.indexOf(" $")>-1?(k=" ",f=f.replace(" $","")):f.indexOf("$ ")>-1?(k=" ",f=f.replace("$ ","")):f=f.replace("$",""),e=i(a._value,f,c,l),-1===b.indexOf("$"))switch(o[p].currency.position){case"postfix":e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,k+o[p].currency.symbol),e=e.join("")):e=e+k+o[p].currency.symbol;break;case"infix":break;default:e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=Math.max(h,j)+1,e.splice(d,0,o[p].currency.symbol+k),e=e.join("")):e=o[p].currency.symbol+k+e}else 1>=g?e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=1,(h>g||j>g)&&(d=0),e.splice(d,0,o[p].currency.symbol+k),e=e.join("")):e=o[p].currency.symbol+k+e:e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,k+o[p].currency.symbol),e=e.join("")):e=e+k+o[p].currency.symbol;return e}function f(a,b,c){var d,e="",f=100*a._value;return b.indexOf(" %")>-1?(e=" ",b=b.replace(" %","")):b=b.replace("%",""),d=i(f,b,c),d.indexOf(")")>-1?(d=d.split(""),d.splice(-1,0,e+"%"),d=d.join("")):d=d+e+"%",d}function g(a){var b=Math.floor(a._value/60/60),c=Math.floor((a._value-60*b*60)/60),d=Math.round(a._value-60*b*60-60*c);return b+":"+(10>c?"0"+c:c)+":"+(10>d?"0"+d:d)}function h(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}function i(a,c,d,e){var f,g,h,i,j,k,l,m,n,r,s,t,u,v,w=!1,x=!1,y=!1,z="",A=!1,B=!1,C=!1,D=!1,E=!1,F="",G="",H=Math.abs(a),I=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],J="",K=!1,L=!1,M=-1,N=-1,O="";if(0===a&&null!==q)return q;if(isFinite(a)){if(-1!==c.indexOf("-")&&(K=!0),c.indexOf("(")>-1?(w=!0,c=c.slice(1,-1)):c.indexOf("+")>-1&&(x=!0,c=c.replace(/\+/g,"")),c.indexOf("a")>-1){if(r=c.split(".")[0].match(/0/g)||[],r=r.length,A=c.indexOf("aK")>=0,B=c.indexOf("aM")>=0,C=c.indexOf("aB")>=0,D=c.indexOf("aT")>=0,E=A||B||C||D,c.indexOf(" a")>-1?(z=" ",c=c.replace(" a","")):c=c.replace("a",""),j=Math.floor(Math.log(H)/Math.LN10)+1,l=j%3,l=0===l?3:l,r>=l&&(k=Math.floor(Math.log(H)/Math.LN10)+1-r,m=3*~~((Math.min(r,j)-l)/3),H/=Math.pow(10,m),-1===c.indexOf(".")&&r>3))for(c+="[.]",v=0===k?0:3*~~(k/3)-k,v=0>v?v+3:v,f=0;v>f;f++)c+="0";Math.floor(Math.log(Math.abs(a))/Math.LN10)+1!==r&&(H>=Math.pow(10,12)&&!E||D?(z+=o[p].abbreviations.trillion,a/=Math.pow(10,12)):H=Math.pow(10,9)&&!E||C?(z+=o[p].abbreviations.billion,a/=Math.pow(10,9)):H=Math.pow(10,6)&&!E||B?(z+=o[p].abbreviations.million,a/=Math.pow(10,6)):(H=Math.pow(10,3)&&!E||A)&&(z+=o[p].abbreviations.thousand,a/=Math.pow(10,3)))}if(c.indexOf("b")>-1)for(c.indexOf(" b")>-1?(F=" ",c=c.replace(" b","")):c=c.replace("b",""),i=0;i<=I.length;i++)if(g=Math.pow(1024,i),h=Math.pow(1024,i+1),a>=g&&h>a){F+=I[i],g>0&&(a/=g);break}return c.indexOf("o")>-1&&(c.indexOf(" o")>-1?(G=" ",c=c.replace(" o","")):c=c.replace("o",""),G+=o[p].ordinal(a)),c.indexOf("[.]")>-1&&(y=!0,c=c.replace("[.]",".")),n=a.toString().split(".")[0],s=c.split(".")[1],u=c.indexOf(","),s?(s.indexOf("[")>-1?(s=s.replace("]",""),s=s.split("["),J=b(a,s[0].length+s[1].length,d,s[1].length)):J=b(a,s.length,d),n=J.split(".")[0],J.split(".")[1].length?(t=e?z+e:o[p].delimiters.decimal,J=t+J.split(".")[1]):J="",y&&0===Number(J.slice(1))&&(J="")):n=b(a,null,d),n.indexOf("-")>-1&&(n=n.slice(1),L=!0),u>-1&&(n=n.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+o[p].delimiters.thousands)),0===c.indexOf(".")&&(n=""),M=c.indexOf("("),N=c.indexOf("-"),O=N>M?(w&&L?"(":"")+(K&&L||!w&&L?"-":""):(K&&L||!w&&L?"-":"")+(w&&L?"(":""),O+(!L&&x?"+":"")+n+J+(G?G:"")+(z&&!e?z:"")+(F?F:"")+(w&&L?")":"")}return""+a}function j(a,b){o[a]=b}function k(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)}function l(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var c=k(a),d=k(b);return c>d?c:d},-(1/0))}var m,n="1.0.4",o={},p="en-US",q=null,r="0,0",s="0$",t="undefined"!=typeof module&&module.exports;m=function(b){return m.isNumbro(b)?b=b.value():0===b||"undefined"==typeof b?b=0:Number(b)||(b=m.fn.unformat(b)),new a(Number(b))},m.version=n,m.isNumbro=function(b){return b instanceof a},m.language=function(a,b){if(!a)return p;if(a&&!b){if(!o[a])throw new Error("Unknown language : "+a);p=a;var c=o[a].defaults;c&&c.format&&m.defaultFormat(c.format),c&&c.currencyFormat&&m.defaultCurrencyFormat(c.currencyFormat)}return(b||!o[a])&&j(a,b),m},m.setLanguage=function(a,b){var c=a,d=a.split("-")[0],e=null;o[c]||(Object.keys(o).forEach(function(a){e||a.split("-")[0]!==d||(e=a)}),c=e||b||"en-US"),m.language(c)},m.languageData=function(a){if(!a)return o[p];if(!o[a])throw new Error("Unknown language : "+a);return o[a]},m.language("en-US",{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"}}),m.zeroFormat=function(a){q="string"==typeof a?a:null},m.defaultFormat=function(a){r="string"==typeof a?a:"0.0"},m.defaultCurrencyFormat=function(a){s="string"==typeof a?a:"0$"},m.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.match(/^\d+$/))return!0;if(""===a)return!1;try{i=m.languageData(b)}catch(k){i=m.languageData(m.language())}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):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+$/))))},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){"use strict";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(1c;++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}),m.fn=a.prototype={clone:function(){return m(this)},format:function(a,b){return c(this,a?a:r,void 0!==b?b:Math.round)},formatCurrency:function(a,b){return e(this,a?a:s,void 0!==b?b:Math.round)},unformat:function(a){return"[object Number]"===Object.prototype.toString.call(a)?a:d(this,a?a:r)},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,d,e){return a+c*b}var c=l.call(null,this._value,a);return this._value=[this._value,a].reduce(b,0)/c,this},subtract:function(a){function b(a,b,d,e){return a-c*b}var c=l.call(null,this._value,a);return this._value=[a].reduce(b,this._value*c)/c,this},multiply:function(a){function b(a,b,c,d){var e=l(a,b);return a*e*b*e/(e*e)}return this._value=[this._value,a].reduce(b,1),this},divide:function(a){function b(a,b,c,d){var e=l(a,b);return a*e/(b*e)}return this._value=[this._value,a].reduce(b),this},difference:function(a){return Math.abs(m(this._value).subtract(a).value())}},t&&(module.exports=m),"undefined"==typeof ender&&(this.numbro=m),"function"==typeof define&&define.amd&&define([],function(){return m})}).call(this); \ No newline at end of file diff --git a/numbro.js b/numbro.js index bbe67a52..3ec5bd22 100644 --- a/numbro.js +++ b/numbro.js @@ -1,6 +1,6 @@ /*! * numbro.js - * version : 1.0.0 + * version : 1.0.4 * author : Företagsplatsen AB * license : MIT * http://www.foretagsplatsen.se From e203799a31287fc3c71af2851e7e5f4d2bea4605 Mon Sep 17 00:00:00 2001 From: phil Date: Tue, 14 Apr 2015 16:04:42 -0400 Subject: [PATCH 26/47] Test with node 0.12 add node 0.12 to be tested by travis --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 384c4072..1b186414 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: node_js node_js: - - "0.10" + - "0.12" + - "0.10" before_script: - npm install -g grunt-cli script: grunt travis --verbose \ No newline at end of file From e53ad9a35bb276255fdf872dae39e1799ea17c5d Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Tue, 14 Apr 2015 21:27:27 -0400 Subject: [PATCH 27/47] Also run tests for io.js --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 1b186414..06f6c8ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: node_js node_js: - "0.12" - "0.10" + - "iojs" before_script: - npm install -g grunt-cli script: grunt travis --verbose \ No newline at end of file From 8fca867622a208f728486e78af3177fd29b796b7 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 21:25:52 -0400 Subject: [PATCH 28/47] Remove trailing whitespace, convert line endings... Use Unix line endings throughout the project to be consistent. --- languages.js | 60 ++++++++++++++++++++-------------------- languages/da-DK.js | 2 +- languages/de-DE.js | 2 +- languages/de-ch.js | 4 +-- languages/en-GB.js | 2 +- languages/es-AR.js | 4 +-- languages/es-ES.js | 2 +- languages/et-EE.js | 2 +- languages/fi-FI.js | 2 +- languages/fr-CH.js | 2 +- languages/fr-FR.js | 2 +- languages/it-IT.js | 2 +- languages/ja-JP.js | 2 +- languages/nb-NO.js | 2 +- languages/nl-BE.js | 2 +- languages/nl-NL.js | 2 +- languages/pl-PL.js | 2 +- languages/pt-BR.js | 2 +- languages/pt-PT.js | 2 +- languages/ru-RU.js | 6 ++-- languages/ru-UA.js | 4 +-- languages/th-TH.js | 2 +- languages/tr-TR.js | 2 +- languages/uk-UA.js | 4 +-- languages/zh-CN.js | 2 +- tests/numbro/misc.js | 16 +++++------ tests/numbro/validate.js | 2 +- 27 files changed, 69 insertions(+), 69 deletions(-) diff --git a/languages.js b/languages.js index 6600d3ab..f83946b8 100644 --- a/languages.js +++ b/languages.js @@ -43,7 +43,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : danish denmark (dk) * author : Michael Storgaard : https://github.com/mstorgaard @@ -87,7 +87,7 @@ this.numbro.language('da-DK', language); } }()); -/*! +/*! * numbro.js language configuration * language : German (de) – generally useful in Germany, Austria, Luxembourg, Belgium * author : Marco Krage : https://github.com/sinky @@ -131,11 +131,11 @@ this.numbro.language('de-DE', language); } }()); -/*! +/*! * numbro.js language configuration * language : German in Switzerland (de-ch) * author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky) - */ + */ (function () { var language = { delimiters: { @@ -175,7 +175,7 @@ this.numbro.language('de-CH', language); } }()); -/*! +/*! * numbro.js language configuration * language : english united kingdom (uk) * author : Dan Ristic : https://github.com/dristic @@ -223,7 +223,7 @@ this.numbro.language('en-GB', language); } }()); -/*! +/*! * numbro.js language configuration * language : spanish * author : Hernan Garcia : https://github.com/hgarcia @@ -244,7 +244,7 @@ var b = number % 10; return (b === 1 || b === 3) ? 'er' : (b === 2) ? 'do' : - (b === 7 || b === 0) ? 'mo' : + (b === 7 || b === 0) ? 'mo' : (b === 8) ? 'vo' : (b === 9) ? 'no' : 'to'; }, @@ -273,7 +273,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : spanish Spain * author : Hernan Garcia : https://github.com/hgarcia @@ -323,7 +323,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : Estonian * author : Illimar Tambek : https://github.com/ragulka @@ -371,7 +371,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : Finnish * author : Sami Saada : https://github.com/samitheberber @@ -460,7 +460,7 @@ this.numbro.language('fr-CA', language); } }()); -/*! +/*! * numbro.js language configuration * language : french (fr-ch) * author : Adam Draper : https://github.com/adamwdraper @@ -505,7 +505,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : french (fr) * author : Adam Draper : https://github.com/adamwdraper @@ -593,7 +593,7 @@ this.numbro.language('hu-HU', language); } }()); -/*! +/*! * numbro.js language configuration * language : italian Italy (it) * author : Giacomo Trombi : http://cinquepunti.it @@ -637,7 +637,7 @@ this.numbro.language('it-IT', language); } }()); -/*! +/*! * numbro.js language configuration * language : japanese * author : teppeis : https://github.com/teppeis @@ -726,7 +726,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : norwegian * author : Benjamin Van Ryseghem @@ -767,7 +767,7 @@ this.numbro.language('nb-NO', language); } }()); -/*! +/*! * numbro.js language configuration * language : belgium-dutch (be-nl) * author : Dieter Luypaert : https://github.com/moeriki @@ -812,7 +812,7 @@ this.numbro.language('nl-BE', language); } }()); -/*! +/*! * numbro.js language configuration * language : netherlands-dutch (nl-nl) * author : Dave Clayton : https://github.com/davedx @@ -857,7 +857,7 @@ this.numbro.language('nl-NL', language); } }()); -/*! +/*! * numbro.js language configuration * language : polish (pl) * author : Dominik Bulaj : https://github.com/dominikbulaj @@ -901,7 +901,7 @@ this.numbro.language('pl-PL', language); } }()); -/*! +/*! * numbro.js language configuration * language : portuguese brazil (pt-br) * author : Ramiro Varandas Jr : https://github.com/ramirovjr @@ -945,7 +945,7 @@ this.numbro.language('pt-BR', language); } }()); -/*! +/*! * numbro.js language configuration * language : portuguese (pt-pt) * author : Diogo Resende : https://github.com/dresende @@ -990,7 +990,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : russian (ru) * author : Anatoli Papirovski : https://github.com/apapirovski @@ -1008,10 +1008,10 @@ trillion: 't' }, ordinal: function () { - // not ideal, but since in Russian it can taken on + // not ideal, but since in Russian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return '.'; + return '.'; }, currency: { symbol: 'руб.', @@ -1054,10 +1054,10 @@ trillion: 't' }, ordinal: function () { - // not ideal, but since in Russian it can taken on + // not ideal, but since in Russian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return '.'; + return '.'; }, currency: { symbol: '\u20B4', @@ -1170,7 +1170,7 @@ this.numbro.language('sv-SE', language); } }()); -/*! +/*! * numbro.js language configuration * language : thai (th) * author : Sathit Jittanupat : https://github.com/jojosati @@ -1215,7 +1215,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : turkish (tr) * author : Ecmel Ercan : https://github.com/ecmel, Erhan Gundogan : https://github.com/erhangundogan, Burak Yiğit Kaya: https://github.com/BYK @@ -1309,10 +1309,10 @@ trillion: 'блн' }, ordinal: function () { - // not ideal, but since in Ukrainian it can taken on + // not ideal, but since in Ukrainian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return ''; + return ''; }, currency: { symbol: '\u20B4', @@ -1339,7 +1339,7 @@ } }()); -/*! +/*! * numbro.js language configuration * language : simplified chinese * author : badplum : https://github.com/badplum diff --git a/languages/da-DK.js b/languages/da-DK.js index 29dcd5be..c49f4bd0 100644 --- a/languages/da-DK.js +++ b/languages/da-DK.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : danish denmark (dk) * author : Michael Storgaard : https://github.com/mstorgaard diff --git a/languages/de-DE.js b/languages/de-DE.js index 86378ea3..eca5ffaf 100644 --- a/languages/de-DE.js +++ b/languages/de-DE.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : German (de) – generally useful in Germany, Austria, Luxembourg, Belgium * author : Marco Krage : https://github.com/sinky diff --git a/languages/de-ch.js b/languages/de-ch.js index 016f399e..6e1c3d7d 100644 --- a/languages/de-ch.js +++ b/languages/de-ch.js @@ -1,8 +1,8 @@ -/*! +/*! * numbro.js language configuration * language : German in Switzerland (de-ch) * author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky) - */ + */ (function () { var language = { delimiters: { diff --git a/languages/en-GB.js b/languages/en-GB.js index b00981c7..5401c3c7 100644 --- a/languages/en-GB.js +++ b/languages/en-GB.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : english united kingdom (uk) * author : Dan Ristic : https://github.com/dristic diff --git a/languages/es-AR.js b/languages/es-AR.js index 0e022e73..7e7525c8 100644 --- a/languages/es-AR.js +++ b/languages/es-AR.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : spanish * author : Hernan Garcia : https://github.com/hgarcia @@ -19,7 +19,7 @@ var b = number % 10; return (b === 1 || b === 3) ? 'er' : (b === 2) ? 'do' : - (b === 7 || b === 0) ? 'mo' : + (b === 7 || b === 0) ? 'mo' : (b === 8) ? 'vo' : (b === 9) ? 'no' : 'to'; }, diff --git a/languages/es-ES.js b/languages/es-ES.js index cbd33271..58b0b0be 100644 --- a/languages/es-ES.js +++ b/languages/es-ES.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : spanish Spain * author : Hernan Garcia : https://github.com/hgarcia diff --git a/languages/et-EE.js b/languages/et-EE.js index 82b38f57..8df069a0 100644 --- a/languages/et-EE.js +++ b/languages/et-EE.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : Estonian * author : Illimar Tambek : https://github.com/ragulka diff --git a/languages/fi-FI.js b/languages/fi-FI.js index 14c46638..704e6999 100644 --- a/languages/fi-FI.js +++ b/languages/fi-FI.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : Finnish * author : Sami Saada : https://github.com/samitheberber diff --git a/languages/fr-CH.js b/languages/fr-CH.js index 2d66dd2f..d2068797 100644 --- a/languages/fr-CH.js +++ b/languages/fr-CH.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : french (fr-ch) * author : Adam Draper : https://github.com/adamwdraper diff --git a/languages/fr-FR.js b/languages/fr-FR.js index 9c9f14e1..9b484633 100644 --- a/languages/fr-FR.js +++ b/languages/fr-FR.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : french (fr) * author : Adam Draper : https://github.com/adamwdraper diff --git a/languages/it-IT.js b/languages/it-IT.js index 7d4eaa25..c2158433 100644 --- a/languages/it-IT.js +++ b/languages/it-IT.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : italian Italy (it) * author : Giacomo Trombi : http://cinquepunti.it diff --git a/languages/ja-JP.js b/languages/ja-JP.js index ba6830c4..2f6aa462 100644 --- a/languages/ja-JP.js +++ b/languages/ja-JP.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : japanese * author : teppeis : https://github.com/teppeis diff --git a/languages/nb-NO.js b/languages/nb-NO.js index ae24bb46..a4a96a34 100644 --- a/languages/nb-NO.js +++ b/languages/nb-NO.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : norwegian * author : Benjamin Van Ryseghem diff --git a/languages/nl-BE.js b/languages/nl-BE.js index e4c9cc81..262bf4ee 100644 --- a/languages/nl-BE.js +++ b/languages/nl-BE.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : belgium-dutch (be-nl) * author : Dieter Luypaert : https://github.com/moeriki diff --git a/languages/nl-NL.js b/languages/nl-NL.js index 730595ff..feaf9e9f 100644 --- a/languages/nl-NL.js +++ b/languages/nl-NL.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : netherlands-dutch (nl-nl) * author : Dave Clayton : https://github.com/davedx diff --git a/languages/pl-PL.js b/languages/pl-PL.js index c20b0c79..875f1b6e 100644 --- a/languages/pl-PL.js +++ b/languages/pl-PL.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : polish (pl) * author : Dominik Bulaj : https://github.com/dominikbulaj diff --git a/languages/pt-BR.js b/languages/pt-BR.js index 062b3a36..4a639a2c 100644 --- a/languages/pt-BR.js +++ b/languages/pt-BR.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : portuguese brazil (pt-br) * author : Ramiro Varandas Jr : https://github.com/ramirovjr diff --git a/languages/pt-PT.js b/languages/pt-PT.js index 067c5ce4..fce0c10f 100644 --- a/languages/pt-PT.js +++ b/languages/pt-PT.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : portuguese (pt-pt) * author : Diogo Resende : https://github.com/dresende diff --git a/languages/ru-RU.js b/languages/ru-RU.js index a5be11e7..fb2dbeea 100644 --- a/languages/ru-RU.js +++ b/languages/ru-RU.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : russian (ru) * author : Anatoli Papirovski : https://github.com/apapirovski @@ -16,10 +16,10 @@ trillion: 't' }, ordinal: function () { - // not ideal, but since in Russian it can taken on + // not ideal, but since in Russian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return '.'; + return '.'; }, currency: { symbol: 'руб.', diff --git a/languages/ru-UA.js b/languages/ru-UA.js index 6fec19f3..89ec7666 100644 --- a/languages/ru-UA.js +++ b/languages/ru-UA.js @@ -14,10 +14,10 @@ trillion: 't' }, ordinal: function () { - // not ideal, but since in Russian it can taken on + // not ideal, but since in Russian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return '.'; + return '.'; }, currency: { symbol: '\u20B4', diff --git a/languages/th-TH.js b/languages/th-TH.js index 267f8a14..b5b3bf0b 100644 --- a/languages/th-TH.js +++ b/languages/th-TH.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : thai (th) * author : Sathit Jittanupat : https://github.com/jojosati diff --git a/languages/tr-TR.js b/languages/tr-TR.js index eb5fcd17..2bf39c04 100644 --- a/languages/tr-TR.js +++ b/languages/tr-TR.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : turkish (tr) * author : Ecmel Ercan : https://github.com/ecmel, Erhan Gundogan : https://github.com/erhangundogan, Burak Yiğit Kaya: https://github.com/BYK diff --git a/languages/uk-UA.js b/languages/uk-UA.js index 32206cfa..594c0e55 100644 --- a/languages/uk-UA.js +++ b/languages/uk-UA.js @@ -14,10 +14,10 @@ trillion: 'блн' }, ordinal: function () { - // not ideal, but since in Ukrainian it can taken on + // not ideal, but since in Ukrainian it can taken on // different forms (masculine, feminine, neuter) // this is all we can do - return ''; + return ''; }, currency: { symbol: '\u20B4', diff --git a/languages/zh-CN.js b/languages/zh-CN.js index a6835f47..6b3e0058 100644 --- a/languages/zh-CN.js +++ b/languages/zh-CN.js @@ -1,4 +1,4 @@ -/*! +/*! * numbro.js language configuration * language : simplified chinese * author : badplum : https://github.com/badplum diff --git a/tests/numbro/misc.js b/tests/numbro/misc.js index 5e1a3d80..6372818c 100644 --- a/tests/numbro/misc.js +++ b/tests/numbro/misc.js @@ -89,35 +89,35 @@ exports.misc = { test.done(); }, - + languageData: function(test) { test.expect(10); - + var cOld = '$', cNew = '!', formatTestVal = function() { return numbro('100').format('$0,0') }, oldCurrencyVal = cOld + '100', newCurrencyVal = cNew + '100'; - + test.strictEqual(numbro.languageData().currency.symbol, cOld, 'Current language currency is ' + cOld); test.strictEqual(numbro.languageData('en-US').currency.symbol, cOld, 'English language currency is ' + cOld); - + numbro.languageData().currency.symbol = cNew; test.strictEqual(numbro.languageData().currency.symbol, cNew, 'Current language currency is changed to ' + cNew); test.strictEqual(formatTestVal(), newCurrencyVal, 'Format uses new currency'); - + numbro.languageData().currency.symbol = cOld; test.strictEqual(numbro.languageData().currency.symbol, '$', 'Current language currency is reset to ' + cOld); test.strictEqual(formatTestVal(), oldCurrencyVal, 'Format uses old currency'); - + numbro.languageData('en-US').currency.symbol = cNew; test.strictEqual(numbro.languageData().currency.symbol, cNew, 'English language currency is changed to ' + cNew); test.strictEqual(formatTestVal(), newCurrencyVal, 'Format uses new currency'); - + numbro.languageData('en-US').currency.symbol = cOld; test.strictEqual(numbro.languageData().currency.symbol, cOld, 'English language currency is reset to ' + cOld); test.strictEqual(formatTestVal(), oldCurrencyVal, 'Format uses old currency'); - + test.done(); } }; \ No newline at end of file diff --git a/tests/numbro/validate.js b/tests/numbro/validate.js index dc4e8dd8..95bb7687 100644 --- a/tests/numbro/validate.js +++ b/tests/numbro/validate.js @@ -21,7 +21,7 @@ exports.validate = { ['1.000,123', false], ['1000.', false], ['1000,', false], - ['10..00', false], + ['10..00', false], ['10,,00', false], ['10, 00', false] ]; From 119332a56632e55603f75a7ce67db24ec6afe66d Mon Sep 17 00:00:00 2001 From: Phil Ostler Date: Tue, 19 Aug 2014 21:53:45 +0100 Subject: [PATCH 29/47] Changes Danish currency symbol to 'kr' * 'DKK' is currency code and not the symbol * See http://www.xe.com/symbols.php --- languages/da-DK.js | 4 ++-- tests/languages/da-dk.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/languages/da-DK.js b/languages/da-DK.js index c49f4bd0..2365c941 100644 --- a/languages/da-DK.js +++ b/languages/da-DK.js @@ -19,7 +19,7 @@ return '.'; }, currency: { - symbol: 'DKK', + symbol: 'kr', position: 'postfix' }, defaults: { @@ -41,4 +41,4 @@ if (typeof window !== 'undefined' && this.numbro && this.numbro.language) { this.numbro.language('da-DK', language); } -}()); \ No newline at end of file +}()); diff --git a/tests/languages/da-dk.js b/tests/languages/da-dk.js index f4c9fc55..ec2385c4 100644 --- a/tests/languages/da-dk.js +++ b/tests/languages/da-dk.js @@ -47,10 +47,10 @@ exports['language:da-dk'] = { test.expect(4); var tests = [ - [1000.234,'$0,0.00','DKK1.000,23'], - [-1000.234,'($0,0)','(DKK1.000)'], - [-1000.234,'$0.00','-DKK1000,23'], - [1230974,'($0.00a)','DKK1,23mio'] + [1000.234,'$0,0.00','kr1.000,23'], + [-1000.234,'($0,0)','(kr1.000)'], + [-1000.234,'$0.00','-kr1000,23'], + [1230974,'($0.00a)','kr1,23mio'] ]; for (var i = 0; i < tests.length; i++) { @@ -83,11 +83,11 @@ exports['language:da-dk'] = { var tests = [ ['10.000,123',10000.123], ['(0,12345)',-0.12345], - ['(DKK1,23mio)',-1230000], + ['(kr1,23mio)',-1230000], ['10k',10000], ['-10k',-10000], ['23.',23], - ['DK10.000,00',10000], + ['kr10.000,00',10000], ['-76%',-0.76], ['2:23:57',8637] ]; From 3858358957253506f7ac26b04e2764a9f0ff8c45 Mon Sep 17 00:00:00 2001 From: Ahmad Date: Fri, 9 Jan 2015 21:13:09 +0330 Subject: [PATCH 30/47] Add farsi language support --- languages/fa-ir.js | 34 +++++++++++++ tests/languages/fa-ir.js | 101 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 languages/fa-ir.js create mode 100644 tests/languages/fa-ir.js diff --git a/languages/fa-ir.js b/languages/fa-ir.js new file mode 100644 index 00000000..0a398908 --- /dev/null +++ b/languages/fa-ir.js @@ -0,0 +1,34 @@ +/*! + * numeral.js language configuration + * language : Farsi Iran + * author : neo13 : https://github.com/neo13 + */ +(function () { + var language = { + delimiters: { + thousands: '،', + decimal: '.' + }, + abbreviations: { + thousand: 'هزار', + million: 'میلیون', + billion: 'میلیارد', + trillion: 'تریلیون' + }, + ordinal: function (number) { + return 'ام'; + }, + currency: { + symbol: '﷼' + } + }; + + // Node + if (typeof module !== 'undefined' && module.exports) { + module.exports = language; + } + // Browser + if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { + this.numeral.language('en-gb', language); + } +}()); diff --git a/tests/languages/fa-ir.js b/tests/languages/fa-ir.js new file mode 100644 index 00000000..b459d961 --- /dev/null +++ b/tests/languages/fa-ir.js @@ -0,0 +1,101 @@ +var numeral = require('../../numeral'), + language = require('../../languages/fa-ir'); + +numeral.language('fa-ir', language); + +exports['language:fa-ir'] = { + setUp: function (callback) { + numeral.language('fa-ir'); + callback(); + }, + + tearDown: function (callback) { + numeral.language('en'); + callback(); + }, + + format: function (test) { + test.expect(16); + + var tests = [ + [10000,'0,0.0000','10،000.0000'], + [10000.23,'0,0','10،000'], + [-10000,'0,0.0','-10،000.0'], + [10000.1234,'0.000','10000.123'], + [-10000,'(0,0.0000)','(10،000.0000)'], + [-0.23,'.00','-.23'], + [-0.23,'(.00)','(.23)'], + [0.23,'0.00000','0.23000'], + [1230974,'0.0a','1.2میلیون'], + [1460,'0a','1هزار'], + [-104000,'0a','-104هزار'], + [1,'0o','1ام'], + [52,'0o','52ام'], + [23,'0o','23ام'], + [100,'0o','100ام'], + [1,'0[.]0','1'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + currency: function (test) { + test.expect(4); + + var tests = [ + [1000.234,'$0,0.00','﷼1،000.23'], + [-1000.234,'($0,0)','(﷼1،000)'], + [-1000.234,'$0.00','-﷼1000.23'], + [1230974,'($0.00a)','﷼1.23میلیون'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + percentages: function (test) { + test.expect(4); + + var tests = [ + [1,'0%','100%'], + [0.974878234,'0.000%','97.488%'], + [-0.43,'0%','-43%'], + [0.43,'(0.000%)','43.000%'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + unformat: function (test) { + test.expect(9); + + var tests = [ + ['10,000.123',10000.123], + ['(0.12345)',-0.12345], + ['(£1.23میلیون)',-1230000], + ['10هزار',10000], + ['-10هزار',-10000], + ['23ام',23], + ['£10,000.00',10000], + ['-76%',-0.76], + ['2:23:57',8637] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral().unformat(tests[i][0]), tests[i][1], tests[i][0]); + } + + test.done(); + } +}; From cd3df2ed824ab7802a5e70101a175df812099084 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 23:07:57 -0400 Subject: [PATCH 31/47] Rename with proper capital locale --- languages/{fa-ir.js => fa-IR.js} | 0 tests/languages/{fa-ir.js => fa-IR.js} | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) rename languages/{fa-ir.js => fa-IR.js} (100%) rename tests/languages/{fa-ir.js => fa-IR.js} (94%) diff --git a/languages/fa-ir.js b/languages/fa-IR.js similarity index 100% rename from languages/fa-ir.js rename to languages/fa-IR.js diff --git a/tests/languages/fa-ir.js b/tests/languages/fa-IR.js similarity index 94% rename from tests/languages/fa-ir.js rename to tests/languages/fa-IR.js index b459d961..e028f907 100644 --- a/tests/languages/fa-ir.js +++ b/tests/languages/fa-IR.js @@ -1,11 +1,11 @@ var numeral = require('../../numeral'), - language = require('../../languages/fa-ir'); + language = require('../../languages/fa-IR'); -numeral.language('fa-ir', language); +numeral.language('fa-IR', language); -exports['language:fa-ir'] = { +exports['language:fa-IR'] = { setUp: function (callback) { - numeral.language('fa-ir'); + numeral.language('fa-IR'); callback(); }, From 35b92a8d70301263fb19dc2957a39219fcbc1ddc Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 23:10:37 -0400 Subject: [PATCH 32/47] Register for proper lang-locale code --- languages/fa-IR.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/fa-IR.js b/languages/fa-IR.js index 0a398908..d37d72b0 100644 --- a/languages/fa-IR.js +++ b/languages/fa-IR.js @@ -29,6 +29,6 @@ } // Browser if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { - this.numeral.language('en-gb', language); + this.numeral.language('fa-IR', language); } }()); From e7858dc3109202c30f2957cb093ec0f35fb2a95c Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 23:11:29 -0400 Subject: [PATCH 33/47] Rename numeral to numbro Also update en language code to en-US in test --- languages/fa-IR.js | 6 +++--- tests/languages/fa-IR.js | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/languages/fa-IR.js b/languages/fa-IR.js index d37d72b0..5fef3768 100644 --- a/languages/fa-IR.js +++ b/languages/fa-IR.js @@ -1,5 +1,5 @@ /*! - * numeral.js language configuration + * numbro.js language configuration * language : Farsi Iran * author : neo13 : https://github.com/neo13 */ @@ -28,7 +28,7 @@ module.exports = language; } // Browser - if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { - this.numeral.language('fa-IR', language); + if (typeof window !== 'undefined' && this.numbro && this.numbro.language) { + this.numbro.language('fa-IR', language); } }()); diff --git a/tests/languages/fa-IR.js b/tests/languages/fa-IR.js index e028f907..07fc5fdc 100644 --- a/tests/languages/fa-IR.js +++ b/tests/languages/fa-IR.js @@ -1,16 +1,16 @@ -var numeral = require('../../numeral'), +var numbro = require('../../numbro'), language = require('../../languages/fa-IR'); -numeral.language('fa-IR', language); +numbro.language('fa-IR', language); exports['language:fa-IR'] = { setUp: function (callback) { - numeral.language('fa-IR'); + numbro.language('fa-IR'); callback(); }, tearDown: function (callback) { - numeral.language('en'); + numbro.language('en-US'); callback(); }, @@ -37,7 +37,7 @@ exports['language:fa-IR'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -54,7 +54,7 @@ exports['language:fa-IR'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -71,7 +71,7 @@ exports['language:fa-IR'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -93,7 +93,7 @@ exports['language:fa-IR'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral().unformat(tests[i][0]), tests[i][1], tests[i][0]); + test.strictEqual(numbro().unformat(tests[i][0]), tests[i][1], tests[i][0]); } test.done(); From 3f4d2413998b017afbff7c94b5d826ef4d0a6ee0 Mon Sep 17 00:00:00 2001 From: mjmaix Date: Mon, 14 Jul 2014 22:32:52 +0800 Subject: [PATCH 34/47] Added support for fil-ph Philippine peso This is different from Tagalog-Philippine peso (tl-ph). --- languages/fil-ph.js | 38 ++++++++++++++ tests/languages/fil-ph.js | 101 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 languages/fil-ph.js create mode 100644 tests/languages/fil-ph.js diff --git a/languages/fil-ph.js b/languages/fil-ph.js new file mode 100644 index 00000000..95369f65 --- /dev/null +++ b/languages/fil-ph.js @@ -0,0 +1,38 @@ +/*! + * numeral.js language configuration + * language : filipino philippines (ph) + * author : Michael Abadilla : https://github.com/mjmaix + */ +(function () { + var language = { + 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' && this.numeral && this.numeral.language) { + this.numeral.language('fil-ph', language); + } +}()); diff --git a/tests/languages/fil-ph.js b/tests/languages/fil-ph.js new file mode 100644 index 00000000..715015ea --- /dev/null +++ b/tests/languages/fil-ph.js @@ -0,0 +1,101 @@ +var numeral = require('../../numeral'), + language = require('../../languages/fil-ph'); + +numeral.language('fil-ph', language); + +exports['language:fil-ph'] = { + setUp: function (callback) { + numeral.language('fil-ph'); + callback(); + }, + + tearDown: function (callback) { + numeral.language('en'); + callback(); + }, + + format: function (test) { + test.expect(16); + + var tests = [ + [10000,'0,0.0000','10,000.0000'], + [10000.23,'0,0','10,000'], + [-10000,'0,0.0','-10,000.0'], + [10000.1234,'0.000','10000.123'], + [-10000,'(0,0.0000)','(10,000.0000)'], + [-0.23,'.00','-.23'], + [-0.23,'(.00)','(.23)'], + [0.23,'0.00000','0.23000'], + [1230974,'0.0a','1.2m'], + [1460,'0a','1k'], + [-104000,'0a','-104k'], + [1,'0o','1st'], + [52,'0o','52nd'], + [23,'0o','23rd'], + [100,'0o','100th'], + [1,'0[.]0','1'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + currency: function (test) { + test.expect(4); + + var tests = [ + [1000.234,'$0,0.00','₱1,000.23'], + [-1000.234,'($0,0)','(₱1,000)'], + [-1000.234,'$0.00','-₱1000.23'], + [1230974,'($0.00a)','₱1.23m'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + percentages: function (test) { + test.expect(4); + + var tests = [ + [1,'0%','100%'], + [0.974878234,'0.000%','97.488%'], + [-0.43,'0%','-43%'], + [0.43,'(0.000%)','43.000%'] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + } + + test.done(); + }, + + unformat: function (test) { + test.expect(9); + + var tests = [ + ['10,000.123',10000.123], + ['(0.12345)',-0.12345], + ['(₱1.23m)',-1230000], + ['10k',10000], + ['-10k',-10000], + ['23rd',23], + ['₱10,000.00',10000], + ['-76%',-0.76], + ['2:23:57',8637] + ]; + + for (var i = 0; i < tests.length; i++) { + test.strictEqual(numeral().unformat(tests[i][0]), tests[i][1], tests[i][0]); + } + + test.done(); + } +}; From f50c478a4af81772cc3fd46f7392b74d1484dca5 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 23:18:45 -0400 Subject: [PATCH 35/47] Rename with proper locale capitalization --- languages/{fil-ph.js => fil-PH.js} | 2 +- tests/languages/{fil-ph.js => fil-PH.js} | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) rename languages/{fil-ph.js => fil-PH.js} (94%) rename tests/languages/{fil-ph.js => fil-PH.js} (94%) diff --git a/languages/fil-ph.js b/languages/fil-PH.js similarity index 94% rename from languages/fil-ph.js rename to languages/fil-PH.js index 95369f65..932fe4cc 100644 --- a/languages/fil-ph.js +++ b/languages/fil-PH.js @@ -33,6 +33,6 @@ } // Browser if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { - this.numeral.language('fil-ph', language); + this.numeral.language('fil-PH', language); } }()); diff --git a/tests/languages/fil-ph.js b/tests/languages/fil-PH.js similarity index 94% rename from tests/languages/fil-ph.js rename to tests/languages/fil-PH.js index 715015ea..896715d5 100644 --- a/tests/languages/fil-ph.js +++ b/tests/languages/fil-PH.js @@ -1,11 +1,11 @@ var numeral = require('../../numeral'), - language = require('../../languages/fil-ph'); + language = require('../../languages/fil-PH'); -numeral.language('fil-ph', language); +numeral.language('fil-PH', language); -exports['language:fil-ph'] = { +exports['language:fil-PH'] = { setUp: function (callback) { - numeral.language('fil-ph'); + numeral.language('fil-PH'); callback(); }, From b7821435a5c6d714eb93f69cb80f7a852a848649 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Wed, 15 Apr 2015 23:23:30 -0400 Subject: [PATCH 36/47] Rename numeral to numbro Also update en language code to en-US in test --- languages/fil-PH.js | 6 +++--- tests/languages/fil-PH.js | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/languages/fil-PH.js b/languages/fil-PH.js index 932fe4cc..6471ac62 100644 --- a/languages/fil-PH.js +++ b/languages/fil-PH.js @@ -1,5 +1,5 @@ /*! - * numeral.js language configuration + * numbro.js language configuration * language : filipino philippines (ph) * author : Michael Abadilla : https://github.com/mjmaix */ @@ -32,7 +32,7 @@ module.exports = language; } // Browser - if (typeof window !== 'undefined' && this.numeral && this.numeral.language) { - this.numeral.language('fil-PH', language); + if (typeof window !== 'undefined' && this.numbro && this.numbro.language) { + this.numbro.language('fil-PH', language); } }()); diff --git a/tests/languages/fil-PH.js b/tests/languages/fil-PH.js index 896715d5..063282b2 100644 --- a/tests/languages/fil-PH.js +++ b/tests/languages/fil-PH.js @@ -1,16 +1,16 @@ -var numeral = require('../../numeral'), +var numbro = require('../../numbro'), language = require('../../languages/fil-PH'); -numeral.language('fil-PH', language); +numbro.language('fil-PH', language); exports['language:fil-PH'] = { setUp: function (callback) { - numeral.language('fil-PH'); + numbro.language('fil-PH'); callback(); }, tearDown: function (callback) { - numeral.language('en'); + numbro.language('en-US'); callback(); }, @@ -37,7 +37,7 @@ exports['language:fil-PH'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -54,7 +54,7 @@ exports['language:fil-PH'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -71,7 +71,7 @@ exports['language:fil-PH'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); + test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]); } test.done(); @@ -93,7 +93,7 @@ exports['language:fil-PH'] = { ]; for (var i = 0; i < tests.length; i++) { - test.strictEqual(numeral().unformat(tests[i][0]), tests[i][1], tests[i][0]); + test.strictEqual(numbro().unformat(tests[i][0]), tests[i][1], tests[i][0]); } test.done(); From 5b3779c18f41a1cafa9627ce765145b2e053dfaa Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Thu, 16 Apr 2015 19:09:49 -0400 Subject: [PATCH 37/47] Make markdown files more readable when viewing as plain text Shorten several line to be within length 100. Some lines it made sense to leave because they contain long links and cannot be broken up nicely. --- CHANGELOG-Numeraljs.md | 4 +++- CHANGELOG.md | 3 ++- README.md | 9 ++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG-Numeraljs.md b/CHANGELOG-Numeraljs.md index 475091ba..c2c47725 100644 --- a/CHANGELOG-Numeraljs.md +++ b/CHANGELOG-Numeraljs.md @@ -1,4 +1,6 @@ -_This is the historical changelog for the [`numeral-js` project](https://github.com/adamwdraper/Numeral-js), which `numbro` is built upon. The `numbro` changelog is at [CHANGELOG.md](CHANGELOG.md)._ +_This is the historical changelog for the [`numeral-js` +project](https://github.com/adamwdraper/Numeral-js), which `numbro` is built upon. The `numbro` +changelog is at [CHANGELOG.md](CHANGELOG.md)._ ### 1.5.3 diff --git a/CHANGELOG.md b/CHANGELOG.md index bb6c1c2a..95595881 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,4 +4,5 @@ Fork `numeraljs` v1.5.3, renaming everything to `numbro` ---- -_For changes before `numbro` forked [`numeral-js`](https://github.com/adamwdraper/Numeral-js), see [CHANGELOG-Numeraljs.md](CHANGELOG-Numeraljs.md)._ +_For changes before `numbro` forked [`numeral-js`](https://github.com/adamwdraper/Numeral-js), see +[CHANGELOG-Numeraljs.md](CHANGELOG-Numeraljs.md)._ diff --git a/README.md b/README.md index c2243d6d..eb368e16 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,10 @@ Please submit all pull requests to the `develop` branch. 7. Submit a pull request to the `develop` branch. -### Languages +### Languages -Languages names follows the Microsoft culture name convention as found [here](https://msdn.microsoft.com/en-us/library/ee825488.aspx). +Languages names follows the Microsoft culture name convention as found +[here](https://msdn.microsoft.com/en-us/library/ee825488.aspx). ### Language translations will not be merged without unit tests. @@ -50,7 +51,9 @@ See [CHANGELOG.md](CHANGELOG.md). # Acknowlegements -`numbro` is forked from [Adam Draper](https://github.com/adamwdraper)'s project [Numeral.js](http://numeraljs.com/), which was in turn inspired by and heavily borrowed from [Moment.js](http://momentjs.com). +`numbro` is forked from [Adam Draper](https://github.com/adamwdraper)'s project +[Numeral.js](http://numeraljs.com/), which was in turn inspired by and heavily borrowed from +[Moment.js](http://momentjs.com). # License From 427b9d7fbd339132da9ace13ff7881abe3acfc90 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Thu, 16 Apr 2015 19:30:05 -0400 Subject: [PATCH 38/47] Update readme to reflect discussion in #12 and #16 --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index eb368e16..405b3d44 100644 --- a/README.md +++ b/README.md @@ -27,17 +27,19 @@ Please submit all pull requests to the `develop` branch. 4. Add your tests to the files in `/tests` -5. To test your tests, run `grunt` +5. To test your tests, run `grunt test` -6. When all your tests are passing, run `grunt build` to minify all files - -7. Submit a pull request to the `develop` branch. +6. When all your tests are passing, submit a pull request to the `develop` branch. ### Languages Languages names follows the Microsoft culture name convention as found -[here](https://msdn.microsoft.com/en-us/library/ee825488.aspx). +[here](https://msdn.microsoft.com/en-us/library/ee825488.aspx). If Microsoft does not have a code +for the country/locale combination, use the format `lang-locale` where the language code is a 2 +letter abbreviation from the list of [ISO 639-1 language +codes](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) and the `localecode` is from the list +of [ISO 3166-1 country codes](http://en.wikipedia.org/wiki/ISO_3166-1) ### Language translations will not be merged without unit tests. From 339b931684bbb3b76a8df40e64560116720e9a66 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Thu, 16 Apr 2015 19:35:36 -0400 Subject: [PATCH 39/47] Move current built files to dist directory --- languages.js => dist/languages.js | 0 {min => dist/min}/languages.min.js | 0 {min => dist/min}/languages/cs-CZ.min.js | 0 {min => dist/min}/languages/da-DK.min.js | 0 {min => dist/min}/languages/de-DE.min.js | 0 {min => dist/min}/languages/de-ch.min.js | 0 {min => dist/min}/languages/en-GB.min.js | 0 {min => dist/min}/languages/es-AR.min.js | 0 {min => dist/min}/languages/es-ES.min.js | 0 {min => dist/min}/languages/et-EE.min.js | 0 {min => dist/min}/languages/fi-FI.min.js | 0 {min => dist/min}/languages/fr-CA.min.js | 0 {min => dist/min}/languages/fr-CH.min.js | 0 {min => dist/min}/languages/fr-FR.min.js | 0 {min => dist/min}/languages/hu-HU.min.js | 0 {min => dist/min}/languages/it-IT.min.js | 0 {min => dist/min}/languages/ja-JP.min.js | 0 {min => dist/min}/languages/lv-LV.min.js | 0 {min => dist/min}/languages/nb-NO.min.js | 0 {min => dist/min}/languages/nl-BE.min.js | 0 {min => dist/min}/languages/nl-NL.min.js | 0 {min => dist/min}/languages/pl-PL.min.js | 0 {min => dist/min}/languages/pt-BR.min.js | 0 {min => dist/min}/languages/pt-PT.min.js | 0 {min => dist/min}/languages/ru-RU.min.js | 0 {min => dist/min}/languages/ru-UA.min.js | 0 {min => dist/min}/languages/sk-SK.min.js | 0 {min => dist/min}/languages/sv-SE.min.js | 0 {min => dist/min}/languages/th-TH.min.js | 0 {min => dist/min}/languages/tr-TR.min.js | 0 {min => dist/min}/languages/uk-UA.min.js | 0 {min => dist/min}/languages/zh-CN.min.js | 0 {min => dist/min}/numbro.min.js | 0 {min => dist/min}/numeral.min.js | 0 34 files changed, 0 insertions(+), 0 deletions(-) rename languages.js => dist/languages.js (100%) rename {min => dist/min}/languages.min.js (100%) rename {min => dist/min}/languages/cs-CZ.min.js (100%) rename {min => dist/min}/languages/da-DK.min.js (100%) rename {min => dist/min}/languages/de-DE.min.js (100%) rename {min => dist/min}/languages/de-ch.min.js (100%) rename {min => dist/min}/languages/en-GB.min.js (100%) rename {min => dist/min}/languages/es-AR.min.js (100%) rename {min => dist/min}/languages/es-ES.min.js (100%) rename {min => dist/min}/languages/et-EE.min.js (100%) rename {min => dist/min}/languages/fi-FI.min.js (100%) rename {min => dist/min}/languages/fr-CA.min.js (100%) rename {min => dist/min}/languages/fr-CH.min.js (100%) rename {min => dist/min}/languages/fr-FR.min.js (100%) rename {min => dist/min}/languages/hu-HU.min.js (100%) rename {min => dist/min}/languages/it-IT.min.js (100%) rename {min => dist/min}/languages/ja-JP.min.js (100%) rename {min => dist/min}/languages/lv-LV.min.js (100%) rename {min => dist/min}/languages/nb-NO.min.js (100%) rename {min => dist/min}/languages/nl-BE.min.js (100%) rename {min => dist/min}/languages/nl-NL.min.js (100%) rename {min => dist/min}/languages/pl-PL.min.js (100%) rename {min => dist/min}/languages/pt-BR.min.js (100%) rename {min => dist/min}/languages/pt-PT.min.js (100%) rename {min => dist/min}/languages/ru-RU.min.js (100%) rename {min => dist/min}/languages/ru-UA.min.js (100%) rename {min => dist/min}/languages/sk-SK.min.js (100%) rename {min => dist/min}/languages/sv-SE.min.js (100%) rename {min => dist/min}/languages/th-TH.min.js (100%) rename {min => dist/min}/languages/tr-TR.min.js (100%) rename {min => dist/min}/languages/uk-UA.min.js (100%) rename {min => dist/min}/languages/zh-CN.min.js (100%) rename {min => dist/min}/numbro.min.js (100%) rename {min => dist/min}/numeral.min.js (100%) diff --git a/languages.js b/dist/languages.js similarity index 100% rename from languages.js rename to dist/languages.js diff --git a/min/languages.min.js b/dist/min/languages.min.js similarity index 100% rename from min/languages.min.js rename to dist/min/languages.min.js diff --git a/min/languages/cs-CZ.min.js b/dist/min/languages/cs-CZ.min.js similarity index 100% rename from min/languages/cs-CZ.min.js rename to dist/min/languages/cs-CZ.min.js diff --git a/min/languages/da-DK.min.js b/dist/min/languages/da-DK.min.js similarity index 100% rename from min/languages/da-DK.min.js rename to dist/min/languages/da-DK.min.js diff --git a/min/languages/de-DE.min.js b/dist/min/languages/de-DE.min.js similarity index 100% rename from min/languages/de-DE.min.js rename to dist/min/languages/de-DE.min.js diff --git a/min/languages/de-ch.min.js b/dist/min/languages/de-ch.min.js similarity index 100% rename from min/languages/de-ch.min.js rename to dist/min/languages/de-ch.min.js diff --git a/min/languages/en-GB.min.js b/dist/min/languages/en-GB.min.js similarity index 100% rename from min/languages/en-GB.min.js rename to dist/min/languages/en-GB.min.js diff --git a/min/languages/es-AR.min.js b/dist/min/languages/es-AR.min.js similarity index 100% rename from min/languages/es-AR.min.js rename to dist/min/languages/es-AR.min.js diff --git a/min/languages/es-ES.min.js b/dist/min/languages/es-ES.min.js similarity index 100% rename from min/languages/es-ES.min.js rename to dist/min/languages/es-ES.min.js diff --git a/min/languages/et-EE.min.js b/dist/min/languages/et-EE.min.js similarity index 100% rename from min/languages/et-EE.min.js rename to dist/min/languages/et-EE.min.js diff --git a/min/languages/fi-FI.min.js b/dist/min/languages/fi-FI.min.js similarity index 100% rename from min/languages/fi-FI.min.js rename to dist/min/languages/fi-FI.min.js diff --git a/min/languages/fr-CA.min.js b/dist/min/languages/fr-CA.min.js similarity index 100% rename from min/languages/fr-CA.min.js rename to dist/min/languages/fr-CA.min.js diff --git a/min/languages/fr-CH.min.js b/dist/min/languages/fr-CH.min.js similarity index 100% rename from min/languages/fr-CH.min.js rename to dist/min/languages/fr-CH.min.js diff --git a/min/languages/fr-FR.min.js b/dist/min/languages/fr-FR.min.js similarity index 100% rename from min/languages/fr-FR.min.js rename to dist/min/languages/fr-FR.min.js diff --git a/min/languages/hu-HU.min.js b/dist/min/languages/hu-HU.min.js similarity index 100% rename from min/languages/hu-HU.min.js rename to dist/min/languages/hu-HU.min.js diff --git a/min/languages/it-IT.min.js b/dist/min/languages/it-IT.min.js similarity index 100% rename from min/languages/it-IT.min.js rename to dist/min/languages/it-IT.min.js diff --git a/min/languages/ja-JP.min.js b/dist/min/languages/ja-JP.min.js similarity index 100% rename from min/languages/ja-JP.min.js rename to dist/min/languages/ja-JP.min.js diff --git a/min/languages/lv-LV.min.js b/dist/min/languages/lv-LV.min.js similarity index 100% rename from min/languages/lv-LV.min.js rename to dist/min/languages/lv-LV.min.js diff --git a/min/languages/nb-NO.min.js b/dist/min/languages/nb-NO.min.js similarity index 100% rename from min/languages/nb-NO.min.js rename to dist/min/languages/nb-NO.min.js diff --git a/min/languages/nl-BE.min.js b/dist/min/languages/nl-BE.min.js similarity index 100% rename from min/languages/nl-BE.min.js rename to dist/min/languages/nl-BE.min.js diff --git a/min/languages/nl-NL.min.js b/dist/min/languages/nl-NL.min.js similarity index 100% rename from min/languages/nl-NL.min.js rename to dist/min/languages/nl-NL.min.js diff --git a/min/languages/pl-PL.min.js b/dist/min/languages/pl-PL.min.js similarity index 100% rename from min/languages/pl-PL.min.js rename to dist/min/languages/pl-PL.min.js diff --git a/min/languages/pt-BR.min.js b/dist/min/languages/pt-BR.min.js similarity index 100% rename from min/languages/pt-BR.min.js rename to dist/min/languages/pt-BR.min.js diff --git a/min/languages/pt-PT.min.js b/dist/min/languages/pt-PT.min.js similarity index 100% rename from min/languages/pt-PT.min.js rename to dist/min/languages/pt-PT.min.js diff --git a/min/languages/ru-RU.min.js b/dist/min/languages/ru-RU.min.js similarity index 100% rename from min/languages/ru-RU.min.js rename to dist/min/languages/ru-RU.min.js diff --git a/min/languages/ru-UA.min.js b/dist/min/languages/ru-UA.min.js similarity index 100% rename from min/languages/ru-UA.min.js rename to dist/min/languages/ru-UA.min.js diff --git a/min/languages/sk-SK.min.js b/dist/min/languages/sk-SK.min.js similarity index 100% rename from min/languages/sk-SK.min.js rename to dist/min/languages/sk-SK.min.js diff --git a/min/languages/sv-SE.min.js b/dist/min/languages/sv-SE.min.js similarity index 100% rename from min/languages/sv-SE.min.js rename to dist/min/languages/sv-SE.min.js diff --git a/min/languages/th-TH.min.js b/dist/min/languages/th-TH.min.js similarity index 100% rename from min/languages/th-TH.min.js rename to dist/min/languages/th-TH.min.js diff --git a/min/languages/tr-TR.min.js b/dist/min/languages/tr-TR.min.js similarity index 100% rename from min/languages/tr-TR.min.js rename to dist/min/languages/tr-TR.min.js diff --git a/min/languages/uk-UA.min.js b/dist/min/languages/uk-UA.min.js similarity index 100% rename from min/languages/uk-UA.min.js rename to dist/min/languages/uk-UA.min.js diff --git a/min/languages/zh-CN.min.js b/dist/min/languages/zh-CN.min.js similarity index 100% rename from min/languages/zh-CN.min.js rename to dist/min/languages/zh-CN.min.js diff --git a/min/numbro.min.js b/dist/min/numbro.min.js similarity index 100% rename from min/numbro.min.js rename to dist/min/numbro.min.js diff --git a/min/numeral.min.js b/dist/min/numeral.min.js similarity index 100% rename from min/numeral.min.js rename to dist/min/numeral.min.js From 140c76eeff3455f93aeeccd044fb6da3b7a45b96 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Thu, 16 Apr 2015 19:58:34 -0400 Subject: [PATCH 40/47] Update build to output to dist directory Also, reordered the config to improve readability. --- Gruntfile.js | 56 +++++++++++++++++++++------------------------------- package.json | 2 +- 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ec308401..50e71483 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,44 +1,36 @@ var fs = require('fs'); +var path = require('path'); module.exports = function(grunt) { - var minifiedFiles = { - 'min/numbro.min.js' : [ - 'numbro.js' - ], - 'min/languages.min.js': [ - 'languages.js' - ] - }; - - // all the lang files need to be added manually - fs.readdirSync('./languages').forEach(function (path) { - var file = path.slice(0, -3), - destination = 'min/languages/' + file + '.min.js', - src = ['languages/' + path]; - - minifiedFiles[destination] = src; - }); - grunt.initConfig({ - nodeunit : { - all : ['tests/**/*.js'] + concat: { + languages: { + src: [ + 'languages/**/*.js', + ], + dest: 'dist/languages.js', + }, }, uglify: { my_target: { - files: minifiedFiles + files: [ + { src: [ 'dist/languages.js' ], dest: 'dist/min/languages.min.js', }, + { src: [ 'numbro.js' ], dest: 'dist/min/numbro.min.js', }, + ].concat( fs.readdirSync('./languages').map(function (fileName) { + var lang = path.basename(fileName, '.js'); + return { + src: [path.join('languages/', fileName)], + dest: path.join('dist/min/languages/', lang + '.min.js'), + }; + })) }, options: { - preserveComments: 'some' - } + preserveComments: 'some', + }, }, - concat: { - languages: { - src: [ - 'languages/**/*.js' - ], - dest: 'languages.js' - } + nodeunit: { + all: ['tests/**/*.js'], }, jshint: { all: [ @@ -78,10 +70,8 @@ module.exports = function(grunt) { 'nodeunit' ]); - // P grunt.registerTask('build', [ - 'jshint', - 'nodeunit', + 'test', 'concat', 'uglify' ]); diff --git a/package.json b/package.json index 38c532b7..be7823e9 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "grunt-contrib-concat": "latest" }, "scripts": { - "test": "grunt" + "test": "grunt test" }, "ender": "./ender.js", "_id": "numbro@1.0.4", From aadc176eb4704711f0bb44239637f3d7de732cba Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Fri, 17 Apr 2015 00:23:08 -0400 Subject: [PATCH 41/47] Automate tag release to github, npm, bower... Using grunt-confirm to help avoid accidental releases --- Gruntfile.js | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++- package.json | 14 ++++++------- 2 files changed, 64 insertions(+), 8 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 50e71483..2304f251 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -4,6 +4,8 @@ var path = require('path'); module.exports = function(grunt) { grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + concat: { languages: { src: [ @@ -29,6 +31,40 @@ module.exports = function(grunt) { preserveComments: 'some', }, }, + bump: { + options: { + files: [ + 'package.json', + 'bower.json', + 'component.json', + ], + updateConfigs: ['pkg'], + commit: false, + createTag: false, + push: false, + }, + }, + confirm: { + release: { + options: { + question: 'Are you sure you want to publish a new release' + + ' with version <%= pkg.version %>? (yes/no)', + continue: function(answer) { + return answer.toLowerCase() === 'yes'; + } + } + } + }, + release:{ + options: { + bump: false, + additionalFiles: [ + 'bower.json', + 'component.json', + ], + tagName: 'v<%= version %>', + }, + }, nodeunit: { all: ['tests/**/*.js'], }, @@ -60,6 +96,10 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-bump'); + grunt.loadNpmTasks('grunt-confirm'); + grunt.loadNpmTasks('grunt-release'); + grunt.registerTask('default', [ 'test' @@ -76,6 +116,22 @@ module.exports = function(grunt) { 'uglify' ]); + // wrap grunt-release with confirmation + [ + 'patch', + 'minor', + 'major', + 'prerelease' + ].forEach(function (detail) { + grunt.registerTask('publish:'+detail, [ + 'bump:'+detail, + 'confirm:release', + 'release', + ]); + }); + grunt.registerTask('publish', ['publish:patch']); + + // Travis CI task. grunt.registerTask('travis', ['test']); -}; \ No newline at end of file +}; diff --git a/package.json b/package.json index be7823e9..b546c133 100644 --- a/package.json +++ b/package.json @@ -34,17 +34,17 @@ } ], "devDependencies": { - "uglify-js": "latest", "grunt": "latest", - "grunt-contrib-uglify": "latest", + "grunt-bump": "latest", + "grunt-confirm": "latest", + "grunt-contrib-concat": "latest", "grunt-contrib-jshint": "latest", "grunt-contrib-nodeunit": "latest", - "grunt-contrib-concat": "latest" + "grunt-contrib-uglify": "latest", + "grunt-release": "latest", + "uglify-js": "latest" }, "scripts": { "test": "grunt test" - }, - "ender": "./ender.js", - "_id": "numbro@1.0.4", - "_from": "numbro" + } } From 42cde60a0f1080f00eeac069e7d816e8bc4eddc1 Mon Sep 17 00:00:00 2001 From: Benjamin Van Ryseghem Date: Sat, 18 Apr 2015 17:24:32 +0200 Subject: [PATCH 42/47] Update LICENSE Update copyrights --- LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index f9810c58..e8709e87 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014 Adam Draper +Copyright (c) 2015 Företagsplatsen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation @@ -19,4 +19,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +OTHER DEALINGS IN THE SOFTWARE. From f009cf8f2dfe4488a2a1fb124a77061546dc3c6e Mon Sep 17 00:00:00 2001 From: Benjamin Van Ryseghem Date: Sat, 18 Apr 2015 18:22:38 +0200 Subject: [PATCH 43/47] Update README.md Update travis link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 405b3d44..4d93e461 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A javascript library for formatting and manipulating numbers. # Travis Build Status -Master [![Build Status](https://api.travis-ci.org/foretagsplatsen/numbro.png)](https://travis-ci.org/foretagsplatsen/numbro) +Master [![Build Status](https://travis-ci.org/foretagsplatsen/numbro.svg?branch=master)](https://travis-ci.org/foretagsplatsen/numbro) Develop [![Build Status](https://travis-ci.org/foretagsplatsen/numbro.png?branch=develop)](https://travis-ci.org/foretagsplatsen/numbro) From 39dac709e6ddd784e9a80e8f8bb0785262d99eab Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Mon, 20 Apr 2015 12:59:58 -0400 Subject: [PATCH 44/47] Allow for 'y' as a valid confirmation --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 2304f251..0cc7e96c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -50,7 +50,7 @@ module.exports = function(grunt) { question: 'Are you sure you want to publish a new release' + ' with version <%= pkg.version %>? (yes/no)', continue: function(answer) { - return answer.toLowerCase() === 'yes'; + return ['yes', 'y'].indexOf(answer.toLowerCase()) !== -1; } } } From 56e2f33c075106f19b9bb76813e191554a595516 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Mon, 20 Apr 2015 12:43:14 -0400 Subject: [PATCH 45/47] Also update version numbers in `numbro.js` Regex here is the same as from grunt-bump, except allows for '=' assignment instead of just object definition with ':' https://github.com/vojtajina/grunt-bump/blob/5e8e187f994a3375a2cf289e171be753733969d7/tasks/bump.js#L60 --- Gruntfile.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 0cc7e96c..8b3e5f35 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -37,11 +37,14 @@ module.exports = function(grunt) { 'package.json', 'bower.json', 'component.json', + 'numbro.js', ], updateConfigs: ['pkg'], commit: false, createTag: false, push: false, + globalReplace: true, + regExp: new RegExp('([\'|\"]?version[\'|\"]?[ ]*[:=][ ]*[\'|\"]?)(\\d+\\.\\d+\\.\\d+(-\\.\\d+)?(-\\d+)?)[\\d||A-a|.|-]*([\'|\"]?)') }, }, confirm: { From a3d46d0202013b1ae90d23642b4bd7d27c493011 Mon Sep 17 00:00:00 2001 From: Graham McGregor Date: Mon, 20 Apr 2015 21:39:53 -0400 Subject: [PATCH 46/47] Separate bump from publish task to allow for changelog... edits. Maybe in the future can prompt for changelog entry and have the whole release process automated with one command. --- Gruntfile.js | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8b3e5f35..eba101e9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -61,10 +61,7 @@ module.exports = function(grunt) { release:{ options: { bump: false, - additionalFiles: [ - 'bower.json', - 'component.json', - ], + commit: false, tagName: 'v<%= version %>', }, }, @@ -120,19 +117,10 @@ module.exports = function(grunt) { ]); // wrap grunt-release with confirmation - [ - 'patch', - 'minor', - 'major', - 'prerelease' - ].forEach(function (detail) { - grunt.registerTask('publish:'+detail, [ - 'bump:'+detail, - 'confirm:release', - 'release', - ]); - }); - grunt.registerTask('publish', ['publish:patch']); + grunt.registerTask('publish', [ + 'confirm:release', + 'release', + ]); // Travis CI task. From 8a83f88c7c474a6cc59d2a61fc5dd93705508bd7 Mon Sep 17 00:00:00 2001 From: Benjamin Van Ryseghem Date: Tue, 21 Apr 2015 20:18:11 +0200 Subject: [PATCH 47/47] Release 1.0.5 --- CHANGELOG.md | 15 +++++++++++++-- bower.json | 2 +- component.json | 2 +- numbro.js | 4 ++-- package.json | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95595881..fbca61d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,19 @@ +### 1.0.5 + +- Improve release process. Thanks @Graham42 +- Update the `README` file. Thanks @Graham42 +- Add support for filipino. Thanks @Graham42 and @mjmaix +- Add support for farsi. Thanks @Graham42 and @neo13 +- Fixes Danish currency symbol. Thanks @Graham42 and @philostler +- Fices npm/bower dependencies. Thanks @BenjaminVanRyseghem +- Numeral-js leftovers clean up. Thanks @uniphil +- Update homepage url. Thanks @BenjaminVanRyseghem +- Rebase on Numeraljs to keep git history. Thanks @uniphil @Graham42 + ### 1.0.4 Fork `numeraljs` v1.5.3, renaming everything to `numbro` ---- -_For changes before `numbro` forked [`numeral-js`](https://github.com/adamwdraper/Numeral-js), see -[CHANGELOG-Numeraljs.md](CHANGELOG-Numeraljs.md)._ +_For changes before `numbro` forked [`numeral-js`](https://github.com/adamwdraper/Numeral-js), see [CHANGELOG-Numeraljs.md](CHANGELOG-Numeraljs.md)._ diff --git a/bower.json b/bower.json index b54a7f38..2b4bfd0c 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "numbro", "repo": "foretagsplatsen/numbro", - "version": "1.0.4", + "version": "1.0.5", "description": "Format and manipulate numbers.", "keywords": [ "numeral", diff --git a/component.json b/component.json index 594b6f4b..09fcf874 100644 --- a/component.json +++ b/component.json @@ -1,7 +1,7 @@ { "name": "numbro", "repo": "foretagsplatsen/numbro", - "version": "1.0.4", + "version": "1.0.5", "description": "Format and manipulate numbers.", "keywords": [ "numeral", diff --git a/numbro.js b/numbro.js index 3ec5bd22..226af0af 100644 --- a/numbro.js +++ b/numbro.js @@ -1,6 +1,6 @@ /*! * numbro.js - * version : 1.0.4 + * version : 1.0.5 * author : Företagsplatsen AB * license : MIT * http://www.foretagsplatsen.se @@ -13,7 +13,7 @@ ************************************/ var numbro, - VERSION = '1.0.4', + VERSION = '1.0.5', // internal storage for language config files languages = {}, currentLanguage = 'en-US', diff --git a/package.json b/package.json index b546c133..b8e7d8d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "numbro", - "version": "1.0.4", + "version": "1.0.5", "description": "Format and manipulate numbers.", "homepage": "http://numbrojs.com", "author": {