Let Me Tink About It
Let Me Tink About It

Reputation: 16102

Where is the source code for the Lodash _.find() function?

Here is the find function for Lodash.

Example
var users = [
  { 'user': 'barney',  'age': 36, 'active': true },
  { 'user': 'fred',    'age': 40, 'active': false },
  { 'user': 'pebbles', 'age': 1,  'active': true }
];
 
_.find(users, function(o) { return o.age < 40; });
// => object for 'barney'
 
// The `_.matches` iteratee shorthand.
_.find(users, { 'age': 1, 'active': true });
// => object for 'pebbles'
 
// The `_.matchesProperty` iteratee shorthand.
_.find(users, ['active', false]);
// => object for 'fred'
 
// The `_.property` iteratee shorthand.
_.find(users, 'active');
// => object for 'barney

Here is the Lodash Github repo.

I'm trying to find the _.find() function in the repo but I don't see it.

Where is it?

Upvotes: 1

Views: 369

Answers (1)

Mike M
Mike M

Reputation: 5122

It seems like they have put everything in one file: https://github.com/lodash/lodash/blob/4.17.15/lodash.js

Upvotes: 0

Related Questions