Permalink
Browse files

feat(repository): Cast values if they have type decorators

  • Loading branch information...
RWOverdijk committed Feb 23, 2016
1 parent c38020a commit a40d7632f856a78ff78c0428075c78f90af67a68
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/repository.js
@@ -1,5 +1,6 @@
import {inject} from 'aurelia-dependency-injection';
import {Config} from 'spoonx/aurelia-api';
import typer from 'typer';
@inject(Config)
export class Repository {
@@ -164,6 +165,12 @@ export class Repository {
let value = data[key];
if (entityMetadata.has('types', key)) {
populatedData[key] = typer.cast(value, entityMetadata.fetch('types', key));
continue;
}
if (!entityMetadata.has('associations', key) || typeof value !== 'object') {
// Not an association, or not an object. clean copy.
populatedData[key] = value;

0 comments on commit a40d763

Please sign in to comment.