blazingly-fast-is-odd

1.0.5 • Public • Published

logo

Check If Odd

A simple, lightweight npm package to determine if a number is odd. This package provides a blazingly fast alternative to existing solutions like the `is-odd` package by leveraging bitwise operations.

Installation

You can install the package using npm:

npm install blazingly-fast-is-odd

Usage

To use the checkIfOdd function, require the package in your JavaScript code:

const { checkIfOdd } = require('check-if-odd');

console.log(checkIfOdd(3));  // true
console.log(checkIfOdd(4));  // false
console.log(checkIfOdd(-5)); // true
console.log(checkIfOdd(-6)); // false

Function Signature

checkIfOdd(number)

  • Parameters
    • number: The number to check (can be an integer).
  • Returns
    • true if the number is odd, false if it is even.

Performance

The chekIfOdd function uses a bitwise operation (number & 1) to determine if a number is odd. This method is typically faster than using modulus (number % 2) because bitwise operations are generally more efficient at the processor level.

License

GPL-3.0-or-later License. See LICENSE for details.

Contributing

Contributions are welcome! If you have suggestions or improvements, please open an issue or submit a pull request.

Readme

Keywords

Package Sidebar

Install

npm i blazingly-fast-is-odd

Weekly Downloads

1

Version

1.0.5

License

GPL-3.0-or-later

Unpacked Size

110 kB

Total Files

12

Last publish

Collaborators

  • 06lw06