definition-generator-framework 1.12.5 → 1.12.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.
Files changed (49) hide show
  1. package/dist/framework/definition-component.d.ts +11 -9
  2. package/dist/framework/definition-component.js +18 -18
  3. package/dist/framework/definition-generator.d.ts +6 -5
  4. package/dist/framework/definition-generator.js +16 -18
  5. package/dist/framework/file-content-generator/file-content-generator.js +1 -1
  6. package/dist/framework/file-content-generator/file-content-generator.test.js +49 -49
  7. package/dist/framework/framework.d.ts +14 -13
  8. package/dist/framework/framework.data.d.ts +3 -3
  9. package/dist/framework/framework.data.js +13 -7
  10. package/dist/framework/framework.js +36 -33
  11. package/dist/framework/framework.model.d.ts +15 -15
  12. package/dist/framework/framework.model.js +3 -3
  13. package/dist/helpers/common-functions/common-functions.js +1 -1
  14. package/dist/helpers/common-functions/common-functions.spec.js +48 -48
  15. package/dist/helpers/duplicate-helper/duplicate-helper.spec.js +52 -52
  16. package/dist/helpers/output-helper/output-helper.d.ts +26 -26
  17. package/dist/helpers/output-helper/output-helper.js +127 -107
  18. package/dist/helpers/output-helper/output-helper.spec.d.ts +22 -22
  19. package/dist/helpers/output-helper/output-helper.spec.js +223 -211
  20. package/dist/helpers/output-helper/output-helper.test.d.ts +22 -22
  21. package/dist/helpers/output-helper/output-helper.test.js +224 -212
  22. package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.js +133 -125
  23. package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.d.ts +1 -1
  24. package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.js +174 -156
  25. package/dist/helpers/validator/custom-validators/image.custom-validator.d.ts +6 -6
  26. package/dist/helpers/validator/custom-validators/image.custom-validator.js +40 -39
  27. package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.d.ts +4 -4
  28. package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.js +29 -29
  29. package/dist/helpers/validator/joi-custom-validators.spec.js +284 -240
  30. package/dist/helpers/validator/validator.spec.js +313 -303
  31. package/dist/pipeline/1-select-definitions-helper.d.ts +13 -13
  32. package/dist/pipeline/1-select-definitions-helper.js +68 -72
  33. package/dist/pipeline/1-select-definitions.helper.test.js +40 -40
  34. package/dist/pipeline/1-select-definitions.spec.js +131 -131
  35. package/dist/pipeline/2-structure-parser.helper.spec.js +266 -266
  36. package/dist/pipeline/parsers/array-parser.spec.js +116 -113
  37. package/dist/pipeline/parsers/object-parser.spec.js +159 -153
  38. package/dist/pipeline/parsers/primitive-parser.spec.js +67 -67
  39. package/dist/pre-made-components/assets/3-font.js +4 -4
  40. package/dist/pre-made-components/events/1-event.d.ts +1 -1
  41. package/dist/pre-made-components/events/1-event.js +157 -125
  42. package/dist/pre-made-components/events/2-event-test.d.ts +8 -8
  43. package/dist/pre-made-components/events/2-event-test.js +156 -119
  44. package/dist/pre-made-components/events/2-script-test.js +0 -1
  45. package/dist/pre-made-components/events/event-setup.d.ts +10 -5
  46. package/dist/pre-made-components/events/event-setup.js +15 -15
  47. package/dist/pre-made-components/events/script-setup.d.ts +5 -3
  48. package/dist/pre-made-components/events/script-setup.js +11 -11
  49. package/package.json +5 -10
@@ -2,17 +2,19 @@ import Joi from 'joi';
2
2
  import { Output } from './framework.model';
3
3
  export type DefinitionComponentClassType<T> = new (...args: any[]) => DefinitionComponent<T> | SingleDefinitionComponent<T>;
4
4
  export interface DefinitionComponentMeta {
5
- componentName: string;
6
- keyName?: string;
7
- singleton?: boolean;
8
- validationSchema: Joi.Schema;
5
+ componentName: string;
6
+ keyName?: string;
7
+ singleton?: boolean;
8
+ validationSchema: Joi.Schema;
9
9
  }
