locutus
Version:
Locutus other languages' standard libraries to JavaScript for fun and educational purposes
16 lines (15 loc) • 655 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.indexOf = indexOf;
const _operator_ts_1 = require("../_helpers/_operator.js");
function indexOf(a, b) {
// discuss at: https://locutus.io/python/operator/indexOf/
// parity verified: Python 3.12
// original by: Kevin van Zonneveld (https://kvz.io)
// note 1: Finds the first matching element or substring like Python's operator.indexOf.
// example 1: indexOf([4, 5, 6], 5)
// returns 1: 1
// example 2: indexOf('banana', 'n')
// returns 2: 2
return (0, _operator_ts_1.pythonIndexOf)(a, b);
}