You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

array-reduce-group-by

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-reduce-group-by

A group-by function working with the built-in Array.reduce()

1.0.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

array-reduce-group-by

NPM Version node Build Status Dependency Status Dev Dependency Status

A group-by function working with the built-in Array.reduce()

Install

$ npm install array-reduce-group-by

Usage

const arrayReduceGroupBy = require('array-reduce-group-by');

['Alpha', 'Beta', 'Animal']
	.reduce(arrayReduceGroupBy(o => o[0]), {})
//=> {A: ['Alpha', 'Animal'], B: ['Beta']}

Make sure not to forget the {} in the end!

API

arrayReduceGroupBy(keyFunc)

keyFunc

Type: (arrayElement) => string

Function to determine the key of a given array element

FAQs

Package last updated on 17 Nov 2019

Did you know?

Socket

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.

Install

Related posts