Type Alias: ObjectHashOptions
ObjectHashOptions =
object
The options of objectHash: the digest, and what the hash takes into account.
Properties
algorithm?
optionalalgorithm?:HashName|"passthrough"
The hash algorithm: a name of crypto.getHashes() ('md5', 'sha1', 'sha256', 'sha512'…), in any case, or 'passthrough' to get the serialization itself (to see what the hash depends on).
Default
'sha1'encoding?
optionalencoding?:"hex"|"binary"|"base64"
How the digest is written: 'hex', 'base64' or 'binary' (a Latin-1 string). 'buffer' is accepted too (returning a Buffer typed as a string). Ignored by the 'passthrough' algorithm.
Default
'hex'excludeKeys?
optionalexcludeKeys?: (key) =>boolean
Leave out the object properties whose key it returns true for, at any depth ((key) => key === 'updatedAt').
Parameters
key
string
Returns
boolean
Default
none (every key counts)excludeValues?
optionalexcludeValues?:boolean
Whether only the keys count, not their values: two objects of the same shape get the same hash.
Default
falseignoreUnknown?
optionalignoreUnknown?:boolean
Whether a value of an unsupported type (a Promise, a WeakMap, a Blob) is hashed as its type name only, instead of throwing.
Default
falsereplacer?
optionalreplacer?: (value) =>any
Replace each value before it is hashed, at any depth ((value) => value instanceof Date ? value.getTime() : value).
Parameters
value
any
Returns
any
Default
nonerespectFunctionNames?
optionalrespectFunctionNames?:boolean
Whether a function's name counts, besides its source code.
Default
truerespectFunctionProperties?
optionalrespectFunctionProperties?:boolean
Whether the properties of a function count (its static members).
Default
truerespectType?
optionalrespectType?:boolean
Whether an object's prototype and constructor count: with false, an instance and a plain object of the same properties get the same hash.
Default
trueunorderedArrays?
optionalunorderedArrays?:boolean
Whether the order of the array items does not count ([1, 2] and [2, 1] get the same hash).
Default
falseunorderedObjects?
optionalunorderedObjects?:boolean
Whether the order of the object keys does not count ({a, b} and {b, a} get the same hash).
Default
trueunorderedSets?
optionalunorderedSets?:boolean
Whether the insertion order of the Set and Map entries does not count.
Default
true