expires

0.0.1 • Public • Published

node-expires

Simple Node.js expiration helper

Install

$ npm install expires

Usage

var expires = require('expires');
 
// Returns some timestamp like 1341151672247
var timestamp = expires.after('2 seconds');
 
// Then it can be tested for expiration
expires.expired(timestamp);  // false
setTimeout(function() {
    expires.expired(timestamp);  // true
}, 2500);

Supported Units

  • "ms", "millisecond(s)"
  • "sec(s)", "second(s)"
  • "min(s)", "minute(s)"
  • "hr(s)", "hour(s)"
  • "day(s)"
  • "wk(s)", "week(s)"
  • "yr(s)", "year(s)"

Fractions

Also completely valid are fractional values, such as the following:

expires.after('0.5 hours');
expires.after('1/2 hours');
 
// A bit extreme, but still valid
expires.after('2.3/4.5 hours');

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    1,818
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    1,818
  • 0.0.0
    1

Package Sidebar

Install

npm i expires

Weekly Downloads

1,819

Version

0.0.1

License

MIT/GPL

Last publish

Collaborators

  • k