Skip to content
This repository was archived by the owner on Jul 26, 2023. It is now read-only.

Commit

Permalink
Merge branch 'pr/103' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwdraper committed Oct 30, 2013
2 parents c9ba580 + a00de62 commit ab8426d
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 1 deletion.
35 changes: 35 additions & 0 deletions languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,41 @@
}
}());

/*!
* numeral.js language configuration
* language : slovak (sk)
* author : Ahmed Al Hafoudh : http://www.freevision.sk
*/
(function () {
var language = {
delimiters: {
thousands: ' ',
decimal: ','
},
abbreviations: {
thousand: 'tis.',
million: 'mil.',
billion: 'b',
trillion: 't'
},
ordinal: function () {
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('sk', language);
}
}());

/*!
* numeral.js language configuration
* language : thai (th)
Expand Down
34 changes: 34 additions & 0 deletions languages/sk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*!
* numeral.js language configuration
* language : slovak (sk)
* author : Ahmed Al Hafoudh : http://www.freevision.sk
*/
(function () {
var language = {
delimiters: {
thousands: ' ',
decimal: ','
},
abbreviations: {
thousand: 'tis.',
million: 'mil.',
billion: 'b',
trillion: 't'
},
ordinal: function () {
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('sk', language);
}
}());
7 changes: 6 additions & 1 deletion min/languages.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ function(){var a={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand
* language : russian (ru)
* author : Anatoli Papirovski : https://github.com/apapirovski
*/
function(){var a={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"тыс.",million:"млн",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"руб."}};"undefined"!=typeof module&&module.exports&&(module.exports=a),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("ru",a)}(),/*!
function(){var a={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"тыс.",million:"млн",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"руб."}};"undefined"!=typeof module&&module.exports&&(module.exports=a),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("ru",a)}(),/*!
* numeral.js language configuration
* language : slovak (sk)
* author : Ahmed Al Hafoudh : http://www.freevision.sk
*/
function(){var a={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"tis.",million:"mil.",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"€"}};"undefined"!=typeof module&&module.exports&&(module.exports=a),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("sk",a)}(),/*!
* numeral.js language configuration
* language : thai (th)
* author : Sathit Jittanupat : https://github.com/jojosati
Expand Down
6 changes: 6 additions & 0 deletions min/languages/sk.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*!
* numeral.js language configuration
* language : slovak (sk)
* author : Ahmed Al Hafoudh : http://www.freevision.sk
*/
!function(){var a={delimiters:{thousands:" ",decimal:","},abbreviations:{thousand:"tis.",million:"mil.",billion:"b",trillion:"t"},ordinal:function(){return"."},currency:{symbol:"€"}};"undefined"!=typeof module&&module.exports&&(module.exports=a),"undefined"!=typeof window&&this.numeral&&this.numeral.language&&this.numeral.language("sk",a)}();
101 changes: 101 additions & 0 deletions tests/languages/sk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
var numeral = require('../../numeral'),
language = require('../../languages/sk');

numeral.language('sk', language);

exports['language:sk'] = {
setUp: function (callback) {
numeral.language('sk');
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,2mil.'],
[1460,'0a','1tis.'],
[-104000,'0a','-104tis.'],
[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,23mil.']
];

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,23mil.)',-1230000],
['10tis.',10000],
['-10tis.',-10000],
['23e',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();
}
};

0 comments on commit ab8426d

Please sign in to comment.