Aller au contenu principal

@w5s/object-id

W5S Unique identifier of object-like values (object, symbol, function) (@w5s/object-id)

NPM Version License

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

Type Aliases

ObjectId

ObjectId: number & Tag<ObjectId>

Type representing a unique object id

ObjectIdParameter

ObjectIdParameter: ObjectLike

Type representing values that can have an ObjectId

Alias of ObjectLike

Page Options