Test name | Executions per second |
---|---|
Native find | 39342480.0 Ops/sec |
Lodash find | 7893685.0 Ops/sec |
Lodash some | 3506421.8 Ops/sec |
Native some | 38422060.0 Ops/sec |
Native find index | 33303154.0 Ops/sec |
Complex | 11148775.0 Ops/sec |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.10/lodash.core.js"></script>
var selected = [{ id: '1' }, { id: '2' }, { id: '3' }];
var found = selected.find(m => m.id === '3');
var found = _.find(selected, m => m.id === '3');
var found = _.some(selected, m => m.id === '3')
var found = selected.some(m => m.id === '3')
var found = selected.findIndex(m => m.id === '3')
var indexes = selected.map(s => s.id);
var found = selected.includes('3');