-
-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Description
Hi !
Let's say I have objects representing a DB record and I wrote this to validate them
const myRecordType = ow.object.exactShape({
id: ow.string,
axis: ow.string.oneOf(['X', 'Y', 'Z']),
value: number,
name: ow.optional.string,
});
How can I use this to generate new empty records?
The idea would be to create a function that returns a correctly initialized object
const newRec = generateNewRecord(myRecordType);
console.dir(newRec);
/*
{
id: '',
axis: 'X',
value: 0,
name: '',
}
*/
Metadata
Metadata
Assignees
Labels
No labels