bool
Adds description for Boolean field in DataCaster
instance.
This method is chainable.
Signature
bool(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')
.bool('is_active');
const result = dc.adapt(serverObject);
// before
{
id: 1,
name: 'John Snow',
is_active: 1,
}
// after
{
id: 1,
name: 'John Snow',
isActive: true,
}