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

lodash.maxby

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.maxby

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

  • 4.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
644K
increased by35.96%
Maintainers
3
Weekly downloads
 
Created

What is lodash.maxby?

The lodash.maxby package is a utility library that provides a function to find the maximum element in a collection based on a specified criterion. It is part of the Lodash library, which is a popular JavaScript utility library that offers various functions for common programming tasks.

What are lodash.maxby's main functionalities?

Find maximum element by property

This feature allows you to find the maximum element in a collection of objects based on a specified property. In this example, the maximum object is found based on the 'n' property.

const _ = require('lodash.maxby');
const objects = [{ 'n': 1 }, { 'n': 2 }];
const maxObject = _.maxBy(objects, 'n');
console.log(maxObject); // { 'n': 2 }

Find maximum element by custom function

This feature allows you to find the maximum element in a collection of objects based on a custom function. In this example, the maximum object is found using a custom function that returns the 'n' property.

const _ = require('lodash.maxby');
const objects = [{ 'n': 1 }, { 'n': 2 }];
const maxObject = _.maxBy(objects, function(o) { return o.n; });
console.log(maxObject); // { 'n': 2 }

Other packages similar to lodash.maxby

Keywords

FAQs

Package last updated on 12 May 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