RegExp key model
Models
const ModelWithRegExpAsKey = Fractale.create("ModelWithRegExpAsKey", {
"/item_\\d+/i": String
});Run
const { ModelWithRegExpAsKey } = module.exports.get();
const instance = new ModelWithRegExpAsKey({
item_1: 'Foo',
item_2: 'Bar',
});
_.test(instance.item_1, 'Foo', 'Error on regexp key accessor with type string');
_.test(instance.item_2, 'Bar', 'Error on regexp key accessor with type string');
resolve(instance);Results
Last updated
Was this helpful?