Improvements to group calling video requests
This commit is contained in:
parent
5c72c785a0
commit
3f0ed541f6
6 changed files with 95 additions and 32 deletions
|
@ -133,6 +133,21 @@ export function groupBy<T>(
|
|||
export const isEmpty = (iterable: Iterable<unknown>): boolean =>
|
||||
Boolean(iterable[Symbol.iterator]().next().done);
|
||||
|
||||
export function join(iterable: Iterable<unknown>, separator: string): string {
|
||||
let hasProcessedFirst = false;
|
||||
let result = '';
|
||||
for (const value of iterable) {
|
||||
const stringifiedValue = value == null ? '' : String(value);
|
||||
if (hasProcessedFirst) {
|
||||
result += separator + stringifiedValue;
|
||||
} else {
|
||||
result = stringifiedValue;
|
||||
}
|
||||
hasProcessedFirst = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function map<T, ResultT>(
|
||||
iterable: Iterable<T>,
|
||||
fn: (value: T) => ResultT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue