AmpersandJS / ampersand-state

Core state management object.
MIT License
141 stars 75 forks source link

Allow clear() on props with values array #212

Closed Bradcomp closed 8 years ago

Bradcomp commented 8 years ago

We should be able to clear out a model, even if a particular field has an array of values.

var Model = require('ampersand-state');

var MyModel = Model.extend({
    props: {
        stuff: {
            type: 'string',
            required: false,
            values: ['a', 'b', 'c', '']
        }
    }
});

var model = new MyModel({stuff: 'a'});
//This line will throw
model.clear();
kamilogorek commented 8 years ago

There you go! :)

wraithgar commented 8 years ago

Thanks for bringing this up @Bradcomp!