UNPKG

ai-cant-even

Version:

A satirical AI-powered utility that's confidently wrong about basic math operations

73 lines (60 loc) 2.85 kB
/** * Example usage of the ai-cant-even package * * This demonstrates various ways to use the package with different * confidence levels and logic types. */ import { aiCantEven, Confidence, Logic } from '../index'; // Function to run examples async function runExamples() { console.log('🧠 AI CANT EVEN - EXAMPLES 🧠\n'); // Example 1: Basic usage with default settings console.log('Example 1: Basic usage with default settings'); const basicAi = aiCantEven(); console.log(await basicAi.isEven(4)); console.log(await basicAi.isOdd(7)); console.log('\n---\n'); // Example 2: Using different confidence levels console.log('Example 2: Using different confidence levels'); const overwhelmedAi = aiCantEven({ confidence: Confidence.OVERWHELMED }); const overthinkAi = aiCantEven({ confidence: Confidence.OVERTHINK }); const smugAi = aiCantEven({ confidence: Confidence.SMUG }); const snarkyAi = aiCantEven({ confidence: Confidence.SNARKY }); console.log('OVERWHELMED:', await overwhelmedAi.isEven(3)); console.log('OVERTHINK:', await overthinkAi.isEven(3)); console.log('SMUG:', await smugAi.isEven(3)); console.log('SNARKY:', await snarkyAi.isEven(3)); console.log('\n---\n'); // Example 3: Using different logic types console.log('Example 3: Using different logic types'); const simpleAi = aiCantEven({ logic: Logic.SIMPLE }); // Default const nonsequiturAi = aiCantEven({ logic: Logic.NONSEQUITUR }); const pseudomathAi = aiCantEven({ logic: Logic.PSEUDOMATH }); const visualAi = aiCantEven({ logic: Logic.VISUAL }); console.log('SIMPLE:', await simpleAi.isOdd(2)); console.log('NONSEQUITUR:', await nonsequiturAi.isOdd(2)); console.log('PSEUDOMATH:', await pseudomathAi.isOdd(2)); console.log('VISUAL:', await visualAi.isOdd(2)); console.log('\n---\n'); // Example 4: Using the fluent API console.log('Example 4: Using the fluent API'); const fluentAi = aiCantEven(); console.log(await fluentAi.withConfidence(Confidence.SNARKY).withLogic(Logic.VISUAL).isEven(42)); console.log( await fluentAi.withConfidence(Confidence.OVERTHINK).withLogic(Logic.PSEUDOMATH).isOdd(13), ); console.log('\n---\n'); // Example 5: Other math operations console.log('Example 5: Other math operations'); const mathAi = aiCantEven(); console.log('isPrime:', await mathAi.isPrime(17)); console.log('isPositive:', await mathAi.isPositive(-3)); console.log('isDivisibleBy:', await mathAi.isDivisibleBy(15, 3)); console.log('isGreaterThan:', await mathAi.isGreaterThan(10, 5)); console.log('isLessThan:', await mathAi.isLessThan(3, 8)); console.log('areEqual:', await mathAi.areEqual(5, 5)); console.log('isNumber:', await mathAi.isNumber('42')); console.log('isInteger:', await mathAi.isInteger(3.14)); } // Run the examples runExamples().catch(console.error);