Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expiry-js

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expiry-js - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

4

dist/expiry.js

@@ -132,3 +132,3 @@ (function (root, factory) {

case 'millisecond':
milliseconds += unitToMilliseconds[unit];
milliseconds += maybeValue * unitToMilliseconds[unit];
break;

@@ -174,5 +174,5 @@ default:

expiry.VERSION = '0.1.4';
expiry.VERSION = '0.1.6';
return expiry;
}));

@@ -1,1 +0,1 @@

!function(a,b){"function"==typeof define&&define.amd?define(function(){return a.expiry=b()}):"object"==typeof exports?module.exports=b():a.expiry=b()}(this,function(){function a(){return b.forge.apply(b,arguments)}var b=function(){function a(b){b=b||0;var c,d=i(b);if("Number"===d)c=new j(b);else{if("String"!==d)throw new Error("Wrong type for argument 1, value. Expected "+b+" to be a number, string, or expiry.");c=a.parse(b)}this._internal=c}var b=1,c=1e3*b,d=60*c,e=60*d,f=24*e,g={millisecond:b,second:c,minute:d,hour:e,day:f,month:function(a,b){var c=new Date,d=new Date(c);return d.setMonth(d.getMonth()+a),d.setDate(d.getDate()+b),d-c}},h={milliseconds:"millisecond",millisecond:"millisecond",ms:"millisecond",seconds:"second",second:"second",s:"second",minutes:"minute",minute:"minute",m:"minute",hours:"hour",hour:"hour",h:"hour",days:"day",day:"day",D:"day",weeks:"week",week:"week",W:"week",months:"month",month:"month",M:"month",years:"year",year:"year",Y:"year"},i=function(a){return toString.call(a).match(/\[object (\S+)\]/).pop()},j=function(a,b,c){this.milliseconds=a||0,this.days=b||0,this.months=c||0},k=Math.round;return a.forge=function(a){return new this(a)},a.parse=function(a){if("String"!==i(a))throw new Error("Wrong type for argument 1, value. String expected.");for(var b,c,d,e,f=/([\d\.]+)\s*([a-zA-Z]+)/g,k=0,l=0,m=0;null!==(b=f.exec(a));)switch(c=parseFloat(b[1]),d=b[2],e=h[d]){case"year":m+=12*c;break;case"month":m+=c;break;case"week":l+=7*c;break;case"day":l+=c;break;case"hour":case"minute":case"second":case"millisecond":k+=g[e];break;default:throw new Error("Unexpected unit "+d)}return new j(k,l,m)},a.prototype.valueOf=function(){var a=this._internal,b=a.milliseconds,c=a.days,d=a.months;return b+g.month(d,c)},a.prototype.asMilliseconds=function(){return this.valueOf()},a.prototype.asSeconds=function(){return k(this.valueOf()/c)},a}();return a.Expiry=b,a.VERSION="0.1.4",a});
!function(a,b){"function"==typeof define&&define.amd?define(function(){return a.expiry=b()}):"object"==typeof exports?module.exports=b():a.expiry=b()}(this,function(){function a(){return b.forge.apply(b,arguments)}var b=function(){function a(b){b=b||0;var c,d=i(b);if("Number"===d)c=new j(b);else{if("String"!==d)throw new Error("Wrong type for argument 1, value. Expected "+b+" to be a number, string, or expiry.");c=a.parse(b)}this._internal=c}var b=1,c=1e3*b,d=60*c,e=60*d,f=24*e,g={millisecond:b,second:c,minute:d,hour:e,day:f,month:function(a,b){var c=new Date,d=new Date(c);return d.setMonth(d.getMonth()+a),d.setDate(d.getDate()+b),d-c}},h={milliseconds:"millisecond",millisecond:"millisecond",ms:"millisecond",seconds:"second",second:"second",s:"second",minutes:"minute",minute:"minute",m:"minute",hours:"hour",hour:"hour",h:"hour",days:"day",day:"day",D:"day",weeks:"week",week:"week",W:"week",months:"month",month:"month",M:"month",years:"year",year:"year",Y:"year"},i=function(a){return toString.call(a).match(/\[object (\S+)\]/).pop()},j=function(a,b,c){this.milliseconds=a||0,this.days=b||0,this.months=c||0},k=Math.round;return a.forge=function(a){return new this(a)},a.parse=function(a){if("String"!==i(a))throw new Error("Wrong type for argument 1, value. String expected.");for(var b,c,d,e,f=/([\d\.]+)\s*([a-zA-Z]+)/g,k=0,l=0,m=0;null!==(b=f.exec(a));)switch(c=parseFloat(b[1]),d=b[2],e=h[d]){case"year":m+=12*c;break;case"month":m+=c;break;case"week":l+=7*c;break;case"day":l+=c;break;case"hour":case"minute":case"second":case"millisecond":k+=c*g[e];break;default:throw new Error("Unexpected unit "+d)}return new j(k,l,m)},a.prototype.valueOf=function(){var a=this._internal,b=a.milliseconds,c=a.days,d=a.months;return b+g.month(d,c)},a.prototype.asMilliseconds=function(){return this.valueOf()},a.prototype.asSeconds=function(){return k(this.valueOf()/c)},a}();return a.Expiry=b,a.VERSION="0.1.6",a});

@@ -119,3 +119,3 @@ var

case 'millisecond':
milliseconds += unitToMilliseconds[unit];
milliseconds += maybeValue * unitToMilliseconds[unit];
break;

@@ -122,0 +122,0 @@ default:

{
"name": "expiry-js",
"version": "0.1.5",
"version": "0.1.6",
"description": "A lightweight Javascript Universal Module for parsing durations",

@@ -5,0 +5,0 @@ "main": "dist/expiry.js",

@@ -39,1 +39,7 @@ # expiry-js

```
## Change Log
### 0.1.6 (2015-06-18)
* Fixes error parsing seconds. Thanks, [@BigFunger](https://github.com/BigFunger)

@@ -65,6 +65,6 @@ /* eslint-env mocha */

var
o = { millisecond: 1 };
o = { millisecond: 2 };
f('1ms', o);
f('1 ms', o);
f('2ms', o);
f('2 ms', o);
});

@@ -75,5 +75,5 @@

var
o = { second: 1 };
o = { second: 2 };
f('1s', o);
f('2s', o);
});

@@ -84,5 +84,5 @@

var
o = { minute: 1 };
o = { minute: 2 };
f('1m', o);
f('2m', o);
});

@@ -93,5 +93,5 @@

var
o = { hour: 1 };
o = { hour: 2 };
f('1h', o);
f('2h', o);
});

@@ -102,5 +102,5 @@

var
o = { day: 1 };
o = { day: 2 };
f('1D', o);
f('2D', o);
});

@@ -119,5 +119,5 @@

var
o = { month: 1 };
o = { month: 2 };
f('1M', o);
f('2M', o);
});

@@ -128,5 +128,5 @@

var
o = { year: 1 };
o = { year: 2 };
f('1Y', o);
f('2Y', o);
});

@@ -133,0 +133,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc