Validator index
Basic operations
requiredMarks a value/property as being requiredCoreanythingAllows any value (no-op)CoreforbiddenDisallows any non-null value, eg. for disallowing a certain propertyCoreis-valueValidates that the input is exactly a specific valueCoreone-ofValidates that the input is one of a set of valid valuesCoreeitherCombinatorValidates that the input passes at least one of the specified rulesCorerequire-eitherCombinatorValidates that the input contains (exactly) one of the specified propertiesCore
Basic utilities
default-toProduces a default value when no explicit value is specifiedCoreignore-resultCombinatorThrows away transformed results, returning the original input insteadCoredynamicCombinatorLets you dynamically specify validation rules at validation time, eg. based on inputCorewhenCombinatorApplies certain rules only if a certain condition is trueCorewrap-errorCombinatorIntercepts validation errors and packages them into a custom error instead, eg. for composed validatorsCorewrap-value-as-optionWraps non-object inputs in a single-property object, eg. for functions that accept either a single value or an options objectCore
Advanced utilities
wrap-pathCombinatorIntercepts validation errors and prefixes their source path, eg. for complex parsing casesCorewith-contextCombinatorPasses configuration to validators that are configurable through contextCore
Basic types
is-stringValidates that the input is a stringCoreis-numberValidates that the input is a numberCoreis-booleanValidates that the input is a booleanCoreis-bufferValidates that the input is a buffer objectCoreis-dateValidates that the input is a Date objectCoreis-regular-expressionValidates that the input is a RegExp objectCoreis-argumentsValidates that the input is a arguments objectCoreis-functionValidates that the input is a functionCoreis-arrayValidates that the input is an arrayCoreis-plain-objectValidates that the input is a plain object (eg. literal)Coreis-promiseValidates that the input is a (Promises/A+ compliant) PromiseCoreis-node-streamValidates that the input is a Node.js stream (of a certain type, optionally)Core
Numeric values
is-integerValidates that the input is an integerCoreis-positiveValidates that the input is a positive numberCoreis-numericValidates that the input is a string representing a valid numeric valueCore
String values
matches-formatValidates that the input matches a certain regular expressionCoreis-lowercaseValidates that the input is all-lowercaseCoreis-uppercaseValidates that the input is all-uppercaseCoreis-non-empty-stringValidates that the input is not completely emptyCorehas-length-ofValidates that the input has exactly a given lengthCorehas-length-betweenValidates that the length of the input falls between two valuesCore
Data structures
array-ofCombinatorValidates the items of an arrayCorenested-array-ofCombinatorValidates the items of an arbitrarily nested tree of arrays; eg. when you intend to flatten it afterwardsCorenested-structure-ofCombinatorLike nested-array-of, but allowing a structure of both arrays and objectsCoreremove-nullish-itemsRemoves all null/undefined values from a (non-nested) arrayCorehas-shapeCombinatorValidates the shape of an object with a fixed schemaCoreany-propertyCombinatorValidates the shape of an object that's used as a key-value mappingCoreallow-extra-propertiesCombinatorModifier for has-shape and object literals that makes them allow unspecified propertiesCore
Networking and addressing
is-email-addressValidates that the input is an e-mail addressCoreis-urlValidates that the input is a valid URL, optionally requiring a certain protocol(s)Coreis-msisdnValidates that the input is a valid E.164 MSISDN (phone number)Core
String formats
is-country-code-2Validates that the input is an ISO-3166-1 alpha-2 (2 character) country codeCoreis-country-code-3Validates that the input is an ISO-3166-1 alpha-3 (3 character) country codeCore
Matrix
is-homeserver-urlValidates that the input would be a valid base URL for a Matrix homeserverThird-partyis-mxc-urlValidates that the input is a valid MXC URLThird-partyis-sessionValidates that the input is a Modular Matrix session objectThird-party