Function Library
TransformScript includes a large library of built-in functions for reshaping data, working with text, doing math, handling dates, and converting between types. They live in one flat namespace, so every function is available everywhere by its bare name. There is nothing to import. Use the library to find an operation that fits your input and check its arguments and return value before incorporating it into a transformation.
How to Read an Entry
Each function is listed with its signature, a description, and a runnable example. Signatures use a short type notation:
| Notation | Meaning |
|---|---|
:string, :number, :boolean, :any | the parameter's expected type (:any accepts anything) |
:array, :object, :collection | a list, a map, or either |
:lambda | a function argument (see Functions and Lambdas) |
a trailing ? (e.g. :number?) | the parameter is optional and accepts null |
A signature reads name(type1, type2?, …). The first parameter is the receiver, so appendIfMissing(:string, :string, :any?) can be called either as appendIfMissing(s, suffix) or, using the postfix style, as s appendIfMissing(suffix). See Functions and Lambdas for both call styles.
Typed arguments must match their declared type; a type mismatch raises an error. Use a conversion function or an as Type cast when your input has a different type. See Types and Coercion for the conversion rules.
Naming Conventions
Function names are camelCase: appendIfMissing, mapObject, daysBetween, toNumber. The cryptographic digests keep their canonical capitalization: MD5, SHA1, SHA256.
Some functions you might expect to be "string" operations live in Core, because they also apply to other collections or belong to the general toolkit: upper, lower, trim, replace, contains, startsWith, endsWith, splitBy, and joinBy.
If You Know DataWeave
The library is modeled on MuleSoft DataWeave's core functions, and many are drop-in equivalents. A shared name does not guarantee identical behavior; check the function's entry when adapting an existing script. The library also includes functions DataWeave doesn't have. Where a function's behavior differs in a way worth knowing, its entry says so. For the broader differences, see Differences from DataWeave.