MCPcopy Index your code
hub / github.com/code-pushup/cli / answerArray

Function answerArray

packages/utils/src/lib/plugin-answers.ts:13–25  ·  view source on GitHub ↗
(
  answers: Record<string, PluginAnswer>,
  key: string,
)

Source from the content-addressed store, hash-verified

11
12/** Extracts a string array from a plugin answer, splitting CSV strings as fallback. */
13export function answerArray(
14 answers: Record<string, PluginAnswer>,
15 key: string,
16): string[] {
17 const value = answers[key];
18 if (Array.isArray(value)) {
19 return value;
20 }
21 return (typeof value === 'string' ? value : '')
22 .split(',')
23 .map(item => item.trim())
24 .filter(Boolean);
25}
26
27/** Extracts a non-empty string array from a plugin answer, using a default if empty. */
28export function answerNonEmptyArray(

Callers 5

parseAnswersFunction · 0.90
parseAnswersFunction · 0.90
parseAnswersFunction · 0.90
parseAnswersFunction · 0.90
answerNonEmptyArrayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected