@arcjet/duration
Advanced tools
+23
-23
| //#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 }; |
+5
-5
| { | ||
| "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": { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
19332
0.14%1
Infinity%