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

jest-get-type

Package Overview
Dependencies
Maintainers
4
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-get-type - npm Package Compare versions

Comparing version 24.0.0 to 24.2.0

build/index.d.ts

42

build/index.js

@@ -0,1 +1,3 @@

'use strict';
/**

@@ -6,10 +8,14 @@ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.

* LICENSE file in the root directory of this source tree.
*
*
*/
'use strict';
const PRIMITIVES = new Set([
'string',
'number',
'boolean',
'null',
'undefined',
'symbol'
]); // get the type of a value with handling the edge cases like `typeof []`
// and `typeof null`
// get the type of a value with handling the edge cases like `typeof []`
// and `typeof null`
const getType = value => {
function getType(value) {
if (value === undefined) {

@@ -30,13 +36,15 @@ return 'undefined';

} else if (typeof value === 'object') {
if (value.constructor === RegExp) {
return 'regexp';
} else if (value.constructor === Map) {
return 'map';
} else if (value.constructor === Set) {
return 'set';
} else if (value.constructor === Date) {
return 'date';
if (value != null) {
if (value.constructor === RegExp) {
return 'regexp';
} else if (value.constructor === Map) {
return 'map';
} else if (value.constructor === Set) {
return 'set';
} else if (value.constructor === Date) {
return 'date';
}
}
return 'object'; // $FlowFixMe https://github.com/facebook/flow/issues/1015
return 'object';
} else if (typeof value === 'symbol') {

@@ -47,4 +55,6 @@ return 'symbol';

throw new Error(`value of unknown type: ${value}`);
};
}
getType.isPrimitive = value => PRIMITIVES.has(getType(value));
module.exports = getType;
{
"name": "jest-get-type",
"description": "A utility function to get the type of a value",
"version": "24.0.0",
"version": "24.2.0",
"repository": {

@@ -15,3 +15,4 @@ "type": "git",

"main": "build/index.js",
"gitHead": "634e5a54f46b2a62d1dc81a170562e6f4e55ad60"
"types": "build/index.d.ts",
"gitHead": "d23f1ef18567763ab0133372e376ae5026a23d4b"
}
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