New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

unduration

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unduration

[![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] [![bundle][bundle-src]][bundle-href] [![Codecov][codecov-src]][codecov-href]

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

unduration

npm version npm downloads bundle Codecov

unduration is a tiny (0.2kb) library that aims to standardize the way we handle durations in JavaScript, aiming to replace things like:

defineHandler('/', {
  ttl: 1000 * 60 * 60 * 24,
  // OR worser
  ttl: 86_400_000
})

With:

defineHandler('/', {
  ttl: '1m',
  // OR
  ttl: {
    minutes: 1,
  }
})

Libraries tend to use different formats for durations, which makes it hard to use them together. unduration aims to solve this problem by providing a standard way to define durations, and utilities to use this standard.

Usage

Install package:

# npm
npm install unduration

# yarn
yarn add unduration

# pnpm
pnpm install unduration

# bun
bun install unduration

Import:

// ESM
import { defineDuration } from "unduration";

// CommonJS
const { defineDuration } = require("unduration");

Development

  • Clone this repository
  • Install latest LTS version of Node.js
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

License

Made with 💛

Published under MIT License.

FAQs

Package last updated on 08 Jan 2024

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