Skip to content

Instantly share code, notes, and snippets.

@matthewp
Created September 10, 2019 19:28
Show Gist options
  • Save matthewp/6b3790f79a64bbe03ca7e22ce8ab1eb0 to your computer and use it in GitHub Desktop.
Save matthewp/6b3790f79a64bbe03ca7e22ce8ab1eb0 to your computer and use it in GitHub Desktop.
Fixtures and schema merging
let RelativeDate = {
[Symbol.for("can.new")](value) {
if( date === "yesterday" ) {
return new Date()- 1000*24
}
return date;
},
[Symbol.for("can.isMember")](value) {
return value instanceof Date;
}
};
let currentSchema = canReflect.getSchema(type.convertAll(Todo));
let schema = {
...currentSchema,
keys: {
...currentSchema.keys,
dueDate: RelativeDate
}
};
fixture.store(items, schema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment