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

lodash.find

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.find

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

  • 4.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1M
decreased by-16.23%
Maintainers
3
Weekly downloads
 
Created

What is lodash.find?

The lodash.find npm package is a method from the Lodash library, which is a popular JavaScript utility library for manipulating and examining arrays, objects, and other data structures. The lodash.find function is used to search through an array or an object and return the first element that matches a specified condition.

What are lodash.find's main functionalities?

Find in Array

This code sample demonstrates how to use lodash.find to search through an array of objects and find the first object where the age is less than 40.

const _ = require('lodash');
const users = [
  { 'user': 'barney',  'age': 36, 'active': true },
  { 'user': 'fred',    'age': 40, 'active': false },
  { 'user': 'pebbles', 'age': 1,  'active': true }
];

const result = _.find(users, function(o) { return o.age < 40; });
console.log(result);

Find with Shorthand Syntax

This example shows how to use lodash.find with an object shorthand syntax to find an element in the array that exactly matches the specified properties.

const _ = require('lodash');
const users = [
  { 'user': 'barney',  'age': 36, 'active': true },
  { 'user': 'fred',    'age': 40, 'active': false },
  { 'user': 'pebbles', 'age': 1,  'active': true }
];

const result = _.find(users, { 'age': 1, 'active': true });
console.log(result);

Other packages similar to lodash.find

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