Trim
Trims a string attribute value:
import { trim } from 'dynamodb-toolbox/transformers/trim'
const prefixedSchema = string().transform(trim())
prefixer.encode(' foo ') // => 'foo'
// π Does not re-inject the trimmed whitespaces
prefixer.decode('foo') // => 'foo'
// π Does not trim when decoding
prefixer.decode(' bar ') // => ' bar '
You can pipe a string transformer with the .pipe(...) method:
import { suffix } from 'dynamodb-toolbox/transformers/suffix'
const piped = trim().pipe(suffix('SUFFIX'))
const schema = string().transform(piped)