Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
family-store
Advanced tools
A storage-agnostic store with parents. If the store doesn't have a key, it asks its parents, who ask their parents, et cetera (breadth-first). Circular dependencies are okay.
const JSONStore = require('atomic-json-store')
const FamilyStore = require('family-store')
const one = new FamilyStore('one', JSONStore('one.json'))
const two = new FamilyStore('two', new Map)
one.inherit(two)
two.inherit(one)
two.set('host', 'two.com')
one.get('host') === 'two.com';
one.getOwn('host') === undefined;
one.getOwner('host').owner === two;
one.set('host', 'one.com')
one.set('port', 8080)
one.get('host') === 'one.com';
two.get('port') === 8080;
FamilyStore(name, storage, [options])
The storage
should have the following synchronous interface:
get(key)
set(key, value)
delete(key)
or remove(key)
keys()
(array or iterable)clear()
(optional, falls back to delete()
all keys()
)Options:
inherit()
frominherit(parent)
Add a parent store to inherit from. Returns false
if it already inherits from parent
or if parent
is the store itself, otherwise true
.
get(key)
or getOwn(key)
Get a value with or without inheritance.
getOwner(key)
Returns an object with these properties:
key
owner
is the store itself)set(key, value)
Set own value of key.
delete(key)
or remove(key)
Delete own value of key.
clear()
Delete all own values.
keys()
or ownKeys()
Returns an array of keys with or without inheritance.
pairs()
or ownPairs()
Returns an array of [key, value]
pairs with or without inheritance.
toJSON()
Get an object with all values, own and inherited.
equals(familyStore)
a.equals(b)
is true if a.toJSON()
deep equals b.toJSON().
traverse(function)
Breadth-first traversal, starting with the store itself. The function
is called once for every store
with the arguments storage
, store
and depth
until the function returns a value other than undefined
.
const a = new FamilyStore('a', storage())
const b = new FamilyStore('b', storage())
const c = new FamilyStore('c', storage())
const d = new FamilyStore('d', storage())
a.inherit(b)
a.inherit(c)
b.inherit(a)
b.inherit(d)
a.traverse(function(storage, store, depth){
console.log('%s: %d', store.name, depth)
})
Gives:
a: 0
b: 1
c: 1
d: 2
With npm do:
npm install family-store
MIT © ironSource.
FAQs
A store that inherits values from its parent(s)
The npm package family-store receives a total of 0 weekly downloads. As such, family-store popularity was classified as not popular.
We found that family-store demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.