INNER CODE UNIT · JavaScript
opsh
danburzo/percollate · src/cli-opts.js:8
function opsh(arr, fn) {
const noop = () => {};
const fn_opt = fn.option || noop;
const fn_operand = fn.operand || noop;
const fn_delim = fn.delimiter || noop;
let args = arr.slice();
let curr,
m,
has_delim = false,
last_opt = undefined;
while ((curr = args.shift()) !== undefined) {
if (has_delim) {
if (fn_operand(curr) === false) {
return;
}
continue;
}