Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
accessed
Advanced tools
Readme
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.
The module is published in the public npm registry and can be installed by running:
npm install --save accessed
const accessed = require('accessed');
const data = accessed({
foo: 'bar',
bar: 'wat',
key: 'value'
});
console.log(data.foo);
console.log(JSON.stringify(data)); // {"foo":"bar"}
console.log(data.bar);
console.log(JSON.stringify(data)); // {"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 configuration
keys
An array of keys that should be included, even when they are not
accessed by the code.exclude
Instead of returning an object on JSON.stringify
that represents
the keys that were accessed, return the data that was not accesed.const data = accessed({ foo: 'bar', hello: 'world' }, {
keys: ['hello']
});
console.log(JSON.stringify(data)); // {"hello":"world"}
FAQs
Only JSON.stringify the properties that we're accessed on the object.
The npm package accessed receives a total of 2 weekly downloads. As such, accessed popularity was classified as not popular.
We found that accessed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.