UNPKG

isoscribe

Version:

An isomorphic logging utility for any JavaScript runtime, providing structured, styled, and extensible logs.

20 lines (19 loc) 573 B
import { exhaustiveMatchGuard } from "ts-jolt/isomorphic"; const createGetBullet = (type) => (index) => { switch (type) { case "dashes": return "-"; case "numbers": return `${index + 1}.`; default: exhaustiveMatchGuard(type); } }; /** * Prints an array of strings as an indented set * of bullet points. */ export function printAsBullets(strArr, options) { const getBullet = createGetBullet(options?.bulletType ?? "dashes"); return `${strArr.map((path, i) => `\n\t${getBullet(i)} ${path}`)}`; }