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

should-type

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

should-type - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

25

cjs/should-type.js

@@ -46,5 +46,3 @@ 'use strict';

var toString = Object.prototype.toString;
/**
/*
* Simple data function to store type information

@@ -103,2 +101,6 @@ * @param {string} type Usually what is returned from typeof

var toString = Object.prototype.toString;
/**

@@ -118,2 +120,11 @@ * Function to store type checks

addBeforeFirstMatch: function(obj, func) {
var match = this.getFirstMatch(obj);
if (match) {
this.checks.splice(match.index, 0, func);
} else {
this.add(func);
}
},
addTypeOf: function(type, res) {

@@ -135,3 +146,3 @@ return this.add(function(obj, tpeOf) {

getType: function(obj) {
getFirstMatch: function(obj) {
var typeOf = typeof obj;

@@ -143,6 +154,10 @@ var cls = toString.call(obj);

if (typeof res !== 'undefined') {
return res;
return { result: res, func: this.checks[i], index: i };
}
}
},
getType: function(obj) {
var match = this.getFirstMatch(obj);
return match && match.result;
}

@@ -149,0 +164,0 @@ };

@@ -44,5 +44,3 @@ var types = {

var toString = Object.prototype.toString;
/**
/*
* Simple data function to store type information

@@ -101,2 +99,6 @@ * @param {string} type Usually what is returned from typeof

var toString = Object.prototype.toString;
/**

@@ -116,2 +118,11 @@ * Function to store type checks

addBeforeFirstMatch: function(obj, func) {
var match = this.getFirstMatch(obj);
if (match) {
this.checks.splice(match.index, 0, func);
} else {
this.add(func);
}
},
addTypeOf: function(type, res) {

@@ -133,3 +144,3 @@ return this.add(function(obj, tpeOf) {

getType: function(obj) {
getFirstMatch: function(obj) {
var typeOf = typeof obj;

@@ -141,6 +152,10 @@ var cls = toString.call(obj);

if (typeof res !== 'undefined') {
return res;
return { result: res, func: this.checks[i], index: i };
}
}
},
getType: function(obj) {
var match = this.getFirstMatch(obj);
return match && match.result;
}

@@ -147,0 +162,0 @@ };

4

package.json
{
"name": "should-type",
"version": "1.3.0",
"version": "1.4.0",
"description": "Simple module to get instance type. Like a bit more advanced version of typeof",

@@ -36,4 +36,4 @@ "main": "cjs/should-type.js",

"eslint-config-shouldjs": "^1.0.2",
"rollup": "^0.34.3"
"rollup": "^0.34.7"
}
}
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