@pritamghara/string-utilities
v1.0.0
Published
it is string utility package
Readme
@pritamghara/string-utilities
A lightweight, zero-dependency Node.js library containing utility functions for common string manipulations like capitalizing, camelcasing, slugifying, truncating, and reversing strings.
Installation
Install the package via npm:
npm install @pritamghara/string-utilitiesUsage
Require the package in your Node.js code:
const stringUtils = require('@pritamghara/string-utilities');
// 1. Capitalize
console.log(stringUtils.capitalize('hello world'));
// Output: 'Hello world'
// 2. CamelCase
console.log(stringUtils.camelCase('hello-world'));
// Output: 'helloWorld'
// 3. KebabCase
console.log(stringUtils.kebabCase('Hello World'));
// Output: 'hello-world'
// 4. Slugify
console.log(stringUtils.slugify('Hello World! #1'));
// Output: 'hello-world-1'
// 5. Truncate
console.log(stringUtils.truncate('This is a very long string', 10));
// Output: 'This is a...'
// 6. Reverse
console.log(stringUtils.reverse('javascript'));
// Output: 'tpircsavaj'
// 7. Word Count
console.log(stringUtils.wordCount('Hello world, this is a test'));
// Output: 6Features
- Zero dependencies: Extremely lightweight.
- Native Test Suite: Fully tested using the native Node.js test runner.
- CommonJS Support: Easily imported with
require().
License
ISC
