Skip to main content
Version: v0.0.3

Function: asCosyteFormat()

asCosyteFormat(value): CosyteFormat | null

Narrow an arbitrary --format string to a CosyteFormat, or null if it is not a known format name (which the caller turns into a usage error, exit 2).

Parameters

value

string

The raw --format argument.

Returns

CosyteFormat | null

The narrowed format, or null.

Example

import { asCosyteFormat } from "@cosyte/cli";

asCosyteFormat("hl7"); // => "hl7"
asCosyteFormat("nope"); // => null