vowelz
v3.2.0
Published
Vowelz is a lightweight javascript/typescript library designed for efficient and flexiable manipulation of vowels within strings
Maintainers
Readme
Vowelz
A tiny, tested, type-safe vowel processing toolkit for modern JavaScript. Supports ES6 style imports, Node.js 18+ with named exports. Fully unit tested with Jest. 🚨 Vowelz 3.x.x is a complete rewrite. If you were using a previous version (2.0.0 or older), you must migrate your imports and usage. This version introduces breaking changes:
- Switched from class-based API → functional API
- Switched from CommonJS → ES Modules (ESM)
- Node.js version requirement is now 18+
- Flat named exports instead of instance methods
📦 Installation
npm install vowelz🎒 Features
- Tiny and dependency-free
- Fully unit tested with Jest
- Type-safe (TypeScript support out of the box)
- Focused vowel manipulation utilities
💻 Available Functions
countAllVowelsgetTotalCountgetCountOfUniqueVowelsextractAllVowelsFromStringgetPositionsOfVowelssetAllVowelsToUpperCasesetAllVowelsToLowerCasereplaceVowelsWithCharacterremoveAllVowelsFromStringencryptAllVowels
🔤 Example Usage
- 📁 Count All Vowels
/* Counts every vowel occurrence in a string. */
import { countAllVowels } from 'vowelz';
const result = countAllVowels('hello');
console.log(result);
/*
Expected Output:
{
input: "hello",
count: {
a: 0,
e: 1,
i: 0,
o: 1,
u: 0
}
}
*/- 📁 Encrypt All Vowels
import { encryptAllVowels } from 'vowelz';
const result = encryptAllVowels('hello');
console.log(result);
/*
Expected Output:
{ input: "hello", encrypted: "h3ll0" }
*/- 📁 Extract All Vowels From String
import { extractAllVowelsFromString } from 'vowelz';
const result = extractAllVowelsFromString('hello');
console.log(result);
/*
Expected Ouput:
{
input: "hello",
extract: ["e", "o"]
}
*/- 📁 Get Count Of Unique Vowels
import { getCountOfUniqueVowels } from 'vowelz';
const result = getCountOfUniqueVowels('beautiful');
console.log(result);
/*
Expected Output:
{ input: "beautiful", unique: 4 }
*/- 📁 Get Position Of Vowels
import { getPositionsOfVowels } from 'vowelz';
const result = getPositionsOfVowels('hello');
console.log(result);
/*
Expected Output:
{
input: "hello",
positions: [1, 4]
}
*/- 📁 Get Total Count
import { getTotalCountOfVowels } from 'vowelz';
const result = getTotalCountOfVowels('hello');
console.log(result);
/*
Expected Output:
{
input: "hello",
total: 2
}
*/- 📁 Remove All Vowels From String
import { removeAllVowelsFromString } from 'vowelz';
const result = removeAllVowelsFromString('hello');
console.log(result);
/*
Expected Output:
{
input: "hello",
removed: "hll"
}
*/- 📁 Replace Vowels With Character
import { replaceVowelsWithCharacter } from 'vowelz';
const result = replaceVowelsWithCharacter('hello', '*');
console.log(result);
/*
Expected Output:
{
input: "hello",
mutated: "h*ll*"
}
*/- 📁 Set All Vowels To Lower Case
import { setAllVowelsToLowerCase } from 'vowelz';
const result = setAllVowelsToLowerCase('HELLO');
console.log(result);
/*
Expected Output:
{
input: "HELLO",
lower: "HeLLo"
}
*/- 📁 Set All Vowels To Upper Case
import { setAllVowelsToUpperCase } from 'vowelz';
const result = setAllVowelsToUpperCase('hello');
console.log(result);
/*
Expected Output:
{
input: "hello",
upper: "hEllO"
}
*/📗 Test Coverage
PASS tests/count-all-vowels.test.ts
PASS tests/encrypt-all-vowels.test.ts
PASS tests/extract-all-vowels-from-string.test.ts
PASS tests/get-count-of-unique-vowels.test.ts
PASS tests/get-positions-of-vowels.test.ts
PASS tests/get-total-count.test.ts
PASS tests/remove-all-vowels-from-string.test.ts
PASS tests/replace-vowels-with-character.test.ts
PASS tests/set-all-vowels-to-lower-case.test.ts
PASS tests/set-all-vowels-to-upper-case.test.ts
Test Suites: 10 passed, 10 total
Tests: 50 passed, 50 total
Snapshots: 0 total--------------------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
--------------------------------|---------|----------|---------|---------|-------------------
All files | 100 | 97.67 | 100 | 100 |
count-all-vowels | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
encrypt-all-vowels | 100 | 80 | 100 | 100 | 21
index.ts | 100 | 80 | 100 | 100 | 21
extract-all-vowels-from-string | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
get-count-of-unique-vowels | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
get-positions-of-vowels | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
get-total-count | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
remove-all-vowels-from-string | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
replace-vowels-with-character | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
set-all-vowels-to-lower-case | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
set-all-vowels-to-upper-case | 100 | 100 | 100 | 100 |
index.ts | 100 | 100 | 100 | 100 |
--------------------------------|---------|----------|---------|---------|-------------------📘 Contributing
Contributions, suggestions, and improvements are welcome. Feel free to open issues or pull requests.
❤️ Support
Like this project? Support it with a github star, it would mean a lot to me! Cheers and Happy Coding.
