.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / internals / array-last-index-of.js
1 'use strict';
2 var toIndexedObject = require('../internals/to-indexed-object');
3 var toInteger = require('../internals/to-integer');
4 var toLength = require('../internals/to-length');
5 var arrayMethodIsStrict = require('../internals/array-method-is-strict');
6
7 var min = Math.min;
8 var nativeLastIndexOf = [].lastIndexOf;
9 var NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
10 var STRICT_METHOD = arrayMethodIsStrict('lastIndexOf');
11 var FORCED = NEGATIVE_ZERO || !STRICT_METHOD;
12
13 // `Array.prototype.lastIndexOf` method implementation
14 // https://tc39.es/ecma262/#sec-array.prototype.lastindexof
15 module.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
16   // convert -0 to +0
17   if (NEGATIVE_ZERO) return nativeLastIndexOf.apply(this, arguments) || 0;
18   var O = toIndexedObject(this);
19   var length = toLength(O.length);
20   var index = length - 1;
21   if (arguments.length > 1) index = min(index, toInteger(arguments[1]));
22   if (index < 0) index = length + index;
23   for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
24   return -1;
25 } : nativeLastIndexOf;