MCPcopy Create free account
hub / github.com/code-pushup/cli / answerNonEmptyArray

Function answerNonEmptyArray

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

Source from the content-addressed store, hash-verified

26
27/** Extracts a non-empty string array from a plugin answer, using a default if empty. */
28export function answerNonEmptyArray(
29 answers: Record<string, PluginAnswer>,
30 key: string,
31 defaultValue: string,
32): [string, ...string[]] {
33 const [first = defaultValue, ...rest] = answerArray(answers, key);
34 return [first, ...rest];
35}
36
37/** Extracts a boolean from a plugin answer, defaulting to `true`. */
38export function answerBoolean(

Callers 3

parseAnswersFunction · 0.90
parseAnswersFunction · 0.90
parseAnswersFunction · 0.90

Calls 1

answerArrayFunction · 0.85

Tested by

no test coverage detected