accessed
Accessed is a simple module that allows you to track property access of a given
object to ensure that only the data that is used (or not used) is included when
you JSON.stringify
the data.
Install
The module is published in the public npm registry and can be installed by running:
npm install --save accessed
Usage
const accessed = ; const data = ; console;console; // {"foo":"bar"} console;console; // {"foo":"bar", "bar": "wat"}
The module exposes the accessed
function as default export. The function
accepts 2 arguments.
data
The object that needs to be tracked.options
Additional configurationkeys
An array of keys that should be included, even when they are not accessed by the code.exclude
Instead of returning an object onJSON.stringify
that represents the keys that were accessed, return the data that was not accesed.
const data = ; console; // {"hello":"world"}