Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
array-group-by-ponyfill
Advanced tools
Array.prototype.groupBy
ponyfill.
A proposal to make grouping of items in an array easier.
npm install array-group-by-ponyfill --save
import groupBy from 'array-group-by-ponyfill';
groupBy([1, 2, 3, 4, 5], (value) => (value % 2 === 0 ? 'even' : 'odd'));
// { odd: [1, 3, 5], even: [2, 4] }
You can use named export preferNative
if you wish to use native
implementation if it’s available. In all other cases, ponyfill will be used.
Beware of
caveats!
Returns: object
Group array items.
Type: any[]
Array to group.
Type: Function
Callback which should return key with which to group array.
Argument | Type | Description |
---|---|---|
value | any | Current iteration value. |
index | number | Current iteration index. |
array | any[] | Original array reference. |
Tested in Chrome 72, Edge 15, Firefox 65 and should work in all modern browsers (support based on Browserslist configuration).
Test suite is taken and modified from core-js test suite.
For automated tests, run npm run test:automated
(append :watch
for watcher
support).
MIT © Ivan Nikolić
[1.0.0][] - 2021-12-15
FAQs
`Array.prototype.groupBy` ponyfill.
We found that array-group-by-ponyfill 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
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.