| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1 1 1 1 |
var Schema = Divhide.Schema;
/// get the schema
var schema = Schema.object({
/// array with multiple strings
data: Schema.array([ "" ]).repeatable().max(10),
/// every other object key is optional
"/.*/": Schema.number().optional()
}).required();
/// apply the schema to the value
var value = schema.value({
data: [ 1, 2, 3, 4, 5, 6],
timestamp: "1404373579473"
});
/// test the value
expect(value).equals({
data: [ '1', '2', '3', '4', '5' , '6'],
timestamp: 1404373579473
}); |