UNPKG

686 BJavaScriptView Raw
1'use strict';
2var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
3var apply = require('../internals/function-apply');
4var $lastIndexOf = require('../internals/array-last-index-of');
5
6var aTypedArray = ArrayBufferViewCore.aTypedArray;
7var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
8
9// `%TypedArray%.prototype.lastIndexOf` method
10// https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof
11exportTypedArrayMethod('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) {
12 var length = arguments.length;
13 return apply($lastIndexOf, aTypedArray(this), length > 1 ? [searchElement, arguments[1]] : [searchElement]);
14});