diff --git a/gun.js b/gun.js index 2666875d..a1eab96b 100644 --- a/gun.js +++ b/gun.js @@ -476,8 +476,7 @@ var gun = this.chain(); cb = cb || function(){}; opt = opt || {}; - if(!Gun.text.is(path = Gun.text.is(path)? path || null : Gun.num.is(path)? (path + '') : Gun.list.is(path)? path.join('.') : path)){ return cb.call(gun, {err: Gun.log("Invalid path '" + path + "'!")}), gun } - //if((path !== null && !path) || !Gun.text.is(path = path.join? path.join('.') : path + '')){ return } + if((path !== null && !path) || !Gun.text.is(path = path.join? path.join('.') : path + '')){ return } if(!gun.back._.at){ return cb.call(gun, {err: Gun.log("No context!")}), gun } gun.back.on(function($, node){ @@ -765,7 +764,7 @@ Util.bi.is = function(b){ return (b instanceof Boolean || typeof b == 'boolean')? true : false } Util.num = {}; Util.num.is = function(n){ - return !Util.list.is(n) && (Infinity === n || n - parseFloat(n) + 1 >= 0); // jquery doesn't check for Infinity. + return ((n===0)? true : (!isNaN(n) && !Util.bi.is(n) && !Util.list.is(n) && !Util.text.is(n))? true : false ); } Util.text = {}; Util.text.is = function(t){ return typeof t == 'string'? true : false } diff --git a/test/common.js b/test/common.js index 468524f5..1a31ccd6 100644 --- a/test/common.js +++ b/test/common.js @@ -9,7 +9,7 @@ describe('Gun', function(){ var t = {}; describe('Utility', function(){ - var u; + /* // causes logger to no longer log. it('verbose console.log debugging', function(done) { @@ -38,8 +38,6 @@ describe('Gun', function(){ it('binary', function(){ expect(Gun.bi.is(false)).to.be(true); expect(Gun.bi.is(true)).to.be(true); - expect(Gun.bi.is(u)).to.be(false); - expect(Gun.bi.is(null)).to.be(false); expect(Gun.bi.is('')).to.be(false); expect(Gun.bi.is('a')).to.be(false); expect(Gun.bi.is(0)).to.be(false); @@ -54,8 +52,6 @@ describe('Gun', function(){ expect(Gun.num.is(0)).to.be(true); expect(Gun.num.is(1)).to.be(true); expect(Gun.num.is(Infinity)).to.be(true); - expect(Gun.num.is(u)).to.be(false); - expect(Gun.num.is(null)).to.be(false); expect(Gun.num.is(NaN)).to.be(false); expect(Gun.num.is('')).to.be(false); expect(Gun.num.is('a')).to.be(false); @@ -70,8 +66,6 @@ describe('Gun', function(){ it('text',function(){ expect(Gun.text.is('')).to.be(true); expect(Gun.text.is('a')).to.be(true); - expect(Gun.text.is(u)).to.be(false); - expect(Gun.text.is(null)).to.be(false); expect(Gun.text.is(false)).to.be(false); expect(Gun.text.is(true)).to.be(false); expect(Gun.text.is(0)).to.be(false); @@ -85,8 +79,6 @@ describe('Gun', function(){ it('list',function(){ expect(Gun.list.is([])).to.be(true); expect(Gun.list.is([1])).to.be(true); - expect(Gun.list.is(u)).to.be(false); - expect(Gun.list.is(null)).to.be(false); expect(Gun.list.is(0)).to.be(false); expect(Gun.list.is(1)).to.be(false); expect(Gun.list.is('')).to.be(false); @@ -100,8 +92,6 @@ describe('Gun', function(){ it('obj',function(){ expect(Gun.obj.is({})).to.be(true); expect(Gun.obj.is({a:1})).to.be(true); - expect(Gun.obj.is(u)).to.be(false); - expect(Gun.obj.is(null)).to.be(false); expect(Gun.obj.is(0)).to.be(false); expect(Gun.obj.is(1)).to.be(false); expect(Gun.obj.is('')).to.be(false); @@ -114,8 +104,6 @@ describe('Gun', function(){ }); it('fns',function(){ expect(Gun.fns.is(function(){})).to.be(true); - expect(Gun.fns.is(u)).to.be(false); - expect(Gun.fns.is(null)).to.be(false); expect(Gun.fns.is('')).to.be(false); expect(Gun.fns.is('a')).to.be(false); expect(Gun.fns.is(0)).to.be(false);