Skip to content

Instantly share code, notes, and snippets.

@jackboberg
Last active August 29, 2015 14:09
Show Gist options
  • Save jackboberg/382197e26bf435de797e to your computer and use it in GitHub Desktop.
Save jackboberg/382197e26bf435de797e to your computer and use it in GitHub Desktop.
{ parse: true } not passed to children
var State = require('ampersand-state');
var A = State.extend({
props: { n: 'number' },
parse: function (attrs) {
attrs.n = parseInt(attrs.n, 10);
return attrs;
}
});
var B = State.extend({
children: { a: A }
});
// parses string to int
var a = new A({ n: '1' }, { parse: true });
// throws TypeError
var b = new B({ a: { n: '1' } }, { parse: true });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment