find.js 282 B

12345678910111213
  1. var findIndex = require('./findIndex');
  2. /**
  3. * Returns first item that matches criteria
  4. */
  5. function find(arr, iterator, thisObj){
  6. var idx = findIndex(arr, iterator, thisObj);
  7. return idx >= 0? arr[idx] : void(0);
  8. }
  9. module.exports = find;