
Company News
Andrew Becherer Joins Socket as Chief Information Security Officer
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.
whichtype is a small JavaScript/TypeScript library for checking the type of your variables, written in TypeScript.
I felt the need for whichtype when I was working on iaseth/josn.
I am using readmix for generating this README.
You can view the source file here.
You can install whichtype with the following command:
npm i whichtype
Now you should be able to use whichtype in your project.
Whichtype export the following functions, each of them accept a single argument and return true or false.
| Function | Description |
|---|---|
| Basics | |
isArray(arg) | Returns true only if the arg is an Array. |
isBoolean(arg) | Returns true only if the arg is a Boolean. |
isChar(arg) | Returns true only if the arg is a Char. |
isNumber(arg) | Returns true only if the arg is a Number. |
isObject(arg) | Returns true only if the arg is an Object. |
isString(arg) | Returns true only if the arg is a String. |
isNull(arg) | Returns true only if the arg is null. |
isUndefined(arg) | Returns true only if the arg is undefined. |
isPrimitive(arg) | Returns true only if the arg is a Primitive value. |
isReference(arg) | Returns true only if the arg is a Reference value. |
| Inverses | |
isNotArray(arg) | Returns true only if the arg is not an Array. |
isNotBoolean(arg) | Returns true only if the arg is not a Boolean. |
isNotChar(arg) | Returns true only if the arg is not a Char. |
isNotNumber(arg) | Returns true only if the arg is not a Number. |
isNotObject(arg) | Returns true only if the arg is not an Object. |
isNotString(arg) | Returns true only if the arg is not a String. |
isNotNull(arg) | Returns true only if the arg is not null. |
isNotUndefined(arg) | Returns true only if the arg is not undefined. |
isNotPrimitive(arg) | Returns true only if the arg is not a Primitive value. |
isNotReference(arg) | Returns true only if the arg is not a Reference value. |
| Array Functions | |
isEmptyArray(arg) | Returns true only if the arg is an empty Array. |
isArrayOfArrays(arg) | Returns true only if the arg is an Array of Arrays. |
isArrayOfBooleans(arg) | Returns true only if the arg is an Array of Boolean values. |
isArrayOfChars(arg) | Returns true only if the arg is an Array of Char values. |
isArrayOfNumbers(arg) | Returns true only if the arg is an Array of Numbers. |
isArrayOfObjects(arg) | Returns true only if the arg is an Array of Objects. |
isArrayOfStrings(arg) | Returns true only if the arg is an Array of Strings. |
| Object Functions | |
isEmptyObject(arg) | Returns true only if the arg is an empty Object. |
isObjectOfArrays(arg) | Returns true only if the arg is an Object only containing Array values. |
isObjectOfBooleans(arg) | Returns true only if the arg is an Object only containing Boolean values. |
isObjectOfChars(arg) | Returns true only if the arg is an Object only containing Char values. |
isObjectOfNumbers(arg) | Returns true only if the arg is an Object only containing Number values. |
isObjectOfObjects(arg) | Returns true only if the arg is an Object only containing Object values. |
isObjectOfStrings(arg) | Returns true only if the arg is an Object only containing String values. |
Name | Value |
|---|---|
Name | whichtype |
Description | Whichtype is a small JavaScript library for checking the type of your variables. |
Version | 1.0.1 |
Author | iaseth |
Homepage | https://github.com/iaseth/whichtype |
Repository | iaseth/whichtype |
License | MIT |
This package has no dependencies.
Package | Version | |
|---|---|---|
| 1 | @types/jest | ^29.5.1 |
| 2 | jest | ^29.5.0 |
MIT License
Copyright (c) Ankur Seth.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This file was generated using readmix.
FAQs
Whichtype is a small JavaScript library for checking the type of your variables.
The npm package whichtype receives a total of 2 weekly downloads. As such, whichtype popularity was classified as not popular.
We found that whichtype demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Company News
Socket’s first CISO brings deep experience securing high-growth SaaS companies as open source supply chain threats accelerate.

Company News
Replit is integrating Socket Firewall into its AI-powered development experience to help protect builders from malicious open source packages.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.