@elemental-concept/oid
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

OID

A simple utility function which generates and attaches unique IDs to JavaScript objects. Such IDs can be used in change detection algorithms or for dependency management when class/object names are unreliable, such as JS apps after minification.

Installation

npm users should run:

$ npm i --save @elemental-concept/oid

Yarn users should run:

$ yarn add @elemental-concept/oid

If your environment does not support ES6 imports natively, then you should use bundlers like webpack or rollup to include this library in your project.

Usage

Import OID function and invoke passing the object or class:

import { OID } from '@elemental-concept/oid';

class Test {
}

console.log(OID(Test));

const instance = new Test();

console.log(OID(instance));

Compatability

OID library contains three bundles (UMD ES5 for nodejs, ESM ES5 for older browsers and ESM ES6 for newer browsers) as well as TypeScript typings. It should work in all modern browsers and in IE starting with IE9.

Readme

Keywords

none

Package Sidebar

Install

npm i @elemental-concept/oid

Weekly Downloads

1

Version

0.1.0

License

BSD-2-Clause

Unpacked Size

4.91 kB

Total Files

7

Last publish

Collaborators

  • ecdavid
  • aux
  • simke2090