1.0.0 • Published 1 year ago

int-or-float v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

int-or-float

npm.io GitHub release (latest SemVer) action-bumpr supported

A small package for the lazy people like me that don't want to always verify if a number is a float or an integer.

Only numbers can be used. Works with typescript.

Why does this package even exist?

It's useful if you want to verify the nature of a number in multiple files but don't want to export that function.

How to use it

import { isFloat, isInt } from "int-or-float"

const foo = 1
const bar = 2.2

console.log(isInt(foo)) // expected output: true
console.log(isInt(bar)) // expected output: false

console.log(isFloat(foo)) // expected output: false
console.log(isFloat(bar)) // expected output: true