source: node_modules/ramda/src/indexOf.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 969 bytes
Line 
1var _curry2 =
2/*#__PURE__*/
3require("./internal/_curry2.js");
4
5var _indexOf =
6/*#__PURE__*/
7require("./internal/_indexOf.js");
8
9var _isArray =
10/*#__PURE__*/
11require("./internal/_isArray.js");
12/**
13 * Returns the position of the first occurrence of an item in an array, or -1
14 * if the item is not included in the array. [`R.equals`](#equals) is used to
15 * determine equality.
16 *
17 * @func
18 * @memberOf R
19 * @since v0.1.0
20 * @category List
21 * @sig a -> [a] -> Number
22 * @param {*} target The item to find.
23 * @param {Array} xs The array to search in.
24 * @return {Number} the index of the target, or -1 if the target is not found.
25 * @see R.lastIndexOf, R.findIndex
26 * @example
27 *
28 * R.indexOf(3, [1,2,3,4]); //=> 2
29 * R.indexOf(10, [1,2,3,4]); //=> -1
30 */
31
32
33var indexOf =
34/*#__PURE__*/
35_curry2(function indexOf(target, xs) {
36 return typeof xs.indexOf === 'function' && !_isArray(xs) ? xs.indexOf(target) : _indexOf(xs, target, 0);
37});
38
39module.exports = indexOf;
Note: See TracBrowser for help on using the repository browser.