Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Latest commit

 

History

History
161 lines (93 loc) · 4.06 KB

README.md

File metadata and controls

161 lines (93 loc) · 4.06 KB

relative-random-time

Index

Classes

Type aliases

Functions

Type aliases

TimeParams

Ƭ TimeParams: { after?: undefined | number ; before?: undefined | number }

Defined in src/types.ts:1

Type declaration:

Name Type
after? undefined | number
before? undefined | number

TimespanParams

Ƭ TimespanParams: TimeParams & { bounds: number[] }

Defined in src/types.ts:6

Functions

farFuture

farFuture({ after: undefined | number ; before: undefined | number }): number

Defined in src/index.ts:81

Returns a number that is higher than before but lower than after representing a time in the near future (seconds to minutes).

throws BadBoundsError if passed invalid bounds

Parameters:

Name Type Default value
(destructured) { after: undefined | number ; before: undefined | number } {}

Returns: number


farPast

farPast({ after: undefined | number ; before: undefined | number }): number

Defined in src/index.ts:44

Returns a number that is higher than before but lower than after representing a time in the distant past (months to decades).

throws BadBoundsError if passed invalid bounds

Parameters:

Name Type Default value
(destructured) { after: undefined | number ; before: undefined | number } {}

Returns: number


fromTimespan

fromTimespan({ after: undefined | number ; before: undefined | number ; bounds: number[] }): number

Defined in src/index.ts:22

Returns a number between bounds[0] and bounds[1] (inclusive) that is higher than before but lower than after.

throws BadBoundsError if passed invalid bounds

Parameters:

Name Type
(destructured) { after: undefined | number ; before: undefined | number ; bounds: number[] }

Returns: number


nearFuture

nearFuture({ after: undefined | number ; before: undefined | number }): number

Defined in src/index.ts:71

Returns a number that is higher than before but lower than after representing a time in the distant future (months to decades).

throws BadBoundsError if passed invalid bounds

Parameters:

Name Type Default value
(destructured) { after: undefined | number ; before: undefined | number } {}

Returns: number


nearPast

nearPast({ after: undefined | number ; before: undefined | number }): number

Defined in src/index.ts:54

Returns a number that is higher than before but lower than after representing a time in the near past (seconds to minutes).

throws BadBoundsError if passed invalid bounds

Parameters:

Name Type Default value
(destructured) { after: undefined | number ; before: undefined | number } {}

Returns: number


present

present(): number

Defined in src/index.ts:61

Returns Date.now()

Returns: number