stringfyr
v1.0.0
Published
Stringfyr is a high-performance, lightweight string utility library providing a comprehensive set of functions for string manipulation.
Downloads
15
Maintainers
Readme
Stringfyr
Stringfyr is a high-performance, lightweight string utility library providing a comprehensive set of functions for string manipulation. It is fully compatible with ESM, UMD, AMD, and CJS environments.
Features
- Capitalize first letter of a string
- Convert strings to kebab-case, snake_case, and camelCase
- Truncate strings with ellipsis
- Reverse strings
- Generate random strings
- Strip HTML tags
- Create URL-friendly slugs
- Template strings with placeholders
- Mask sensitive parts of strings (emails, passwords, etc.)
Installation
npm install stringfyr
# or
jdx-plugins add stringfyr[!NOTE]: If you are using JDX CLI, you must first install JDX CLI from NPM. Read this to install the JDX CLI.
Usage
CommondJS
const str = require('stringfyr');
// Capitalization
console.log(str.capitalize("hello world")); // "Hello world"
// Case conversions
console.log(str.kebabCase("Hello World")); // "hello-world"
console.log(str.snakeCase("Hello World")); // "hello_world"
console.log(str.camelCase("hello world")); // "helloWorld"
// Truncate
console.log(str.truncate("This is a long string", 10)); // "This is a ..."
// Reverse
console.log(str.reverse("hello")); // "olleh"
// Random string
console.log(str.randomString(8)); // "aB3dE1X2"
// Strip HTML
console.log(str.stripHtml("<p>Hello</p>")); // "Hello"
// Slugify
console.log(str.slugify("Hello World! @2026")); // "hello-world-2026"
// Template
console.log(str.template("Hello, {name}!", {name: "Sholeh"})); // "Hello, Sholeh!"
// Mask
console.log(str.mask("[email protected]", 3)); // "jho***@example.com"ESM
import { capitalize, kebabCase } from 'stringfyr';
console.log(capitalize("hello world")); // "Hello world"
console.log(kebabCase("Hello World")); // "hello-world"UMD
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/stringfyr.umd.js"></script>
<script>
console.log(capitalize("hello world")); // "Hello world"
console.log(kebabCase("Hello World")); // "hello-world"
</script>
---
## Repository
Full source code and documentation are available at [GitHub](https://github.com/KhairyK/jdx-plugins/tree/main/plugins/stringfyr).
---
## License
MIT License