@w5s/object-id
W5S Unique identifier of object-like values (object, symbol, function) (@w5s/object-id)
This package can be used to generate a unique identifier (number) for an object / function / symbol. This kind of numeric identifier can be used to compute hash, generate debug trace, etc.
Installation
npm install @w5s/object-id
Usage
import { objectId } from '@w5s/object-id';
export function main(): void {
const someObject = { foo: 1 };
const id = objectId(someObject); // typeof id === 'number'
console.log(id === objectId(someObject)); // true (because idempotent)
}
License
MIT © Julien Polo julien.polo@gmail.com
Index
Functions
Type Aliases
Type Aliases
ObjectId
ObjectIdParameter
Type representing values that can have an ObjectId
Alias of ObjectLike
Type representing a unique object id