nhb-toolbox 2.4.0 → 2.4.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/dist/form/transform.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LooseObject } from '../object/types';
|
|
2
2
|
import type { FormDataConfigs } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Utility to convert object into FormData in a controlled way.
|
|
@@ -8,5 +8,5 @@ import type { FormDataConfigs } from './types';
|
|
|
8
8
|
*
|
|
9
9
|
* @returns FormData instance containing the sanitized and transformed data
|
|
10
10
|
*/
|
|
11
|
-
export declare const createControlledFormData: <T extends
|
|
11
|
+
export declare const createControlledFormData: <T extends LooseObject>(data: T, configs?: FormDataConfigs<T>) => FormData;
|
|
12
12
|
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/form/transform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/form/transform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,WAAW,QACvD,CAAC,YACG,eAAe,CAAC,CAAC,CAAC,KAC1B,QAqFF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/string/convert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/string/convert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAqF5E;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,UACvB,MAAM,QACP,MAAM,GAAG,MAAM,WACZ,MAAM,KACb,MAgBF,CAAC"}
|
package/dist/string/convert.js
CHANGED
|
@@ -59,9 +59,17 @@ function convertStringCase(string, format) {
|
|
|
59
59
|
return (formattedString.charAt(0).toLowerCase() +
|
|
60
60
|
formattedString.slice(1));
|
|
61
61
|
case 'snake_case':
|
|
62
|
-
return
|
|
62
|
+
return /[^a-zA-Z0-9]/.test(string) ?
|
|
63
|
+
string.split(/\W+/g).join('_').toLowerCase()
|
|
64
|
+
: formattedString.replace(/[A-Z]/g, (letter, index) => index === 0 ?
|
|
65
|
+
letter.toLowerCase()
|
|
66
|
+
: `_${letter.toLowerCase()}`);
|
|
63
67
|
case 'kebab-case':
|
|
64
|
-
return
|
|
68
|
+
return /[^a-zA-Z0-9]/.test(string) ?
|
|
69
|
+
string.split(/\W+/g).join('-').toLowerCase()
|
|
70
|
+
: formattedString.replace(/[A-Z]/g, (letter, index) => index === 0 ?
|
|
71
|
+
letter.toLowerCase()
|
|
72
|
+
: `-${letter.toLowerCase()}`);
|
|
65
73
|
case 'PascalCase':
|
|
66
74
|
return (formattedString.charAt(0).toUpperCase() +
|
|
67
75
|
formattedString.slice(1));
|
package/package.json
CHANGED