Check undefined/null data
This commit is contained in:
parent
f164ed6919
commit
fc2a53562e
|
@ -119,8 +119,8 @@ Memory.prototype.fromDb = function(model, data) {
|
||||||
var props = this._models[model].properties;
|
var props = this._models[model].properties;
|
||||||
for(var key in data) {
|
for(var key in data) {
|
||||||
var val = data[key];
|
var val = data[key];
|
||||||
if (typeof val === 'undefined' || val === null) {
|
if (val === undefined || val === null) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
if (props[key]) {
|
if (props[key]) {
|
||||||
switch(props[key].type.name) {
|
switch(props[key].type.name) {
|
||||||
|
@ -216,7 +216,7 @@ function applyFilter(filter) {
|
||||||
return function (obj) {
|
return function (obj) {
|
||||||
var pass = true;
|
var pass = true;
|
||||||
keys.forEach(function (key) {
|
keys.forEach(function (key) {
|
||||||
if (!test(filter.where[key], obj[key])) {
|
if (!test(filter.where[key], obj && obj[key])) {
|
||||||
pass = false;
|
pass = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue