isitodd
v2.1.0
Published
Strongly-typed odd/even utilities for number and bigint.
Maintainers
Readme
isitodd
Strongly-typed odd/even utilities for number and bigint.
Install
npm install isitoddUsage
ESM:
import { isOdd, isEven } from 'isitodd'
isOdd(3) // true
isEven(4n) // trueCommonJS:
const { isOdd, isEven } = require('isitodd')
isOdd(-1) // true
isEven(0) // trueAPI
- isOdd(n: number | bigint): boolean
- isEven(n: number | bigint): boolean
Notes:
numberinputs must be finite integers (throws otherwise).biginthas no such restriction.- Negative values are supported.
License
MIT
