@mongez/reinforcements 2.0.4 → 2.0.6

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.
package/README.md CHANGED
@@ -767,6 +767,7 @@ The following list defines all available string utilities
767
767
  - `capitalize`
768
768
  - `toCamelCase`
769
769
  - `toSnakeCase`
770
+ - `toKebabCase`
770
771
  - `toStudlyCase`
771
772
  - `ucfirst`
772
773
  - `toInputName`
@@ -844,6 +845,30 @@ const words = "Hello World";
844
845
  console.log(toSnakeCase(words, '-', false)); // Hello_World
845
846
  ```
846
847
 
848
+ ### Convert string to kebab case
849
+
850
+ Convert string to kebab case, each word in string Separated by **whitespace** or **dashes** or **Upper Letters** `toKebabCase(string: string, lowerAll: boolean = true): string`.
851
+
852
+ The final output of the text will be all letters in lower case string separated by \- **dashes**.
853
+
854
+ ```ts
855
+ import { toKebabCase } from "@mongez/reinforcements";
856
+
857
+ const words = "hello world";
858
+
859
+ console.log(toKebabCase(words)); // hello-world
860
+ ```
861
+
862
+ If you want to ignore the lower case conversion, set the second argument to false.
863
+
864
+ ```ts
865
+ import { toKebabCase } from "@mongez/reinforcements";
866
+
867
+ const words = "Hello World";
868
+
869
+ console.log(toKebabCase(words, false)); // Hello-World
870
+ ```
871
+
847
872
  ### Convert string to studly case
848
873
 
849
874
  Convert string to studly case, each word in string Separated by **whitespace**, **underscores** or **dashes** `toStudlyCase(string: string, separator: string = "-|\\.|_|\\s"): string`.
@@ -1197,6 +1222,8 @@ If you want to contribute to this package, you can check the [todo list page](./
1197
1222
 
1198
1223
  ## Change Log
1199
1224
 
1225
+ - 2.0.5 (25 Oct 2022)
1226
+ - Added `toKebabCase` function
1200
1227
  - 2.0.0 (24 Oct 2022)
1201
1228
  - Fully refactored the code.
1202
1229
  - Added Immutable Collections class.
package/cjs/index.d.ts CHANGED
@@ -43,6 +43,7 @@ export { default as rtrim } from "./string/rtrim";
43
43
  export { ARABIC_PATTERN, default as startsWithArabic, } from "./string/startsWithArabic";
44
44
  export { default as toCamelCase } from "./string/toCamelCase";
45
45
  export { default as toInputName } from "./string/toInputName";
46
+ export { default as toKebabCase } from "./string/toKebabCase";
46
47
  export { default as toSnakeCase } from "./string/toSnakeCase";
47
48
  export { default as toStudlyCase } from "./string/toStudlyCase";
48
49
  export { default as trim } from "./string/trim";
package/cjs/index.js CHANGED
@@ -47,6 +47,7 @@ var rtrim = require("./string/rtrim.js");
47
47
  var startsWithArabic = require("./string/startsWithArabic.js");
48
48
  var toCamelCase = require("./string/toCamelCase.js");
49
49
  var toInputName = require("./string/toInputName.js");
50
+ var toKebabCase = require("./string/toKebabCase.js");
50
51
  var toSnakeCase = require("./string/toSnakeCase.js");
51
52
  var toStudlyCase = require("./string/toStudlyCase.js");
52
53
  var trim = require("./string/trim.js");
@@ -102,6 +103,7 @@ exports.ARABIC_PATTERN = startsWithArabic.ARABIC_PATTERN;
102
103
  exports.startsWithArabic = startsWithArabic["default"];
103
104
  exports.toCamelCase = toCamelCase;
104
105
  exports.toInputName = toInputName;
106
+ exports.toKebabCase = toKebabCase;
105
107
  exports.toSnakeCase = toSnakeCase;
106
108
  exports.toStudlyCase = toStudlyCase;
107
109
  exports.trim = trim;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Convert current string to kebab case
3
+ */
4
+ export default function toKebabCase(string: string, lowerAll?: boolean): string;
5
+ //# sourceMappingURL=toKebabCase.d.ts.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ var toSnakeCase = require("./toSnakeCase.js");
4
+
5
+ /**
6
+ * Convert current string to kebab case
7
+ */
8
+ function toKebabCase(string, lowerAll) {
9
+ if (lowerAll === void 0) {
10
+ lowerAll = true;
11
+ }
12
+ return toSnakeCase(string, "-", lowerAll);
13
+ }
14
+
15
+ module.exports = toKebabCase;
package/esm/index.d.ts CHANGED
@@ -43,6 +43,7 @@ export { default as rtrim } from "./string/rtrim";
43
43
  export { ARABIC_PATTERN, default as startsWithArabic, } from "./string/startsWithArabic";
44
44
  export { default as toCamelCase } from "./string/toCamelCase";
45
45
  export { default as toInputName } from "./string/toInputName";
46
+ export { default as toKebabCase } from "./string/toKebabCase";
46
47
  export { default as toSnakeCase } from "./string/toSnakeCase";
47
48
  export { default as toStudlyCase } from "./string/toStudlyCase";
48
49
  export { default as trim } from "./string/trim";
package/esm/index.js CHANGED
@@ -49,6 +49,7 @@ export {
49
49
  } from "./string/startsWithArabic.js";
50
50
  export { default as toCamelCase } from "./string/toCamelCase.js";
51
51
  export { default as toInputName } from "./string/toInputName.js";
52
+ export { default as toKebabCase } from "./string/toKebabCase.js";
52
53
  export { default as toSnakeCase } from "./string/toSnakeCase.js";
53
54
  export { default as toStudlyCase } from "./string/toStudlyCase.js";
54
55
  export { default as trim } from "./string/trim.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Convert current string to kebab case
3
+ */
4
+ export default function toKebabCase(string: string, lowerAll?: boolean): string;
5
+ //# sourceMappingURL=toKebabCase.d.ts.map
@@ -0,0 +1,13 @@
1
+ import toSnakeCase from "./toSnakeCase.js";
2
+
3
+ /**
4
+ * Convert current string to kebab case
5
+ */
6
+ function toKebabCase(string, lowerAll) {
7
+ if (lowerAll === void 0) {
8
+ lowerAll = true;
9
+ }
10
+ return toSnakeCase(string, "-", lowerAll);
11
+ }
12
+
13
+ export { toKebabCase as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mongez/reinforcements",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "A lightweight package to give a massive reinforcements to variant types of data in Nodejs/Javascript",
5
5
  "main": "./cjs/index.js",
6
6
  "dependencies": {