MCPcopy Create free account
hub / github.com/ReactiveCircus/android-emulator-runner / parseScript

Function parseScript

src/script-parser.ts:4–18  ·  view source on GitHub ↗
(rawScript: string)

Source from the content-addressed store, hash-verified

2 * Convert a (potentially multi-line) script to an array of single-line script(s).
3 */
4export function parseScript(rawScript: string): Array<string> {
5 const scripts: Array<string> = rawScript
6 .trim()
7 .split(/\r\n|\n|\r/)
8 .map((value: string) => value.trim())
9 .filter((value: string) => {
10 return !value.startsWith('#') && value.length > 0;
11 });
12
13 if (scripts.length == 0) {
14 throw new Error(`No valid script found.`);
15 }
16
17 return scripts;
18}

Callers 1

runFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected