]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Adding minifier in build script for lang files
authorTim Wood <washwithcare@gmail.com>
Thu, 13 Oct 2011 18:41:22 +0000 (11:41 -0700)
committerTim Wood <washwithcare@gmail.com>
Thu, 13 Oct 2011 18:41:22 +0000 (11:41 -0700)
Now builds `lang/fr.min.js` and `lang/all.min.js`

build.js
lang/all.min.js [new file with mode: 0644]
lang/fr.js
lang/fr.min.js [new file with mode: 0644]
lang/it.min.js [new file with mode: 0644]
lang/pt.min.js [new file with mode: 0644]
underscore.date.min.js

index b4a7affc755cc6e20044fd5d5d54b13f6b508591..5e05b08a66a9c01fdafa99996d5ba3ae22f68162 100755 (executable)
--- a/build.js
+++ b/build.js
@@ -2,7 +2,13 @@ var fs     = require('fs'),
     uglify = require('uglify-js'),
     jshint = require('jshint');
 
-var config = {
+
+/*********************************************
+    Constants
+*********************************************/
+
+
+var JSHINT_CONFIG = {
     "node" : true,
     "es5" : true,
     "browser" : true,
@@ -27,43 +33,107 @@ var config = {
     "sub": true,
     "strict": false,
     "white": true
-}
-    
+};
+var LANGS = "fr it pt".split(" ");
+
+
+/*********************************************
+    Helpers
+*********************************************/
+
+/*
+ * function to minify a string and write to a file
+ *
+ * @param {String} source The source JS
+ * @param {String} dest The file destination
+ */
 function makeFile(filename, contents) {
     fs.writeFileSync(filename, contents);
     console.log(filename + " saved");
 }
 
-function minify() {
-    var output = fs.readFileSync('./underscore.date.js', 'utf8'), 
-        ast, 
+/*********************************************
+    Uglify
+*********************************************/
+
+/*
+ * function to minify a string and write to a file
+ *
+ * @param {String} source The source JS
+ * @param {String} dest The file destination
+ */
+function minifyToFile(source, dest) {
+    var ast, 
         ugly;
-    ast  = uglify.parser.parse(output);
+    ast  = uglify.parser.parse(source);
     ast  = uglify.uglify.ast_mangle(ast);
     ast  = uglify.uglify.ast_squeeze(ast);
     ugly = uglify.uglify.gen_code(ast);
-        
-    makeFile('./underscore.date.min.js', ugly);
+
+    makeFile('./' + dest + '.min.js', ugly);
 }
 
+
+/*********************************************
+    JSHint
+*********************************************/
+
+
 function logError(error) {
     console.log('==== ' + error.id + ' ' + error.line + ':' + error.character);
     console.log('     ' + error.reason);
     console.log('     ' + error.evidence);
 }
 
-(function(){
-    var source = fs.readFileSync('./underscore.date.js', 'utf8');
+function hint(source, name) {
+    var passed = jshint.JSHINT(source, JSHINT_CONFIG);
 
-    var passed = jshint.JSHINT(source, config);
-       
     if (passed) {
-        console.log(' passed jshint ');
-        minify();
+        console.log(name + ' passed jshint ');
+        return true;
     } else {
         console.log('============================================');
-        console.log(' failed jshint ');
+        console.log(name + ' failed jshint ');
         jshint.JSHINT.errors.forEach(logError);
         console.log('============================================');
+        return false;
+    }
+}
+
+
+/*********************************************
+    Lang
+*********************************************/
+
+
+(function(){
+    var allSource = '',
+        i,
+        failures = 0,
+        source;
+    for (i = 0; i < LANGS.length; i++) {
+        source = fs.readFileSync('./lang/' + LANGS[i] + '.js', 'utf8');
+        if (hint(source, 'lang/' + LANGS[i])) {
+            minifyToFile(source, 'lang/' + LANGS[i]);
+            allSource += source;
+        } else {
+            failures ++;
+        }
+    }
+    if (failures === 0) {
+        minifyToFile(allSource, 'lang/all');
+    }
+})();
+
+
+/*********************************************
+    Main
+*********************************************/
+
+
+(function(){
+    var source = fs.readFileSync('./underscore.date.js', 'utf8');
+    if (hint(source, 'underscore.date')) {
+        minifyToFile(source, 'underscore.date');
     }
 })();
\ No newline at end of file
diff --git a/lang/all.min.js b/lang/all.min.js
new file mode 100644 (file)
index 0000000..68d4cc8
--- /dev/null
@@ -0,0 +1 @@
+(function(){var a={months:"Janvier_Février_Mars_Avril_Mai_Juin_Juillet_Aout_Septembre_Octobre_Novembre_Décembre".split("_"),monthsShort:"Jan_Fev_Mar_Avr_Mai_Jui_Jui_Aou_Sep_Oct_Nov_Dec".split("_"),weekdays:"Dimanche_Lundi_Mardi_Mercredi_Jeudi_Vendredi_Samedi".split("_"),weekdaysShort:"Dim_Lun_Mar_Mer_Jeu_Ven_Sam".split("_"),relativeTime:{future:"in %s",past:"il y a %s",s:"secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"une année",yy:"%d années"},ordinal:function(a){return~~(a%100/10)===1?"er":"ème"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this._date&&this._date.lang&&this._date.lang("fr",a)})(),function(){var a={months:"Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settebre_Ottobre_Novembre_Dicembre".split("_"),monthsShort:"Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic".split("_"),weekdays:"Domenica_Lunedi_Martedi_Mercoledi_Giovedi_Venerdi_Sabato".split("_"),weekdaysShort:"Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),relativeTime:{future:"in %s",past:"%s fa",s:"secondi",m:"un minuto",mm:"%d minuti",h:"un ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:function(){return"º"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this._date&&this._date.lang&&this._date.lang("it",a)}(),function(){var a={months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Feb_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),relativeTime:{future:"em %s",past:"%s atrás",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:function(a){return"º"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this._date&&this._date.lang&&this._date.lang("pt",a)}()
\ No newline at end of file
index 00c591971353a245bfc9d9d6e224c8cf5b630efa..b2d4e7bf7e415bb06c930306ad4a13143500a74f 100644 (file)
@@ -19,7 +19,7 @@
                 y : "une année",
                 yy : "%d années"
             },
-            ordinal : function(number) {
+            ordinal : function (number) {
                 return (~~ (number % 100 / 10) === 1) ? 'er' : 'ème';
             }
         };
diff --git a/lang/fr.min.js b/lang/fr.min.js
new file mode 100644 (file)
index 0000000..f3b1bcd
--- /dev/null
@@ -0,0 +1 @@
+(function(){var a={months:"Janvier_Février_Mars_Avril_Mai_Juin_Juillet_Aout_Septembre_Octobre_Novembre_Décembre".split("_"),monthsShort:"Jan_Fev_Mar_Avr_Mai_Jui_Jui_Aou_Sep_Oct_Nov_Dec".split("_"),weekdays:"Dimanche_Lundi_Mardi_Mercredi_Jeudi_Vendredi_Samedi".split("_"),weekdaysShort:"Dim_Lun_Mar_Mer_Jeu_Ven_Sam".split("_"),relativeTime:{future:"in %s",past:"il y a %s",s:"secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"une année",yy:"%d années"},ordinal:function(a){return~~(a%100/10)===1?"er":"ème"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this._date&&this._date.lang&&this._date.lang("fr",a)})()
\ No newline at end of file
diff --git a/lang/it.min.js b/lang/it.min.js
new file mode 100644 (file)
index 0000000..ae9bc0d
--- /dev/null
@@ -0,0 +1 @@
+(function(){var a={months:"Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settebre_Ottobre_Novembre_Dicembre".split("_"),monthsShort:"Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic".split("_"),weekdays:"Domenica_Lunedi_Martedi_Mercoledi_Giovedi_Venerdi_Sabato".split("_"),weekdaysShort:"Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),relativeTime:{future:"in %s",past:"%s fa",s:"secondi",m:"un minuto",mm:"%d minuti",h:"un ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:function(){return"º"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this._date&&this._date.lang&&this._date.lang("it",a)})()
\ No newline at end of file
diff --git a/lang/pt.min.js b/lang/pt.min.js
new file mode 100644 (file)
index 0000000..0909f9b
--- /dev/null
@@ -0,0 +1 @@
+(function(){var a={months:"Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),monthsShort:"Jan_Feb_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),relativeTime:{future:"em %s",past:"%s atrás",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:function(a){return"º"}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this._date&&this._date.lang&&this._date.lang("pt",a)})()
\ No newline at end of file
index 76e39f27764125d2eff88870d408b2fbada525fc..0359ac3132a257ed683bb4c59d76fb19951e2d15 100755 (executable)
@@ -1 +1 @@
-(function(a,b){function i(a,b){var c=a+"";while(c.length<b)c="0"+c;return c}function j(b,c,d){var e=(c.ms||0)+(c.s||0)*1e3+(c.m||0)*6e4+(c.h||0)*36e5+(c.d||0)*864e5+(c.w||0)*6048e5,f=(c.M||0)+(c.y||0)*12,g;return e&&b.setMilliseconds(b.getMilliseconds()+e*d),f&&(g=b.getDate(),b.setDate(1),b.setMonth(b.getMonth()+f*d),b.setDate(Math.min((new a(b.getFullYear(),b.getMonth()+1,0)).getDate(),g))),b}function k(a){return Object.prototype.toString.call(a)==="[object Array]"}function l(b){return new a(b[0],b[1]||0,b[2]||1,b[3]||0,b[4]||0,b[5]||0,b[6]||0)}function m(b,d){function p(d){var m,q;switch(d){case"M":return e+1;case"Mo":return e+1+c.ordinal(e+1);case"MM":return i(e+1,2);case"MMM":return c.monthsShort[e];case"MMMM":return c.months[e];case"D":return f;case"Do":return f+c.ordinal(f);case"DD":return i(f,2);case"DDD":return m=new a(g,e,f),q=new a(g,0,1),~~((m-q)/864e5+1.5);case"DDDo":return m=p("DDD"),m+c.ordinal(m);case"DDDD":return i(p("DDD"),3);case"d":return h;case"do":return h+c.ordinal(h);case"ddd":return c.weekdaysShort[h];case"dddd":return c.weekdays[h];case"w":return m=new a(g,e,f-h+5),q=new a(m.getFullYear(),0,4),~~((m-q)/864e5/7+1.5);case"wo":return m=p("w"),m+c.ordinal(m);case"ww":return i(p("w"),2);case"YY":return(g+"").slice(-2);case"YYYY":return g;case"a":return j>11?"pm":"am";case"A":return j>11?"PM":"AM";case"H":return j;case"HH":return i(j,2);case"h":return j%12||12;case"hh":return i(j%12||12,2);case"m":return k;case"mm":return i(k,2);case"s":return l;case"ss":return i(l,2);case"zz":case"z":return(b.toString().match(o)||[""])[0].replace(n,"");default:return d.replace("\\","")}}var e=b.getMonth(),f=b.getDate(),g=b.getFullYear(),h=b.getDay(),j=b.getHours(),k=b.getMinutes(),l=b.getSeconds(),m=/(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?)/g,n=/[^A-Z]/g,o=/\([A-Za-z ]+\)|:[0-9]{2} [A-Z]{3} /g;return d.replace(m,p)}function n(a,b){function i(a,b){switch(a){case"M":case"MM":c[1]=~~b-1;break;case"D":case"DD":case"DDD":case"DDDD":c[2]=~~b;break;case"YY":b=~~b,c[0]=b+(b>70?1900:2e3);break;case"YYYY":c[0]=~~b;break;case"a":case"A":h=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":c[3]=~~b;break;case"m":case"mm":c[4]=~~b;break;case"s":case"ss":c[5]=~~b}}var c=[0],d=/[0-9a-zA-Z]+/g,e=a.match(d),f=b.match(d),g,h;for(g=0;g<f.length;g++)i(f[g],e[g]);return h&&c[3]<12&&(c[3]+=12),l(c)}function o(a,b){var c=Math.min(a.length,b.length),d=Math.abs(a.length-b.length),e=0,f;for(f=0;f<c;f++)~~a[f]!==~~b[f]&&e++;return e+d}function p(a,b){var c,d=/[0-9a-zA-Z]+/g,e=a.match(d),f=[],g=99,h,i,j;for(h=0;h<b.length;h++)i=n(a,b[h]),j=o(e,m(i,b[h]).match(d)),j<g&&(g=j,c=i);return c}function q(c,d){c&&c._d instanceof a?this._d=c._d:d?k(d)?this._d=p(c,d):this._d=n(c,d):this._d=c===b?new a:c instanceof a?c:k(c)?l(c):new a(c)}function r(a,b){return c.relativeTime[a].replace(/%d/i,b||1)}function s(a){var b=Math.abs(a)/1e3,c=b/60,e=c/60,f=e/24,g=f/365;return b<45&&r("s",d(b))||d(c)===1&&r("m")||c<45&&r("mm",d(c))||d(e)===1&&r("h")||e<22&&r("hh",d(e))||d(f)===1&&r("d")||f<25&&r("dd",d(f))||f<45&&r("M")||f<345&&r("MM",d(f/30))||d(g)===1&&r("y")||r("yy",d(g))}function t(a,b){c.fn[a]=function(a){return a?(this._d["set"+b](a),this):this._d["get"+b]()}}var c,d=Math.round,e={},f="months|monthsShort|weekdays|weekdaysShort|relativeTime|ordinal".split("|"),g,h="Month|Date|Hours|Minutes|Seconds".split("|");c=function(a,b){return new q(a,b)},c.lang=function(a,b){var d,g;b&&(e[a]=b);if(e[a])for(d=0;d<f.length;d++)g=f[d],c[g]=e[a][g]||c[g]},c.lang("en",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),relativeTime:{future:"in %s",past:"%s ago",s:"seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10;return~~(a%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th"}}),c.fn=q.prototype={valueOf:function(){return+this._d},format:function(a){return m(this._d,a)},add:function(a){return this._d=j(this._d,a,1),this},subtract:function(a){return this._d=j(this._d,a,-1),this},diff:function(a,b){return this._d-c(a,b)._d},from:function(a,b){var d=this.diff(a),e=d<0?c.relativeTime.past:c.relativeTime.future,f=s(d);return b?f:e.replace(/%s/i,f)},fromNow:function(a){return this.from(new q,a)},isLeapYear:function(){var a=this._d.getFullYear();return a%4===0&&a%100!==0||a%400===0}};for(g=0;g<h.length;g++)t(h[g].toLowerCase(),h[g]);t("year","FullYear"),c.fn.day=function(){return this._d.getDay()},typeof window=="undefined"&&typeof module!="undefined"?module.exports=c:(this._!==b&&this._.mixin!==b&&this._.mixin({date:c}),this._date=c)})(Date)
\ No newline at end of file
+(function(a,b){function j(a,b){var c=a+"";while(c.length<b)c="0"+c;return c}function k(b,c,d){var e=(c.ms||0)+(c.s||0)*1e3+(c.m||0)*6e4+(c.h||0)*36e5+(c.d||0)*864e5+(c.w||0)*6048e5,f=(c.M||0)+(c.y||0)*12,g;return e&&b.setMilliseconds(b.getMilliseconds()+e*d),f&&(g=b.getDate(),b.setDate(1),b.setMonth(b.getMonth()+f*d),b.setDate(Math.min((new a(b.getFullYear(),b.getMonth()+1,0)).getDate(),g))),b}function l(a){return Object.prototype.toString.call(a)==="[object Array]"}function m(b){return new a(b[0],b[1]||0,b[2]||1,b[3]||0,b[4]||0,b[5]||0,b[6]||0)}function n(b,d){function p(d){var m,q;switch(d){case"M":return e+1;case"Mo":return e+1+c.ordinal(e+1);case"MM":return j(e+1,2);case"MMM":return c.monthsShort[e];case"MMMM":return c.months[e];case"D":return f;case"Do":return f+c.ordinal(f);case"DD":return j(f,2);case"DDD":return m=new a(g,e,f),q=new a(g,0,1),~~((m-q)/864e5+1.5);case"DDDo":return m=p("DDD"),m+c.ordinal(m);case"DDDD":return j(p("DDD"),3);case"d":return h;case"do":return h+c.ordinal(h);case"ddd":return c.weekdaysShort[h];case"dddd":return c.weekdays[h];case"w":return m=new a(g,e,f-h+5),q=new a(m.getFullYear(),0,4),~~((m-q)/864e5/7+1.5);case"wo":return m=p("w"),m+c.ordinal(m);case"ww":return j(p("w"),2);case"YY":return(g+"").slice(-2);case"YYYY":return g;case"a":return i>11?"pm":"am";case"A":return i>11?"PM":"AM";case"H":return i;case"HH":return j(i,2);case"h":return i%12||12;case"hh":return j(i%12||12,2);case"m":return k;case"mm":return j(k,2);case"s":return l;case"ss":return j(l,2);case"zz":case"z":return(b.toString().match(o)||[""])[0].replace(n,"");default:return d.replace("\\","")}}var e=b.getMonth(),f=b.getDate(),g=b.getFullYear(),h=b.getDay(),i=b.getHours(),k=b.getMinutes(),l=b.getSeconds(),m=/(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|dddd?|do?|w[o|w]?|YYYY|YY|a|A|hh?|HH?|mm?|ss?|zz?)/g,n=/[^A-Z]/g,o=/\([A-Za-z ]+\)|:[0-9]{2} [A-Z]{3} /g;return d.replace(m,p)}function o(a,b){function i(a,b){switch(a){case"M":case"MM":c[1]=~~b-1;break;case"D":case"DD":case"DDD":case"DDDD":c[2]=~~b;break;case"YY":b=~~b,c[0]=b+(b>70?1900:2e3);break;case"YYYY":c[0]=~~b;break;case"a":case"A":h=b.toLowerCase()==="pm";break;case"H":case"HH":case"h":case"hh":c[3]=~~b;break;case"m":case"mm":c[4]=~~b;break;case"s":case"ss":c[5]=~~b}}var c=[0],d=/[0-9a-zA-Z]+/g,e=a.match(d),f=b.match(d),g,h;for(g=0;g<f.length;g++)i(f[g],e[g]);return h&&c[3]<12&&(c[3]+=12),m(c)}function p(a,b){var c=Math.min(a.length,b.length),d=Math.abs(a.length-b.length),e=0,f;for(f=0;f<c;f++)~~a[f]!==~~b[f]&&e++;return e+d}function q(a,b){var c,d=/[0-9a-zA-Z]+/g,e=a.match(d),f=[],g=99,h,i,j;for(h=0;h<b.length;h++)i=o(a,b[h]),j=p(e,n(i,b[h]).match(d)),j<g&&(g=j,c=i);return c}function r(c,d){c&&c._d instanceof a?this._d=c._d:d?l(d)?this._d=q(c,d):this._d=o(c,d):this._d=c===b?new a:c instanceof a?c:l(c)?m(c):new a(c)}function s(a,b){return c.relativeTime[a].replace(/%d/i,b||1)}function t(a){var b=Math.abs(a)/1e3,c=b/60,e=c/60,f=e/24,g=f/365;return b<45&&s("s",d(b))||d(c)===1&&s("m")||c<45&&s("mm",d(c))||d(e)===1&&s("h")||e<22&&s("hh",d(e))||d(f)===1&&s("d")||f<25&&s("dd",d(f))||f<45&&s("M")||f<345&&s("MM",d(f/30))||d(g)===1&&s("y")||s("yy",d(g))}function u(a,b){c.fn[a]=function(a){return a?(this._d["set"+b](a),this):this._d["get"+b]()}}var c,d=Math.round,e={},f=typeof window=="undefined"&&typeof module!="undefined",g="months|monthsShort|weekdays|weekdaysShort|relativeTime|ordinal".split("|"),h,i="Month|Date|Hours|Minutes|Seconds".split("|");c=function(a,b){return new r(a,b)},c.lang=function(a,b){var d,h,i;b&&(e[a]=b);if(e[a])for(d=0;d<g.length;d++)h=g[d],c[h]=e[a][h]||c[h];else f&&(i=require("./lang/"+a),c.lang(a,i))},c.lang("en",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),relativeTime:{future:"in %s",past:"%s ago",s:"seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10;return~~(a%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th"}}),c.fn=r.prototype={valueOf:function(){return+this._d},format:function(a){return n(this._d,a)},add:function(a){return this._d=k(this._d,a,1),this},subtract:function(a){return this._d=k(this._d,a,-1),this},diff:function(a,b){return this._d-c(a,b)._d},from:function(a,b){var d=this.diff(a),e=d<0?c.relativeTime.past:c.relativeTime.future,f=t(d);return b?f:e.replace(/%s/i,f)},fromNow:function(a){return this.from(new r,a)},isLeapYear:function(){var a=this._d.getFullYear();return a%4===0&&a%100!==0||a%400===0}};for(h=0;h<i.length;h++)u(i[h].toLowerCase(),i[h]);u("year","FullYear"),c.fn.day=function(){return this._d.getDay()},f?module.exports=c:(this._!==b&&this._.mixin!==b&&this._.mixin({date:c}),this._date=c)})(Date)
\ No newline at end of file