Sha256: a244755fb1991802f8b548539bd0e0214f9225e64bc70f49ab8aaccb165b03bf

Contents?: true

Size: 986 Bytes

Versions: 26

Compression:

Stored size: 986 Bytes

Contents

'use strict';

var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');

var Call = require('es-abstract/2023/Call');
var Get = require('es-abstract/2023/Get');
var IsCallable = require('es-abstract/2023/IsCallable');
var LengthOfArrayLike = require('es-abstract/2023/LengthOfArrayLike');
var ToBoolean = require('es-abstract/2023/ToBoolean');
var ToObject = require('es-abstract/2023/ToObject');
var ToString = require('es-abstract/2023/ToString');

module.exports = function findLastIndex(predicate) {
	var O = ToObject(this);
	var len = LengthOfArrayLike(O);

	if (!IsCallable(predicate)) {
		throw new $TypeError('predicate must be a function');
	}

	var thisArg;
	if (arguments.length > 1) {
		thisArg = arguments[1];
	}

	var k = len - 1;
	while (k >= 0) {
		var Pk = ToString(k);
		var kValue = Get(O, Pk);
		var testResult = ToBoolean(Call(predicate, thisArg, [kValue, k, O]));
		if (testResult) {
			return k;
		}
		k -= 1;
	}

	return -1;
};

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.32 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.31 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.30 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.29 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.28 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.27 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.26 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.25 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.24 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.23 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.22 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.21 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.20 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.19 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.18 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.17 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.16 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.14 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.13 node_modules/array.prototype.findlastindex/implementation.js
immosquare-cleaner-0.1.12 node_modules/array.prototype.findlastindex/implementation.js