1.0.3 • Published 2 years ago

@sollentson/is-even v1.0.3

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
2 years ago

isEven Function

Bundlephobia

You can check the performance in my repository or write your own tests In my case it came out to 1 million iterations: isEven.png

The isEven function is a JavaScript utility that determines whether a given number is even. It performs the following checks before returning the result:

  1. Validates that the input is a number.
  2. Ensures that the number is an integer.
  3. Verifies that the number does not exceed the maximum safe integer in JavaScript.

The function then uses a bitwise operation to check if the absolute value of the number is even, and returns true if it is, and false if it's odd.

Usage

The isEven function can be used as follows:

import { isEven } from '@sollentson/is-even';

console.log(isEven(3)); // Output: false
console.log(isEven(4)); // Output: true

Installation

You can install the @sollentson/is-even package using npm:

$ npm install @sollentson/is-even

License

This function is provided under the MIT License. Please see the LICENSE file for more details.

For any issues or feature requests, please create an issue on the BitBucket repository.


If you have any further questions or need additional information, feel free to ask! sollentson@gmail.com

1.0.2

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago