6.0.0 • Published 7 years ago
metadatio v6.0.0
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-metadata
let testItem = {
name: 'test-value';
}
Foo.validate(testItem); // Returns true
testItem.name = '123n';
Foo.validate(testItem); // Returns false
There are several ongoing projects for building up some extensions of Metadatio core:
6.0.0
7 years ago
3.0.0
7 years ago
2.0.0
7 years ago
0.7.54
8 years ago
0.7.53
8 years ago
0.7.51
8 years ago
0.7.50
8 years ago
0.0.10
8 years ago
0.7.23
8 years ago
0.7.20
8 years ago
0.7.19
8 years ago
0.6.1
8 years ago
0.7.0
8 years ago
0.6.0
8 years ago
0.5.0
8 years ago
0.4.0
8 years ago
0.3.0
8 years ago
0.2.0
8 years ago
0.1.0
8 years ago
0.0.1
8 years ago