Skip to content

nonEmpty

nonEmpty(s): NonEmptyString

Defined in: src/core/types.ts:54

Validates and converts a string to NonEmptyString.

Parameters

s

string

The string to validate

Returns

NonEmptyString

The string as NonEmptyString

Throws

GitArgumentError if the string is empty

Example

const branchName = nonEmpty('feature-branch'); // OK
const invalid = nonEmpty(''); // throws GitArgumentError