Skip to content

Typefy is a versatile and lightweight library for Node.js that simplifies variable type checking.

License

Notifications You must be signed in to change notification settings

GeisonJr/typefy

Repository files navigation

Logo

Typefy Library

Easy to use, fast and lightweight library for Node.js.

CI CD LICENSE NPM version NPM downloads

Warning

This project is under development and is not yet ready for use.

🌱 Overview

This library is a collection of functions that help you to check the type of a variable in JavaScript and TypeScript.

✨ Features

Infer the type

  • isArray
  • isArrayBuffer
  • isBigInt
  • isBlob
  • isBoolean
  • isBuffer
  • isDate
  • isEnum
  • isError
  • isFunction
  • isNothing
  • isNull
  • isNullOrUndefined
  • isNumber
  • isObject
  • isPromise
  • isRegExp
  • isString
  • isSymbol
  • isUndefined
  • isURL
  • isURLSearchParams
  • isVoid

Check the value

  • isFalsy
  • isNaNumber
  • isTruthy

🚀 Tecnologies

The following tools were used in the construction of the project:

📦 Install

Use the package manager npm, yarn.

npm install @geisonjr/typefy
yarn add @geisonjr/typefy

🏗️ Usage

Example with True Condition

import { isBoolean } from '@geisonjr/typefy'

let test: any = true // false

// Is `true` if the value is a boolean type
if (isBoolean(test)) {
	// The intelisense will be recognize the variable as a boolean
	console.log('This is a boolean')
}

// Output: This is a boolean

Example with False Condition

import { isNumber } from '@geisonjr/typefy'

let test: any = '123'

// Is `true` if the value is a number type
if (isNumber(test)) {
	// The intelisense will be recognize the variable as a number
	console.log('This is a number')
} else {
	// The intelisense will be recognize the variable not as a number
	console.log('This is not a number')
}

// Output: This is not a number

📋 License

This project is under the MIT License

About

Typefy is a versatile and lightweight library for Node.js that simplifies variable type checking.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published