stringArray
Adds description for Array of Strings field in DataCaster
instance.
This method is chainable.
Signature
stringArray(originName, options = {})
options
is an object that can be omitted. To get more about options see Fields section
Example
import { DataCaster } from '@daminort/data-caster';
const dc = new DataCaster()
.int('id')
.string('name')
.stringArray('places')
.stringArray('weapons');
const result = dc.adapt(serverObject);
// before
{
id: 1,
name: 'John Snow',
places: ['Winterfell', 'Wall'],
weapons: [1, 13, 22],
}
// after
{
id: 1,
name: 'John Snow',
places: ['Winterfell', 'Wall'],
weapons: ['1', '13', '22'],
}