metadatio
v6.0.0
Published
Metadatio handles data objects using metadata
Maintainers
Readme
super.addField(new Field({
name: 'name',
dataType: DataTypes.string,
validators: {
'pattern': new Validator(ValidatorTypes.regex, /^_?(\d|[a-zA-Z]|_|-)$/i),
'lengths': new Validator(ValidatorTypes.lengths, { min: 2, max: 64 }
}
}));
}
static getInstance() {
Foo.instance = new Foo();
return Foo.instance;
}
} ...
}
...
} super.addField(new Field({
name: 'foo',
dataType: Foo.getInstance(),
multiplicity: 'many'
}));
}
...
}module.exports = {
Foo: Foo.getInstance(),
Bar: Bar.getInstance()
};# and include it on your consumer projects
npm install --save my-project-metadatalet testItem = {
name: 'test-value';
}
Foo.validate(testItem); // Returns true
testItem.name = '123n';
Foo.validate(testItem); // Returns falseThere are several ongoing projects for building up some extensions of Metadatio core: