mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #38489 from microsoft/removeDuplicateInfo
Remove duplicate JSDoc comments
This commit is contained in:
@@ -129,6 +129,22 @@ namespace ts {
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new array with `element` interspersed in between each element of `input`
|
||||
* if there is more than 1 value in `input`. Otherwise, returns the existing array.
|
||||
*/
|
||||
export function intersperse<T>(input: T[], element: T): T[] {
|
||||
if (input.length <= 1) {
|
||||
return input;
|
||||
}
|
||||
const result: T[] = [];
|
||||
for (let i = 0, n = input.length; i < n; i++) {
|
||||
if (i) result.push(element);
|
||||
result.push(input[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates through `array` by index and performs the callback on each element of array until the callback
|
||||
* returns a falsey value, then returns false.
|
||||
|
||||
Reference in New Issue
Block a user