@ealch/oddyssey
v0.1.5
Published
A tiny TypeScript library to check if a number is odd or even — your journey into parity begins here.
Maintainers
Readme
🌀 Oddyssey - it's odd
A tiny utility to check if a number is odd or even.
Published as: @ealch/oddyssey
📦 Installation
npm install @ealch/oddyssey
# or
pnpm add @ealch/oddyssey
# or
yarn add @ealch/oddyssey📦 Usage
import { isOdd, isEven } from '@ealch/oddyssey';
console.log(isOdd(3)); // true
console.log(isEven(4)); // true
console.log(isOdd(0)); // false
console.log(isEven(1)); // false🧠 API
isOdd(value: number): boolean
Returns true if the given number is odd.
isEven(value: number): boolean
Returns true if the given number is even.
🧪 Example
import { isEven } from '@ealch/oddyssey';
[1, 2, 3, 4, 5, 6].forEach(n => {
console.log(`${n} is even: ${isEven(n) ? 'yes' : 'no'}`);
});Output:
1 is even: no
2 is even: yes
3 is even: no
4 is even: yes
5 is even: no
6 is even: yes🧾 Scripts
dev: Run Vite in dev modebuild: Build the library (JS bundles + TypeScript types)preview: Preview the library build locallyprepublishOnly: Hook to build before publishing to npm
📄 License
MIT © @ealch
