domaindrivenjs
Version:
Composition-based Domain-Driven Design toolkit for JavaScript/TypeScript
42 lines (41 loc) • 1.24 kB
TypeScript
/**
* NonEmptyString represents a string with at least one character
*
* Use cases:
* - Names (person, product, category)
* - Titles and headings
* - References and codes
* - Any text that must not be empty
*
* Features:
* - Validates string is not empty
* - Trims whitespace by default
* - Inherits all methods from StringValue
*
* @example
* const name = NonEmptyString.create("John Doe");
* const title = NonEmptyString.create("Product Launch");
*
* // Will throw ValidationError:
* const empty = NonEmptyString.create("");
* const whitespace = NonEmptyString.create(" ");
*
* @typedef {import('../Base.js').ValueObject<string>} NonEmptyStringType
*/
export const NonEmptyString: import("../Base.js").ValueObjectFactory<unknown, z.ZodType<any, z.ZodTypeDef, any>>;
/**
* NonEmptyString represents a string with at least one character
*
* Use cases:
* - Names (person, product, category)
* - Titles and headings
* - References and codes
* - Any text that must not be empty
*
* Features:
* - Validates string is not empty
* - Trims whitespace by default
* - Inherits all methods from StringValue
*/
export type NonEmptyStringType = import("../Base.js").ValueObject<string>;
import { z } from "zod";