ai-is-even
v1.0.1
Published
Checks the evenness of numbers using the power of ✨AI✨.
Downloads
139
Maintainers
Readme
ai-is-even
Uses the power of artificial intelligence to return true if the given number is even.
This package leverages the is-odd-ai
package for its operation, which in turn utilises OpenAI's API, so you will need to provide an API key.
Installation
npm install ai-is-even
Usage
You'll need to create a .env
file in your project's root directory and specify your OpenAI API key.
Setup the .env
file
In your project folder, create a .env
file with the following content:
OPENAI_API_KEY=your-api-key
Replace your-api-key
with your actual OpenAI API key.
Example
const isEvenAI = require('ai-is-even');
async function checkNumber() {
const number = 4;
const result = await isEvenAI(number);
if (result) {
console.log(`${number} is even!`);
} else {
console.log(`${number} is odd!`);
}
}
checkNumber();
API
ai-is-even(i)
i
: A number you want to check for evenness.- Returns: A
Promise
that resolves totrue
if the number is even, orfalse
if it's odd.
License
This project is licensed under the Apache 2.0 License.