Gathering detailed insights and metrics for extra-map
Gathering detailed insights and metrics for extra-map
npm install extra-map
Typescript
Module System
Node Version
NPM Version
75.9
Supply Chain
99.4
Quality
77.1
Maintenance
100
Vulnerability
100
License
TypeScript (91.87%)
JavaScript (8.13%)
Total Downloads
87,188
Last Day
23
Last Week
141
Last Month
649
Last Year
6,296
4 Stars
239 Commits
1 Forks
3 Watching
2 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
3.2.0
Package Id
extra-map@3.2.0
Unpacked Size
78.74 kB
Size
15.22 kB
File Count
6
NPM Version
10.8.3
Node Version
22.9.0
Publised On
29 Sept 2024
Cumulative downloads
Total Downloads
Last day
130%
23
Compared to previous day
Last week
123.8%
141
Compared to previous week
Last month
221.3%
649
Compared to previous month
Last year
-62.9%
6,296
Compared to previous year
A group of functions for working with Maps.
📦 Node.js,
🌐 Web,
📜 Files,
📰 Docs,
📘 Wiki.
A Map is a collection of key-value pairs, with unique keys. This package includes common set functions related to querying about map, generating them, comparing one with another, finding their size, adding and removing entries, obtaining its properties, getting a part of it, getting a subset entries in it, finding an entry in it, performing functional operations, manipulating it in various ways, combining together maps or its entries, of performing set operations upon it.
All functions except from*()
take set as 1st parameter. Some names
are borrowed from Haskell, Python, Java, Processing. Methods like
swap()
are pure and do not modify the map itself, while methods like
swap$()
do modify (update) the map itself.
This package is available in Node.js and Web formats. The web format
is exposed as extra_set
standalone variable and can be loaded from
jsDelivr CDN.
Stability: Experimental.
1const map = require('extra-map'); 2// import * as map from "extra-map"; 3// import * as map from "https://unpkg.com/extra-map/index.mjs"; (deno) 4 5var x = new Map([["a", 1], ["b", 2], ["c", 3], ["d", 4]]); 6map.swap(x, "a", "b"); 7// → Map(4) { "a" => 2, "b" => 1, "c" => 3, "d" => 4 } 8 9var x = new Map([["a", 1], ["b", 2], ["c", 3], ["d", 4]]); 10var y = new Map([["b", 20], ["c", 30], ["e", 50]]); 11map.intersection(x, y); 12// → Map(2) { "b" => 2, "c" => 3 } 13 14var x = new Map([["a", 1], ["b", 2], ["c", 3], ["d", -2]]); 15map.searchAll(x, v => Math.abs(v) === 2); 16// → [ "b", "d" ] ^ ^ 17 18var x = new Map([["a", 1], ["b", 2], ["c", 3]]); 19[...map.subsets(x)]; 20// → [ 21// → Map(0) {}, 22// → Map(1) { "a" => 1 }, 23// → Map(1) { "b" => 2 }, 24// → Map(2) { "a" => 1, "b" => 2 }, 25// → Map(1) { "c" => 3 }, 26// → Map(2) { "a" => 1, "c" => 3 }, 27// → Map(2) { "b" => 2, "c" => 3 }, 28// → Map(3) { "a" => 1, "b" => 2, "c" => 3 } 29// → ]
Property | Description |
---|---|
is | Check if value is a map. |
keys | List all keys. |
values | List all values. |
entries | List all key-value pairs. |
from | Convert entries to map. |
from$ | Convert entries to map. |
fromLists | Convert lists to map. |
fromKeys | Create a map from keys. |
fromValues | Create a map from values. |
compare | Compare two maps. |
isEqual | Check if two maps are equal. |
size | Find the size of a map. |
isEmpty | Check if a map is empty. |
get | Get value at key. |
getAll | Get values at keys. |
getPath | Get value at path in a nested map. |
hasPath | Check if nested map has a path. |
set | Set value at key. |
set$ | Set value at key. |
setPath$ | Set value at path in a nested map. |
swap | Exchange two values. |
swap$ | Exchange two values. |
remove | Remove value at key. |
remove$ | Remove value at key. |
removePath$ | Remove value at path in a nested map. |
count | Count values which satisfy a test. |
countAs | Count occurrences of values. |
min | Find smallest value. |
minEntry | Find smallest entry. |
max | Find largest value. |
maxEntry | Find largest entry. |
range | Find smallest and largest values. |
rangeEntries | Find smallest and largest entries. |
head | Get first entry from map (default order). |
tail | Get a map without its first entry (default order). |
take | Keep first n entries only (default order). |
take$ | Keep first n entries only (default order). |
drop | Remove first n entries (default order). |
drop$ | Remove first n entries (default order). |
subsets | List all possible subsets. |
randomKey | Pick an arbitrary key. |
randomEntry | Pick an arbitrary entry. |
randomSubset | Pick an arbitrary subset. |
has | Check if map has a key. |
hasValue | Check if map has a value. |
hasEntry | Check if map has an entry. |
hasSubset | Check if map has a subset. |
find | Find first value passing a test (default order). |
findAll | Find values passing a test. |
search | Find key of an entry passing a test. |
searchAll | Find keys of entries passing a test. |
searchValue | Find a key with given value. |
searchValueAll | Find keys with given value. |
forEach | Call a function for each value. |
some | Check if any value satisfies a test. |
every | Check if all values satisfy a test. |
map | Transform values of a map. |
map$ | Transform values of a map. |
reduce | Reduce values of set to a single value. |
filter | Keep entries which pass a test. |
filter$ | Keep entries which pass a test. |
filterAt | Keep values at given keys. |
filterAt$ | Keep values at given keys. |
reject | Discard entries which pass a test. |
reject$ | Discard entries which pass a test. |
rejectAt | Discard values at given keys. |
rejectAt$ | Discard values at given keys. |
flat | Flatten nested map to given depth. |
flatMap | Flatten nested map, based on map function. |
zip | Combine matching entries from maps. |
partition | Segregate entries by test result. |
partitionAs | Segregate entries by similarity. |
chunk | Break map into chunks of given size. |
concat | Append entries from maps, preferring last. |
concat$ | Append entries from maps, preferring last. |
join | Join entries together into a string. |
isDisjoint | Check if maps have no common keys. |
unionKeys | Obtain keys present in any map. |
union | Obtain entries present in any map. |
union$ | Obtain entries present in any map. |
intersectionKeys | Obtain keys present in all maps. |
intersection | Obtain entries present in both maps. |
intersection$ | Obtain entries present in both maps. |
difference | Obtain entries not present in another map. |
difference$ | Obtain entries not present in another map. |
symmetricDifference | Obtain entries not present in both maps. |
symmetricDifference$ | Obtain entries not present in both maps. |
cartesianProduct | List cartesian product of maps. |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-13
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More