@ntnyq/utils 0.0.0 → 0.0.2

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
@@ -8,6 +8,12 @@
8
8
  pnpm add @ntnyq/utils -D
9
9
  ```
10
10
 
11
+ ## Utils
12
+
13
+ - [camelCase](./src/camelCase.ts)
14
+ - [capitalize](./src/capitalize.ts)
15
+ - [kekabCase](./src/kekabCase.ts)
16
+
11
17
  ## License
12
18
 
13
19
  [MIT](./LICENSE) License © 2022-PRESENT [ntnyq](https://github.com/ntnyq)
package/dist/index.cjs CHANGED
@@ -1,10 +1,16 @@
1
1
  'use strict';
2
2
 
3
- const kekabCase = (input) => input.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
3
+ function kekabCase(input) {
4
+ return input.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
5
+ }
4
6
 
5
- const camelCase = (input) => input.replace(/[._-](\w)/g, (_, c) => c ? c.toUpperCase() : "");
7
+ function camelCase(input) {
8
+ return input.replace(/[._-](\w)/g, (_, c) => c ? c.toUpperCase() : "");
9
+ }
6
10
 
7
- const capitalize = (input) => `${input[0].toUpperCase()}${input.slice(1)}`;
11
+ function capitalize(input) {
12
+ return `${input.charAt(0).toUpperCase()}${input.slice(1)}`;
13
+ }
8
14
 
9
15
  exports.camelCase = camelCase;
10
16
  exports.capitalize = capitalize;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,43 @@
1
- declare const kekabCase: (input: string) => string;
1
+ /**
2
+ * transform given string to kekabCase
3
+ *
4
+ * @param input given string
5
+ * @returns string in kekabCase
6
+ *
7
+ * @example
8
+ * ```
9
+ * import { kekabCase } from '@ntnyq/utils'
10
+ * kekabCase('FooBarBaz') // foo-bar-baz
11
+ * ```
12
+ */
13
+ declare function kekabCase(input: string): string;
2
14
 
3
- declare const camelCase: (input: string) => string;
15
+ /**
16
+ * transform given string to camelCase
17
+ *
18
+ * @param input given string
19
+ * @returns string in camelCase
20
+ *
21
+ * @example
22
+ * ```
23
+ * import { camelCase } from '@ntnyq/utils'
24
+ * camelCase('foo-bar-baz') // fooBarBaz
25
+ * ```
26
+ */
27
+ declare function camelCase(input: string): string;
4
28
 
5
- declare const capitalize: (input: string) => string;
29
+ /**
30
+ * capitalize the given string's first letter
31
+ *
32
+ * @param input given string
33
+ * @returns string first letter capitalize
34
+ *
35
+ * @example
36
+ * ```
37
+ * import { capitalize } from '@ntnyq/utils'
38
+ * capitalize('fooBarBaz') // FooBarBaz
39
+ * ```
40
+ */
41
+ declare function capitalize(input: string): string;
6
42
 
7
43
  export { camelCase, capitalize, kekabCase };
package/dist/index.mjs CHANGED
@@ -1,7 +1,13 @@
1
- const kekabCase = (input) => input.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
1
+ function kekabCase(input) {
2
+ return input.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
3
+ }
2
4
 
3
- const camelCase = (input) => input.replace(/[._-](\w)/g, (_, c) => c ? c.toUpperCase() : "");
5
+ function camelCase(input) {
6
+ return input.replace(/[._-](\w)/g, (_, c) => c ? c.toUpperCase() : "");
7
+ }
4
8
 
5
- const capitalize = (input) => `${input[0].toUpperCase()}${input.slice(1)}`;
9
+ function capitalize(input) {
10
+ return `${input.charAt(0).toUpperCase()}${input.slice(1)}`;
11
+ }
6
12
 
7
13
  export { camelCase, capitalize, kekabCase };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ntnyq/utils",
3
- "version": "0.0.0",
3
+ "version": "0.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },