@riya.panchal.1231/string-utils-kit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/Readme.md +15 -0
  2. package/package.json +12 -0
  3. package/src/index.js +27 -0
package/Readme.md ADDED
@@ -0,0 +1,15 @@
1
+ # String Utils Kit
2
+
3
+ Simple utility functions for string manipulation.
4
+
5
+ ## Install
6
+
7
+ npm install string-utils-kit
8
+
9
+ ## Usage
10
+
11
+ const utils = require("string-utils-kit")
12
+
13
+ utils.capitalize("hello")
14
+ utils.slugify("Hello World")
15
+ utils.reverseString("node")
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@riya.panchal.1231/string-utils-kit",
3
+ "version": "1.0.0",
4
+ "description": "Useful string utility functions",
5
+ "main": "src/index.js",
6
+ "keywords": ["string", "utils", "slug", "text"],
7
+ "author": "Riya Panchal",
8
+ "license": "MIT",
9
+ "scripts": {
10
+ "test": "node test/test.js"
11
+ }
12
+ }
package/src/index.js ADDED
@@ -0,0 +1,27 @@
1
+ function capitalize(str) {
2
+ if (!str) return "";
3
+ return str.charAt(0).toUpperCase() + str.slice(1);
4
+ }
5
+
6
+ function reverseString(str) {
7
+ return str.split("").reverse().join("");
8
+ }
9
+
10
+ function slugify(str) {
11
+ return str
12
+ .toLowerCase()
13
+ .trim()
14
+ .replace(/\s+/g, "-")
15
+ .replace(/[^\w-]/g, "");
16
+ }
17
+
18
+ function removeExtraSpaces(str) {
19
+ return str.replace(/\s+/g, " ").trim();
20
+ }
21
+
22
+ module.exports = {
23
+ capitalize,
24
+ reverseString,
25
+ slugify,
26
+ removeExtraSpaces
27
+ };