Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@teamawesome/multi-dict
Advanced tools
``` npm install @teamawesome/multi-dict ``` # Usage The aim of multi-dict is to behave just like a set of nested maps, but with an easy to use api. ``` import MultiDict from '@teamawesome/multi-dict'
npm install @teamawesome/multi-dict
The aim of multi-dict is to behave just like a set of nested maps, but with an easy to use api.
import MultiDict from '@teamawesome/multi-dict'
const dict = new MultiDict();
entries
Optional. An iterable whose elements are in the shape of [key1, ..., value]
. Each element is added to
the dict.options
Optional. A hash of options as specified in the options paragraph.new Dict([ /* Entries */ ], { /* Options */ });
new Dict([ /* Entries */ ]);
new Dict({ /* Options */ });
By default, for each level of the dict a Map is used. However, you can specify a type for each level and/or a default type.
defaultType
The type for each level that is not specified in types
. Default is Map.types
Array of types, for each depth that should be specified.// Each level of the dict will be an array
new MultiDict({
defaultType: Array
});
// The first level will be an Object, the second an Array.
// The third and deeper levels will be the default type.
new MultiDict({
types: [Object, Array]
});
get(...keys)
Get a value by it's pathset(...keys, value)
Set a value by a path of keyshas(...keys)
Check if a path of keys existsdelete(...keys)
Delete a path of keysclear
Remove all entries in the dictforEach(callback, thisArg)
Run a callback for each entry of the dictdict.set(key1, key2, value);
dict.get(key1, key2); // => value
It's possible to get/set/delete a sub-level of the dictionary by omitting the last key(s) from a path.
keys
Get an iterable yielding all the paths of the dictvalues
Get an iterable yielding all the values of the dictentries
Get an iterable yielding all the paths and values of the dictSymbol.iterator
Get an iterable yielding all the paths and values of the dictfor (const key of dict.keys())
for (const [key, value] of dict)
size
The amount of entries in the dictionaryFAQs
```shell script npm install @teamawesome/multi-dict ``` # Usage The aim of multi-dict is to behave just like a set of nested maps, but with an easy to use api. It supports all the regular methods of `Map`, including the iterators. ```js import Dict
The npm package @teamawesome/multi-dict receives a total of 0 weekly downloads. As such, @teamawesome/multi-dict popularity was classified as not popular.
We found that @teamawesome/multi-dict 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.