string
Adds description for String field in DataCaster
instance.
This method is chainable.
Signature
string(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()
.string('id')
.string('name')
.string('place_id');
const result = dc.adapt(serverObject);
// before
{
id: 1,
user_name: 'John Snow',
place_id: 'Winterfell',
}
// after
{
id: '1',
userName: 'John Snow',
placeID: 'Winterfell',
}