namirasoft-core 1.3.16 → 1.3.18
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/NamingConvention.d.ts +10 -10
- package/dist/NamingConvention.js +30 -17
- package/dist/NamingConvention.js.map +1 -1
- package/package.json +1 -1
- package/src/NamingConvention.ts +33 -17
|
@@ -7,31 +7,31 @@ export declare class NamingConvention {
|
|
|
7
7
|
private static splitter_normal;
|
|
8
8
|
private static splitter_uppercase;
|
|
9
9
|
private static splitter_none;
|
|
10
|
-
static
|
|
11
|
-
static UPPERCASE: NamingConvention;
|
|
12
|
-
static PascalCase: NamingConvention;
|
|
13
|
-
static camelCase: NamingConvention;
|
|
14
|
-
static Firstwordcase: NamingConvention;
|
|
15
|
-
static snake_case: NamingConvention;
|
|
10
|
+
static lower_case: NamingConvention;
|
|
16
11
|
static UPPER_CASE: NamingConvention;
|
|
17
12
|
static Pascal_Case: NamingConvention;
|
|
18
13
|
static camel_Case: NamingConvention;
|
|
19
14
|
static First_word_case: NamingConvention;
|
|
20
|
-
static
|
|
15
|
+
static lower_case_underscore: NamingConvention;
|
|
16
|
+
static UPPER_CASE_UNDERSCORE: NamingConvention;
|
|
17
|
+
static Pascal_Case_Underscore: NamingConvention;
|
|
18
|
+
static camel_Case_Underscore: NamingConvention;
|
|
19
|
+
static First_word_case_underscore: NamingConvention;
|
|
20
|
+
static lower_case_dash: NamingConvention;
|
|
21
21
|
static UPPER_CASE_DASH: NamingConvention;
|
|
22
22
|
static Pascal_Case_Dash: NamingConvention;
|
|
23
23
|
static camel_Case_Dash: NamingConvention;
|
|
24
24
|
static First_word_case_dash: NamingConvention;
|
|
25
|
-
static
|
|
25
|
+
static lower_case_dot: NamingConvention;
|
|
26
26
|
static UPPER_CASE_DOT: NamingConvention;
|
|
27
27
|
static Pascal_Case_Dot: NamingConvention;
|
|
28
28
|
static camel_Case_Dot: NamingConvention;
|
|
29
29
|
static First_word_case_dot: NamingConvention;
|
|
30
30
|
static lower_case_space: NamingConvention;
|
|
31
31
|
static UPPER_CASE_SPACE: NamingConvention;
|
|
32
|
-
static
|
|
32
|
+
static Pascal_Case_Space: NamingConvention;
|
|
33
33
|
static camel_Case_Space: NamingConvention;
|
|
34
|
-
static
|
|
34
|
+
static First_word_case_space: NamingConvention;
|
|
35
35
|
name: string;
|
|
36
36
|
delimiter: string;
|
|
37
37
|
formatter: (word: string, index: number) => string;
|
package/dist/NamingConvention.js
CHANGED
|
@@ -10,15 +10,28 @@ class NamingConvention {
|
|
|
10
10
|
}
|
|
11
11
|
convert(name, to) {
|
|
12
12
|
let words = name.split(this.delimiter);
|
|
13
|
+
words = words.filter(w => w);
|
|
13
14
|
for (let i = 0; i < words.length; i++)
|
|
14
15
|
words[i] = to.formatter(words[i], i);
|
|
15
16
|
return words.join(to.delimiter);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
exports.NamingConvention = NamingConvention;
|
|
19
|
-
NamingConvention.formatter_lower = (word) => {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
NamingConvention.formatter_lower = (word) => {
|
|
21
|
+
if (word)
|
|
22
|
+
return word.toLowerCase();
|
|
23
|
+
return "";
|
|
24
|
+
};
|
|
25
|
+
NamingConvention.formatter_upper = (word) => {
|
|
26
|
+
if (word)
|
|
27
|
+
return word.toUpperCase();
|
|
28
|
+
return "";
|
|
29
|
+
};
|
|
30
|
+
NamingConvention.formatter_pascal = (word) => {
|
|
31
|
+
if (word)
|
|
32
|
+
return word[0].toUpperCase() + word.substring(1).toLowerCase();
|
|
33
|
+
return "";
|
|
34
|
+
};
|
|
22
35
|
NamingConvention.formatter_camel = (word, index) => {
|
|
23
36
|
if (index == 0)
|
|
24
37
|
return NamingConvention.formatter_lower(word);
|
|
@@ -38,29 +51,29 @@ NamingConvention.splitter_uppercase = (name) => {
|
|
|
38
51
|
NamingConvention.splitter_none = (name) => {
|
|
39
52
|
return [name];
|
|
40
53
|
};
|
|
41
|
-
NamingConvention.
|
|
42
|
-
NamingConvention.
|
|
43
|
-
NamingConvention.
|
|
44
|
-
NamingConvention.
|
|
45
|
-
NamingConvention.
|
|
46
|
-
NamingConvention.
|
|
47
|
-
NamingConvention.
|
|
48
|
-
NamingConvention.
|
|
49
|
-
NamingConvention.
|
|
50
|
-
NamingConvention.
|
|
51
|
-
NamingConvention.
|
|
54
|
+
NamingConvention.lower_case = new NamingConvention("lowercase", "", NamingConvention.formatter_lower, NamingConvention.splitter_none);
|
|
55
|
+
NamingConvention.UPPER_CASE = new NamingConvention("UPPERCASE", "", NamingConvention.formatter_upper, NamingConvention.splitter_none);
|
|
56
|
+
NamingConvention.Pascal_Case = new NamingConvention("PascalCase", "", NamingConvention.formatter_pascal, NamingConvention.splitter_uppercase);
|
|
57
|
+
NamingConvention.camel_Case = new NamingConvention("camelCase", "", NamingConvention.formatter_camel, NamingConvention.splitter_uppercase);
|
|
58
|
+
NamingConvention.First_word_case = new NamingConvention("Firstwordcase", "", NamingConvention.formatter_sentence, NamingConvention.splitter_none);
|
|
59
|
+
NamingConvention.lower_case_underscore = new NamingConvention("snake_case", "_", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
60
|
+
NamingConvention.UPPER_CASE_UNDERSCORE = new NamingConvention("SNAKE_CASE", "_", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
61
|
+
NamingConvention.Pascal_Case_Underscore = new NamingConvention("Pascal_CASE", "_", NamingConvention.formatter_pascal, NamingConvention.splitter_normal);
|
|
62
|
+
NamingConvention.camel_Case_Underscore = new NamingConvention("camel_Case", "_", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
63
|
+
NamingConvention.First_word_case_underscore = new NamingConvention("First_word_case", "_", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
64
|
+
NamingConvention.lower_case_dash = new NamingConvention("kebab-case", "-", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
52
65
|
NamingConvention.UPPER_CASE_DASH = new NamingConvention("UPPER-CASE", "-", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
53
66
|
NamingConvention.Pascal_Case_Dash = new NamingConvention("Pascal-Case", "-", NamingConvention.formatter_pascal, NamingConvention.splitter_normal);
|
|
54
67
|
NamingConvention.camel_Case_Dash = new NamingConvention("camel-Case", "-", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
55
68
|
NamingConvention.First_word_case_dash = new NamingConvention("First-word-case", "-", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
56
|
-
NamingConvention.
|
|
69
|
+
NamingConvention.lower_case_dot = new NamingConvention("domain.case", ".", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
57
70
|
NamingConvention.UPPER_CASE_DOT = new NamingConvention("UPPER.CASE", ".", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
58
71
|
NamingConvention.Pascal_Case_Dot = new NamingConvention("Pascal.Case", ".", NamingConvention.formatter_pascal, NamingConvention.splitter_normal);
|
|
59
72
|
NamingConvention.camel_Case_Dot = new NamingConvention("camel.Case", ".", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
60
73
|
NamingConvention.First_word_case_dot = new NamingConvention("First.word.case", ".", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
61
74
|
NamingConvention.lower_case_space = new NamingConvention("lower case", " ", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
62
75
|
NamingConvention.UPPER_CASE_SPACE = new NamingConvention("UPPRE CASE", " ", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
63
|
-
NamingConvention.
|
|
76
|
+
NamingConvention.Pascal_Case_Space = new NamingConvention("Title Case", " ", NamingConvention.formatter_pascal, NamingConvention.splitter_normal);
|
|
64
77
|
NamingConvention.camel_Case_Space = new NamingConvention("camel Case", " ", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
65
|
-
NamingConvention.
|
|
78
|
+
NamingConvention.First_word_case_space = new NamingConvention("Sentence case", " ", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
66
79
|
//# sourceMappingURL=NamingConvention.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NamingConvention.js","sourceRoot":"","sources":["../src/NamingConvention.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"NamingConvention.js","sourceRoot":"","sources":["../src/NamingConvention.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;IA6EzB,YAAY,IAAY,EAAE,SAAiB,EAAE,SAAkD,EAAE,QAAuD;QAEpJ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IACD,OAAO,CAAC,IAAY,EAAE,EAAoB;QAEtC,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACvC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE;YACjC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACzC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;;AA3FL,4CA4FC;AA1FkB,gCAAe,GAAG,CAAC,IAAY,EAAE,EAAE;IAE9C,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC9B,OAAO,EAAE,CAAC;AACd,CAAC,CAAC;AACa,gCAAe,GAAG,CAAC,IAAY,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CAAC,YAAY,EAAE,GAAG,EAAE,gBAAgB,CAAC,eAAe,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;AACjJ,iCAAgB,GAAqB,IAAI,gBAAgB,CAAC,YAAY,EAAE,GAAG,EAAE,gBAAgB,CAAC,eAAe,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;AACjJ,kCAAiB,GAAqB,IAAI,gBAAgB,CAAC,YAAY,EAAE,GAAG,EAAE,gBAAgB,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;AACnJ,iCAAgB,GAAqB,IAAI,gBAAgB,CAAC,YAAY,EAAE,GAAG,EAAE,gBAAgB,CAAC,eAAe,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;AACjJ,sCAAqB,GAAqB,IAAI,gBAAgB,CAAC,eAAe,EAAE,GAAG,EAAE,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/NamingConvention.ts
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
export class NamingConvention
|
|
2
2
|
{
|
|
3
|
-
private static formatter_lower = (word: string) =>
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
private static formatter_lower = (word: string) =>
|
|
4
|
+
{
|
|
5
|
+
if (word)
|
|
6
|
+
return word.toLowerCase();
|
|
7
|
+
return "";
|
|
8
|
+
};
|
|
9
|
+
private static formatter_upper = (word: string) =>
|
|
10
|
+
{
|
|
11
|
+
if (word)
|
|
12
|
+
return word.toUpperCase();
|
|
13
|
+
return "";
|
|
14
|
+
};
|
|
15
|
+
private static formatter_pascal = (word: string) =>
|
|
16
|
+
{
|
|
17
|
+
if (word)
|
|
18
|
+
return word[0].toUpperCase() + word.substring(1).toLowerCase();
|
|
19
|
+
return "";
|
|
20
|
+
};
|
|
6
21
|
private static formatter_camel = (word: string, index: number) =>
|
|
7
22
|
{
|
|
8
23
|
if (index == 0)
|
|
@@ -27,25 +42,25 @@ export class NamingConvention
|
|
|
27
42
|
{
|
|
28
43
|
return [name];
|
|
29
44
|
};
|
|
30
|
-
public static
|
|
31
|
-
public static
|
|
32
|
-
public static
|
|
33
|
-
public static
|
|
34
|
-
public static
|
|
45
|
+
public static lower_case: NamingConvention = new NamingConvention("lowercase", "", NamingConvention.formatter_lower, NamingConvention.splitter_none);
|
|
46
|
+
public static UPPER_CASE: NamingConvention = new NamingConvention("UPPERCASE", "", NamingConvention.formatter_upper, NamingConvention.splitter_none);
|
|
47
|
+
public static Pascal_Case: NamingConvention = new NamingConvention("PascalCase", "", NamingConvention.formatter_pascal, NamingConvention.splitter_uppercase);
|
|
48
|
+
public static camel_Case: NamingConvention = new NamingConvention("camelCase", "", NamingConvention.formatter_camel, NamingConvention.splitter_uppercase);
|
|
49
|
+
public static First_word_case: NamingConvention = new NamingConvention("Firstwordcase", "", NamingConvention.formatter_sentence, NamingConvention.splitter_none);
|
|
35
50
|
|
|
36
|
-
public static
|
|
37
|
-
public static
|
|
38
|
-
public static
|
|
39
|
-
public static
|
|
40
|
-
public static
|
|
51
|
+
public static lower_case_underscore: NamingConvention = new NamingConvention("snake_case", "_", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
52
|
+
public static UPPER_CASE_UNDERSCORE: NamingConvention = new NamingConvention("SNAKE_CASE", "_", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
53
|
+
public static Pascal_Case_Underscore: NamingConvention = new NamingConvention("Pascal_CASE", "_", NamingConvention.formatter_pascal, NamingConvention.splitter_normal);
|
|
54
|
+
public static camel_Case_Underscore: NamingConvention = new NamingConvention("camel_Case", "_", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
55
|
+
public static First_word_case_underscore: NamingConvention = new NamingConvention("First_word_case", "_", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
41
56
|
|
|
42
|
-
public static
|
|
57
|
+
public static lower_case_dash: NamingConvention = new NamingConvention("kebab-case", "-", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
43
58
|
public static UPPER_CASE_DASH: NamingConvention = new NamingConvention("UPPER-CASE", "-", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
44
59
|
public static Pascal_Case_Dash: NamingConvention = new NamingConvention("Pascal-Case", "-", NamingConvention.formatter_pascal, NamingConvention.splitter_normal);
|
|
45
60
|
public static camel_Case_Dash: NamingConvention = new NamingConvention("camel-Case", "-", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
46
61
|
public static First_word_case_dash: NamingConvention = new NamingConvention("First-word-case", "-", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
47
62
|
|
|
48
|
-
public static
|
|
63
|
+
public static lower_case_dot: NamingConvention = new NamingConvention("domain.case", ".", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
49
64
|
public static UPPER_CASE_DOT: NamingConvention = new NamingConvention("UPPER.CASE", ".", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
50
65
|
public static Pascal_Case_Dot: NamingConvention = new NamingConvention("Pascal.Case", ".", NamingConvention.formatter_pascal, NamingConvention.splitter_normal);
|
|
51
66
|
public static camel_Case_Dot: NamingConvention = new NamingConvention("camel.Case", ".", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
@@ -53,9 +68,9 @@ export class NamingConvention
|
|
|
53
68
|
|
|
54
69
|
public static lower_case_space: NamingConvention = new NamingConvention("lower case", " ", NamingConvention.formatter_lower, NamingConvention.splitter_normal);
|
|
55
70
|
public static UPPER_CASE_SPACE: NamingConvention = new NamingConvention("UPPRE CASE", " ", NamingConvention.formatter_upper, NamingConvention.splitter_normal);
|
|
56
|
-
public static
|
|
71
|
+
public static Pascal_Case_Space: NamingConvention = new NamingConvention("Title Case", " ", NamingConvention.formatter_pascal, NamingConvention.splitter_normal);
|
|
57
72
|
public static camel_Case_Space: NamingConvention = new NamingConvention("camel Case", " ", NamingConvention.formatter_camel, NamingConvention.splitter_normal);
|
|
58
|
-
public static
|
|
73
|
+
public static First_word_case_space: NamingConvention = new NamingConvention("Sentence case", " ", NamingConvention.formatter_sentence, NamingConvention.splitter_normal);
|
|
59
74
|
name: string;
|
|
60
75
|
delimiter: string;
|
|
61
76
|
formatter: (word: string, index: number) => string;
|
|
@@ -70,6 +85,7 @@ export class NamingConvention
|
|
|
70
85
|
convert(name: string, to: NamingConvention)
|
|
71
86
|
{
|
|
72
87
|
let words = name.split(this.delimiter);
|
|
88
|
+
words = words.filter(w => w);
|
|
73
89
|
for (let i = 0; i < words.length; i++)
|
|
74
90
|
words[i] = to.formatter(words[i], i);
|
|
75
91
|
return words.join(to.delimiter);
|