Why check if something is even simply, when you can do it with ✨AI✨
is-even-ai
is a unique package that utilizes OpenAI's GPT-3.5-turbo model to determine if a number is odd or even. Because sometimes you just want to add a little bit of AI magic to your number checking!
To install is-even-ai
, use npm:
npm install is-even-ai
To use is-even-ai
, you'll need an OpenAI API key. You can get one by signing up at OpenAI.
- Create a
.env
file in the root of your project. - Add your OpenAI API key to the
.env
file:
OPENAI_API_KEY=your-api-key
Here's an example of how to use the is-even-ai
package in your project:
const isEven = require('is-even-ai');
(async () => {
const number = 5;
const result = await isEven(number);
console.log(`Is ${number} even? ${result}`); // Output: Is 5 even? false
})();
- Parameters:
number
(Number) - The number to check. - Returns:
Promise<Boolean>
- Resolves totrue
if the number is even,false
if odd. - Throws: Throws an error if the determination could not be made.
Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.
This project is licensed under the Apache 2.0 license.