Skip to main content

Built-in Processors

A reference for all built-in value processors available via $keyword syntax.

ProcessorDescription
$absReturns the absolute value of a number.
$allA constraint that checks whether all the provided processors return a defined value.
$alphaValidates that a string contains only alphabetic characters (a-z, A-Z). No spaces, numbers, punctuation, or special char
$alphanumValidates that a string contains only alphanumeric characters (A-Z, a-z, 0-9). No spaces, punctuation, or special charac
$andA constraint that checks whether all the provided processors return a truthy value.
$anyA constraint that checks whether any of the provided processors return a defined value. (Not to be confused with the unr
$arrayAttempt to normalize the input value as an array.
$assertRequire that the provided processor returns a truthy value; return original input. Throws a constraint exception if not
$base64Validates that a string is properly formatted Base64 encoded data. Checks for valid Base64 character set (A-Z, a-z, 0-9,
$base64-decodeDecodes a Base64-encoded string to a Buffer. Throws if the input is not a string.
$base64-encodeEncodes a Buffer to a Base64 string. Throws if the input is not a Buffer.
$bufferConverts a value to a Node.js Buffer. Accepts: - Buffer — passed through unchanged - string — decoded from Base64 via B
$camel-caseConverts a string value to camelCase format. Words are identified by spaces, hyphens, underscores, or case changes. The
$capitalizeCapitalizes the first letter of each word, separated by spaces. Words are split on non-alphanumeric boundaries (spaces,
$cardnumValidates a payment card number (PAN) using the Luhn algorithm and normalizes its formatting based on the detected card
$ceilRounds a numeric value up to the nearest integer or specified decimal precision. Non-numeric values are passed through u
$checkThis is a conditional operator that evaluates a predicate for truthiness.
$clampConstrains a number to a [min, max] range by returning the nearest boundary when the value falls outside. Unlike $range
$collapseCollapses runs of whitespace within a string to a single space, and trims leading and trailing whitespace. Useful for no
$compactStrips common formatting characters from a string: whitespace, hyphens, dots, parentheses, and forward slashes. Useful f
$compileCompiles a Schema (or CompiledSchema) into a CompiledSchema ready for use in value processing. If a schema argument is p
$concatReturns a new array with the specified values appended to the input array. Throws SchemaError at compile time if no argu
$constant-caseConverts a string to CONSTANT_CASE format (uppercase letters with underscores). Safe to use in normalize phase (non-thro
$dateNormalize the input value as a Date. Accepts strings, numbers, Date instances, and date-field objects produced by $date
$date-objectExpands a Date into a plain object with named calendar fields.
$date-rangeValidates that a date value falls within the specified range (inclusive). Can specify minimum, maximum, or both bounds.
$definedAllow any value, as long as it's defined.
$directoryValidates that a path exists on the filesystem and is a directory (not a file). This is an async processor that performs
$eachApplies a processor to each element of an array. The processor can be any valid processor specification (RegExp, functio
$emailValidates that a string matches a practical email address format (local-part@domain.tld).
$entriesReturns the enumerable own properties of an object as an array of [key, value] pairs, matching the output of Object.entr
$eqDo a deep equality check between the value and the provided constraint value.
$exclusiveA constraint that checks whether exactly one of the provided processors returns a truthy value.
$executableValidates that a file path points to an executable file by checking execute permissions. This is an asynchronous process
$fileValidates that a path exists in the filesystem and is a file (not a directory or other type). Performs an asynchronous f
$file-sizeValidates that a file's size falls within the specified range. Accepts size constraints in bytes and checks the file's m
$filterRuns a processor on each element of the input array, keeping elements for which the processor succeeds and returning the
$find-schemaFind a schema in the schema hierarchy based on a dotted path. Returns the current schema by default. The provided path
$firstAn operator that returns the first defined value successfully returned from a sequence of processors.
$flattenReturns a new array with sub-array elements flattened to the specified depth. Throws if the input is not an array.
$floorRounds a numeric value down to the specified number of decimal places. Non-numeric values are passed through unchanged.
$gateThis is a conditional operator that evaluates a predicate for whether it returns a defined value.
$getExtracts a value from the input using a dot-separated path (for objects) or a numeric index (for arrays). Does not requi
$group-byGroups an array of objects by a key, returning an object whose values are arrays of elements that share that key value.
$has-prefixCheck that the provided string value starts with the prefix value
$has-suffixCheck that the provided string value ends with the suffix value
$hexValidates that a string contains only valid hexadecimal characters (0-9, a-f, A-F). Does not require or validate a "0x"
$hostnameValidates that a string matches valid hostname format according to RFC 1123. Hostnames must start and end with alphanume
$http-urlValidates that a string is a valid HTTP or HTTPS URL. Uses the URL Web API for validation and specifically requires the
$ifThis is a conditional operator that evaluates a predicate for truthiness.
$inValidates that a value is included in an allowed list of values. Uses strict equality (===) for comparison.
$index-byGroups an array of objects by a unique key, returning an object whose value is the single array element value that has t
$inputReturns the input value passed to the processor. Acts as a declarative "pass-through". Useful for passing the input to
$instanceofValidates that the input is an instance of the specified constructor.
$integerValidates that a numeric value is an integer (no fractional part). Input must already be a number; use $number in a prio
$invokeCalls a provided processor and passes it arguments (if any).
$ipv4Validates that a string is a valid IPv4 address in dotted-decimal notation.
$ipv6Validates that a string is a properly formatted IPv6 address. Supports all standard notation formats including full, com
$is-arrayValidates that the input is a valid array.
$is-bufferValidates that the input is a Node.js Buffer.
$is-dateValidates that the input is a valid date.
$is-numberValidates that the input is a valid number.
$is-objectValidates that the input is a valid object (and not null!)
$is-stringValidates that the input is a valid string.
$joinJoin the input array elements into a string using the provided separator.
$jsonValidates that a string contains valid JSON that can be parsed by JSON.parse(). The processor does not modify the input
$json-decodeParses a JSON string into a value. Throws if the input is not a string or is not valid JSON.
$json-encodeSerializes any value to a JSON string.
$kebab-caseConverts a string to kebab-case format (lowercase words separated by hyphens). Safe to use in normalize phase (non-throw
$keysReturns the enumerable own property keys of an object as an array of strings. Throws if the input is not a plain object.
$lengthValidates that the length of a string or array falls within specified bounds (inclusive). Can specify minimum, maximum,
$lookupUses the pipeline value as a key to look up a corresponding value from the argument collection. This is the inverse of $
$lowercaseConverts a string value to lowercase. Safe to use in normalize phase (non-throwing).
$mapPolymorphic map operator. Applies a processor to each element of an array, or to each value of a plain object. Returns a
$matchOperator that executes a RegExp match against a string input and returns the extracted result. Non-string values are pas
$matchesConstraint that tests the string representation of the input against a RegExp. Throws a ConstraintError if the input doe
$maxReturns the maximum value from an array of numbers. Returns undefined for an empty array.
$mergeMerges the argument object into the input object (shallow). The argument fields take precedence over same-named fields i
$merge-deepRecursively deep-merges the argument object into the input object, returning a new object. Nested plain objects are merg
$metadataExtracts named metadata from a schema, either from the current schema or a parameter.
$minReturns the minimum value from an array of numbers. Returns undefined for an empty array.
$negativeValidates that a numeric value is negative (less than 0). Input must already be a number; use $number in a prior normali
$neverInverts a processor - Returns the input if the wrapped processor throws or returns an undefined value. Throw a constrain
$non-emptyValidates that a string, array, or object is not empty. For strings, the value must contain at least one non-whitespace
$normalizeNormalize the incoming value according using the provided schema
$notInverts a processor result - returns true if the wrapped processor throws or returns a falsey value. Throw a constraint
$numberValidates and coerces values to numbers. Accepts numeric strings, integers, and floats. Rejects NaN, Infinity, and non-n
$numericValidates that a string contains only numeric digits (0-9). The value is coerced to a string before validation, so numbe
$objectAttempts to normalize the input value as an object.
$omitReturns a new object or dense array with the specified keys/indices removed. Keys not present in the input are silently
$oneA constraint that checks whether exactly one of the provided processors returns a defined value.
$orA constraint that checks whether any of the provided processors return a truthy value.
$padPads a string to a minimum width.
$parallelApplies an array of processors concurrently to the same input value, returning an array of all results in the same order
$pascal-caseConverts a string value to PascalCase format (first letter of each word capitalized, no separators). Safe to use in norm
$phoneValidates and normalizes a phone number string.
$pickReturns a new object or dense array containing only the specified keys/indices from the input. Keys not present in the i
$pipelineExecutes a sequence of processors in order, passing the output of each processor as input to the next. The final process
$portValidates that a value is a valid TCP/UDP port number (1-65535). Accepts numeric values or strings that can be converted
$positiveValidates that a numeric value is positive (greater than 0). Input must already be a number; use $number in a prior norm
$powRaises a number to a power.
$processProcess the incoming value according to the provided schema
$propertyExtracts a named property value from an object. This operator is useful for accessing nested properties or extracting sp
$rangeValidates that a numeric value falls within the specified range (inclusive). Can specify minimum, maximum, or both bound
$reachableValidates that a hostname is reachable by performing a DNS lookup. This is an asynchronous processor that checks if the
$readableValidates that a file or directory path exists and has read permissions for the current process. Performs an asynchronou
$referenceReturns the value at the referenced path (relative to the current schema) in the target data, or undefined if not set.
$replaceReplaces occurrences of a pattern in a string.
$requireRequire that the provided processor returns a defined value; return the original input if so. Throws a constraint error
$reverseReturns a new array with elements in reverse order. Non-mutating. Throws if the input is not an array.
$roundRounds a numeric value to the nearest integer or to a specified number of decimal places. Safe to use in normalize phase
$semverValidates that a string is a valid semantic version per the semver 2.0.0 spec.
$sortReturns a new sorted array. Non-mutating. Numbers are compared numerically; all other values are compared lexicographica
$splitStringify the input and split on the provided separator, returning an array.
$sqrtReturns the square root of a number.
$stringEnsures value is a string, stringifying as necessary. Everything other than null and undefined can be converted.
$substringExtracts a portion of a string by start index and optional length.
$sumReturns the sum of an array of numbers. Returns 0 for an empty array.
$targetReturns the target value passed to the processor (value being built relative to the root). (Note: may return undefined o
$templateOperator that interpolates a template string using properties from the input object. Placeholders use {key} syntax; do
$title-caseConverts a string to title case, capitalizing the first letter of each significant word and leaving articles, coordinati
$trimRemoves leading and trailing whitespace from a string value. Safe to use in normalize phase (non-throwing operator).
$truthyValidates that the value is "truthy". Note that the definition of what values are "truthy" mirrors the boolean schema n
$tryThis is a conditional operator that evaluates a predicate for whether it throws/rejects.
$typeReturns the type name of the input value as a string. Unlike the $is-* constraint family, this operator produces the typ
$uniqueReturns a new array with duplicate values removed, preserving insertion order of first occurrences. Uses identity-based
$uppercaseConverts a string value to uppercase. Safe to use in normalize phase (non-throwing). Non-string values are coerced to st
$urlValidates that a string is a valid URL and normalizes it to canonical form. Uses the WHATWG URL Standard for validation
$url-decodeDecodes a percent-encoded URL string.
$url-encodePercent-encodes a string for safe use as a URL component (query param value, path segment, etc.). Encodes all characters
$uuidValidates that a string matches valid UUID format (versions 1-5). UUIDs must follow RFC 4122 format: 8-4-4-4-12 hexadeci
$valuesReturns the enumerable own property values of an object as an array. Throws if the input is not a plain object.
$whenThis is a conditional operator that evaluates a predicate for whether it returns a defined value.
$writableValidates that a file system path is writable by checking write permissions. If the path does not exist, validates that