@newdash/newdash
Version:
javascript/typescript utility library
24 lines (23 loc) • 982 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const baseFindIndex_1 = __importDefault(require("./baseFindIndex"));
const baseIsNaN_1 = __importDefault(require("./baseIsNaN"));
const strictIndexOf_1 = __importDefault(require("./strictIndexOf"));
/**
* The base implementation of `indexOf` without `fromIndex` bounds checks.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
return value === value
? (0, strictIndexOf_1.default)(array, value, fromIndex)
: (0, baseFindIndex_1.default)(array, baseIsNaN_1.default, fromIndex);
}
exports.default = baseIndexOf;