ts-to-html
Version:
TS and SASS compiler for a HTML with live preview
23 lines (22 loc) • 671 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseArgs = void 0;
function parseArgs(args) {
const flags = [], params = [];
for (const arg of args) {
if (arg.startsWith("--")) {
// i.e : "--am" => ["am"]
const flag = arg.slice(2);
flags.push(flag);
}
else if (arg.startsWith("-")) {
// i.e : "-am" => ["a", "m"]
const flagChars = arg.slice(1).split("");
flagChars.push(...flagChars);
}
else
params.push(arg);
}
return { flags, params };
}
exports.parseArgs = parseArgs;