Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
electrum-field
Advanced tools
The electrum-field
module handles state associated with form fields and is
used by electrum
.
A field can have multiple states associated with it:
Each state is represented as a simple object.
The fingerprint of a state is built by concatenating the sorted
names of the state's properties (property id
is not included in
the computation of the fingerprint).
import {FieldStates} from 'electrum-field';
const state = {
id: '1234',
begin: 12,
end: 23
};
expect (FieldStates.fingerprint (state)).to.equal ('begin,end');
The states are managed by class FieldStates
, which maintains a read-only
array of simple state objects. An instance of FieldStates
is immutable.
To create a FieldStates
instance, use one of the static methods:
FieldStates.create ()
→ creates an empty states collection.FieldStates.from (s1, s2, ...)
→ create a states collection based
on the provided states s1
, s2
, etc.To manipulate a FieldStates
instance:
add (state)
→ adds or updates the state based; matching with any
existing states is based on the fingerprint.remove (state)
→ removes the state.find (state)
→ returns the immutable state (if it is found) or
undefined
otherwise.get ()
→ returns an immutable array of immutable states, as they
are stored in the FieldStates
instance.Methods remove()
and find()
accept either a simple object (the
values of the fields are not used in the comparison) or a fingerprint
to specify the state.
Methods add()
and remove()
return a new instance of FieldStates
if
the state changes; otherwise, they just return the same instance.
Note: states are considered to be equal if they respond
true
to shallow equality. Since states should be simple objects where all properties are just value types, a shallow comparison is enough.
FAQs
Electrum Field handles state associated with form fields.
The npm package electrum-field receives a total of 6 weekly downloads. As such, electrum-field popularity was classified as not popular.
We found that electrum-field 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.