Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
array-product
Advanced tools
Returns an array of all combinations of elements from all arrays.
A simple function to duplicate Ruby's Array#product, but without extending the function on Array's prototype
.
This makes use of Array.prototype.flatMap
which has limited support in both Node and browsers. For Node this means for native flatMap
support you need to be above Node 10.x. If you are using this for browsers either polyfill the functionality with your favorite tool or core-js
.
const product = require('array-product');
product([1,2,3], [4,5]) // [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]
product([1,2], [1,2]) // [[1,1],[1,2],[2,1],[2,2]]
product([1,2], [3,4],[5,6]) // [[1,3,5],[1,3,6],[1,4,5],[1,4,6],
// [2,3,5],[2,3,6],[2,4,5],[2,4,6]]
product([1,2], nil) // [[1],[2]]
product([1,2], []) // []
FAQs
Returns an array of all combinations of elements from all arrays.
The npm package array-product receives a total of 2 weekly downloads. As such, array-product popularity was classified as not popular.
We found that array-product 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
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.