Skip to content

Instantly share code, notes, and snippets.

@vldvel
Last active April 20, 2018 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vldvel/fceb0ebf2c4cc19a700f5a660098fa84 to your computer and use it in GitHub Desktop.
Save vldvel/fceb0ebf2c4cc19a700f5a660098fa84 to your computer and use it in GitHub Desktop.
lodash find vs native find
const users = [
{ 'user': 'barney', 'age': 36, 'active': true },
{ 'user': 'fred', 'age': 40, 'active': false },
{ 'user': 'pebbles', 'age': 1, 'active': true }
];
const timerDateFindLodash = new Date();
console.log('lodash find', find(users, ({ age }) => age < 40));
console.log('lodash time', new Date() - timerDateFindLodash);
const timerDateFindJS = new Date();
console.log('native find', users.find(({ age }) => age < 40));
console.log('native time', new Date() - timerDateFindJS);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment