Merge pull request #28 from strongloop/check-undefined

Check undefined/null data
This commit is contained in:
Raymond Feng 2013-10-25 16:19:11 -07:00
commit 1e91c42798
1 changed files with 3 additions and 3 deletions

View File

@ -119,8 +119,8 @@ Memory.prototype.fromDb = function(model, data) {
var props = this._models[model].properties;
for(var key in data) {
var val = data[key];
if (typeof val === 'undefined' || val === null) {
return;
if (val === undefined || val === null) {
continue;
}
if (props[key]) {
switch(props[key].type.name) {
@ -216,7 +216,7 @@ function applyFilter(filter) {
return function (obj) {
var pass = true;
keys.forEach(function (key) {
if (!test(filter.where[key], obj[key])) {
if (!test(filter.where[key], obj && obj[key])) {
pass = false;
}
});