Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Actually it's the other way around. The isEven package has one dependency, which is the isOdd package.

I am literally not joking. https://www.npmjs.com/package/is-even



https://www.npmjs.com/package/is-odd-and-even

I don't know what to say.

  /**
   * 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)
  }


IsOdd and IsEven are so famous that it would not surprise me at all if there a bunch of joke modules using them.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: