1 | import _curry2 from "./internal/_curry2.js";
|
2 | import _indexOf from "./internal/_indexOf.js";
|
3 | import _isArray from "./internal/_isArray.js";
|
4 | /**
|
5 | * Returns the position of the first occurrence of an item in an array, or -1
|
6 | * if the item is not included in the array. [`R.equals`](#equals) is used to
|
7 | * determine equality.
|
8 | *
|
9 | * @func
|
10 | * @memberOf R
|
11 | * @since v0.1.0
|
12 | * @category List
|
13 | * @sig a -> [a] -> Number
|
14 | * @param {*} target The item to find.
|
15 | * @param {Array} xs The array to search in.
|
16 | * @return {Number} the index of the target, or -1 if the target is not found.
|
17 | * @see R.lastIndexOf
|
18 | * @example
|
19 | *
|
20 | * R.indexOf(3, [1,2,3,4]); //=> 2
|
21 | * R.indexOf(10, [1,2,3,4]); //=> -1
|
22 | */
|
23 |
|
24 | var indexOf =
|
25 | /*#__PURE__*/
|
26 | _curry2(function indexOf(target, xs) {
|
27 | return typeof xs.indexOf === 'function' && !_isArray(xs) ? xs.indexOf(target) : _indexOf(xs, target, 0);
|
28 | });
|
29 |
|
30 | export default indexOf; |
\ | No newline at end of file |