MCPcopy Create free account
hub / github.com/cloudconvert/cloudconvert-cli / castBooleanParameter

Function castBooleanParameter

src/job.ts:586–605  ·  view source on GitHub ↗
(parameterName: string, value: unknown)

Source from the content-addressed store, hash-verified

584}
585
586function castBooleanParameter(parameterName: string, value: unknown): boolean {
587 if (typeof value === 'boolean') {
588 return value;
589 }
590
591 if (typeof value === 'string') {
592 switch (value.toLowerCase()) {
593 case 'true':
594 case '1':
595 case 'yes':
596 return true;
597 case 'false':
598 case '0':
599 case 'no':
600 return false;
601 }
602 }
603
604 throw new Error(`Parameter ${parameterName} must be a boolean.`);
605}
606
607function normalizeInputParameterFiles(parameterName: string, value: unknown): string | string[] {
608 if (typeof value === 'string') {

Callers 1

castSingleParameterValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected