NPM Smell 🍑💨

trivial and outdated NPM packages

is-even trivial npm logo

Checks if a number is even.

Weekly Downloads
144,246
Dependencies
4
Latest Release
7 years ago
The provided functionality does not warrant its own package
Trivial

Dependency Tree

is-even
  is-odd
    is-number
      kind-of
        is-buffer

About

This dependency checks if a number is even.

This can be done natively with the % remainder operator. It returns the remainder leftover.

1 % 2; // 1
2 % 2; // 0
3 % 2; // 1
4 % 2; // 0
// ...

Even numbers return 0, so a corresponding function would look like:

function isEven(number) {
    return number % 2 === 0;
}

isEven(4); // true
isEven(7); // false