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

component-type

Package Overview
Dependencies
Maintainers
20
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

component-type - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

component.json
{
"name": "type",
"description": "Cross-browser type assertions (less broken typeof)",
"version": "1.0.0",
"version": "1.1.0",
"keywords": ["typeof", "type", "utility"],

@@ -6,0 +6,0 @@ "dependencies": {},

@@ -1,2 +0,1 @@

/**

@@ -18,3 +17,2 @@ * toString ref.

switch (toString.call(val)) {
case '[object Function]': return 'function';
case '[object Date]': return 'date';

@@ -24,3 +22,3 @@ case '[object RegExp]': return 'regexp';

case '[object Array]': return 'array';
case '[object String]': return 'string';
case '[object Error]': return 'error';
}

@@ -30,6 +28,10 @@

if (val === undefined) return 'undefined';
if (val !== val) return 'nan';
if (val && val.nodeType === 1) return 'element';
if (val === Object(val)) return 'object';
val = val.valueOf
? val.valueOf()
: Object.prototype.valueOf.apply(val)
return typeof val;
};
{
"name": "component-type",
"description": "Cross-browser type assertions (less broken typeof)",
"version": "1.0.0",
"version": "1.1.0",
"keywords": [

@@ -6,0 +6,0 @@ "typeof",

@@ -0,1 +1,2 @@

# type

@@ -30,2 +31,4 @@

type(document.createElement('div')) == 'element'
type(NaN) == 'nan'
type(new Error('Ups! Something wrong...')) == 'error'
```

@@ -32,0 +35,0 @@

@@ -9,5 +9,2 @@ var type = require('type')

assert('object' === type(new Foo));
assert('object' === type(new Boolean(true)));
assert('object' === type(new Number(123)));
// assert('object' === type(new String('whoop')));
});

@@ -17,6 +14,15 @@

assert('number' === type(12));
assert('number' === type(1.0));
assert('number' === type(-5));
assert('number' === type(new Number(123)));
assert('number' === type(Infinity));
});
it('should match NaN', function () {
assert('nan' === type(NaN));
});
it('should match strings', function(){
assert('string' === type("test"));
assert('string' === type(new String('whoop')));
});

@@ -31,2 +37,3 @@

assert('boolean' === type(false));
assert('boolean' === type(new Boolean(true)));
});

@@ -39,2 +46,3 @@

it('should match undefined', function(){
assert('undefined' === type());
assert('undefined' === type(undefined));

@@ -45,2 +53,3 @@ });

assert('array' === type([]));
assert('array' === type(new Array()));
});

@@ -58,3 +67,3 @@

it('should match arguments', function(){
assert('arguments' === type((function(){ return arguments })()));
assert('arguments' === type(arguments));
});

@@ -65,2 +74,6 @@

});
});
it('should match errors', function(){
assert('error' === type(new Error('Ups!')));
});
});

Sorry, the diff of this file is not supported yet

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