Sha256: 6d008a0b6871109ac232969f6da62f8c6685ad35c5c51e403b18f23ddd0dd476
Contents?: true
Size: 678 Bytes
Versions: 69
Compression:
Stored size: 678 Bytes
Contents
/** * Array lastIndexOf */ function lastIndexOf(arr, item, fromIndex) { if (arr == null) { return -1; } var len = arr.length; fromIndex = (fromIndex == null || fromIndex >= len)? len - 1 : fromIndex; fromIndex = (fromIndex < 0)? len + fromIndex : fromIndex; while (fromIndex >= 0) { // we iterate over sparse items since there is no way to make it // work properly on IE 7-8. see #64 if (arr[fromIndex] === item) { return fromIndex; } fromIndex--; } return -1; } module.exports = lastIndexOf;
Version data entries
69 entries across 69 versions & 2 rubygems