Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lodash.groupby

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.groupby

The lodash method `_.groupBy` exported as a module.

  • 4.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is lodash.groupby?

The lodash.groupby npm package is a utility that allows for the grouping of collection items based on a specified criterion. This can be particularly useful for organizing data, performing aggregations, or simplifying complex collections of objects or arrays by categorizing them into groups.

What are lodash.groupby's main functionalities?

Grouping by property

This feature allows grouping of objects in an array by a specific property. In the provided code, objects are grouped by their 'age' property.

_.groupBy([{ 'age': 23 }, { 'age': 24 }], 'age')

Grouping by computed criterion

This demonstrates grouping elements of an array by a computed criterion, in this case, rounding down the numbers to the nearest whole number using Math.floor.

_.groupBy([6.1, 4.2, 6.3], Math.floor)

Grouping by property path

This feature allows for grouping by nested object properties, specified by a path. Here, objects are grouped based on the 'age' property nested under 'user'.

_.groupBy([{ 'user': { 'age': 23 } }, { 'user': { 'age': 24 } }], 'user.age')

Other packages similar to lodash.groupby

Keywords

FAQs

Package last updated on 13 Aug 2016

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc