MCPcopy Create free account
hub / github.com/EndBug/add-and-commit / parseInputArray

Function parseInputArray

src/util.ts:75–87  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

73 * If it fails, it returns an array containing the input value as its only element.
74 */
75export function parseInputArray(input: string): string[] {
76 core.debug(`Parsing input array: ${input}`);
77 try {
78 const yaml = YAML.load(input);
79 if (yaml && Array.isArray(yaml) && yaml.every(e => typeof e === 'string')) {
80 core.debug(`Input parsed as YAML array of length ${yaml.length}`);
81 return yaml;
82 }
83 } catch {} // eslint-disable-line no-empty
84
85 core.debug('Input parsed as single string');
86 return [input];
87}
88
89export function readJSON(filePath: string) {
90 let fileContent: string;

Callers 4

util.test.tsFile · 0.90
checkInputsFunction · 0.90
addFunction · 0.90
removeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected