string-formatter-utils
v1.0.3
Published
A lightweight utility library for string formatting in Node.js
Maintainers
Readme
string-formatter-utils
A lightweight Node.js utility to format strings to different cases.
Installation
npm install string-formatter-utils
---
#### 🧪 2. **Importing the Package**
```md
## Usage
```js
// CommonJS (Node.js)
const format = require('string-formatter-utils');
// Example usage:
console.log(format.toCamelCase("hello world")); // helloWorld
---
#### 🔧 3. **Examples for All Functions**
Here’s a full usage section you can copy-paste:
```md
## Available Functions
### ➤ toCamelCase
```js
format.toCamelCase("hello world");
// Output: "helloWorld"
format.toPascalCase("hello world");
// Output: "HelloWorld"
format.toSnakeCase("hello world test");
// Output: "hello_world_test"
format.toKebabCase("hello world test");
// Output: "hello-world-test"
format.toTitleCase("hello world test");
// Output: "Hello World Test"
format.toSentenceCase("hello WORLD");
// Output: "Hello world"
format.toLowerCase("HeLLo WoRLD");
// Output: "hello world"
format.toUpperCase("HeLLo WoRLD");
// Output: "HELLO WORLD"
format.toSlug("Hello World!!");
// Output: "hello-world"
format.toCapitalizeWords("hello world again");
// Output: "Hello World Again"
format.reverseWords("Hello from the other side");
// Output: "side other the from Hello"
---
### ✅ 4. Push to GitHub (optional but recommended)
If your package has a GitHub repo, make sure the README is committed there — npm will automatically pull it and display the content.
---
### 🚀 5. Publish to npm
Once your `README.md` is ready:
```bash
npm login # if not already logged in
npm publish