Constructors
constructor
new Hashids( salt?: string , minLength?: number , alphabet?: string , seps?: string ) : Hashids
Defined in node_modules/hashids/lib/hashids.ts:6
Parameters
Default value salt: string = ""
Default value minLength: number = 0
Default value alphabet: string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
Default value seps: string = "cfhistuCFHISTU"
Properties
Private alphabet
alphabet: string
Defined in node_modules/hashids/lib/hashids.ts:4
Private guards
guards: string
Defined in node_modules/hashids/lib/hashids.ts:6
Private minLength
minLength: number
Defined in node_modules/hashids/lib/hashids.ts:10
Private salt
salt: string
Defined in node_modules/hashids/lib/hashids.ts:9
Private seps
seps: string
Defined in node_modules/hashids/lib/hashids.ts:5
Methods
Private _decode
_decode( id: string , alphabet: string ) : NumberLike []
Defined in node_modules/hashids/lib/hashids.ts:221
Parameters
id: string
alphabet: string
Private _encode
Defined in node_modules/hashids/lib/hashids.ts:155
Parameters
Returns string
decode
Defined in node_modules/hashids/lib/hashids.ts:109
Parameters
decodeHex
decodeHex( id: string ) : string
Defined in node_modules/hashids/lib/hashids.ts:149
Parameters
Returns string
encode
encode( numbers: string ) : string
encode( numbers: NumberLike [] ) : string
encode( ... numbers: NumberLike [] ) : string
encode( numbers: string [] ) : string
encode( ... numbers: string [] ) : string
Defined in node_modules/hashids/lib/hashids.ts:72
Parameters
Returns string
Defined in node_modules/hashids/lib/hashids.ts:73
Parameters
Returns string
Defined in node_modules/hashids/lib/hashids.ts:74
Parameters
Returns string
Defined in node_modules/hashids/lib/hashids.ts:75
Parameters
Returns string
Defined in node_modules/hashids/lib/hashids.ts:76
Parameters
Rest ... numbers: string []
Returns string
encodeHex
encodeHex( hex: string | bigint ) : string
Defined in node_modules/hashids/lib/hashids.ts:129
Parameters
Returns string
Legend
Module
Object literal
Variable
Function
Function with type parameter
Index signature
Type alias
Type alias with type parameter
Enumeration
Enumeration member
Property
Method
Interface
Interface with type parameter
Constructor
Property
Method
Index signature
Class
Class with type parameter
Constructor
Property
Method
Accessor
Index signature
Inherited constructor
Inherited property
Inherited method
Inherited accessor
Protected property
Protected method
Protected accessor
Private property
Private method
Private accessor
Static property
Static method
Splits a hex string into groups of 12-digit hexadecimal numbers, then prefixes each with '1' and encodes the resulting array of numbers
Encoding '00000000000f00000000000f000f' would be the equivalent of: Hashids.encode([0x100000000000f, 0x100000000000f, 0x1000f])
This means that if your environment supports BigInts, you will get different (shorter) results if you provide a BigInt representation of your hex and use
encode
directly, e.g.: Hashids.encode(BigInt(0x${hex}
))To decode such a representation back to a hex string, use the following snippet: Hashids.decode(id)[0].toString(16)