Skip to content

Checks the evenness of numbers using the power of ✨AI✨.

License

Notifications You must be signed in to change notification settings

Dukemz/ai-is-even

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 to true if the number is even, or false if it's odd.

License

This project is licensed under the Apache 2.0 License.

About

Checks the evenness of numbers using the power of ✨AI✨.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published