Sha256: aeb70ec1202d937d37661b8d57195f4676f6aef24007b35624769c4544a348b7

Contents?: true

Size: 1.09 KB

Versions: 12

Compression:

Stored size: 1.09 KB

Contents

'use strict';
var toIndexedObject = require('../internals/to-indexed-object');
var toInteger = require('../internals/to-integer');
var toLength = require('../internals/to-length');
var sloppyArrayMethod = require('../internals/sloppy-array-method');

var min = Math.min;
var nativeLastIndexOf = [].lastIndexOf;
var NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
var SLOPPY_METHOD = sloppyArrayMethod('lastIndexOf');

// `Array.prototype.lastIndexOf` method implementation
// https://tc39.github.io/ecma262/#sec-array.prototype.lastindexof
module.exports = (NEGATIVE_ZERO || SLOPPY_METHOD) ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
  // convert -0 to +0
  if (NEGATIVE_ZERO) return nativeLastIndexOf.apply(this, arguments) || 0;
  var O = toIndexedObject(this);
  var length = toLength(O.length);
  var index = length - 1;
  if (arguments.length > 1) index = min(index, toInteger(arguments[1]));
  if (index < 0) index = length + index;
  for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
  return -1;
} : nativeLastIndexOf;

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/core-js/internals/array-last-index-of.js
disco_app-0.18.2 test/dummy/node_modules/core-js/internals/array-last-index-of.js
condenser-0.0.8 lib/condenser/processors/node_modules/core-js-pure/internals/array-last-index-of.js
jester-data-8.0.0 node_modules/core-js/internals/array-last-index-of.js
ezii-os-5.2.1 node_modules/core-js/internals/array-last-index-of.js
ezii-os-2.0.1 node_modules/core-js/internals/array-last-index-of.js
ezii-os-1.1.0 node_modules/core-js/internals/array-last-index-of.js
ezii-os-1.0.0 node_modules/core-js/internals/array-last-index-of.js
condenser-0.0.7 lib/condenser/processors/node_modules/core-js-pure/internals/array-last-index-of.js
ezii-os-0.0.0.1.0 node_modules/core-js/internals/array-last-index-of.js
ezii-os-0.0.0.0.1 node_modules/core-js/internals/array-last-index-of.js
condenser-0.0.5 lib/condenser/processors/node_modules/core-js-pure/internals/array-last-index-of.js