int-or-float
v1.0.0
Published
Verify if a number is an integer or a float.
Downloads
1
Maintainers
Readme
int-or-float
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