Options
'use strict';
const Fractale = require('fractale');
Fractale.setOptions({
use_moment: () => { try { require('moment'); return true; } catch (error) { return false; }}, // Specify to fractale to transform date to moment instance
});Field options
'use strict';
const Fractale = require('fractale');
const Child = Fractale.create('Child', {
mixed: undefined,
boolean: Boolean,
number: Number,
string: String,
});
const Parent = Fractale.create('Parent', Child, {
parent: Fractale.with(Fractale.SELF, {
// Pass number of parent to number of great-parent
through: ['number'],
}),
children: [
Fractale.with(Child, {
// Pass number of parent to mixed of child
// Pass string of parent to string of child
through: { number: 'mixed', string: 'string' },
})
],
});Field validators
Last updated
Was this helpful?