mirror of
https://github.com/denoland/deno.git
synced 2024-11-26 16:09:27 -05:00
343 lines
21 KiB
TypeScript
343 lines
21 KiB
TypeScript
|
/*! *****************************************************************************
|
||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||
|
this file except in compliance with the License. You may obtain a copy of the
|
||
|
License at http://www.apache.org/licenses/LICENSE-2.0
|
||
|
|
||
|
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||
|
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||
|
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||
|
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||
|
|
||
|
See the Apache Version 2.0 License for specific language governing permissions
|
||
|
and limitations under the License.
|
||
|
***************************************************************************** */
|
||
|
|
||
|
|
||
|
/// <reference no-default-lib="true"/>
|
||
|
|
||
|
interface Array<T> {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface ReadonlyArray<T> {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface Int8Array {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends number>(predicate: (value: number, index: number, array: Int8Array) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): number | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface Uint8Array {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends number>(predicate: (value: number, index: number, array: Uint8Array) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface Uint8ClampedArray {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends number>(predicate: (value: number, index: number, array: Uint8ClampedArray) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): number | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface Int16Array {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends number>(predicate: (value: number, index: number, array: Int16Array) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): number | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface Uint16Array {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends number>(predicate: (value: number, index: number, array: Uint16Array) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): number | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface Int32Array {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends number>(predicate: (value: number, index: number, array: Int32Array) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): number | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface Uint32Array {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends number>(predicate: (value: number, index: number, array: Uint32Array) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): number | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface Float32Array {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends number>(predicate: (value: number, index: number, array: Float32Array) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): number | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface Float64Array {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends number>(predicate: (value: number, index: number, array: Float64Array) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): number | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface BigInt64Array {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends bigint>(predicate: (value: bigint, index: number, array: BigInt64Array) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: bigint, index: number, array: BigInt64Array) => unknown, thisArg?: any): bigint | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: bigint, index: number, array: BigInt64Array) => unknown, thisArg?: any): number;
|
||
|
}
|
||
|
|
||
|
interface BigUint64Array {
|
||
|
/**
|
||
|
* Returns the value of the last element in the array where predicate is true, and undefined
|
||
|
* otherwise.
|
||
|
* @param predicate findLast calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found, findLast
|
||
|
* immediately returns that element value. Otherwise, findLast returns undefined.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLast<S extends bigint>(predicate: (value: bigint, index: number, array: BigUint64Array) => value is S, thisArg?: any): S | undefined;
|
||
|
findLast(predicate: (value: bigint, index: number, array: BigUint64Array) => unknown, thisArg?: any): bigint | undefined;
|
||
|
|
||
|
/**
|
||
|
* Returns the index of the last element in the array where predicate is true, and -1
|
||
|
* otherwise.
|
||
|
* @param predicate findLastIndex calls predicate once for each element of the array, in descending
|
||
|
* order, until it finds one where predicate returns true. If such an element is found,
|
||
|
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
|
||
|
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||
|
* predicate. If it is not provided, undefined is used instead.
|
||
|
*/
|
||
|
findLastIndex(predicate: (value: bigint, index: number, array: BigUint64Array) => unknown, thisArg?: any): number;
|
||
|
}
|