with-known-usage
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

with known usage


Just be aware

Tracking object usage in a performant way. Created specially for tracking redux store usage.

import {withKnowUsage} from 'with-known-usage';

const obj = { a:1, b:2 };

const {
  proxy: obj,
  usage: Set<string>,
  usedKeys: Array<string>,
  resetUsage()
} = withKnowUsage(obj);

usage.has('a') === false;
usedKeys === [];

// now use it
proxy.a === 1 // (==obj.a)

usage.has('a') === true;
usedKeys === ['a'];

Package Sidebar

Install

npm i with-known-usage

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

6.38 kB

Total Files

7

Last publish

Collaborators

  • kashey