chore: formatting

This commit is contained in:
cha0s 2019-09-16 19:04:35 -05:00
parent 5b1b9442c7
commit 937dca2657

View File

@ -90,21 +90,6 @@ let numericUid = 1;
export class Entity extends decorate(Resource) { export class Entity extends decorate(Resource) {
static jsonWithDefaults(json) {
if ('undefined' === typeof json) {
return;
}
const pristine = JSON.parse(JSON.stringify(json));
for (const type in json.traits) {
if (!hasTrait(type)) {
continue;
}
const Trait = lookupTrait(type);
pristine.traits[type] = merge({}, Trait.defaultJSON(), json.traits[type]);
}
return pristine;
}
constructor(json, jsonext) { constructor(json, jsonext) {
super(); super();
this._hooks = {}; this._hooks = {};
@ -254,6 +239,21 @@ export class Entity extends decorate(Resource) {
return type in this._traits; return type in this._traits;
} }
static jsonWithDefaults(json) {
if ('undefined' === typeof json) {
return;
}
const pristine = JSON.parse(JSON.stringify(json));
for (const type in json.traits) {
if (!hasTrait(type)) {
continue;
}
const Trait = lookupTrait(type);
pristine.traits[type] = merge({}, Trait.defaultJSON(), json.traits[type]);
}
return pristine;
}
mergeDiff() { mergeDiff() {
if (!this.uri) { if (!this.uri) {
return this.toJSON(); return this.toJSON();