with-known-usage
v1.0.0
Published
Observes object key usage
Downloads
5
Readme
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'];