mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-08-31 17:49:33 +00:00
20 lines
556 B
JavaScript
20 lines
556 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.parseScript = parseScript;
|
|
/**
|
|
* Convert a (potentially multi-line) script to an array of single-line script(s).
|
|
*/
|
|
function parseScript(rawScript) {
|
|
const scripts = rawScript
|
|
.trim()
|
|
.split(/\r\n|\n|\r/)
|
|
.map((value) => value.trim())
|
|
.filter((value) => {
|
|
return !value.startsWith('#') && value.length > 0;
|
|
});
|
|
if (scripts.length == 0) {
|
|
throw new Error(`No valid script found.`);
|
|
}
|
|
return scripts;
|
|
}
|