import isObj from './isObj';
import findIndex from './findIndex';

/**
 * 判断值是否在数组、字符串或对象的key中
 * @param {string|Array|Object} collection
 * @param {*} predicate
 * @returns
 */
function includes(collection, predicate) {
  if (isObj(collection)) {
    collection = Object.keys(collection);
  }

  return findIndex(collection, predicate) > -1;
}

export default includes;
