Test name | Executions per second |
---|---|
array find | 1993471.9 Ops/sec |
_.find | 1447335.0 Ops/sec |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.core.js"></script>
var users = {
0:{ 'user': 'joey', 'age': 32 },
1:{ 'user': 'ross', 'age': 41 },
2:{ 'user': 'chandler', 'age': 39 }
}
// Native
Object.values(users).find(function (o) { return o.age < 40; })
_.find(users, function (o) { return o.age < 40; })