/**
* is-odd-and-even
* Github: https://github.com/fabrisdev/is-odd-and-even
*/
import isOdd from 'is-odd'
import isEven from 'is-even'
/**
* @param {number | string} i The number to check if it's odd and even
* @returns {boolean} True if the number is odd and even, false otherwise
*/
export default function isOddAndEven(i){
return isOdd(i) && isEven(i)
}
Independent of the insanity that is the npm ecosystem, the API design skill of handling invalid input in a bug-resistant way is important. If somebody sent me a code review with isEven implemented as "typeof x !== “number” ? false : x % 2 === 0" I'd tell them to fix it.
I am literally not joking. https://www.npmjs.com/package/is-even