Releases: dpoindexter/immutable-validation
Return results as ValidationRecords
This release alters the data structure returned by [[Validator]].validate
. validate
now returns an immutable record type.
type ValidationRecord = {
isValid: boolean,
messages: Set<string>,
rules: Map<string, ValidationRecord>
}
ValidationRecord
is recursive, which makes it easier to traverse.
The rules
field makes deep traversals a little unwieldy. [[ValidationRecord]].refine(path: Array<string>)
provides a convenient method for getting arbitrarily-nested results while excluding verbose parts of the key path. (See #3 for an example)
v0.6.0
This release reconfigures the build process to support distribution via npm. UMD scripts are still committed to the /dist
folder.
v0.5.0
When using the fluent interface to describe rulesets, each call to validator.ruleFor
or validator.ruleForEach
will return a new Validator
instance. Validator rulesets are now immutable if you use the method interface.
v0.4.1
Fixes the naive implementation of the required predicate:
- Whitespace fails validation
NaN
fails validation- Reference types,
null
andundefined
fail validation
v0.4.0
- Renames
facts
export topredicates
- Adds
ruleForEach
method to instances ofValidator
, to support validating collections of items - Adds
Validator.which
static constructor to support dynamically picking a validator each timevalidate()
is called
v0.0.2
Update compiled files in the dist directory
v0.0.1
Initial version of codebase