Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@samual/duration

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@samual/duration - npm Package Compare versions

Comparing version
0.0.1-fd6847c
to
0.0.2-961dbdd
+77
default.d.ts
import type { LaxPartial } from "@samual/types";
/**
* A duration of time.
*
* All properties are optional and must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an integer
* (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
* Absent properties and properties set to `undefined` are treated the same.
* More units of time will be added in the future.
*
* @example Basic Usage
* ```ts
* import type { Duration } from "@samual/duration"
*
* let duration: Duration = { milliseconds: Date.now() }
* ```
*/
export type Duration = LaxPartial<{
/**
* The number of years in the duration. Same as 365 days.
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
years: number;
/**
* The number of days in the duration. Same as 24 hours
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
days: number;
/**
* The number of hours in the duration. Same as 60 minutes
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
hours: number;
/**
* The number of minutes in the duration. Same as 60 seconds
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
minutes: number;
/**
* The number of seconds in the duration. Same as 1000 milliseconds
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
seconds: number;
/**
* The number of milliseconds in the duration.
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
milliseconds: number;
}>;
export { DurationError } from "./DurationError";
export { formatDuration, FormatDurationError, FormatEmptyDurationError, FormatNonIntegerDurationError, type FormatDurationOptions } from "./formatDuration";
export { normalizeDuration, NormalizeDurationError, NormalizeNonIntegerDurationError } from "./normalizeDuration";
export { DurationError } from "./DurationError.js"
export {
FormatDurationError,
FormatEmptyDurationError,
FormatNonIntegerDurationError,
formatDuration
} from "./formatDuration.js"
export { NormalizeDurationError, NormalizeNonIntegerDurationError, normalizeDuration } from "./normalizeDuration.js"
+1
-1

@@ -15,3 +15,3 @@ /**

import { DurationError } from "./DurationError";
import type { Duration } from "./index";
import type { Duration } from "./default";
/**

@@ -18,0 +18,0 @@ * Error that can be thrown by {@linkcode formatDuration()}.

@@ -17,3 +17,3 @@ /**

import { DurationError } from "./DurationError";
import type { Duration } from "./index";
import type { Duration } from "./default";
/**

@@ -20,0 +20,0 @@ * Error that can be thrown by {@linkcode normalizeDuration()}.

{
"name": "@samual/duration",
"version": "0.0.1-fd6847c",
"version": "0.0.2-961dbdd",
"description": "Normalize and format durations of time.",

@@ -23,6 +23,6 @@ "keywords": [

"engines": {
"node": "^20.10 || >=22"
"node": "^20.10 || ^22 || >=24"
},
"exports": {
".": "./index.js",
".": "./default.js",
"./DurationError": "./DurationError.js",

@@ -29,0 +29,0 @@ "./formatDuration": "./formatDuration.js",

import type { LaxPartial } from "@samual/types";
/**
* A duration of time.
*
* All properties are optional and must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an integer
* (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
* Absent properties and properties set to `undefined` are treated the same.
* More units of time will be added in the future.
*
* @example Basic Usage
* ```ts
* import type { Duration } from "@samual/duration"
*
* let duration: Duration = { milliseconds: Date.now() }
* ```
*/
export type Duration = LaxPartial<{
/**
* The number of years in the duration. Same as 365 days.
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
years: number;
/**
* The number of days in the duration. Same as 24 hours
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
days: number;
/**
* The number of hours in the duration. Same as 60 minutes
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
hours: number;
/**
* The number of minutes in the duration. Same as 60 seconds
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
minutes: number;
/**
* The number of seconds in the duration. Same as 1000 milliseconds
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
seconds: number;
/**
* The number of milliseconds in the duration.
*
* Must be set to
* [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) or an
* integer (be able to pass
* [`Number.isInteger()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger)).
*/
milliseconds: number;
}>;
export { DurationError } from "./DurationError";
export { formatDuration, FormatDurationError, FormatEmptyDurationError, FormatNonIntegerDurationError, type FormatDurationOptions } from "./formatDuration";
export { normalizeDuration, NormalizeDurationError, NormalizeNonIntegerDurationError } from "./normalizeDuration";
export { DurationError } from "./DurationError.js"
export {
FormatDurationError,
FormatEmptyDurationError,
FormatNonIntegerDurationError,
formatDuration
} from "./formatDuration.js"
export { NormalizeDurationError, NormalizeNonIntegerDurationError, normalizeDuration } from "./normalizeDuration.js"