MCPcopy Create free account
hub / github.com/msgbyte/tailchat / joinArray

Function joinArray

client/shared/utils/array-helper.ts:11–21  ·  view source on GitHub ↗
(arr: T[], separator: K)

Source from the content-addressed store, hash-verified

9 * @example joinArray([1, 2, 3], '5') => [1, '5', 2, '5', 3]
10 */
11export function joinArray<T, K>(arr: T[], separator: K): (T | K)[] {
12 return _flatten(
13 arr.map((item, i) => {
14 if (i === 0) {
15 return [item];
16 } else {
17 return [separator, item];
18 }
19 })
20 );
21}

Callers 2

SpeakerNames.tsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected