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. This page explains how to read a function's entry, then links to each category.
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 |
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.
Arguments are converted to their declared type where it makes sense, and a genuine type mismatch raises an error. 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.
Categories
| Category | What's In It |
|---|---|
| Core | the general toolkit: map, filter, reduce, groupBy, orderBy, math, upper/lower/trim/replace, now, uuid |
| Strings | string building, casing and inflection, padding, search, distance metrics, character-level operations |
| Types | the is…Type checks and function-type introspection |
| Arrays | slicing (take/drop/slice), joins (leftJoin/outerJoin), partitioning, predicates |
| Dates & Times | temporal constructors and atBeginningOf… truncation helpers |
| Periods | duration constructors and between |
| Coercions | toString, toNumber, toDate, and the rest (distinct from the as Type cast — see Types and Coercion) |
| Objects | key, value, and entry extraction, plus entry-level checks |
| Binaries | base64 and hex encoding, line reading and writing, byte concatenation |
| Numbers | radix and binary conversions |
| Crypto | MD5, SHA1, SHA256, hashWith |
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. When a TransformScript function shares a name with a DataWeave core function, it shares the same behavior. 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.