ata-validator
1.61.3 · 29 Oct 2026MIT21.8k / weekRepositoryHomepagenpmAtom feed
Upgrading ata-validator from 1.10.0 to 1.11.0
1 release in betweenevery note read
Reading releases, release notes and advisories…
Release by release
- new
ipv6andhostnameread the string once as well: 54.7 to 29.6 ns and 45.5 to 28.2 ns, interleaved medians.ipv6no longer allocates two arrays per check;hostnamekeeps the answers of the expression it replaces, fuzzed over 300k strings with 0 mismatches. - new
date-timereads the string once, with no regular expression, no date object and no allocation: 95.0 to 39.4 ns on a valid value with aZ, 103.8 to 45.3 ns with a numeric offset, interleaved medians. Fuzzed against a reference that spells out RFC 3339, with 0 mismatches over 300k strings;tests/test_formats_single_pass.jskeeps both the predicate and the generated form on it. - new
A constructed Validator is roughly three times smaller on the heap until it is used. The public methods and the Standard Schema entry moved from per-instance closures built in the constructor to memoized prototype accessors, and the JSON position cache is only allocated when the JSON text path first needs it. Measured per instance on a 10-key object schema, double-gc deltas over 2000 instances: 1.61 KB to 0.43 KB with a shared schema object, 2.33 KB to 1.12 KB when each instance owns its schema, 3.93 KB to 3.30 KB once compiled and used. Construction alone went from 1504 to 855 ns; construction plus first validate pays about 0.9 microseconds more, once, because the compile step's method assignments now go through a defining setter. The hot validate() path is unchanged, measured interleaved. Detached method references (
const f = v.validate) still work;tests/test_lazy_instance.jspins the shape. - fixed
The verdict methods answer the same question as
validate()again. WithcoerceTypes,removeAdditionalor a schemadefaultin play,validate()ran the preprocess pass andisValidObject(),isValidJSON()andvalidateJSON()did not, so the same validator answeredtruefrom one andfalsefrom another for the same document:validate({ age: '26' })accepted whereisValidObject({ age: '26' })rejected. Every path now runs the same pass. Verdict methods on a validator configured this way rewrite the input in place, asvalidate()already did, and the cost of the correction is 0.5 ns onisValidObjectand 2.7 ns onisValidJSON, measured interleaved; validators without those options are unchanged.tests/test_verdict_preprocess.jsholds all four methods to the same answers.
- new