
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
json-key-map
Advanced tools
A module for mapping between JSON keys and values
npm install json-key-map
const JsonKeyMap = require("json-key-map");
const map = new JsonKeyMap();
map.set({ foo: 1, bar: 2 }, "test-value");
map.get({ foo: 1, bar: 2 });
//=> 'test-value'
Type: JsonKeyMap
Object
Elements to populate the JsonKeyMap with. Object
inputs must be in the same form as those created by the
JsonKeyMap.prototype.toJSON() method.
const map1 = new JsonKeyMap();
const map2 = new JsonKeyMap(map1);
const map3 = new JsonKeyMap({ '{"foo":1,"bar":2}': "test-value" });
Type: Object
Type: Function
Default: JSON.parse
Parses strings into the keys they represent.
Type: Function
Default: JSON.stringify
Converts keys into strings.
const stringify = require("json-stable-stringify");
const map = new JsonKeyMap(undefined, { keyStringifier: stringify });
Removes all key/value pairs from the JsonKeyMap
.
Returns true
if a element in the JsonKeyMap
existed and has been removed, or false
if the element does
not exist.
Type: Array
Object
string
number
boolean
null
The key of the element to be deleted.
Returns a new Iterator
object that contains an array of [key, value]
for each element in the JsonKeyMap
.
Calls callbackFn once for each element present in the JsonKeyMap
.
Returns the value associated to the key
, or undefined
if there is none.
Type: Array
Object
string
number
boolean
null
The key
of the element to be returned.
Returns a boolean asserting whether a value has been associated to the key
in the JsonKeyMap
or not.
Type: Array
Object
string
number
boolean
null
The key
of the element to be found.
Returns a new Iterator
object that contains the keys for each element in the JsonKeyMap
.
Sets the value of the key
in the JsonKeyMap
. Returns the JsonKeyMap
.
Type: Array
Object
string
number
boolean
null
The key
to set the value for.
Type: any
The value to store.
Type: number
The number of elements in the JsonKeyMap
.
Returns an Object
containing all elements in the JsonKeyMap
.
const map = new JsonKeyMap();
map.set({ foo: 1, bar: 2 }, "test-value");
const json = JSON.stringify(map);
console.log(JSON.parse(json));
//=>{ '{"foo":1,"bar":2}': "test-value" }
const map2 = new JsonKeyMap(JSON.parse(json));
Returns a new Iterator
object that contains the values for each element in the JsonKeyMap
.
Returns a new Iterator
object that contains an array of [key, value]
for each element in the JsonKeyMap
.
Some text from this readme was sourced from developer.mozilla.org.
FAQs
A module for mapping between JSON keys and values
The npm package json-key-map receives a total of 6 weekly downloads. As such, json-key-map popularity was classified as not popular.
We found that json-key-map 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.