New:Socket for Asana Is Now Available.Learn more
Get Started

@arcjet/duration

Package Overview
Dependencies
Maintainers
2
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcjet/duration - npm Package Compare versions

Comparing version
1.9.1
to
1.10.0-rc.0
+23
-23
dist/index.d.ts
//#region src/index.d.ts
/**
* Parse a duration into a number representing seconds while ensuring the value
* fits within an unsigned 32-bit integer.
*
* If a number is passed it is validated and returned.
*
* If a string is passed it must be in the form of digits followed by a unit.
* Supported units are `s` (seconds),
* `m` (minutes),
* `h` (hours),
* and `d` (days).
*
* @example
* ```ts
* console.log(parse("1s")) // => 1
* console.log(parse("1m")) // => 60
* console.log(parse("1h")) // => 3600
* console.log(parse("1d")) // => 86400
* ```
* @param value
* Value to parse.
* @returns
* Parsed seconds.
*/
* Parse a duration into a number representing seconds while ensuring the value
* fits within an unsigned 32-bit integer.
*
* If a number is passed it is validated and returned.
*
* If a string is passed it must be in the form of digits followed by a unit.
* Supported units are `s` (seconds),
* `m` (minutes),
* `h` (hours),
* and `d` (days).
*
* @example
* ```ts
* console.log(parse("1s")) // => 1
* console.log(parse("1m")) // => 60
* console.log(parse("1h")) // => 3600
* console.log(parse("1d")) // => 86400
* ```
* @param value
* Value to parse.
* @returns
* Parsed seconds.
*/
declare function parse(value: number | string): number;
//#endregion
export { parse };
{
"name": "@arcjet/duration",
"version": "1.9.1",
"version": "1.10.0-rc.0",
"description": "Arcjet utilities for parsing duration strings",

@@ -46,3 +46,3 @@ "keywords": [

"build": "tsdown",
"typecheck": "tsgo --noEmit",
"typecheck": "tsc --noEmit",
"test-api": "node --test -- test/*.test.ts",

@@ -54,5 +54,5 @@ "test-coverage": "node --experimental-test-coverage --test -- test/*.test.ts",

"devDependencies": {
"@types/node": "22.19.21",
"tsdown": "0.22.3",
"typescript": "6.0.3"
"@types/node": "22.20.1",
"tsdown": "0.22.7",
"typescript": "7.0.2"
},

@@ -59,0 +59,0 @@ "engines": {