Usage
Declaration
'use strict';
const Fractale = require('fractale');
const KeyValuePair = Fractale.create(
'KeyValuePair', /* Name of your model (required) */
{ /* Model's schema */
key: String,
value: undefined,
}
);
/* More complete example */
const Model = Fractale.create(
'Model',
{
mixed: undefined,
boolean: Boolean,
number: Number,
string: String,
date: Date,
boards: [String],
metadata: { key: String },
inception: KeyValuePair,
collection: [{ key: String, value: null }],
self: Fractale.SELF, // the Model itself
}
);
/* Full example */
const Full = Fractale.create(
'Full',
Model, // Full inherit Model
{
declareAfter: Fractale.from('After'),
withOption: Fractale.with(String, { validator: { in: ['Foo','Bar'] } }),
}
);
const After = Fractale.create('After', {
start: Fractale.with(Date, { required: true, default: '2000-01-01' }),
end: Date,
});Instanciation
Modification
Array helpers
Last updated
Was this helpful?