reshow-runtime
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -0,1 +1,3 @@ | ||
var types = '|number|string|boolean|object|function|undefined|'; | ||
var getTypeOf = function getTypeOf(val, name) { | ||
@@ -6,6 +8,11 @@ if (Number.isNaN(val)) { | ||
try { | ||
if (!name) { | ||
name = Object.getPrototypeOf(val).constructor.name.toLowerCase(); | ||
var type = Object.getPrototypeOf(val).constructor.name.toLowerCase(); | ||
if (-1 === types.indexOf(type)) { | ||
if (!name) { | ||
name = type; | ||
} | ||
return name; | ||
} else { | ||
return type; | ||
} | ||
return name; | ||
} catch (ex) { | ||
@@ -12,0 +19,0 @@ return Object.prototype.toString.call(val).replace(/^\[object\s(.*)\]$/, '$1').toLowerCase(); |
@@ -6,2 +6,4 @@ 'use strict'; | ||
}); | ||
var types = '|number|string|boolean|object|function|undefined|'; | ||
var getTypeOf = function getTypeOf(val, name) { | ||
@@ -12,6 +14,11 @@ if (Number.isNaN(val)) { | ||
try { | ||
if (!name) { | ||
name = Object.getPrototypeOf(val).constructor.name.toLowerCase(); | ||
var type = Object.getPrototypeOf(val).constructor.name.toLowerCase(); | ||
if (-1 === types.indexOf(type)) { | ||
if (!name) { | ||
name = type; | ||
} | ||
return name; | ||
} else { | ||
return type; | ||
} | ||
return name; | ||
} catch (ex) { | ||
@@ -18,0 +25,0 @@ return Object.prototype.toString.call(val).replace(/^\[object\s(.*)\]$/, '$1').toLowerCase(); |
{ | ||
"name": "reshow-runtime", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Babel runtime alternative", | ||
@@ -5,0 +5,0 @@ "repository": "react-atomic/reshow", |
@@ -40,3 +40,8 @@ 'use strict'; | ||
(0, _chai.expect)((0, _typeof3.default)(new FOO())).to.equal('object'); | ||
(0, _chai.expect)((0, _typeof3.default)(1)).to.equal('number'); | ||
(0, _chai.expect)((0, _typeof3.default)('1')).to.equal('string'); | ||
(0, _chai.expect)((0, _typeof3.default)(true)).to.equal('boolean'); | ||
(0, _chai.expect)((0, _typeof3.default)(function () {})).to.equal('function'); | ||
(0, _chai.expect)((0, _typeof3.default)(undefined)).to.equal('undefined'); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36998
327