This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
’s 1,000,000+ packages pre-installed, including skemer
with all npm
packages installed. Try it out:
var skemer = require('skemer');
var schema = {
doc: 'A basic schema',
type: {
value: {
doc: 'Some string value',
type: 'string'
},
figure: {
doc: 'A number value',
type: 'number',
min: 20,
max: 50
}
}
};
var valid = {
value: 'a string',
figure: 30
};
var valid1 = {
figure: 35
};
var valid2 = {
value: 'a different string'
};
var invalid = false;
var stringSchema = {
type: 'string'
};
var aString = 'string';
skemer.validateNew({ schema: stringSchema }, aString);
var Schema, data;
console.log(data = skemer.buildJsDocs(schema, {
wrap: 80,
preLine: ' * ',
lineup: true
}));
Schema = new skemer.Skemer({ schema: schema });
console.log(data = Schema.validateNew(valid));
console.log(data = Schema.validateAdd(data, valid1));
Schema.validateAdd(data, valid2, invalid);
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.