normalize
$normalize
Normalize the incoming value according using the provided schema
Parameters
schema(CompiledSchema, required): the compiled schema to apply to the input value. AnySchemafound in a handler pipeline will be automatically compiled; Use$compileto produce aCompiledSchemafrom aSchemaliteral value.
Example
import { Schema, SchemaResolver } from '@versionzero/schema';
const resolver = new SchemaResolver();
const = await resolver.compile(
new Schema('object')
.property('collection', new Schema('array')
.property('*', new Schema('string').normalizer('$trim').normalizer('$lowercase'))
.property('chosen', new Schema('string').normalizer({$normalize: {'$find-schema': '^.collection.*'}})
);