artdaq_node_server  v1_00_07
 All Classes Namespaces Files Variables Pages
includes.js
1 var baseIndexOf = require('./_baseIndexOf'),
2  isArrayLike = require('./isArrayLike'),
3  isString = require('./isString'),
4  toInteger = require('./toInteger'),
5  values = require('./values');
6 
7 /* Built-in method references for those with the same name as other `lodash` methods. */
8 var nativeMax = Math.max;
9 
40 function includes(collection, value, fromIndex, guard) {
41  collection = isArrayLike(collection) ? collection : values(collection);
42  fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
43 
44  var length = collection.length;
45  if (fromIndex < 0) {
46  fromIndex = nativeMax(length + fromIndex, 0);
47  }
48  return isString(collection)
49  ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
50  : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
51 }
52 
53 module.exports = includes;