@ealch/oddyssey
Version:
A tiny TypeScript library to check if a number is odd or even โ your journey into parity begins here.
73 lines (51 loc) โข 1.57 kB
Markdown
# ๐ Oddyssey - it's odd
[](https://www.npmjs.com/package/@ealch/oddyssey)
[](./LICENSE.md)
[](https://bundlephobia.com/package/@ealch/oddyssey)
A tiny utility to check if a number is **odd** or **even**.
Published as: [`@ealch/oddyssey`](https://www.npmjs.com/package/@ealch/oddyssey)
---
## ๐ฆ Installation
```bash
npm install @ealch/oddyssey
# or
pnpm add @ealch/oddyssey
# or
yarn add @ealch/oddyssey
```
## ๐ฆ Usage
```js
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
```js
import { isEven } from '@ealch/oddyssey';
[1, 2, 3, 4, 5, 6].forEach(n => {
console.log(`${n} is even: ${isEven(n) ? 'yes' : 'no'}`);
});
```
**Output:**
```bash
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 mode
- **`build`**: Build the library (JS bundles + TypeScript types)
- **`preview`**: Preview the library build locally
- **`prepublishOnly`**: Hook to build before publishing to npm
## ๐ License
MIT ยฉ @ealch