Skip to content
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.

Commit

Permalink
Fixed null bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
pluma committed Apr 3, 2014
1 parent dd1fb55 commit c34de7f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion .jshintrc
@@ -1,5 +1,4 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
Expand Down
3 changes: 2 additions & 1 deletion index.js
@@ -1,4 +1,4 @@
/*! revalidator-model 0.4.0 Original author Alan Plum <me@pluma.io>. Released into the Public Domain under the UNLICENSE. @preserve */
/*! revalidator-model 0.4.1 Original author Alan Plum <me@pluma.io>. Released into the Public Domain under the UNLICENSE. @preserve */
var revalidator = require('revalidator'),
filterObj = require('object-filter'),
transform = require('transform-object'),
Expand All @@ -9,6 +9,7 @@ module.exports = exports = model;
exports.deepCall = deepCall;

function deepCall(obj) {
if (!obj) return obj;
if (typeof obj === 'function') {
return obj();
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "revalidator-model",
"version": "0.4.0",
"version": "0.4.1",
"author": "Alan Plum <me@pluma.io>",
"description": "Simple validatable models with revalidator.",
"licenses": {
Expand Down
4 changes: 2 additions & 2 deletions spec/deepCall.spec.js
Expand Up @@ -20,9 +20,9 @@ describe('deepCall(obj)', function() {
expect(obj).to.have.property('z', 2);
});
it('leaves other values alone', function() {
var obj = {x: {y: {z: 5}}};
var obj = {x: {y: {z: 5, a: null, b: undefined}}};
deepCall(obj);
expect(obj).to.eql({x: {y: {z: 5}}});
expect(obj).to.eql({x: {y: {z: 5, a: null, b: undefined}}});
});
it('traverses nested properties', function() {
var obj = {x: {y: {z: function() {return 13;}}}};
Expand Down

0 comments on commit c34de7f

Please sign in to comment.