Last active
April 20, 2018 07:29
-
-
Save vldvel/fceb0ebf2c4cc19a700f5a660098fa84 to your computer and use it in GitHub Desktop.
lodash find vs native find
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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