@inglorious/utils 3.7.3 → 3.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/utils",
3
- "version": "3.7.3",
3
+ "version": "3.8.0",
4
4
  "description": "A set of general-purpose utility functions designed with functional programming principles in mind.",
5
5
  "author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
6
6
  "license": "MIT",
@@ -26,6 +26,10 @@
26
26
  "types": "./types/index.d.ts",
27
27
  "import": "./src/index.js"
28
28
  },
29
+ "./data-structures/string.js": {
30
+ "types": "./types/data-structures/string.d.ts",
31
+ "import": "./src/data-structures/string.js"
32
+ },
29
33
  "./*": {
30
34
  "types": "./types/*.d.ts",
31
35
  "import": "./src/*"
@@ -5,6 +5,7 @@ import * as heap from "./heap.js"
5
5
  import * as object from "./object.js"
6
6
  import * as objects from "./objects.js"
7
7
  import * as set from "./set.js"
8
+ import * as string from "./string.js"
8
9
  import * as tree from "./tree.js"
9
10
 
10
- export { array, board, boolean, heap, object, objects, set, tree }
11
+ export { array, board, boolean, heap, object, objects, set, string, tree }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Convert kebab-case or PascalCase to camelCase.
3
+ *
4
+ * @param {string} input - The string to convert.
5
+ * @returns {string} The camelCased string.
6
+ */
7
+ export function toCamelCase(input) {
8
+ const [firstChar, ...rest] = input.replace(/-([a-z0-9])/gi, (_, c) =>
9
+ c.toUpperCase(),
10
+ )
11
+
12
+ return [firstChar.toLowerCase(), ...rest].join("")
13
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Convert kebab-case or PascalCase to camelCase.
3
+ *
4
+ * @param input - The string to convert.
5
+ * @returns The camelCased string.
6
+ */
7
+ export function toCamelCase(input: string): string