numeraljs-rails 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/numeraljs-rails.rb +8 -0
- data/vendor/assets/javascripts/languages/cs.js +32 -0
- data/vendor/assets/javascripts/languages/de-de.js +32 -0
- data/vendor/assets/javascripts/languages/en-gb.js +36 -0
- data/vendor/assets/javascripts/languages/es.js +37 -0
- data/vendor/assets/javascripts/languages/fr.js +32 -0
- data/vendor/assets/javascripts/languages/it.js +32 -0
- data/vendor/assets/javascripts/languages/min/cs.min.js +4 -0
- data/vendor/assets/javascripts/languages/min/de-de.min.js +4 -0
- data/vendor/assets/javascripts/languages/min/en-gb.min.js +4 -0
- data/vendor/assets/javascripts/languages/min/es.min.js +4 -0
- data/vendor/assets/javascripts/languages/min/fr.min.js +4 -0
- data/vendor/assets/javascripts/languages/min/it.min.js +4 -0
- data/vendor/assets/javascripts/languages/min/pt-br.min.js +4 -0
- data/vendor/assets/javascripts/languages/min/pt-pt.min.js +4 -0
- data/vendor/assets/javascripts/languages/min/ru.min.js +4 -0
- data/vendor/assets/javascripts/languages/min/tr.min.js +6 -0
- data/vendor/assets/javascripts/languages/pt-br.js +32 -0
- data/vendor/assets/javascripts/languages/pt-pt.js +32 -0
- data/vendor/assets/javascripts/languages/ru.js +35 -0
- data/vendor/assets/javascripts/languages/tr.js +68 -0
- data/vendor/assets/javascripts/numeral.js +518 -0
- data/vendor/assets/javascripts/numeral.min.js +6 -0
- metadata +68 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : czech (cs)
|
3
|
+
// author : Anatoli Papirovski : https://github.com/apapirovski
|
4
|
+
(function () {
|
5
|
+
var language = {
|
6
|
+
delimiters: {
|
7
|
+
thousands: ' ',
|
8
|
+
decimal: ','
|
9
|
+
},
|
10
|
+
abbreviations: {
|
11
|
+
thousand: 'tis.',
|
12
|
+
million: 'mil.',
|
13
|
+
billion: 'b',
|
14
|
+
trillion: 't'
|
15
|
+
},
|
16
|
+
ordinal: function () {
|
17
|
+
return '.';
|
18
|
+
},
|
19
|
+
currency: {
|
20
|
+
symbol: 'Kč'
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
// Node
|
25
|
+
if (typeof module !== 'undefined' && module.exports) {
|
26
|
+
module.exports = language;
|
27
|
+
}
|
28
|
+
// Browser
|
29
|
+
if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
|
30
|
+
this.numeral.language('cs', language);
|
31
|
+
}
|
32
|
+
}());
|
@@ -0,0 +1,32 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : german (de-de)
|
3
|
+
// author : Marco Krage : https://github.com/sinky
|
4
|
+
(function () {
|
5
|
+
var language = {
|
6
|
+
delimiters: {
|
7
|
+
thousands: '.',
|
8
|
+
decimal: ','
|
9
|
+
},
|
10
|
+
abbreviations: {
|
11
|
+
thousand: 'k',
|
12
|
+
million: 'm',
|
13
|
+
billion: 'b',
|
14
|
+
trillion: 't'
|
15
|
+
},
|
16
|
+
ordinal: function (number) {
|
17
|
+
return '.';
|
18
|
+
},
|
19
|
+
currency: {
|
20
|
+
symbol: '€'
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
// Node
|
25
|
+
if (typeof module !== 'undefined' && module.exports) {
|
26
|
+
module.exports = language;
|
27
|
+
}
|
28
|
+
// Browser
|
29
|
+
if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
|
30
|
+
this.numeral.language('de-de', language);
|
31
|
+
}
|
32
|
+
}());
|
@@ -0,0 +1,36 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : english united kingdom (uk)
|
3
|
+
// author : Dan Ristic : https://github.com/dristic
|
4
|
+
(function () {
|
5
|
+
var language = {
|
6
|
+
delimiters: {
|
7
|
+
thousands: ',',
|
8
|
+
decimal: '.'
|
9
|
+
},
|
10
|
+
abbreviations: {
|
11
|
+
thousand: 'k',
|
12
|
+
million: 'm',
|
13
|
+
billion: 'b',
|
14
|
+
trillion: 't'
|
15
|
+
},
|
16
|
+
ordinal: function (number) {
|
17
|
+
var b = number % 10;
|
18
|
+
return (~~ (number % 100 / 10) === 1) ? 'th' :
|
19
|
+
(b === 1) ? 'st' :
|
20
|
+
(b === 2) ? 'nd' :
|
21
|
+
(b === 3) ? 'rd' : 'th';
|
22
|
+
},
|
23
|
+
currency: {
|
24
|
+
symbol: '£'
|
25
|
+
}
|
26
|
+
};
|
27
|
+
|
28
|
+
// Node
|
29
|
+
if (typeof module !== 'undefined' && module.exports) {
|
30
|
+
module.exports = language;
|
31
|
+
}
|
32
|
+
// Browser
|
33
|
+
if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
|
34
|
+
this.numeral.language('en-gb', language);
|
35
|
+
}
|
36
|
+
}());
|
@@ -0,0 +1,37 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : spanish
|
3
|
+
// author : Hernan Garcia : https://github.com/hgarcia
|
4
|
+
(function () {
|
5
|
+
var language = {
|
6
|
+
delimiters: {
|
7
|
+
thousands: '.',
|
8
|
+
decimal: ','
|
9
|
+
},
|
10
|
+
abbreviations: {
|
11
|
+
thousand: 'k',
|
12
|
+
million: 'mm',
|
13
|
+
billion: 'b',
|
14
|
+
trillion: 't'
|
15
|
+
},
|
16
|
+
ordinal: function (number) {
|
17
|
+
var b = number % 10;
|
18
|
+
return (b === 1 || b === 3) ? 'er' :
|
19
|
+
(b === 2) ? 'do' :
|
20
|
+
(b === 7 || b === 0) ? 'mo' :
|
21
|
+
(b === 8) ? 'vo' :
|
22
|
+
(b === 9) ? 'no' : 'to';
|
23
|
+
},
|
24
|
+
currency: {
|
25
|
+
symbol: '$'
|
26
|
+
}
|
27
|
+
};
|
28
|
+
|
29
|
+
// Node
|
30
|
+
if (typeof module !== 'undefined' && module.exports) {
|
31
|
+
module.exports = language;
|
32
|
+
}
|
33
|
+
// Browser
|
34
|
+
if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
|
35
|
+
this.numeral.language('es', language);
|
36
|
+
}
|
37
|
+
}());
|
@@ -0,0 +1,32 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : french (fr)
|
3
|
+
// author : Adam Draper : https://github.com/adamwdraper
|
4
|
+
(function () {
|
5
|
+
var language = {
|
6
|
+
delimiters: {
|
7
|
+
thousands: ' ',
|
8
|
+
decimal: ','
|
9
|
+
},
|
10
|
+
abbreviations: {
|
11
|
+
thousand: 'k',
|
12
|
+
million: 'm',
|
13
|
+
billion: 'b',
|
14
|
+
trillion: 't'
|
15
|
+
},
|
16
|
+
ordinal : function (number) {
|
17
|
+
return number === 1 ? 'er' : 'e';
|
18
|
+
},
|
19
|
+
currency: {
|
20
|
+
symbol: '€'
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
// Node
|
25
|
+
if (typeof module !== 'undefined' && module.exports) {
|
26
|
+
module.exports = language;
|
27
|
+
}
|
28
|
+
// Browser
|
29
|
+
if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
|
30
|
+
this.numeral.language('fr', language);
|
31
|
+
}
|
32
|
+
}());
|
@@ -0,0 +1,32 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : italian Italy (it)
|
3
|
+
// author : Giacomo Trombi : http://cinquepunti.it
|
4
|
+
(function () {
|
5
|
+
var language = {
|
6
|
+
delimiters: {
|
7
|
+
thousands: '.',
|
8
|
+
decimal: ','
|
9
|
+
},
|
10
|
+
abbreviations: {
|
11
|
+
thousand: 'mila',
|
12
|
+
million: 'mil',
|
13
|
+
billion: 'b',
|
14
|
+
trillion: 't'
|
15
|
+
},
|
16
|
+
ordinal: function (number) {
|
17
|
+
return 'º';
|
18
|
+
},
|
19
|
+
currency: {
|
20
|
+
symbol: '€'
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
// Node
|
25
|
+
if (typeof module !== 'undefined' && module.exports) {
|
26
|
+
module.exports = language;
|
27
|
+
}
|
28
|
+
// Browser
|
29
|
+
if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
|
30
|
+
this.numeral.language('it', language);
|
31
|
+
}
|
32
|
+
}());
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : czech (cs)
|
3
|
+
// author : Anatoli Papirovski : https://github.com/apapirovski
|
4
|
+
(function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"tis.",million:"mil.",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"Kč"}};typeof module!="undefined"&&module.exports&&(module.exports=e);typeof window!="undefined"&&this.numeral&&this.numeral.language&&this.numeral.language("cs",e)})();
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : german (de-de)
|
3
|
+
// author : Marco Krage : https://github.com/sinky
|
4
|
+
(function(){var e={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){return"."},currency:{symbol:"€"}};typeof module!="undefined"&&module.exports&&(module.exports=e);typeof window!="undefined"&&this.numeral&&this.numeral.language&&this.numeral.language("de-de",e)})();
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : english united kingdom (uk)
|
3
|
+
// author : Dan Ristic : https://github.com/dristic
|
4
|
+
(function(){var e={delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){var t=e%10;return~~(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th"},currency:{symbol:"£"}};typeof module!="undefined"&&module.exports&&(module.exports=e);typeof window!="undefined"&&this.numeral&&this.numeral.language&&this.numeral.language("en-gb",e)})();
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : spanish
|
3
|
+
// author : Hernan Garcia : https://github.com/hgarcia
|
4
|
+
(function(){var e={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"k",million:"mm",billion:"b",trillion:"t"},ordinal:function(e){var t=e%10;return t===1||t===3?"er":t===2?"do":t===7||t===0?"mo":t===8?"vo":t===9?"no":"to"},currency:{symbol:"$"}};typeof module!="undefined"&&module.exports&&(module.exports=e);typeof window!="undefined"&&this.numeral&&this.numeral.language&&this.numeral.language("es",e)})();
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : french (fr)
|
3
|
+
// author : Adam Draper : https://github.com/adamwdraper
|
4
|
+
(function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){return e===1?"er":"e"},currency:{symbol:"€"}};typeof module!="undefined"&&module.exports&&(module.exports=e);typeof window!="undefined"&&this.numeral&&this.numeral.language&&this.numeral.language("fr",e)})();
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : italian Italy (it)
|
3
|
+
// author : Giacomo Trombi : http://cinquepunti.it
|
4
|
+
(function(){var e={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"mila",million:"mil",billion:"b",trillion:"t"},ordinal:function(e){return"º"},currency:{symbol:"€"}};typeof module!="undefined"&&module.exports&&(module.exports=e);typeof window!="undefined"&&this.numeral&&this.numeral.language&&this.numeral.language("it",e)})();
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : portuguese brazil (pt-br)
|
3
|
+
// author : Ramiro Varandas Jr : https://github.com/ramirovjr
|
4
|
+
(function(){var e={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"mil",million:"milhões",billion:"b",trillion:"t"},ordinal:function(e){return"º"},currency:{symbol:"R$"}};typeof module!="undefined"&&module.exports&&(module.exports=e);typeof window!="undefined"&&this.numeral&&this.numeral.language&&this.numeral.language("pt-br",e)})();
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : portuguese (pt-pt)
|
3
|
+
// author : Diogo Resende : https://github.com/dresende
|
4
|
+
(function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){return"º"},currency:{symbol:"€"}};typeof module!="undefined"&&module.exports&&(module.exports=e);typeof window!="undefined"&&this.numeral&&this.numeral.language&&this.numeral.language("pt-pt",e)})();
|
@@ -0,0 +1,4 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : russian (ru)
|
3
|
+
// author : Anatoli Papirovski : https://github.com/apapirovski
|
4
|
+
(function(){var e={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"тыс.",million:"млн",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"руб."}};typeof module!="undefined"&&module.exports&&(module.exports=e);typeof window!="undefined"&&this.numeral&&this.numeral.language&&this.numeral.language("ru",e)})();
|
@@ -0,0 +1,6 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : turkish (tr)
|
3
|
+
// author : Ecmel Ercan : https://github.com/ecmel
|
4
|
+
// Erhan Gundogan : https://github.com/erhangundogan,
|
5
|
+
// Burak Yiğit Kaya: https://github.com/BYK
|
6
|
+
(function(){var e={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"},t={delimiters:{thousands:".",decimal:","},abbreviations:{thousand:"b",million:"m",billion:"bi",trillion:"t"},ordinal:function(t){if(t===0)return"'ıncı";var n=t%10,r=t%100-n,i=t>=100?100:null;return e[n]||e[r]||e[i]},currency:{symbol:"₺"}};typeof module!="undefined"&&module.exports&&(module.exports=t);typeof window!="undefined"&&this.numeral&&this.numeral.language&&this.numeral.language("tr",t)})();
|
@@ -0,0 +1,32 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : portuguese brazil (pt-br)
|
3
|
+
// author : Ramiro Varandas Jr : https://github.com/ramirovjr
|
4
|
+
(function () {
|
5
|
+
var language = {
|
6
|
+
delimiters: {
|
7
|
+
thousands: '.',
|
8
|
+
decimal: ','
|
9
|
+
},
|
10
|
+
abbreviations: {
|
11
|
+
thousand: 'mil',
|
12
|
+
million: 'milhões',
|
13
|
+
billion: 'b',
|
14
|
+
trillion: 't'
|
15
|
+
},
|
16
|
+
ordinal: function (number) {
|
17
|
+
return 'º';
|
18
|
+
},
|
19
|
+
currency: {
|
20
|
+
symbol: 'R$'
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
// Node
|
25
|
+
if (typeof module !== 'undefined' && module.exports) {
|
26
|
+
module.exports = language;
|
27
|
+
}
|
28
|
+
// Browser
|
29
|
+
if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
|
30
|
+
this.numeral.language('pt-br', language);
|
31
|
+
}
|
32
|
+
}());
|
@@ -0,0 +1,32 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : portuguese (pt-pt)
|
3
|
+
// author : Diogo Resende : https://github.com/dresende
|
4
|
+
(function () {
|
5
|
+
var language = {
|
6
|
+
delimiters: {
|
7
|
+
thousands: ' ',
|
8
|
+
decimal: ','
|
9
|
+
},
|
10
|
+
abbreviations: {
|
11
|
+
thousand: 'k',
|
12
|
+
million: 'm',
|
13
|
+
billion: 'b',
|
14
|
+
trillion: 't'
|
15
|
+
},
|
16
|
+
ordinal : function (number) {
|
17
|
+
return 'º';
|
18
|
+
},
|
19
|
+
currency: {
|
20
|
+
symbol: '€'
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
// Node
|
25
|
+
if (typeof module !== 'undefined' && module.exports) {
|
26
|
+
module.exports = language;
|
27
|
+
}
|
28
|
+
// Browser
|
29
|
+
if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
|
30
|
+
this.numeral.language('pt-pt', language);
|
31
|
+
}
|
32
|
+
}());
|
@@ -0,0 +1,35 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : russian (ru)
|
3
|
+
// author : Anatoli Papirovski : https://github.com/apapirovski
|
4
|
+
(function () {
|
5
|
+
var language = {
|
6
|
+
delimiters: {
|
7
|
+
thousands: ' ',
|
8
|
+
decimal: ','
|
9
|
+
},
|
10
|
+
abbreviations: {
|
11
|
+
thousand: 'тыс.',
|
12
|
+
million: 'млн',
|
13
|
+
billion: 'b',
|
14
|
+
trillion: 't'
|
15
|
+
},
|
16
|
+
ordinal: function () {
|
17
|
+
// not ideal, but since in Russian it can taken on
|
18
|
+
// different forms (masculine, feminine, neuter)
|
19
|
+
// this is all we can do
|
20
|
+
return '.';
|
21
|
+
},
|
22
|
+
currency: {
|
23
|
+
symbol: 'руб.'
|
24
|
+
}
|
25
|
+
};
|
26
|
+
|
27
|
+
// Node
|
28
|
+
if (typeof module !== 'undefined' && module.exports) {
|
29
|
+
module.exports = language;
|
30
|
+
}
|
31
|
+
// Browser
|
32
|
+
if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
|
33
|
+
this.numeral.language('ru', language);
|
34
|
+
}
|
35
|
+
}());
|
@@ -0,0 +1,68 @@
|
|
1
|
+
// numeral.js language configuration
|
2
|
+
// language : turkish (tr)
|
3
|
+
// author : Ecmel Ercan : https://github.com/ecmel
|
4
|
+
// Erhan Gundogan : https://github.com/erhangundogan,
|
5
|
+
// Burak Yiğit Kaya: https://github.com/BYK
|
6
|
+
|
7
|
+
(function () {
|
8
|
+
var suffixes = {
|
9
|
+
1: "'inci",
|
10
|
+
5: "'inci",
|
11
|
+
8: "'inci",
|
12
|
+
70: "'inci",
|
13
|
+
80: "'inci",
|
14
|
+
|
15
|
+
2: "'nci",
|
16
|
+
7: "'nci",
|
17
|
+
20: "'nci",
|
18
|
+
50: "'nci",
|
19
|
+
|
20
|
+
3: "'üncü",
|
21
|
+
4: "'üncü",
|
22
|
+
100: "'üncü",
|
23
|
+
|
24
|
+
6: "'ncı",
|
25
|
+
|
26
|
+
9: "'uncu",
|
27
|
+
10: "'uncu",
|
28
|
+
30: "'uncu",
|
29
|
+
|
30
|
+
60: "'ıncı",
|
31
|
+
90: "'ıncı"
|
32
|
+
};
|
33
|
+
var language = {
|
34
|
+
delimiters: {
|
35
|
+
thousands: '.',
|
36
|
+
decimal: ','
|
37
|
+
},
|
38
|
+
abbreviations: {
|
39
|
+
thousand: 'b',
|
40
|
+
million: 'm',
|
41
|
+
billion: 'bi',
|
42
|
+
trillion: 't'
|
43
|
+
},
|
44
|
+
ordinal: function (number) {
|
45
|
+
if (number === 0) { // special case for zero
|
46
|
+
return "'ıncı";
|
47
|
+
}
|
48
|
+
|
49
|
+
var a = number % 10;
|
50
|
+
var b = number % 100 - a;
|
51
|
+
var c = number >= 100 ? 100 : null;
|
52
|
+
|
53
|
+
return suffixes[a] || suffixes[b] || suffixes[c];
|
54
|
+
},
|
55
|
+
currency: {
|
56
|
+
symbol: '\u20BA'
|
57
|
+
}
|
58
|
+
};
|
59
|
+
|
60
|
+
// Node
|
61
|
+
if (typeof module !== 'undefined' && module.exports) {
|
62
|
+
module.exports = language;
|
63
|
+
}
|
64
|
+
// Browser
|
65
|
+
if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
|
66
|
+
this.numeral.language('tr', language);
|
67
|
+
}
|
68
|
+
}());
|
@@ -0,0 +1,518 @@
|
|
1
|
+
// numeral.js
|
2
|
+
// version : 1.4.5
|
3
|
+
// author : Adam Draper
|
4
|
+
// license : MIT
|
5
|
+
// http://adamwdraper.github.com/Numeral-js/
|
6
|
+
|
7
|
+
(function () {
|
8
|
+
|
9
|
+
/************************************
|
10
|
+
Constants
|
11
|
+
************************************/
|
12
|
+
|
13
|
+
var numeral,
|
14
|
+
VERSION = '1.4.5',
|
15
|
+
// internal storage for language config files
|
16
|
+
languages = {},
|
17
|
+
currentLanguage = 'en',
|
18
|
+
zeroFormat = null,
|
19
|
+
// check for nodeJS
|
20
|
+
hasModule = (typeof module !== 'undefined' && module.exports);
|
21
|
+
|
22
|
+
|
23
|
+
/************************************
|
24
|
+
Constructors
|
25
|
+
************************************/
|
26
|
+
|
27
|
+
|
28
|
+
// Numeral prototype object
|
29
|
+
function Numeral (number) {
|
30
|
+
this._n = number;
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Implementation of toFixed() that treats floats more like decimals
|
35
|
+
*
|
36
|
+
* Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present
|
37
|
+
* problems for accounting- and finance-related software.
|
38
|
+
*/
|
39
|
+
function toFixed (value, precision, optionals) {
|
40
|
+
var power = Math.pow(10, precision),
|
41
|
+
output;
|
42
|
+
|
43
|
+
// Multiply up by precision, round accurately, then divide and use native toFixed():
|
44
|
+
output = (Math.round(value * power) / power).toFixed(precision);
|
45
|
+
|
46
|
+
if (optionals) {
|
47
|
+
var optionalsRegExp = new RegExp('0{1,' + optionals + '}$');
|
48
|
+
output = output.replace(optionalsRegExp, '');
|
49
|
+
}
|
50
|
+
|
51
|
+
return output;
|
52
|
+
}
|
53
|
+
|
54
|
+
/************************************
|
55
|
+
Formatting
|
56
|
+
************************************/
|
57
|
+
|
58
|
+
// determine what type of formatting we need to do
|
59
|
+
function formatNumeral (n, format) {
|
60
|
+
var output;
|
61
|
+
|
62
|
+
// figure out what kind of format we are dealing with
|
63
|
+
if (format.indexOf('$') > -1) { // currency!!!!!
|
64
|
+
output = formatCurrency(n, format);
|
65
|
+
} else if (format.indexOf('%') > -1) { // percentage
|
66
|
+
output = formatPercentage(n, format);
|
67
|
+
} else if (format.indexOf(':') > -1) { // time
|
68
|
+
output = formatTime(n, format);
|
69
|
+
} else { // plain ol' numbers or bytes
|
70
|
+
output = formatNumber(n, format);
|
71
|
+
}
|
72
|
+
|
73
|
+
// return string
|
74
|
+
return output;
|
75
|
+
}
|
76
|
+
|
77
|
+
// revert to number
|
78
|
+
function unformatNumeral (n, string) {
|
79
|
+
if (string.indexOf(':') > -1) {
|
80
|
+
n._n = unformatTime(string);
|
81
|
+
} else {
|
82
|
+
if (string === zeroFormat) {
|
83
|
+
n._n = 0;
|
84
|
+
} else {
|
85
|
+
var stringOriginal = string;
|
86
|
+
if (languages[currentLanguage].delimiters.decimal !== '.') {
|
87
|
+
string = string.replace(/\./g,'').replace(languages[currentLanguage].delimiters.decimal, '.');
|
88
|
+
}
|
89
|
+
|
90
|
+
// see if abbreviations are there so that we can multiply to the correct number
|
91
|
+
var thousandRegExp = new RegExp(languages[currentLanguage].abbreviations.thousand + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'),
|
92
|
+
millionRegExp = new RegExp(languages[currentLanguage].abbreviations.million + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'),
|
93
|
+
billionRegExp = new RegExp(languages[currentLanguage].abbreviations.billion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$'),
|
94
|
+
trillionRegExp = new RegExp(languages[currentLanguage].abbreviations.trillion + '(?:\\)|(\\' + languages[currentLanguage].currency.symbol + ')?(?:\\))?)?$');
|
95
|
+
|
96
|
+
// see if bytes are there so that we can multiply to the correct number
|
97
|
+
var prefixes = ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
98
|
+
bytesMultiplier = false;
|
99
|
+
|
100
|
+
for (var power = 0; power <= prefixes.length; power++) {
|
101
|
+
bytesMultiplier = (string.indexOf(prefixes[power]) > -1) ? Math.pow(1024, power + 1) : false;
|
102
|
+
|
103
|
+
if (bytesMultiplier) {
|
104
|
+
break;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
// do some math to create our number
|
109
|
+
n._n = ((bytesMultiplier) ? bytesMultiplier : 1) * ((stringOriginal.match(thousandRegExp)) ? Math.pow(10, 3) : 1) * ((stringOriginal.match(millionRegExp)) ? Math.pow(10, 6) : 1) * ((stringOriginal.match(billionRegExp)) ? Math.pow(10, 9) : 1) * ((stringOriginal.match(trillionRegExp)) ? Math.pow(10, 12) : 1) * ((string.indexOf('%') > -1) ? 0.01 : 1) * Number(((string.indexOf('(') > -1) ? '-' : '') + string.replace(/[^0-9\.'-]+/g, ''));
|
110
|
+
|
111
|
+
// round if we are talking about bytes
|
112
|
+
n._n = (bytesMultiplier) ? Math.ceil(n._n) : n._n;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
return n._n;
|
116
|
+
}
|
117
|
+
|
118
|
+
function formatCurrency (n, format) {
|
119
|
+
var prependSymbol = (format.indexOf('$') <= 1) ? true : false;
|
120
|
+
|
121
|
+
// remove $ for the moment
|
122
|
+
var space = '';
|
123
|
+
|
124
|
+
// check for space before or after currency
|
125
|
+
if (format.indexOf(' $') > -1) {
|
126
|
+
space = ' ';
|
127
|
+
format = format.replace(' $', '');
|
128
|
+
} else if (format.indexOf('$ ') > -1) {
|
129
|
+
space = ' ';
|
130
|
+
format = format.replace('$ ', '');
|
131
|
+
} else {
|
132
|
+
format = format.replace('$', '');
|
133
|
+
}
|
134
|
+
|
135
|
+
// format the number
|
136
|
+
var output = formatNumeral(n, format);
|
137
|
+
|
138
|
+
// position the symbol
|
139
|
+
if (prependSymbol) {
|
140
|
+
if (output.indexOf('(') > -1 || output.indexOf('-') > -1) {
|
141
|
+
output = output.split('');
|
142
|
+
output.splice(1, 0, languages[currentLanguage].currency.symbol + space);
|
143
|
+
output = output.join('');
|
144
|
+
} else {
|
145
|
+
output = languages[currentLanguage].currency.symbol + space + output;
|
146
|
+
}
|
147
|
+
} else {
|
148
|
+
if (output.indexOf(')') > -1) {
|
149
|
+
output = output.split('');
|
150
|
+
output.splice(-1, 0, space + languages[currentLanguage].currency.symbol);
|
151
|
+
output = output.join('');
|
152
|
+
} else {
|
153
|
+
output = output + space + languages[currentLanguage].currency.symbol;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
return output;
|
158
|
+
}
|
159
|
+
|
160
|
+
function formatPercentage (n, format) {
|
161
|
+
var space = '';
|
162
|
+
// check for space before %
|
163
|
+
if (format.indexOf(' %') > -1) {
|
164
|
+
space = ' ';
|
165
|
+
format = format.replace(' %', '');
|
166
|
+
} else {
|
167
|
+
format = format.replace('%', '');
|
168
|
+
}
|
169
|
+
|
170
|
+
n._n = n._n * 100;
|
171
|
+
var output = formatNumeral(n, format);
|
172
|
+
if (output.indexOf(')') > -1 ) {
|
173
|
+
output = output.split('');
|
174
|
+
output.splice(-1, 0, space + '%');
|
175
|
+
output = output.join('');
|
176
|
+
} else {
|
177
|
+
output = output + space + '%';
|
178
|
+
}
|
179
|
+
return output;
|
180
|
+
}
|
181
|
+
|
182
|
+
function formatTime (n, format) {
|
183
|
+
var hours = Math.floor(n._n/60/60),
|
184
|
+
minutes = Math.floor((n._n - (hours * 60 * 60))/60),
|
185
|
+
seconds = Math.round(n._n - (hours * 60 * 60) - (minutes * 60));
|
186
|
+
return hours + ':' + ((minutes < 10) ? '0' + minutes : minutes) + ':' + ((seconds < 10) ? '0' + seconds : seconds);
|
187
|
+
}
|
188
|
+
|
189
|
+
function unformatTime (string) {
|
190
|
+
var timeArray = string.split(':'),
|
191
|
+
seconds = 0;
|
192
|
+
// turn hours and minutes into seconds and add them all up
|
193
|
+
if (timeArray.length === 3) {
|
194
|
+
// hours
|
195
|
+
seconds = seconds + (Number(timeArray[0]) * 60 * 60);
|
196
|
+
// minutes
|
197
|
+
seconds = seconds + (Number(timeArray[1]) * 60);
|
198
|
+
// seconds
|
199
|
+
seconds = seconds + Number(timeArray[2]);
|
200
|
+
} else if (timeArray.lenght === 2) {
|
201
|
+
// minutes
|
202
|
+
seconds = seconds + (Number(timeArray[0]) * 60);
|
203
|
+
// seconds
|
204
|
+
seconds = seconds + Number(timeArray[1]);
|
205
|
+
}
|
206
|
+
return Number(seconds);
|
207
|
+
}
|
208
|
+
|
209
|
+
function formatNumber (n, format) {
|
210
|
+
var negP = false,
|
211
|
+
optDec = false,
|
212
|
+
abbr = '',
|
213
|
+
bytes = '',
|
214
|
+
ord = '',
|
215
|
+
abs = Math.abs(n._n);
|
216
|
+
|
217
|
+
// check if number is zero and a custom zero format has been set
|
218
|
+
if (n._n === 0 && zeroFormat !== null) {
|
219
|
+
return zeroFormat;
|
220
|
+
} else {
|
221
|
+
// see if we should use parentheses for negative number
|
222
|
+
if (format.indexOf('(') > -1) {
|
223
|
+
negP = true;
|
224
|
+
format = format.slice(1, -1);
|
225
|
+
}
|
226
|
+
|
227
|
+
// see if abbreviation is wanted
|
228
|
+
if (format.indexOf('a') > -1) {
|
229
|
+
// check for space before abbreviation
|
230
|
+
if (format.indexOf(' a') > -1) {
|
231
|
+
abbr = ' ';
|
232
|
+
format = format.replace(' a', '');
|
233
|
+
} else {
|
234
|
+
format = format.replace('a', '');
|
235
|
+
}
|
236
|
+
|
237
|
+
if (abs >= Math.pow(10, 12)) {
|
238
|
+
// trillion
|
239
|
+
abbr = abbr + languages[currentLanguage].abbreviations.tillion;
|
240
|
+
n._n = n._n / Math.pow(10, 12);
|
241
|
+
} else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9)) {
|
242
|
+
// billion
|
243
|
+
abbr = abbr + languages[currentLanguage].abbreviations.billion;
|
244
|
+
n._n = n._n / Math.pow(10, 9);
|
245
|
+
} else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6)) {
|
246
|
+
// million
|
247
|
+
abbr = abbr + languages[currentLanguage].abbreviations.million;
|
248
|
+
n._n = n._n / Math.pow(10, 6);
|
249
|
+
} else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3)) {
|
250
|
+
// thousand
|
251
|
+
abbr = abbr + languages[currentLanguage].abbreviations.thousand;
|
252
|
+
n._n = n._n / Math.pow(10, 3);
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
// see if we are formatting bytes
|
257
|
+
if (format.indexOf('b') > -1) {
|
258
|
+
// check for space before
|
259
|
+
if (format.indexOf(' b') > -1) {
|
260
|
+
bytes = ' ';
|
261
|
+
format = format.replace(' b', '');
|
262
|
+
} else {
|
263
|
+
format = format.replace('b', '');
|
264
|
+
}
|
265
|
+
|
266
|
+
var prefixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
267
|
+
min,
|
268
|
+
max;
|
269
|
+
|
270
|
+
for (var power = 0; power <= prefixes.length; power++) {
|
271
|
+
min = Math.pow(1024, power);
|
272
|
+
max = Math.pow(1024, power+1);
|
273
|
+
|
274
|
+
if (n._n >= min && n._n < max) {
|
275
|
+
bytes = bytes + prefixes[power];
|
276
|
+
if (min > 0) {
|
277
|
+
n._n = n._n / min;
|
278
|
+
}
|
279
|
+
break;
|
280
|
+
}
|
281
|
+
}
|
282
|
+
}
|
283
|
+
|
284
|
+
// see if ordinal is wanted
|
285
|
+
if (format.indexOf('o') > -1) {
|
286
|
+
// check for space before
|
287
|
+
if (format.indexOf(' o') > -1) {
|
288
|
+
ord = ' ';
|
289
|
+
format = format.replace(' o', '');
|
290
|
+
} else {
|
291
|
+
format = format.replace('o', '');
|
292
|
+
}
|
293
|
+
|
294
|
+
ord = ord + languages[currentLanguage].ordinal(n._n);
|
295
|
+
}
|
296
|
+
|
297
|
+
if (format.indexOf('[.]') > -1) {
|
298
|
+
optDec = true;
|
299
|
+
format = format.replace('[.]', '.');
|
300
|
+
}
|
301
|
+
|
302
|
+
var w = n._n.toString().split('.')[0],
|
303
|
+
precision = format.split('.')[1],
|
304
|
+
thousands = format.indexOf(','),
|
305
|
+
d = '',
|
306
|
+
neg = false;
|
307
|
+
|
308
|
+
if (precision) {
|
309
|
+
if (precision.indexOf('[') > -1) {
|
310
|
+
precision = precision.replace(']', '');
|
311
|
+
precision = precision.split('[');
|
312
|
+
d = toFixed(n._n, (precision[0].length + precision[1].length), precision[1].length);
|
313
|
+
} else {
|
314
|
+
d = toFixed(n._n, precision.length);
|
315
|
+
}
|
316
|
+
|
317
|
+
w = d.split('.')[0];
|
318
|
+
|
319
|
+
if (d.split('.')[1].length) {
|
320
|
+
d = languages[currentLanguage].delimiters.decimal + d.split('.')[1];
|
321
|
+
} else {
|
322
|
+
d = '';
|
323
|
+
}
|
324
|
+
|
325
|
+
if (optDec && Number(d) === 0) {
|
326
|
+
d = '';
|
327
|
+
}
|
328
|
+
} else {
|
329
|
+
w = toFixed(n._n, null);
|
330
|
+
}
|
331
|
+
|
332
|
+
// format number
|
333
|
+
if (w.indexOf('-') > -1) {
|
334
|
+
w = w.slice(1);
|
335
|
+
neg = true;
|
336
|
+
}
|
337
|
+
|
338
|
+
if (thousands > -1) {
|
339
|
+
w = w.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + languages[currentLanguage].delimiters.thousands);
|
340
|
+
}
|
341
|
+
|
342
|
+
if (format.indexOf('.') === 0) {
|
343
|
+
w = '';
|
344
|
+
}
|
345
|
+
|
346
|
+
return ((negP && neg) ? '(' : '') + ((!negP && neg) ? '-' : '') + w + d + ((ord) ? ord : '') + ((abbr) ? abbr : '') + ((bytes) ? bytes : '') + ((negP && neg) ? ')' : '');
|
347
|
+
}
|
348
|
+
}
|
349
|
+
|
350
|
+
/************************************
|
351
|
+
Top Level Functions
|
352
|
+
************************************/
|
353
|
+
|
354
|
+
numeral = function (input) {
|
355
|
+
if (numeral.isNumeral(input)) {
|
356
|
+
input = input.value();
|
357
|
+
} else if (!Number(input)) {
|
358
|
+
input = 0;
|
359
|
+
}
|
360
|
+
|
361
|
+
return new Numeral(Number(input));
|
362
|
+
};
|
363
|
+
|
364
|
+
// version number
|
365
|
+
numeral.version = VERSION;
|
366
|
+
|
367
|
+
// compare numeral object
|
368
|
+
numeral.isNumeral = function (obj) {
|
369
|
+
return obj instanceof Numeral;
|
370
|
+
};
|
371
|
+
|
372
|
+
// This function will load languages and then set the global language. If
|
373
|
+
// no arguments are passed in, it will simply return the current global
|
374
|
+
// language key.
|
375
|
+
numeral.language = function (key, values) {
|
376
|
+
if (!key) {
|
377
|
+
return currentLanguage;
|
378
|
+
}
|
379
|
+
|
380
|
+
if (key && !values) {
|
381
|
+
currentLanguage = key;
|
382
|
+
}
|
383
|
+
|
384
|
+
if (values || !languages[key]) {
|
385
|
+
loadLanguage(key, values);
|
386
|
+
}
|
387
|
+
|
388
|
+
return numeral;
|
389
|
+
};
|
390
|
+
|
391
|
+
numeral.language('en', {
|
392
|
+
delimiters: {
|
393
|
+
thousands: ',',
|
394
|
+
decimal: '.'
|
395
|
+
},
|
396
|
+
abbreviations: {
|
397
|
+
thousand: 'k',
|
398
|
+
million: 'm',
|
399
|
+
billion: 'b',
|
400
|
+
trillion: 't'
|
401
|
+
},
|
402
|
+
ordinal: function (number) {
|
403
|
+
var b = number % 10;
|
404
|
+
return (~~ (number % 100 / 10) === 1) ? 'th' :
|
405
|
+
(b === 1) ? 'st' :
|
406
|
+
(b === 2) ? 'nd' :
|
407
|
+
(b === 3) ? 'rd' : 'th';
|
408
|
+
},
|
409
|
+
currency: {
|
410
|
+
symbol: '$'
|
411
|
+
}
|
412
|
+
});
|
413
|
+
|
414
|
+
numeral.zeroFormat = function (format) {
|
415
|
+
if (typeof(format) === 'string') {
|
416
|
+
zeroFormat = format;
|
417
|
+
} else {
|
418
|
+
zeroFormat = null;
|
419
|
+
}
|
420
|
+
};
|
421
|
+
|
422
|
+
/************************************
|
423
|
+
Helpers
|
424
|
+
************************************/
|
425
|
+
|
426
|
+
function loadLanguage(key, values) {
|
427
|
+
languages[key] = values;
|
428
|
+
}
|
429
|
+
|
430
|
+
|
431
|
+
/************************************
|
432
|
+
Numeral Prototype
|
433
|
+
************************************/
|
434
|
+
|
435
|
+
|
436
|
+
numeral.fn = Numeral.prototype = {
|
437
|
+
|
438
|
+
clone : function () {
|
439
|
+
return numeral(this);
|
440
|
+
},
|
441
|
+
|
442
|
+
format : function (inputString) {
|
443
|
+
return formatNumeral(this, inputString ? inputString : numeral.defaultFormat);
|
444
|
+
},
|
445
|
+
|
446
|
+
unformat : function (inputString) {
|
447
|
+
return unformatNumeral(this, inputString ? inputString : numeral.defaultFormat);
|
448
|
+
},
|
449
|
+
|
450
|
+
value : function () {
|
451
|
+
return this._n;
|
452
|
+
},
|
453
|
+
|
454
|
+
valueOf : function () {
|
455
|
+
return this._n;
|
456
|
+
},
|
457
|
+
|
458
|
+
set : function (value) {
|
459
|
+
this._n = Number(value);
|
460
|
+
return this;
|
461
|
+
},
|
462
|
+
|
463
|
+
add : function (value) {
|
464
|
+
this._n = this._n + Number(value);
|
465
|
+
return this;
|
466
|
+
},
|
467
|
+
|
468
|
+
subtract : function (value) {
|
469
|
+
this._n = this._n - Number(value);
|
470
|
+
return this;
|
471
|
+
},
|
472
|
+
|
473
|
+
multiply : function (value) {
|
474
|
+
this._n = this._n * Number(value);
|
475
|
+
return this;
|
476
|
+
},
|
477
|
+
|
478
|
+
divide : function (value) {
|
479
|
+
this._n = this._n / Number(value);
|
480
|
+
return this;
|
481
|
+
},
|
482
|
+
|
483
|
+
difference : function (value) {
|
484
|
+
var difference = this._n - Number(value);
|
485
|
+
|
486
|
+
if (difference < 0) {
|
487
|
+
difference = -difference;
|
488
|
+
}
|
489
|
+
|
490
|
+
return difference;
|
491
|
+
}
|
492
|
+
|
493
|
+
};
|
494
|
+
|
495
|
+
/************************************
|
496
|
+
Exposing Numeral
|
497
|
+
************************************/
|
498
|
+
|
499
|
+
// CommonJS module is defined
|
500
|
+
if (hasModule) {
|
501
|
+
module.exports = numeral;
|
502
|
+
}
|
503
|
+
|
504
|
+
/*global ender:false */
|
505
|
+
if (typeof ender === 'undefined') {
|
506
|
+
// here, `this` means `window` in the browser, or `global` on the server
|
507
|
+
// add `numeral` as a global object via a string identifier,
|
508
|
+
// for Closure Compiler 'advanced' mode
|
509
|
+
this['numeral'] = numeral;
|
510
|
+
}
|
511
|
+
|
512
|
+
/*global define:false */
|
513
|
+
if (typeof define === 'function' && define.amd) {
|
514
|
+
define([], function () {
|
515
|
+
return numeral;
|
516
|
+
});
|
517
|
+
}
|
518
|
+
}).call(this);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
// numeral.js
|
2
|
+
// version : 1.4.5
|
3
|
+
// author : Adam Draper
|
4
|
+
// license : MIT
|
5
|
+
// http://adamwdraper.github.com/Numeral-js/
|
6
|
+
(function(){function o(e){this._n=e}function u(e,t,n){var r=Math.pow(10,t),i;i=(Math.round(e*r)/r).toFixed(t);if(n){var s=new RegExp("0{1,"+n+"}$");i=i.replace(s,"")}return i}function a(e,t){var n;t.indexOf("$")>-1?n=l(e,t):t.indexOf("%")>-1?n=c(e,t):t.indexOf(":")>-1?n=h(e,t):n=d(e,t);return n}function f(e,t){if(t.indexOf(":")>-1)e._n=p(t);else if(t===i)e._n=0;else{var s=t;n[r].delimiters.decimal!=="."&&(t=t.replace(/\./g,"").replace(n[r].delimiters.decimal,"."));var o=new RegExp(n[r].abbreviations.thousand+"(?:\\)|(\\"+n[r].currency.symbol+")?(?:\\))?)?$"),u=new RegExp(n[r].abbreviations.million+"(?:\\)|(\\"+n[r].currency.symbol+")?(?:\\))?)?$"),a=new RegExp(n[r].abbreviations.billion+"(?:\\)|(\\"+n[r].currency.symbol+")?(?:\\))?)?$"),f=new RegExp(n[r].abbreviations.trillion+"(?:\\)|(\\"+n[r].currency.symbol+")?(?:\\))?)?$"),l=["KB","MB","GB","TB","PB","EB","ZB","YB"],c=!1;for(var h=0;h<=l.length;h++){c=t.indexOf(l[h])>-1?Math.pow(1024,h+1):!1;if(c)break}e._n=(c?c:1)*(s.match(o)?Math.pow(10,3):1)*(s.match(u)?Math.pow(10,6):1)*(s.match(a)?Math.pow(10,9):1)*(s.match(f)?Math.pow(10,12):1)*(t.indexOf("%")>-1?.01:1)*Number((t.indexOf("(")>-1?"-":"")+t.replace(/[^0-9\.'-]+/g,""));e._n=c?Math.ceil(e._n):e._n}return e._n}function l(e,t){var i=t.indexOf("$")<=1?!0:!1,s="";if(t.indexOf(" $")>-1){s=" ";t=t.replace(" $","")}else if(t.indexOf("$ ")>-1){s=" ";t=t.replace("$ ","")}else t=t.replace("$","");var o=a(e,t);if(i)if(o.indexOf("(")>-1||o.indexOf("-")>-1){o=o.split("");o.splice(1,0,n[r].currency.symbol+s);o=o.join("")}else o=n[r].currency.symbol+s+o;else if(o.indexOf(")")>-1){o=o.split("");o.splice(-1,0,s+n[r].currency.symbol);o=o.join("")}else o=o+s+n[r].currency.symbol;return o}function c(e,t){var n="";if(t.indexOf(" %")>-1){n=" ";t=t.replace(" %","")}else t=t.replace("%","");e._n=e._n*100;var r=a(e,t);if(r.indexOf(")")>-1){r=r.split("");r.splice(-1,0,n+"%");r=r.join("")}else r=r+n+"%";return r}function h(e,t){var n=Math.floor(e._n/60/60),r=Math.floor((e._n-n*60*60)/60),i=Math.round(e._n-n*60*60-r*60);return n+":"+(r<10?"0"+r:r)+":"+(i<10?"0"+i:i)}function p(e){var t=e.split(":"),n=0;if(t.length===3){n+=Number(t[0])*60*60;n+=Number(t[1])*60;n+=Number(t[2])}else if(t.lenght===2){n+=Number(t[0])*60;n+=Number(t[1])}return Number(n)}function d(e,t){var s=!1,o=!1,a="",f="",l="",c=Math.abs(e._n);if(e._n===0&&i!==null)return i;if(t.indexOf("(")>-1){s=!0;t=t.slice(1,-1)}if(t.indexOf("a")>-1){if(t.indexOf(" a")>-1){a=" ";t=t.replace(" a","")}else t=t.replace("a","");if(c>=Math.pow(10,12)){a+=n[r].abbreviations.tillion;e._n=e._n/Math.pow(10,12)}else if(c<Math.pow(10,12)&&c>=Math.pow(10,9)){a+=n[r].abbreviations.billion;e._n=e._n/Math.pow(10,9)}else if(c<Math.pow(10,9)&&c>=Math.pow(10,6)){a+=n[r].abbreviations.million;e._n=e._n/Math.pow(10,6)}else if(c<Math.pow(10,6)&&c>=Math.pow(10,3)){a+=n[r].abbreviations.thousand;e._n=e._n/Math.pow(10,3)}}if(t.indexOf("b")>-1){if(t.indexOf(" b")>-1){f=" ";t=t.replace(" b","")}else t=t.replace("b","");var h=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],p,d;for(var v=0;v<=h.length;v++){p=Math.pow(1024,v);d=Math.pow(1024,v+1);if(e._n>=p&&e._n<d){f+=h[v];p>0&&(e._n=e._n/p);break}}}if(t.indexOf("o")>-1){if(t.indexOf(" o")>-1){l=" ";t=t.replace(" o","")}else t=t.replace("o","");l+=n[r].ordinal(e._n)}if(t.indexOf("[.]")>-1){o=!0;t=t.replace("[.]",".")}var m=e._n.toString().split(".")[0],g=t.split(".")[1],y=t.indexOf(","),b="",w=!1;if(g){if(g.indexOf("[")>-1){g=g.replace("]","");g=g.split("[");b=u(e._n,g[0].length+g[1].length,g[1].length)}else b=u(e._n,g.length);m=b.split(".")[0];b.split(".")[1].length?b=n[r].delimiters.decimal+b.split(".")[1]:b="";o&&Number(b)===0&&(b="")}else m=u(e._n,null);if(m.indexOf("-")>-1){m=m.slice(1);w=!0}y>-1&&(m=m.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+n[r].delimiters.thousands));t.indexOf(".")===0&&(m="");return(s&&w?"(":"")+(!s&&w?"-":"")+m+b+(l?l:"")+(a?a:"")+(f?f:"")+(s&&w?")":"")}function v(e,t){n[e]=t}var e,t="1.4.5",n={},r="en",i=null,s=typeof module!="undefined"&&module.exports;e=function(t){e.isNumeral(t)?t=t.value():Number(t)||(t=0);return new o(Number(t))};e.version=t;e.isNumeral=function(e){return e instanceof o};e.language=function(t,i){if(!t)return r;t&&!i&&(r=t);(i||!n[t])&&v(t,i);return e};e.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){var t=e%10;return~~(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th"},currency:{symbol:"$"}});e.zeroFormat=function(e){typeof e=="string"?i=e:i=null};e.fn=o.prototype={clone:function(){return e(this)},format:function(t){return a(this,t?t:e.defaultFormat)},unformat:function(t){return f(this,t?t:e.defaultFormat)},value:function(){return this._n},valueOf:function(){return this._n},set:function(e){this._n=Number(e);return this},add:function(e){this._n=this._n+Number(e);return this},subtract:function(e){this._n=this._n-Number(e);return this},multiply:function(e){this._n=this._n*Number(e);return this},divide:function(e){this._n=this._n/Number(e);return this},difference:function(e){var t=this._n-Number(e);t<0&&(t=-t);return t}};s&&(module.exports=e);typeof ender=="undefined"&&(this.numeral=e);typeof define=="function"&&define.amd&&define([],function(){return e})}).call(this);
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: numeraljs-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Adam Draper
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-30 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: A javascript library for formatting and manipulating numbers.
|
15
|
+
email: rustam@zagirov.name
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/numeraljs-rails.rb
|
21
|
+
- vendor/assets/javascripts/languages/cs.js
|
22
|
+
- vendor/assets/javascripts/languages/de-de.js
|
23
|
+
- vendor/assets/javascripts/languages/en-gb.js
|
24
|
+
- vendor/assets/javascripts/languages/es.js
|
25
|
+
- vendor/assets/javascripts/languages/fr.js
|
26
|
+
- vendor/assets/javascripts/languages/it.js
|
27
|
+
- vendor/assets/javascripts/languages/min/cs.min.js
|
28
|
+
- vendor/assets/javascripts/languages/min/de-de.min.js
|
29
|
+
- vendor/assets/javascripts/languages/min/en-gb.min.js
|
30
|
+
- vendor/assets/javascripts/languages/min/es.min.js
|
31
|
+
- vendor/assets/javascripts/languages/min/fr.min.js
|
32
|
+
- vendor/assets/javascripts/languages/min/it.min.js
|
33
|
+
- vendor/assets/javascripts/languages/min/pt-br.min.js
|
34
|
+
- vendor/assets/javascripts/languages/min/pt-pt.min.js
|
35
|
+
- vendor/assets/javascripts/languages/min/ru.min.js
|
36
|
+
- vendor/assets/javascripts/languages/min/tr.min.js
|
37
|
+
- vendor/assets/javascripts/languages/pt-br.js
|
38
|
+
- vendor/assets/javascripts/languages/pt-pt.js
|
39
|
+
- vendor/assets/javascripts/languages/ru.js
|
40
|
+
- vendor/assets/javascripts/languages/tr.js
|
41
|
+
- vendor/assets/javascripts/numeral.js
|
42
|
+
- vendor/assets/javascripts/numeral.min.js
|
43
|
+
homepage: http://numeraljs.com/
|
44
|
+
licenses: []
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 1.8.24
|
64
|
+
signing_key:
|
65
|
+
specification_version: 3
|
66
|
+
summary: Numeral.js
|
67
|
+
test_files: []
|
68
|
+
has_rdoc:
|