Skip to content

Fix the optional keys

Compare
Choose a tag to compare
@w3nl w3nl released this 16 Apr 14:05
· 366 commits to master since this release
007e4ca
class Test2 {
    constructor(name) {
        this.name = name;
    }
}

const Test3Schema = {
    name: String
}

const schema = {
    name: String,
    'test?': Test2,
    'test3?': Test3Schema
}

const Test = Obj({ schema })


const test2 = new Test2('me')

const data = {
    name: 'test',
    test: test2,
    test3: [{ name: 'test' }],
}


const test = Test.create(data)