@skmtc/core 0.0.410 → 0.0.412

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/esm/dsl/File.js CHANGED
@@ -62,14 +62,14 @@ export class File {
62
62
  return __classPrivateFieldGet(this, _File_generatorKeys, "f");
63
63
  }
64
64
  toString() {
65
- const reExports = Array.from(this.reExports.entries()).map(([module, entityTypes]) => {
65
+ const reExports = Array.from(this.reExports.entries()).flatMap(([module, entityTypes]) => {
66
66
  const updatedModuleName = updateModuleName({
67
67
  destinationPath: this.path,
68
68
  moduleImportMap: this.moduleImportMap,
69
69
  exportPath: module,
70
70
  settings: this.settings
71
71
  });
72
- return Object.entries(entityTypes).flatMap(([entityType, names]) => {
72
+ return Object.entries(entityTypes).map(([entityType, names]) => {
73
73
  const prefix = entityType === 'type' ? 'type' : '';
74
74
  return `export ${prefix} { ${Array.from(names).join(', ')} } from '${updatedModuleName}'`;
75
75
  });
@@ -1,3 +1,9 @@
1
1
  export declare const capitalize: (str: string) => string;
2
2
  export declare const decapitalize: (str: string) => string;
3
+ type CamelCaseArgs = {
4
+ str: string;
5
+ upperFirst?: boolean;
6
+ };
7
+ export declare const camelCase: ({ str, upperFirst }: CamelCaseArgs) => string;
8
+ export {};
3
9
  //# sourceMappingURL=strings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,QAAS,MAAM,KAAE,MAEvC,CAAA;AAED,eAAO,MAAM,YAAY,QAAS,MAAM,KAAE,MAEzC,CAAA"}
1
+ {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,MAExC,CAAA;AAED,eAAO,MAAM,YAAY,QAAS,MAAM,KAAG,MAE1C,CAAA;AAED,KAAK,aAAa,GAAG;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,SAAS,wBAAyB,aAAa,KAAG,MAY9D,CAAA"}
@@ -4,3 +4,13 @@ export const capitalize = (str) => {
4
4
  export const decapitalize = (str) => {
5
5
  return str.charAt(0).toLocaleLowerCase() + str.slice(1);
6
6
  };
7
+ export const camelCase = ({ str, upperFirst }) => {
8
+ let doCapitalize = Boolean(upperFirst);
9
+ return str.replace(':', '').replace(/[^a-zA-Z0-9]+([a-zA-Z0-9]+)/g, (_, matched) => {
10
+ if (doCapitalize) {
11
+ return capitalize(matched);
12
+ }
13
+ doCapitalize = true;
14
+ return matched;
15
+ });
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.410",
3
+ "version": "0.0.412",
4
4
  "main": "./script/mod.js",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -65,14 +65,14 @@ class File {
65
65
  return __classPrivateFieldGet(this, _File_generatorKeys, "f");
66
66
  }
67
67
  toString() {
68
- const reExports = Array.from(this.reExports.entries()).map(([module, entityTypes]) => {
68
+ const reExports = Array.from(this.reExports.entries()).flatMap(([module, entityTypes]) => {
69
69
  const updatedModuleName = updateModuleName({
70
70
  destinationPath: this.path,
71
71
  moduleImportMap: this.moduleImportMap,
72
72
  exportPath: module,
73
73
  settings: this.settings
74
74
  });
75
- return Object.entries(entityTypes).flatMap(([entityType, names]) => {
75
+ return Object.entries(entityTypes).map(([entityType, names]) => {
76
76
  const prefix = entityType === 'type' ? 'type' : '';
77
77
  return `export ${prefix} { ${Array.from(names).join(', ')} } from '${updatedModuleName}'`;
78
78
  });
@@ -1,3 +1,9 @@
1
1
  export declare const capitalize: (str: string) => string;
2
2
  export declare const decapitalize: (str: string) => string;
3
+ type CamelCaseArgs = {
4
+ str: string;
5
+ upperFirst?: boolean;
6
+ };
7
+ export declare const camelCase: ({ str, upperFirst }: CamelCaseArgs) => string;
8
+ export {};
3
9
  //# sourceMappingURL=strings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,QAAS,MAAM,KAAE,MAEvC,CAAA;AAED,eAAO,MAAM,YAAY,QAAS,MAAM,KAAE,MAEzC,CAAA"}
1
+ {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/helpers/strings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,MAExC,CAAA;AAED,eAAO,MAAM,YAAY,QAAS,MAAM,KAAG,MAE1C,CAAA;AAED,KAAK,aAAa,GAAG;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,SAAS,wBAAyB,aAAa,KAAG,MAY9D,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decapitalize = exports.capitalize = void 0;
3
+ exports.camelCase = exports.decapitalize = exports.capitalize = void 0;
4
4
  const capitalize = (str) => {
5
5
  return str.charAt(0).toUpperCase() + str.slice(1);
6
6
  };
@@ -9,3 +9,14 @@ const decapitalize = (str) => {
9
9
  return str.charAt(0).toLocaleLowerCase() + str.slice(1);
10
10
  };
11
11
  exports.decapitalize = decapitalize;
12
+ const camelCase = ({ str, upperFirst }) => {
13
+ let doCapitalize = Boolean(upperFirst);
14
+ return str.replace(':', '').replace(/[^a-zA-Z0-9]+([a-zA-Z0-9]+)/g, (_, matched) => {
15
+ if (doCapitalize) {
16
+ return (0, exports.capitalize)(matched);
17
+ }
18
+ doCapitalize = true;
19
+ return matched;
20
+ });
21
+ };
22
+ exports.camelCase = camelCase;