10
- export declare function DefinitionComponentDecorator(meta: DefinitionComponentMeta): (ComponentClass: DefinitionComponentClassType<any>) => any;
10
+ export declare function DefinitionComponentDecorator(
11
+ meta: DefinitionComponentMeta
12
+ ): (ComponentClass: DefinitionComponentClassType<any>) => any;
11
13
  export declare abstract class DefinitionComponent<T> {
12
- static getSchema(): Joi.Schema;
13
- abstract process(definitions: T[], context: Output): Promise<void>;
14
+ static getSchema(): Joi.Schema;
15
+ abstract process(definitions: T[], context: Output): Promise<void>;
14
16
  }
15
17
  export declare abstract class SingleDefinitionComponent<T> {
16
- static getSchema(): Joi.Schema;
17
- abstract process(definitions: T, context: Output): Promise<void>;
18
+ static getSchema(): Joi.Schema;
19
+ abstract process(definitions: T, context: Output): Promise<void>;
18
20
  }
@@ -1,29 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.SingleDefinitionComponent = exports.DefinitionComponent = exports.DefinitionComponentDecorator = void 0;
4
- const definition_store_1 = require("./definition-store");
4
+ const definition_store_1 = require('./definition-store');
5
5
  function DefinitionComponentDecorator(meta) {
6
- return function (ComponentClass) {
7
- definition_store_1.FrameworkData.definitionComponentNames.add(meta.componentName);
8
- ComponentClass.$meta = {
9
- componentName: meta.componentName,
10
- keyName: meta.keyName,
11
- singleton: meta.singleton,
12
- validationSchema: meta.validationSchema
13
- };
6
+ return function (ComponentClass) {
7
+ definition_store_1.FrameworkData.definitionComponentNames.add(meta.componentName);
8
+ ComponentClass.$meta = {
9
+ componentName: meta.componentName,
10
+ keyName: meta.keyName,
11
+ singleton: meta.singleton,
12
+ validationSchema: meta.validationSchema
14
13
  };
14
+ };
15
15
  }
16
16
  exports.DefinitionComponentDecorator = DefinitionComponentDecorator;
17
17
  class DefinitionComponent {
18
- static getSchema() {
19
- return this.$meta.validationSchema;
20
- }
18
+ static getSchema() {
19
+ return this.$meta.validationSchema;
20
+ }
21
21
  }
22
22
  exports.DefinitionComponent = DefinitionComponent;
23
23
  class SingleDefinitionComponent {
24
- static getSchema() {
25
- return this.$meta.validationSchema;
26
- }
24
+ static getSchema() {
25
+ return this.$meta.validationSchema;
26
+ }
27
27
  }
28
28
  exports.SingleDefinitionComponent = SingleDefinitionComponent;
29
- //# sourceMappingURL=definition-component.js.map
29
+ //# sourceMappingURL=definition-component.js.map
@@ -1,10 +1,11 @@
1
1
  import { DefinitionComponentClassType } from './definition-component';
2
2
  interface DefinitionGeneratorMeta {
3
- modules: DefinitionComponentClassType<any>[];
4
- interfaces: string;
3
+ modules: DefinitionComponentClassType<any>[];
4
+ interfaces: string;
5
5
  }
6
- export declare function DefinitionGeneratorDecorator(meta: DefinitionGeneratorMeta): (ModuleClass: DefinitionGeneratorClassType) => any;
6
+ export declare function DefinitionGeneratorDecorator(
7
+ meta: DefinitionGeneratorMeta
8
+ ): (ModuleClass: DefinitionGeneratorClassType) => any;
7
9
  export type DefinitionGeneratorClassType = new (...args: any[]) => DefinitionGenerator;
8
- export declare abstract class DefinitionGenerator {
9
- }
10
+ export declare abstract class DefinitionGenerator {}
10
11
  export {};
@@ -1,24 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.DefinitionGenerator = exports.DefinitionGeneratorDecorator = void 0;
4
- const definition_store_1 = require("./definition-store");
5
- const kernel_1 = require("./kernel");
4
+ const definition_store_1 = require('./definition-store');
5
+ const kernel_1 = require('./kernel');
6
6
  let ModuleIsRegistered = false;
7
7
  function DefinitionGeneratorDecorator(meta) {
8
- return function (ModuleClass) {
9
- if (ModuleIsRegistered) {
10
- console.error('There can be only one definition module!');
11
- }
12
- else {
13
- ModuleIsRegistered = true;
14
- definition_store_1.FrameworkData.modules.push(...meta.modules);
15
- definition_store_1.FrameworkData.interfaces = meta.interfaces;
16
- kernel_1.Kernel.process();
17
- }
18
- };
8
+ return function (ModuleClass) {
9
+ if (ModuleIsRegistered) {
10
+ console.error('There can be only one definition module!');
11
+ } else {
12
+ ModuleIsRegistered = true;
13
+ definition_store_1.FrameworkData.modules.push(...meta.modules);
14
+ definition_store_1.FrameworkData.interfaces = meta.interfaces;
15
+ kernel_1.Kernel.process();
16
+ }
17
+ };
19
18
  }
20
19
  exports.DefinitionGeneratorDecorator = DefinitionGeneratorDecorator;
21
- class DefinitionGenerator {
22
- }
20
+ class DefinitionGenerator {}
23
21
  exports.DefinitionGenerator = DefinitionGenerator;
24
- //# sourceMappingURL=definition-generator.js.map
22
+ //# sourceMappingURL=definition-generator.js.map
@@ -109,7 +109,7 @@ class FileContentGenerator {
109
109
  return { assetImports, replaceMap };
110
110
  }
111
111
  static stringify(obj) {
112
- // eslint-disable-next-line no-null/no-null
112
+ // biome-ignore lint:all
113
113
  return JSON.stringify(obj, (k, v) => (v === undefined ? null : v)).replace(/null/gm, 'undefined');
114
114
  }
115
115
  }
