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.
Foliage is lightweight tree that operates on a tree of JavaScript primitives. It is modeled
loosely on Om's Cursor
and
OmniscientJS's immstruct
,
however it is not nearly as ambitious. It compromises on robustness
and purity for the benefit of build size.
Foliage makes it easier to work with data in component-oriented frameworks such as React by allowing data to be passed around in terms of references to locations in a global application state object. This means that state can be maintained in a single location, however that entire structure isn't necessary for an individual component.
Foliage accepts a seed:
let plant = new Foliage({ berries: true })
get
pulls data out of a "plant."
let plant = new Foliage({ berries: true })
plant.get('berries').valueOf() // => true
Take out that valueOf
must be called to retrieve the value out of a
plant. This is because get
returns a branch
. Now let's dig into
that.
Calling get
returns a branch
. Technically, this is called a
cursor
, but let's keep with the dendrology theme.
let oak = new Foliage({
squirrels: {
squeakem: { weight: 2, height: 12 }
chatters: { weight: 5, height: 8 }
}
})
let squirrels = oak.get('squirrels')
In this example, squirrels
is a subset of oak
focused on the
squirrels
key. Under the hood, they point to the same underlying
data. This means if you set
in squirrel
, oak
will be modified as
well:
squirrels.set(['squeakem', 'weight'], 5)
oak.get(['squirrels', 'squeakem', 'weight']).valueOf() // => 5
A couple of things are going on here. First, set
is used to modify
data. Second, both get
and set
accept an array of keys. When given
an array, they will traverse the tree for the leaf value instead of
just returning the key from the most immediate level.
There is nothing novel about Foliage, it shamelessly mimics:
FAQs
Styled Components for forest
The npm package foliage receives a total of 5,212 weekly downloads. As such, foliage popularity was classified as popular.
We found that foliage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.