1.1.1 • Published 1 year ago

strid v1.1.1

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

Strid

Get a unique string identifier for any input value.

Details

  • All values that are the same according to Object.is will have the same string identifier.
  • All values that are different according to Object.is will have different string identifiers.
  • If your engine hasn't implemented this proposal then input symbols will be kept in memory indefinitely.
  • Records and Tuples are not supported yet, the function will throw for unknown types like that.

Install

npm install --save strid

Usage

import strid from 'strid';

strid ( null ); // => 'n';
strid ( undefined ); // => 'u';
strid ( true ); // => 't';
strid ( false ); // => 'f';
strid ( 0 ); // => '0';
strid ( -0 ); // => '-0';
strid ( 0n ); // => '0n';
strid ( 'foo' ); // => 'sfoo';
strid ( () => {} ); // => 'c1';
strid ( () => {} ); // => 'c2';
strid ( {} ); // => 'c3';
strid ( [] ); // => 'c4';
strid ( Symbol () ); // -> 'c5'

License

MIT © Fabio Spampinato

1.1.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago