Fixed bug that raised an error for a null value

pull/2/head
Louis Chatriot 12 years ago
parent 082a3afba6
commit 1dccdf0497
  1. 2
      lib/model.js
  2. 2
      package.json
  3. 6
      test/model.test.js

@ -44,7 +44,7 @@ function checkObject (obj) {
}); });
} }
if (typeof obj === 'object') { if (typeof obj === 'object' && obj !== null) {
Object.keys(obj).forEach(function (k) { Object.keys(obj).forEach(function (k) {
checkKey(k, obj[k]); checkKey(k, obj[k]);
checkObject(obj[k]); checkObject(obj[k]);

@ -1,6 +1,6 @@
{ {
"name": "nedb", "name": "nedb",
"version": "0.7.3", "version": "0.7.4",
"author": { "author": {
"name": "tldr.io", "name": "tldr.io",
"email": "hello@tldr.io" "email": "hello@tldr.io"

@ -159,6 +159,12 @@ describe('Model', function () {
// Recursive behaviour testing done in the above test on $ signs // Recursive behaviour testing done in the above test on $ signs
}); });
it('Properties with a null value dont trigger an error', function () {
var obj = { prop: null };
model.checkObject(obj);
});
}); // ==== End of 'Object checking' ==== // }); // ==== End of 'Object checking' ==== //

Loading…
Cancel
Save