Transformations
The atomic functions a mapping can apply to a source value before it lands on a target property. Compact codes chain in a mapping definition's "transform" array.
22 of 22 transformations
String10
| Transformation | Parameter | Description | Example |
|---|---|---|---|
lowerCaseString | flag | Lowercases the string. | value.toLowerCase() |
upperCaseString | flag | Uppercases the string. | value.toUpperCase() |
trimString | flag | Strips leading and trailing whitespace. | value.trim() |
prefixString | string | Prepends the parameter to the value. | prefix: "sub_" |
suffixString | string | Appends the parameter to the value. | suffix: "@acme.com" |
stripPrefixString | string | Removes the leading occurrence of the parameter when present. | stripPrefix: "pi_" |
stripSuffixString | string | Removes the trailing occurrence of the parameter when present. | stripSuffix: ".json" |
replaceString | object | Replaces all occurrences of a pattern with a replacement. | { type: "replace", param: { pattern: "-", replacement: "_" } } |
substringString | object | Extracts a range of characters. | { type: "substring", param: { start: 0, end: 8 } } |
joinString | string | Joins the array of a multi-field `from` into a string separated by the parameter; null/undefined entries are skipped. | { from: ["first_name", "last_name"], to: "fullName", transform: [{ type: "join", param: " " }] } |
Number5
| Transformation | Parameter | Description | Example |
|---|---|---|---|
multiplyNumber | number | Multiplies the number by the parameter. | multiply: 100 |
divideNumber | number | Divides the number by the parameter. | divide: 100 |
absNumber | flag | Absolute value. | Math.abs(value) |
roundNumber | flag | Rounds to the nearest integer. | Math.round(value) |
roundToNumber | integer | Rounds to the given number of decimals. | roundTo: 2 |
Coercion3
| Transformation | Parameter | Description | Example |
|---|---|---|---|
toNumberCoercion | flag | Coerces to a number when possible. | toNumber |
toStringCoercion | flag | Coerces to a string. | toString |
toBooleanCoercion | flag | Coerces to a boolean (true/1/yes, false/0/no). | toBoolean |
Date / Time1
| Transformation | Parameter | Description | Example |
|---|---|---|---|
formatDateDate / Time | string | Formats a date/time into the target model's format. The parameter is the SOURCE format: 'unix' (epoch seconds/millis) or a dref token pattern to parse a string from; blank = numbers as unix, strings as ISO. The output format is resolved from the domain's defaults.formats for that field type, else the ISO standard; named 'iso8601' outputs that value kind's ISO pattern, while 'epoch'/'epochMillis' outputs whole-number Unix seconds or milliseconds. | { type: "formatDate", param: "unix" } |
Common3
| Transformation | Parameter | Description | Example |
|---|---|---|---|
defaultCommon | any | Returns the parameter when the value is null or blank. | default: "unknown" |
constantCommon | any | Always returns the parameter, ignoring the source value. | constant: "legacy-import" |
customCommon | string | Free-text reference resolved at runtime. Java: Function<Object,Object> lambda; TypeScript: resolver callback. | custom: "com.acme.slug" |