You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9 lines
199 B

8 years ago
  1. var indexOf = [].indexOf;
  2. module.exports = function(arr, obj){
  3. if (indexOf) return arr.indexOf(obj);
  4. for (var i = 0; i < arr.length; ++i) {
  5. if (arr[i] === obj) return i;
  6. }
  7. return -1;
  8. };