UNPKG

cmpstr-cli

Version:

simple CLI wrapper for the cmpstr package to normalize and compare strings directly via terminal

19 lines (18 loc) 429 B
/** * Module `readList` for `cmpstr-cli` * * Reads input as list. * * @author Paul Köhler (komed3) * @license MIT */ import { readInput } from './readInput.js'; export async function readList(source, delimiter = ',') { try { const text = await readInput(source); return text.split(/\n/.exec(text) ? /\r?\n/ : delimiter).map(l => l.trim()).filter(Boolean); } catch { return []; } }