@@ -57,57 +57,57 @@ exports.Const = {
57
57
  ]
58
58
  }
59
59
  };
60
- let noTypeExpected = `export const ConstSample = { type: 'item' };
60
+ let noTypeExpected = `export const ConstSample = { type: 'item' };
61
61
  `;
62
- let basicConstExpected = `export const ConstSample: string = 'basic';
62
+ let basicConstExpected = `export const ConstSample: string = 'basic';
63
63
  `;
64
- let complexConstExpected = `export const ConstSample: any = {
65
- type: 'bow',
66
- material: 'WoodenItemMaterial',
67
- maxQuantity: 10,
68
- mainHand: undefined,
69
- offHand: undefined,
70
- bothHands: {
71
- imageOnCharacter: 'BodyPartImageNames',
72
- parryDice: undefined,
73
- attacks: [
74
- {
75
- actionIcon: 'AssetNames.characterActionBowAttack',
76
- attackDices: ['DiceType.d6', 'DiceType.d6'],
77
- range: 'WeaponRange.ranged',
78
- requiresSetup: false,
79
- unparryable: true,
80
- lowersQuantity: true,
81
- projectileType: 'ProjectileType.arrow',
82
- sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
83
- }
84
- ]
85
- }
86
- };
64
+ let complexConstExpected = `export const ConstSample: any = {
65
+ type: 'bow',
66
+ material: 'WoodenItemMaterial',
67
+ maxQuantity: 10,
68
+ mainHand: undefined,
69
+ offHand: undefined,
70
+ bothHands: {
71
+ imageOnCharacter: 'BodyPartImageNames',
72
+ parryDice: undefined,
73
+ attacks: [
74
+ {
75
+ actionIcon: 'AssetNames.characterActionBowAttack',
76
+ attackDices: ['DiceType.d6', 'DiceType.d6'],
77
+ range: 'WeaponRange.ranged',
78
+ requiresSetup: false,
79
+ unparryable: true,
80
+ lowersQuantity: true,
81
+ projectileType: 'ProjectileType.arrow',
82
+ sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
83
+ }
84
+ ]
85
+ }
86
+ };
87
87
  `;
88
- let complexConstReplaceExpected = `export const ConstSample: any = {
89
- type: 'bow',
90
- material: 'WoodenItemMaterial',
91
- maxQuantity: 10,
92
- mainHand: undefined,
93
- offHand: undefined,
94
- bothHands: {
95
- imageOnCharacter: 'BodyPartImageNames',
96
- parryDice: undefined,
97
- attacks: [
98
- {
99
- actionIcon: 'AssetNames.characterActionBowAttack',
100
- attackDices: ['DiceType.d6', 'DiceType.d6'],
101
- range: WeaponRange,
102
- requiresSetup: false,
103
- unparryable: true,
104
- lowersQuantity: true,
105
- projectileType: 'ProjectileType.arrow',
106
- sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
107
- }
108
- ]
109
- }
110
- };
88
+ let complexConstReplaceExpected = `export const ConstSample: any = {
89
+ type: 'bow',
90
+ material: 'WoodenItemMaterial',
91
+ maxQuantity: 10,
92
+ mainHand: undefined,
93
+ offHand: undefined,
94
+ bothHands: {
95
+ imageOnCharacter: 'BodyPartImageNames',
96
+ parryDice: undefined,
97
+ attacks: [
98
+ {
99
+ actionIcon: 'AssetNames.characterActionBowAttack',
100
+ attackDices: ['DiceType.d6', 'DiceType.d6'],
101
+ range: WeaponRange,
102
+ requiresSetup: false,
103
+ unparryable: true,
104
+ lowersQuantity: true,
105
+ projectileType: 'ProjectileType.arrow',
106
+ sounds: { hit: 'AssetGroups.battleSoundArrowHit', pre: 'AssetGroups.battleSoundArrowShot' }
107
+ }
108
+ ]
109
+ }
110
+ };
111
111
  `;
