Socket
Book a DemoInstallSign in
Socket

@arcjet/duration

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcjet/duration

Arcjet utilities for parsing duration strings

1.0.0-beta.11
latest
Source
npmnpm
Version published
Maintainers
3
Created
Source
Arcjet Logo

@arcjet/duration

npm badge

Arcjet utilities for parsing duration strings.

What is this?

This is an internal utility that exists so our users can pass meaningful duration strings such as 1h instead of having to manually calculate seconds or milliseconds. We turned the Go [ParseDuration][go-parser] into TypeScript so that we have the exact same functionality in both languages.

When should I use this?

You should not use this but use one of the many alternatives such as vercel/ms. This package matches our current needs which are likely different from yours.

Install

This package is ESM only. Install with npm in Node.js:

npm install @arcjet/duration

Example

import { parse } from "@arcjet/duration";

const seconds = parse("1h");
console.log(seconds); // prints 3600

License

Apache License, Version 2.0 © Arcjet Labs, Inc.

Derivative work based on time.ParseDuration from golang/go licensed under BSD-3.0 © The Go Authors. Our work ports to TypeScript.

Keywords

arcjet

FAQs

Package last updated on 03 Sep 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.