Fix JS style issues
This commit is contained in:
parent
4c99fbabba
commit
e659e2f603
|
@ -189,10 +189,11 @@ RelationDefinition.prototype.applyScope = function(modelInstance, filter) {
|
||||||
filter.where[discriminator] = this.modelFrom.modelName;
|
filter.where[discriminator] = this.modelFrom.modelName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var scope;
|
||||||
if (typeof this.scope === 'function') {
|
if (typeof this.scope === 'function') {
|
||||||
var scope = this.scope.call(this, modelInstance, filter);
|
scope = this.scope.call(this, modelInstance, filter);
|
||||||
} else {
|
} else {
|
||||||
var scope = this.scope;
|
scope = this.scope;
|
||||||
}
|
}
|
||||||
if (typeof scope === 'object') {
|
if (typeof scope === 'object') {
|
||||||
mergeQuery(filter, scope);
|
mergeQuery(filter, scope);
|
||||||
|
@ -207,25 +208,27 @@ RelationDefinition.prototype.applyScope = function(modelInstance, filter) {
|
||||||
RelationDefinition.prototype.applyProperties = function(modelInstance, obj) {
|
RelationDefinition.prototype.applyProperties = function(modelInstance, obj) {
|
||||||
var source = modelInstance, target = obj;
|
var source = modelInstance, target = obj;
|
||||||
if (this.options.invertProperties) {
|
if (this.options.invertProperties) {
|
||||||
source = obj, target = modelInstance;
|
source = obj;
|
||||||
|
target = modelInstance;
|
||||||
}
|
}
|
||||||
if (this.options.embedsProperties) {
|
if (this.options.embedsProperties) {
|
||||||
target = target.__data[this.name] = {};
|
target = target.__data[this.name] = {};
|
||||||
target[this.keyTo] = source[this.keyTo];
|
target[this.keyTo] = source[this.keyTo];
|
||||||
}
|
}
|
||||||
|
var k, key;
|
||||||
if (typeof this.properties === 'function') {
|
if (typeof this.properties === 'function') {
|
||||||
var data = this.properties.call(this, source, target);
|
var data = this.properties.call(this, source, target);
|
||||||
for(var k in data) {
|
for(k in data) {
|
||||||
target[k] = data[k];
|
target[k] = data[k];
|
||||||
}
|
}
|
||||||
} else if (Array.isArray(this.properties)) {
|
} else if (Array.isArray(this.properties)) {
|
||||||
for(var k = 0; k < this.properties.length; k++) {
|
for(k = 0; k < this.properties.length; k++) {
|
||||||
var key = this.properties[k];
|
key = this.properties[k];
|
||||||
target[key] = source[key];
|
target[key] = source[key];
|
||||||
}
|
}
|
||||||
} else if (typeof this.properties === 'object') {
|
} else if (typeof this.properties === 'object') {
|
||||||
for(var k in this.properties) {
|
for(k in this.properties) {
|
||||||
var key = this.properties[k];
|
key = this.properties[k];
|
||||||
target[key] = source[k];
|
target[key] = source[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue