humanize-duration
Advanced tools
Comparing version 0.2.0 to 0.3.0
/* | ||
HumanizeDuration.js | ||
http://git.io/j0HgmQ | ||
Lovingly made by Evan Hahn. Unlicensed. | ||
Lovingly made by Evan Hahn with language support by Martin Prins. Unlicensed. | ||
@@ -76,40 +77,50 @@ */ | ||
en: { | ||
year: function (c) { return "year" + ((c !== 1) ? 's' :'');}, | ||
month: function (c) { return "month" + ((c !== 1) ? 's' :'');}, | ||
week: function (c) { return "week" + ((c !== 1) ? 's' :'');}, | ||
day: function (c) { return "day" + ((c !== 1) ? 's' :'');}, | ||
hour: function (c) { return "hour" + ((c !== 1) ? 's' :'');}, | ||
minute: function (c) { return "minute" + ((c !== 1) ? 's' :'');}, | ||
second: function (c) { return "second" + ((c !== 1) ? 's' :'');}, | ||
millisecond: function (c) { return "millisecond" + ((c !== 1) ? 's' :'');} | ||
year: function(c) { return "year" + ((c !== 1) ? "s" : ""); }, | ||
month: function(c) { return "month" + ((c !== 1) ? "s" : ""); }, | ||
week: function(c) { return "week" + ((c !== 1) ? "s" : ""); }, | ||
day: function(c) { return "day" + ((c !== 1) ? "s" : ""); }, | ||
hour: function(c) { return "hour" + ((c !== 1) ? "s" : ""); }, | ||
minute: function(c) { return "minute" + ((c !== 1) ? "s" : ""); }, | ||
second: function(c) { return "second" + ((c !== 1) ? "s" : ""); }, | ||
millisecond: function(c) { return "millisecond" + ((c !== 1) ? "s" : ""); } | ||
}, | ||
ca: { | ||
year: function (c) { return "any" + ((c !== 1) ? 's' :'');}, | ||
month: function (c) { return "mes" + ((c !== 1) ? 'os' :'');}, | ||
week: function (c) { return "setman" + ((c !== 1) ? 'es' :'a');}, | ||
day: function (c) { return "di" + ((c !== 1) ? 'es' :'a');}, | ||
hour: function (c) { return "hor" + ((c !== 1) ? 'es' :'a');}, | ||
minute: function (c) { return "minut" + ((c !== 1) ? 's' :'');}, | ||
second: function (c) { return "segon" + ((c !== 1) ? 's' :'');}, | ||
millisecond: function (c) { return "milisegon" + ((c !== 1) ? 's' :'');} | ||
year: function(c) { return "any" + ((c !== 1) ? "s" : ""); }, | ||
month: function(c) { return "mes" + ((c !== 1) ? "os" : ""); }, | ||
week: function(c) { return "setman" + ((c !== 1) ? "es" :"a"); }, | ||
day: function(c) { return "di" + ((c !== 1) ? "es" :"a"); }, | ||
hour: function(c) { return "hor" + ((c !== 1) ? "es" :"a"); }, | ||
minute: function(c) { return "minut" + ((c !== 1) ? "s" : ""); }, | ||
second: function(c) { return "segon" + ((c !== 1) ? "s" : ""); }, | ||
millisecond: function(c) { return "milisegon" + ((c !== 1) ? "s" : "" ); } | ||
}, | ||
es: { | ||
year: function (c) { return "año" + ((c !== 1) ? 's' :'');}, | ||
month: function (c) { return "mes" + ((c !== 1) ? 'es' :'');}, | ||
week: function (c) { return "semana" + ((c !== 1) ? 's' :'');}, | ||
day: function (c) { return "día" + ((c !== 1) ? 's' :'');}, | ||
hour: function (c) { return "hora" + ((c !== 1) ? 's' :'');}, | ||
minute: function (c) { return "minuto" + ((c !== 1) ? 's' :'');}, | ||
second: function (c) { return "segundo" + ((c !== 1) ? 's' :'');}, | ||
millisecond: function (c) { return "milisegundo" + ((c !== 1) ? 's' :'');} | ||
year: function(c) { return "año" + ((c !== 1) ? "s" : ""); }, | ||
month: function(c) { return "mes" + ((c !== 1) ? "es" : ""); }, | ||
week: function(c) { return "semana" + ((c !== 1) ? "s" : ""); }, | ||
day: function(c) { return "día" + ((c !== 1) ? "s" : ""); }, | ||
hour: function(c) { return "hora" + ((c !== 1) ? "s" : ""); }, | ||
minute: function(c) { return "minuto" + ((c !== 1) ? "s" : ""); }, | ||
second: function(c) { return "segundo" + ((c !== 1) ? "s" : ""); }, | ||
millisecond: function(c) { return "milisegundo" + ((c !== 1) ? "s" : "" ); } | ||
}, | ||
fr: { | ||
year: function (c) { return "an" + ((c !== 1) ? 's' :'');}, | ||
month: function (c) { return "mois";}, | ||
week: function (c) { return "semaine" + ((c !== 1) ? 's' :'');}, | ||
day: function (c) { return "jour" + ((c !== 1) ? 's' :'');}, | ||
hour: function (c) { return "heure" + ((c !== 1) ? 's' :'');}, | ||
minute: function (c) { return "minute" + ((c !== 1) ? 's' :'');}, | ||
second: function (c) { return "seconde" + ((c !== 1) ? 's' :'');}, | ||
millisecond: function (c) { return "milliseconde" + ((c !== 1) ? 's' :'');} | ||
year: function(c) { return "an" + ((c !== 1) ? "s" : ""); }, | ||
month: function(c) { return "mois"; }, | ||
week: function(c) { return "semaine" + ((c !== 1) ? "s" : ""); }, | ||
day: function(c) { return "jour" + ((c !== 1) ? "s" : ""); }, | ||
hour: function(c) { return "heure" + ((c !== 1) ? "s" : ""); }, | ||
minute: function(c) { return "minute" + ((c !== 1) ? "s" : ""); }, | ||
second: function(c) { return "seconde" + ((c !== 1) ? "s" : ""); }, | ||
millisecond: function(c) { return "milliseconde" + ((c !== 1) ? "s" : ""); } | ||
}, | ||
pt: { | ||
year: function(c) { return "ano" + ((c !== 1) ? "s" : ""); }, | ||
month: function(c) { return "mês"((c !== 1) ? "es" : ""); }, | ||
week: function(c) { return "semana" + ((c !== 1) ? "s" : ""); }, | ||
day: function(c) { return "dia" + ((c !== 1) ? "s" : ""); }, | ||
hour: function(c) { return "hora" + ((c !== 1) ? "s" : ""); }, | ||
minute: function(c) { return "minuto" + ((c !== 1) ? "s" : ""); }, | ||
second: function(c) { return "segundo" + ((c !== 1) ? "s" : ""); }, | ||
millisecond: function(c) { return "milesegundo" + ((c !== 1) ? "s" : ""); } | ||
} | ||
@@ -116,0 +127,0 @@ } |
{ | ||
"name": "humanize-duration", | ||
"author": "Evan Hahn", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Convert millisecond durations to English (or a few other languages).", | ||
@@ -6,0 +6,0 @@ "main": "humanize-duration.js", |
@@ -10,3 +10,3 @@ Humanize Duration | ||
humanizeDuration(97320000); // "1 day, 3 hours, 2 minutes" | ||
humanizeDuration(3000, "es"); // "3 seconds" | ||
humanizeDuration(3000, "es"); // "3 segundos" | ||
@@ -34,3 +34,4 @@ humanizeDuration.language = "fr"; // change default language to French | ||
* Catalan (ca) | ||
* Portuguese (pt) | ||
Lovingly made by [Evan Hahn](http://evanhahn.com/) with language support by [Martin Prins](http://thingsofgeek.com/). Enjoy! | ||
Lovingly made by [Evan Hahn](http://evanhahn.com/) with language support by [Martin Prins](https://github.com/magarcia). Enjoy! |
@@ -137,15 +137,2 @@ "use strict"; | ||
it("humanizes Spanish when passed as an argument", function() { | ||
humanizing((1).second(), "es").should.equal("1 segundo"); | ||
humanizing((2).seconds(), "es").should.equal("2 segundos"); | ||
humanizing((5).years(), "es").should.equal("5 años"); | ||
}); | ||
it("humanizes Spanish when the default language is changed", function() { | ||
humanizing.language = "es"; | ||
humanizing((1).second()).should.equal("1 segundo"); | ||
humanizing((2).seconds()).should.equal("2 segundos"); | ||
humanizing((5).years()).should.equal("5 años"); | ||
}); | ||
it("keeps Number objects intact", function() { | ||
@@ -152,0 +139,0 @@ var duration = new Number(2012); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16686
10
306
36