2.0.2 • Published 1 year ago
num-is-even-or-odd v2.0.2
num-is-even-or-odd
Return even or odd to as result to a given number.
Install
Install with npm:
$ npm install -D num-is-even-or-odd
Usage
import { evenOrOdd } from 'num-is-even-or-odd'
const { isEvenOrOdd, isEven, isOdd } = evenOrOdd()
// Method to verify even and odd
console.log(isEvenOrOdd(3)); //=> "odd"
console.log(isEvenOrOdd(4)); //=> "even"
// You can pass a "returnAsBool" boolean parameter to return results as boolean, true to even and false to odd, default value for parameter is false
console.log(isEvenOrOdd(3, true)); //=> false (odd)
console.log(isEvenOrOdd(4, true)); //=> true (even)
// Method to verify if the value is odd
console.log(isOdd(3)); //=> true
console.log(isOdd(4)); //=> false
// Method to verify if the value is even
console.log(isEven(3)); //=> false
console.log(isEven(4)); //=> true
Author
Otavio Rampinelli
License
Copyright © 2023, Otavio Rampinelli. Released under the MIT License.