Skip to main content

Class: Snowflake

snowflake/src.Snowflake

Constructors

constructor

new Snowflake(epoch)

Parameters

NameTypeDescription
epochnumber | bigint | Date

Defined in

projects/utilities/packages/snowflake/src/lib/Snowflake.ts:39

Properties

#epoch

Private #epoch: bigint

Defined in

projects/utilities/packages/snowflake/src/lib/Snowflake.ts:28


#increment

Private #increment: bigint

Defined in

projects/utilities/packages/snowflake/src/lib/Snowflake.ts:22


decode

decode: (id: string | bigint) => DeconstructedSnowflake

Type declaration

▸ (id): DeconstructedSnowflake

Parameters
NameTypeDescription
idstring | bigint
Returns

DeconstructedSnowflake

Defined in

projects/utilities/packages/snowflake/src/lib/Snowflake.ts:34

Accessors

epoch

get epoch(): bigint

Returns

bigint

Defined in

projects/utilities/packages/snowflake/src/lib/Snowflake.ts:46

Methods

deconstruct

deconstruct(id): DeconstructedSnowflake

Parameters

NameTypeDescription
idstring | bigint

Returns

DeconstructedSnowflake

Defined in

projects/utilities/packages/snowflake/src/lib/Snowflake.ts:89


generate

generate(options?): bigint

Parameters

NameTypeDescription
optionsSnowflakeGenerateOptions

Returns

bigint

Defined in

projects/utilities/packages/snowflake/src/lib/Snowflake.ts:62


timestampFrom

timestampFrom(id): number

Parameters

NameTypeDescription
idstring | bigint

Returns

number

Defined in

projects/utilities/packages/snowflake/src/lib/Snowflake.ts:106