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

human-interval

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

human-interval

Human readable time measurements

  • 0.1.6
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is human-interval?

The human-interval npm package allows you to parse human-readable time intervals into milliseconds. This can be useful for setting timeouts, scheduling tasks, or any other scenario where you need to convert a human-friendly time format into a machine-readable one.

What are human-interval's main functionalities?

Parse human-readable intervals

This feature allows you to convert a human-readable time interval (e.g., '3 minutes and 30 seconds') into milliseconds. This is useful for applications that need to work with precise time intervals but want to allow users to input times in a more natural format.

const humanInterval = require('human-interval');
const milliseconds = humanInterval('3 minutes and 30 seconds');
console.log(milliseconds); // 210000

Support for various time units

The package supports a wide range of time units including seconds, minutes, hours, days, weeks, months, and years. This allows for flexible and comprehensive time interval parsing.

const humanInterval = require('human-interval');
const milliseconds = humanInterval('2 days, 4 hours, and 20 minutes');
console.log(milliseconds); // 187200000

Combining multiple intervals

You can combine multiple time intervals in a single string, and the package will correctly parse the total time in milliseconds. This is useful for more complex scheduling needs.

const humanInterval = require('human-interval');
const milliseconds = humanInterval('1 hour and 45 minutes');
console.log(milliseconds); // 6300000

Other packages similar to human-interval

Keywords

FAQs

Package last updated on 11 May 2016

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