🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@jest/get-type

Package Overview
Dependencies
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jest/get-type

A utility function to get the type of a value

30.0.0
Source
npm
Version published
Weekly downloads
1.3M
290%
Maintainers
5
Weekly downloads
 
Created

What is @jest/get-type?

@jest/get-type is a utility package used to determine the type of a given value. It is commonly used in testing environments to help identify the type of variables and ensure that they match expected types.

What are @jest/get-type's main functionalities?

Determine Type of a Value

This feature allows you to determine the type of a given value. In the code sample, the type of the string 'Hello, World!' is determined to be 'string'.

const getType = require('@jest/get-type');

const value = 'Hello, World!';
const type = getType(value);
console.log(type); // Output: 'string'

Type Checking in Tests

This feature is useful for type checking within tests. The code sample demonstrates a function that checks if a value matches an expected type using @jest/get-type.

const getType = require('@jest/get-type');

function checkType(value, expectedType) {
  return getType(value) === expectedType;
}

console.log(checkType(123, 'number')); // Output: true
console.log(checkType({}, 'object')); // Output: true

Other packages similar to @jest/get-type

FAQs

Package last updated on 10 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts