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

A lightweight Javascript Universal Module for parsing durations

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
decreased by-0.56%
Maintainers
1
Weekly downloads
 
Created
Source

expiry-js

A lightweight Javascript Universal Module for parsing durations.

I developed it as a utility for managing Redis expiries.

Installation

npm install expiry-js
bower install expiry-js

Usage

var
    expiry = require('expiry-js');

var
    example = expiry('1Y1M2W3D5h8m11s19ms'), // or '1Y 1M 2W 3D 5h 8m 11s 19ms'

    year = expiry('1Y'), // or '1 year', '1 years'
    month = expiry('1M'), // or '1 month', '1 months'
    week = expiry('1W'), // or '1 week', '1 weeks'
    day = expiry('1D'), // or '1 day', '1 days'
    hour = expiry('1h'), // or '1 hour', '1 hours'
    minute = expiry('1m'), // or '1 minute', '1 minutes'
    second = expiry('1s'), // or '1 second', '1 seconds'
    milliseconds = expiry('1ms'); // or '1 millisecond', '1 milliseconds'

console.log(day.valueOf()); // 86400000
console.log(day.asMilliseconds()); // 86400000
console.log(day.asSeconds()); // 86400

Keywords

FAQs

Package last updated on 23 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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