Socket
Socket
Sign inDemoInstall

array-reduce-group-by

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

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()


Version published
Weekly downloads
3
decreased by-40%
Maintainers
1
Install size
3.97 kB
Created
Weekly downloads
 

Readme

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

Last updated on 17 Nov 2019

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc