Skip to content

toMapDataParser ​

The toMapDataParser() function converts a Clean handler (NewType, constraint, primitive, or entity property definition) into a DataParser. The resulting parser maps parsed input into a typed object while preserving business kinds (newTypeKind, constrainedTypeKind) when available.

Interactive example ​

Syntax ​

Classic signature ​

typescript
function toMapDataParser(
	input: ConstraintHandler | ConstraintsSetHandler | PrimitiveHandler | EntityPropertyDefinition,
	params?: { coerce?: boolean }
): DDataParser.DataParser<MappedValue, unknown>

Parameters ​

  • input: Clean handler to convert (NewType, constraint, constraints set, primitive, or entity property definition).
  • params: Conversion options.
  • params.coerce: Enables coercion on compatible parsers (string, number, boolean, date, time, etc.).

Return value ​

A DDataParser.DataParser that:

  • parses unknown input,
  • maps output into a typed object ready for domain usage,
  • preserves business type markers when present.

See also ​

Released under the MIT license.