reduceRight is never used (#19605)
This commit is contained in:
parent
98e9a561af
commit
ce25dc9807
1 changed files with 0 additions and 26 deletions
|
@ -985,32 +985,6 @@ namespace ts {
|
||||||
return initial;
|
return initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function reduceRight<T, U>(array: ReadonlyArray<T>, f: (memo: U, value: T, i: number) => U, initial: U, start?: number, count?: number): U;
|
|
||||||
export function reduceRight<T>(array: ReadonlyArray<T>, f: (memo: T, value: T, i: number) => T): T;
|
|
||||||
export function reduceRight<T>(array: T[], f: (memo: T, value: T, i: number) => T, initial?: T, start?: number, count?: number): T {
|
|
||||||
if (array) {
|
|
||||||
const size = array.length;
|
|
||||||
if (size > 0) {
|
|
||||||
let pos = start === undefined || start > size - 1 ? size - 1 : start;
|
|
||||||
const end = count === undefined || pos - count < 0 ? 0 : pos - count;
|
|
||||||
let result: T;
|
|
||||||
if (arguments.length <= 2) {
|
|
||||||
result = array[pos];
|
|
||||||
pos--;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
result = initial;
|
|
||||||
}
|
|
||||||
while (pos >= end) {
|
|
||||||
result = f(result, array[pos], pos);
|
|
||||||
pos--;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return initial;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue