π― Use case
This file lives under βutils/β, which covers cross-cutting helpers (shell, tempfiles, settings, messages, process input, β¦). On the API surface it exposes intersperse, count, and uniq β mainly functions, hooks, or classes.
Generated from folder role, exports, dependency roots, and inline comments β not hand-reviewed for every path.
π§ Inline summary
export function intersperse<A>(as: A[], separator: (index: number) => A): A[] { return as.flatMap((a, i) => (i ? [separator(i), a] : [a])) } export function count<T>(arr: readonly T[], pred: (x: T) => unknown): number {
π€ Exports (heuristic)
interspersecountuniq
π₯οΈ Source preview
export function intersperse<A>(as: A[], separator: (index: number) => A): A[] {
return as.flatMap((a, i) => (i ? [separator(i), a] : [a]))
}
export function count<T>(arr: readonly T[], pred: (x: T) => unknown): number {
let n = 0
for (const x of arr) n += +!!pred(x)
return n
}
export function uniq<T>(xs: Iterable<T>): T[] {
return [...new Set(xs)]
}