Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

type-of-is

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

type-of-is - npm Package Compare versions

Comparing version 3.1.2 to 3.1.3

136

index.js

@@ -1,74 +0,86 @@

var isBuiltIn = (function () {
var built_ins = [
Object,
Function,
Array,
String,
Boolean,
Number,
Date,
RegExp,
Error
];
var built_ins_length = built_ins.length;
return function (_constructor) {
for (var i = 0; i < built_ins_length; i++) {
if (built_ins[i] === _constructor) {
return true;
(function (factory) {
if (typeof exports == 'object') {
module.exports = factory();
} else if ((typeof define == 'function') && define.amd) {
define(factory);
}
}(function () {
var isBuiltIn = (function () {
var built_ins = [
Object,
Function,
Array,
String,
Boolean,
Number,
Date,
RegExp,
Error
];
var built_ins_length = built_ins.length;
return function (_constructor) {
for (var i = 0; i < built_ins_length; i++) {
if (built_ins[i] === _constructor) {
return true;
}
}
}
return false;
};
})();
return false;
};
})();
var stringType = (function () {
var _toString = ({}).toString;
return function (obj) {
// [object Blah] -> Blah
var stype = _toString.call(obj).slice(8, -1);
var stringType = (function () {
var _toString = ({}).toString;
return function (obj) {
// [object Blah] -> Blah
var stype = _toString.call(obj).slice(8, -1);
if ((obj === null) || (obj === undefined)) {
return stype.toLowerCase();
}
var ctype = of(obj);
if (ctype && !isBuiltIn(ctype)) {
return ctype.name;
} else {
return stype;
}
};
})();
function of (obj) {
if ((obj === null) || (obj === undefined)) {
return stype.toLowerCase();
}
var ctype = of(obj);
if (ctype && !isBuiltIn(ctype)) {
return ctype.name;
return obj;
} else {
return stype;
return obj.constructor;
}
};
})();
function of (obj) {
if ((obj === null) || (obj === undefined)) {
return obj;
} else {
return obj.constructor;
function is (obj, test) {
var typer = (of(test) === String) ? stringType : of;
return (typer(obj) === test);
};
function instance (obj, test) {
return (obj instanceof test);
}
};
function is (obj, test) {
var typer = (of(test) === String) ? stringType : of;
return (typer(obj) === test);
};
var exports = function (obj, type) {
if (arguments.length == 1) {
return of(obj);
} else {
return is(obj, type);
}
}
function instance (obj, test) {
return (obj instanceof test);
}
exports.instance = instance;
exports.string = stringType;
exports.of = of;
exports.is = is;
module.exports = function (obj, type) {
if (arguments.length == 1) {
return of(obj);
} else {
return is(obj, type);
}
}
return exports;
module.exports.instance = instance;
module.exports.string = stringType;
module.exports.of = of;
module.exports.is = is;
}));
{
"name": "type-of-is",
"version": "3.1.2",
"version": "3.1.3",
"description": "Determine and test types using constructor or {}.toString",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -43,3 +43,3 @@ # Description

3.1.2
3.1.3

@@ -46,0 +46,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc