Revert "fix num validation & upgrade jesse's path check"

This reverts commit ba5dc00b6afea3d86a3b7809d9201d69d1d5f2e3.
This commit is contained in:
Mark Nadal 2015-10-23 08:50:47 -07:00
parent ba5dc00b6a
commit e4d0e6c0c4
2 changed files with 3 additions and 16 deletions

5
gun.js
View File

@ -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 }

View File

@ -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);