canjs / can-observable-mixin

Define properties on JavaScript classes
https://canjs.com
MIT License
2 stars 1 forks source link

Define properties default value as null or undefined #154

Closed cherifGsoul closed 4 years ago

cherifGsoul commented 4 years ago

This fix adds the ability to define properties with null or undefined default value:

class Foo extends mixinObject() {
    static get props() {
          return {
           nullProp: { default: null },
           undefinedProp: { default: undefined }
     };
    }
}

var foo = new Foo();
foo.nullProp; // -> null
foo.undefinedProp; // -> undefined

Closes #148