112
112
  (0, vitest_1.describe)('File Content Generator: Const Output', () => {
113
113
  (0, vitest_1.test)('should handle no type', async () => {
@@ -140,7 +140,7 @@ let complexConstReplaceExpected = `export const ConstSample: any = {
140
140
  (0, vitest_1.test)('should not lose properties with undefined or null value', async () => {
141
141
  let output = await file_content_generator_1.FileContentGenerator['stringify']({
142
142
  a: undefined,
143
- // eslint-disable-next-line no-null/no-null
143
+ // biome-ignore lint:all
144
144
  b: null
145
145
  });
146
146
  (0, vitest_1.expect)(output).toStrictEqual('{"a":undefined,"b":undefined}');
@@ -2,26 +2,27 @@ import Joi from 'joi';
2
2
  import { Output } from './framework.model';
3
3
  export type DefinitionComponentClassType<T> = new (...args: any[]) => DefinitionComponent<T> | SingleDefinitionComponent<T>;
4
4
  export interface DefinitionComponentMeta {
5
- definitionName: string;
6
- keyName?: string;
7
- singleton?: boolean;
8
- validationSchema: Joi.Schema;
5
+ definitionName: string;
6
+ keyName?: string;
7
+ singleton?: boolean;
8
+ validationSchema: Joi.Schema;
9
9
  }
10
- export declare function DefinitionComponentDecorator(meta: DefinitionComponentMeta): (ComponentClass: DefinitionComponentClassType<any>) => any;
10
+ export declare function DefinitionComponentDecorator(
11
+ meta: DefinitionComponentMeta
12
+ ): (ComponentClass: DefinitionComponentClassType<any>) => any;
11
13
  export declare abstract class DefinitionComponent<T> {
12
- static getSchema(): Joi.Schema;
13
- abstract process(definitions: T[], context: Output): Promise<void>;
14
+ static getSchema(): Joi.Schema;
15
+ abstract process(definitions: T[], context: Output): Promise<void>;
14
16
  }
15
17
  export declare abstract class SingleDefinitionComponent<T> {
16
- static getSchema(): Joi.Schema;
17
- abstract process(definitions: T, context: Output): Promise<void>;
18
+ static getSchema(): Joi.Schema;
19
+ abstract process(definitions: T, context: Output): Promise<void>;
18
20
  }
19
21
  interface DefinitionModuleMeta {
20
- modules: DefinitionComponentClassType<any>[];
21
- interfaces: string;
22
+ modules: DefinitionComponentClassType<any>[];
23
+ interfaces: string;
22
24
  }
23
25
  export declare function DefinitionModuleDecorator(meta: DefinitionModuleMeta): (ModuleClass: DefinitionModuleClassType) => any;
24
26
  export type DefinitionModuleClassType = new (...args: any[]) => DefinitionModule;
25
- export declare abstract class DefinitionModule {
26
- }
27
+ export declare abstract class DefinitionModule {}
27
28
  export {};
@@ -1,6 +1,6 @@
1
1
  import { DefinitionComponentClassType } from './framework';
2
2
  export declare class FrameworkData {
3
- static readonly definitionNames: Set<string>;
4
- static readonly modules: DefinitionComponentClassType<any>[];
5
- static interfaces: string;
3
+ static readonly definitionNames: Set<string>;
4
+ static readonly modules: DefinitionComponentClassType<any>[];
5
+ static interfaces: string;
6
6
  }
@@ -1,11 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.FrameworkData = void 0;
4
- const _3_config_1 = require("../pipeline/3-config");
4
+ const _3_config_1 = require('../pipeline/3-config');
5
5
  class FrameworkData {
6
- static { this.definitionNames = new Set([_3_config_1.ConfigDefinitionName]); }
7
- static { this.modules = []; }
8
- static { this.interfaces = ''; }
6
+ static {
7
+ this.definitionNames = new Set([_3_config_1.ConfigDefinitionName]);
8
+ }
9
+ static {
10
+ this.modules = [];
11
+ }
12
+ static {
13
+ this.interfaces = '';
14
+ }
9
15
  }
10
16
  exports.FrameworkData = FrameworkData;
11
- //# sourceMappingURL=framework.data.js.map
17
+ //# sourceMappingURL=framework.data.js.map
@@ -1,48 +1,51 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefinitionModule = exports.DefinitionModuleDecorator = exports.SingleDefinitionComponent = exports.DefinitionComponent = exports.DefinitionComponentDecorator = void 0;
4
- const kernel_1 = require("./kernel");
5
- const definition_store_1 = require("./definition-store");
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ exports.DefinitionModule =
4
+ exports.DefinitionModuleDecorator =
5
+ exports.SingleDefinitionComponent =
6
+ exports.DefinitionComponent =
7
+ exports.DefinitionComponentDecorator =
8
+ void 0;
9
+ const kernel_1 = require('./kernel');
10
+ const definition_store_1 = require('./definition-store');
6
11
  function DefinitionComponentDecorator(meta) {
7
- return function (ComponentClass) {
8
- definition_store_1.FrameworkData.definitionNames.add(meta.definitionName);
9
- ComponentClass.$meta = {
10
- definitionName: meta.definitionName,
11
- keyName: meta.keyName,
12
- singleton: meta.singleton,
13
- validationSchema: meta.validationSchema
14
- };
12
+ return function (ComponentClass) {
13
+ definition_store_1.FrameworkData.definitionNames.add(meta.definitionName);
14
+ ComponentClass.$meta = {
15
+ definitionName: meta.definitionName,
16
+ keyName: meta.keyName,
17
+ singleton: meta.singleton,
18
+ validationSchema: meta.validationSchema
15
19
  };
20
+ };
16
21
  }
17
22
  exports.DefinitionComponentDecorator = DefinitionComponentDecorator;
18
23
  class DefinitionComponent {
19
- static getSchema() {
20
- return this.$meta.validationSchema;
21
- }
24
+ static getSchema() {
25
+ return this.$meta.validationSchema;
26
+ }
22
27
  }
23
28
  exports.DefinitionComponent = DefinitionComponent;
24
29
  class SingleDefinitionComponent {
25
- static getSchema() {
26
- return this.$meta.validationSchema;
27
- }
30
+ static getSchema() {
31
+ return this.$meta.validationSchema;
32
+ }
28
33
  }
29
34
  exports.SingleDefinitionComponent = SingleDefinitionComponent;
30
35
  let ModuleIsRegistered = false;
31
36
  function DefinitionModuleDecorator(meta) {
32
- return function (ModuleClass) {
33
- if (ModuleIsRegistered) {
34
- console.error('There can be only one definition module!');
35
- }
36
- else {
37
- ModuleIsRegistered = true;
38
- definition_store_1.FrameworkData.modules.push(...meta.modules);
39
- definition_store_1.FrameworkData.interfaces = meta.interfaces;
40
- kernel_1.Kernel.process();
41
- }
42
- };
37
+ return function (ModuleClass) {
38
+ if (ModuleIsRegistered) {
39
+ console.error('There can be only one definition module!');
40
+ } else {
41
+ ModuleIsRegistered = true;
42
+ definition_store_1.FrameworkData.modules.push(...meta.modules);
43
+ definition_store_1.FrameworkData.interfaces = meta.interfaces;
44
+ kernel_1.Kernel.process();
45
+ }
46
+ };
43
47
  }
44
48
  exports.DefinitionModuleDecorator = DefinitionModuleDecorator;
45
- class DefinitionModule {
46
- }
49
+ class DefinitionModule {}
47
50
  exports.DefinitionModule = DefinitionModule;
48
- //# sourceMappingURL=framework.js.map
51
+ //# sourceMappingURL=framework.js.map
@@ -1,32 +1,32 @@
1
1
  export interface FileSystem {
2
- existsSync: (path: string) => boolean;
2
+ existsSync: (path: string) => boolean;
3
3
  }
4
4
  export interface FileInfo {
5
- path: string;
6
- content: string;
5
+ path: string;
6
+ content: string;
7
7
  }
8
8
  export interface LocationInFile {
9
- readonly path: string;
10
- readonly line: number;
9
+ readonly path: string;
10
+ readonly line: number;
11
11
  }
12
12
  export interface ErrorLog {
13
- readonly description: string;
14
- readonly location: LocationInFile;
13
+ readonly description: string;
14
+ readonly location: LocationInFile;
15
15
  }
16
16
  export interface Config {
17
- projectRoot: string;
17
+ projectRoot: string;
18
18
  }
19
19
  export type RawData = undefined | string | ParsedStructure[] | Record<string, ParsedStructure>;
20
20
  export interface ParsedStructure {
21
- readonly rawData: RawData;
22
- readonly line: number;
21
+ readonly rawData: RawData;
22
+ readonly line: number;
23
23
  }
24
24
  export interface RawDefinition {
25
- readonly componentName: string;
26
- readonly parsedStructure: ParsedStructure;
27
- readonly location: LocationInFile;
25
+ readonly componentName: string;
26
+ readonly parsedStructure: ParsedStructure;
27
+ readonly location: LocationInFile;
28
28
  }
29
29
  export interface Output {
30
- addFile: (fileInfo: FileInfo) => void;
31
- addError: (errorLog: ErrorLog) => void;
30
+ addFile: (fileInfo: FileInfo) => void;
31
+ addError: (errorLog: ErrorLog) => void;
32
32
  }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=framework.model.js.map
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ //# sourceMappingURL=framework.model.js.map
@@ -19,7 +19,7 @@ class CommonFunctionsClass {
19
19
  .replace(/\r?\n|\r/g, '')
20
20
  .replace(/\/\/.*$/gm, '')
21
21
  .trim()
22
- .replace(/ +/g, ' ');
22
+ .replace(/ {2,}/g, ' ');
23
23
  }
24
24
  removeComments(row) {
25
25
  return row.replace(/\/\/.*$/gm, '').trimEnd();
@@ -1,50 +1,50 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const common_functions_1 = require("./common-functions");
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ const common_functions_1 = require('./common-functions');
4
4
  describe('COMMON FUNCTIONS', () => {
5
- test('kabab case to camel case', () => {
6
- expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('')).toEqual('');
7
- expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('text')).toEqual('text');
8
- expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('TEXT')).toEqual('text');
9
- expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('text-asdf')).toEqual('textAsdf');
10
- expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('TEXT-ASDF')).toEqual('textAsdf');
11
- });
12
- test('lower case first letter', () => {
13
- expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter('')).toEqual('');
14
- expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter('text')).toEqual('text');
15
- expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter(' ')).toEqual(' ');
16
- expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter('Text')).toEqual('text');
17
- expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter(' Text')).toEqual(' Text');
18
- });
19
- test('upper case first letter', () => {
20
- expect(common_functions_1.CommonFunctions.upperCaseFirstLetter('')).toEqual('');
21
- expect(common_functions_1.CommonFunctions.upperCaseFirstLetter('Text')).toEqual('Text');
22
- expect(common_functions_1.CommonFunctions.upperCaseFirstLetter(' ')).toEqual(' ');
23
- expect(common_functions_1.CommonFunctions.upperCaseFirstLetter('text')).toEqual('Text');
24
- expect(common_functions_1.CommonFunctions.upperCaseFirstLetter(' text')).toEqual(' text');
25
- });
26
- test('remove whitespace', () => {
27
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('')).toEqual('');
28
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text')).toEqual('text');
29
- expect(common_functions_1.CommonFunctions.removeWhiteSpace(' text')).toEqual('text');
30
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text ')).toEqual('text');
31
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text\n')).toEqual('text');
32
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text\r')).toEqual('text');
33
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text\r\n')).toEqual('text');
34
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text//')).toEqual('text');
35
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text //')).toEqual('text');
36
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text // asdf')).toEqual('text');
37
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text text')).toEqual('text text');
38
- expect(common_functions_1.CommonFunctions.removeWhiteSpace('text text')).toEqual('text text');
39
- });
40
- test('remove comments', () => {
41
- expect(common_functions_1.CommonFunctions.removeComments('')).toEqual('');
42
- expect(common_functions_1.CommonFunctions.removeComments('text')).toEqual('text');
43
- expect(common_functions_1.CommonFunctions.removeComments(' text ')).toEqual(' text');
44
- expect(common_functions_1.CommonFunctions.removeComments(' text//')).toEqual(' text');
45
- expect(common_functions_1.CommonFunctions.removeComments(' text //')).toEqual(' text');
46
- expect(common_functions_1.CommonFunctions.removeComments(' text // asdf')).toEqual(' text');
47
- expect(common_functions_1.CommonFunctions.removeComments('- Symbol: □ // Dirt\n')).toEqual('- Symbol: □');
48
- });
5
+ test('kabab case to camel case', () => {
6
+ expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('')).toEqual('');
7
+ expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('text')).toEqual('text');
8
+ expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('TEXT')).toEqual('text');
9
+ expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('text-asdf')).toEqual('textAsdf');
10
+ expect(common_functions_1.CommonFunctions.kebabCaseToCamelCase('TEXT-ASDF')).toEqual('textAsdf');
11
+ });
12
+ test('lower case first letter', () => {
13
+ expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter('')).toEqual('');
14
+ expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter('text')).toEqual('text');
15
+ expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter(' ')).toEqual(' ');
16
+ expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter('Text')).toEqual('text');
17
+ expect(common_functions_1.CommonFunctions.lowerCaseFirstLetter(' Text')).toEqual(' Text');
18
+ });
19
+ test('upper case first letter', () => {
20
+ expect(common_functions_1.CommonFunctions.upperCaseFirstLetter('')).toEqual('');
21
+ expect(common_functions_1.CommonFunctions.upperCaseFirstLetter('Text')).toEqual('Text');
22
+ expect(common_functions_1.CommonFunctions.upperCaseFirstLetter(' ')).toEqual(' ');
23
+ expect(common_functions_1.CommonFunctions.upperCaseFirstLetter('text')).toEqual('Text');
24
+ expect(common_functions_1.CommonFunctions.upperCaseFirstLetter(' text')).toEqual(' text');
25
+ });
26
+ test('remove whitespace', () => {
27
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace('')).toEqual('');
28
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace('text')).toEqual('text');
29
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace(' text')).toEqual('text');
30
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace('text ')).toEqual('text');
31
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace('text\n')).toEqual('text');
32
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace('text\r')).toEqual('text');
33
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace('text\r\n')).toEqual('text');
34
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace('text//')).toEqual('text');
35
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace('text //')).toEqual('text');
36
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace('text // asdf')).toEqual('text');
37
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace('text text')).toEqual('text text');
38
+ expect(common_functions_1.CommonFunctions.removeWhiteSpace('text text')).toEqual('text text');
39
+ });
40
+ test('remove comments', () => {
41
+ expect(common_functions_1.CommonFunctions.removeComments('')).toEqual('');
42
+ expect(common_functions_1.CommonFunctions.removeComments('text')).toEqual('text');
43
+ expect(common_functions_1.CommonFunctions.removeComments(' text ')).toEqual(' text');
44
+ expect(common_functions_1.CommonFunctions.removeComments(' text//')).toEqual(' text');
45
+ expect(common_functions_1.CommonFunctions.removeComments(' text //')).toEqual(' text');
46
+ expect(common_functions_1.CommonFunctions.removeComments(' text // asdf')).toEqual(' text');
47
+ expect(common_functions_1.CommonFunctions.removeComments('- Symbol: □ // Dirt\n')).toEqual('- Symbol: □');
48
+ });
49
49
  });
50
- //# sourceMappingURL=common-functions.spec.js.map
50
+ //# sourceMappingURL=common-functions.spec.js.map