contains.js 404 B

12345678910
  1. import isArrayLike from './_isArrayLike.js';
  2. import values from './values.js';
  3. import indexOf from './indexOf.js';
  4. // Determine if the array or object contains a given item (using `===`).
  5. export default function contains(obj, item, fromIndex, guard) {
  6. if (!isArrayLike(obj)) obj = values(obj);
  7. if (typeof fromIndex != 'number' || guard) fromIndex = 0;
  8. return indexOf(obj, item, fromIndex) >= 0;
  9. }