Installations
npm install extra-set
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Node Version
22.9.0
NPM Version
10.8.3
Score
75
Supply Chain
99.4
Quality
77.1
Maintenance
100
Vulnerability
100
License
Contributors
Unable to fetch Contributors
Languages
TypeScript (86.35%)
JavaScript (13.65%)
Developer
Download Statistics
Total Downloads
66,264
Last Day
57
Last Week
112
Last Month
429
Last Year
9,385
GitHub Statistics
1 Stars
126 Commits
1 Forks
3 Watching
2 Branches
1 Contributors
Bundle Size
7.95 kB
Minified
2.10 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.2.0
Package Id
extra-set@3.2.0
Unpacked Size
53.66 kB
Size
9.71 kB
File Count
6
NPM Version
10.8.3
Node Version
22.9.0
Publised On
29 Sept 2024
Total Downloads
Cumulative downloads
Total Downloads
66,264
Last day
1,325%
57
Compared to previous day
Last week
-52.3%
112
Compared to previous week
Last month
-44%
429
Compared to previous month
Last year
-24.4%
9,385
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
A pack of functions for working with Sets.
📦 Node.js,
🌐 Web,
📜 Files,
📰 Docs,
📘 Wiki.
A Set is a collection of unique values. This package includes common set functions related to querying about sets, generating them, comparing one with another, finding their size, adding and removing elements, obtaining its properties, getting a part of it, getting a subset elements in it, finding an element in it, performing functional operations, manipulating it in various ways, combining together sets or its elements, of performing set operations upon it.
All functions except from*()
take set as 1st parameter. Methods like
concat()
are pure and do not modify the set itself, while methods like
concat$()
do modify (update) the set 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 set = require('extra-set'); 2// import * as set from "extra-set"; 3// import * as set from "https://unpkg.com/extra-set/index.mjs"; (Deno) 4 5var x = new Set([1, 2, 3, 4, 5]); 6var y = new Set([2, 4]); 7set.difference(x, y); 8// → Set(3) { 1, 3, 5 } 9 10var x = new Set([1, 2, 3]); 11var y = new Set([3, 4]); 12set.isDisjoint(x, y); 13// → false 14 15var x = new Set([1, 2, 3, 4]); 16var y = new Set([3, 4, 5, 6]); 17set.symmetricDifference(x, y); 18// → Set(4) { 1, 2, 5, 6 } 19 20var x = new Set([1, 2, 3]); 21[...set.subsets(x)]; 22// → [ 23// → Set(0) {}, 24// → Set(1) { 1 }, 25// → Set(1) { 2 }, 26// → Set(2) { 1, 2 }, 27// → Set(1) { 3 }, 28// → Set(2) { 1, 3 }, 29// → Set(2) { 2, 3 }, 30// → Set(3) { 1, 2, 3 } 31// → ]
Index
Property | Description |
---|---|
is | Check if value is a set. |
values | List all values. |
entries | List all value-value pairs. |
from | Convert an iterable to set. |
from$ | Convert an iterable to set. |
compare | Compare two sets. |
isEqual | Check if two sets are equal. |
size | Find the size of a set. |
isEmpty | Check if a set is empty. |
add | Add a value to set. |
add$ | Add a value to set. |
remove | Delete a value from set. |
remove$ | Delete a value from set. |
count | Count values which satisfy a test. |
countAs | Count occurrences of values. |
min | Find smallest value. |
max | Find largest value. |
range | Find smallest and largest entries. |
head | Get first value from set (default order). |
tail | Get a set without its first value (default order). |
take | Keep first n values only (default order). |
take$ | Keep first n values only (default order). |
drop | Remove first n values (default order). |
drop$ | Remove first n values (default order). |
subsets | List all possible subsets. |
randomValue | Pick an arbitrary value. |
randomEntry | Pick an arbitrary entry. |
randomSubset | Pick an arbitrary subset. |
hasSubset | Checks if set has a subset. |
has | Check if set has a value. |
find | Find first value passing a test (default order). |
findAll | Find all values passing a test. |
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 set. |
map$ | Transform values of a set. |
reduce | Reduce values of set to a single value. |
filter | Keep values which pass a test. |
filter$ | Keep values which pass a test. |
reject | Discard values which pass a test. |
reject$ | Discard values which pass a test. |
flat | Flatten nested set to given depth. |
flatMap | Flatten nested set, based on map function. |
partition | Segregate values by test result. |
partitionAs | Segregates values by similarity. |
chunk | Break set into chunks of given size. |
concat | Append values from sets. |
concat$ | Append values from sets. |
join | Join values together into a string. |
isDisjoint | Check if sets have no value in common. |
union | Obtain values present in any set. |
union$ | Obtain values present in any set. |
intersection | Obtain values present in both sets. |
intersection$ | Obtain values present in both sets. |
difference | Obtain values not present in another set. |
difference$ | Obtain values not present in another set. |
symmetricDifference | Obtain values not present in both sets. |
symmetricDifference$ | Obtain values not present in both sets. |
cartesianProduct | List cartesian product of sets. |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
1 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:72: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:73: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/pr.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/nodef/extra-set/pr.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:63
- Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:80
- Info: 0 out of 10 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 4 third-party GitHubAction dependencies pinned
- Info: 5 out of 7 npmCommand dependencies pinned
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Warn: no topLevel permission defined: .github/workflows/pr.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3.6
/10
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