@skmtc/core 0.0.878 → 0.0.880
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/helpers/protectedKeywords.d.ts +2 -0
- package/esm/helpers/protectedKeywords.d.ts.map +1 -0
- package/esm/helpers/protectedKeywords.js +68 -0
- package/esm/helpers/sanitizePropertyName.d.ts +2 -2
- package/esm/helpers/sanitizePropertyName.d.ts.map +1 -1
- package/esm/helpers/sanitizePropertyName.js +6 -8
- package/package.json +1 -1
- package/script/helpers/protectedKeywords.d.ts +2 -0
- package/script/helpers/protectedKeywords.d.ts.map +1 -0
- package/script/helpers/protectedKeywords.js +71 -0
- package/script/helpers/sanitizePropertyName.d.ts +2 -2
- package/script/helpers/sanitizePropertyName.d.ts.map +1 -1
- package/script/helpers/sanitizePropertyName.js +5 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protectedKeywords.d.ts","sourceRoot":"","sources":["../../src/helpers/protectedKeywords.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmEpD,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export const protectedKeywords = {
|
|
2
|
+
abstract: 'abstractValue',
|
|
3
|
+
arguments: 'argumentsValue',
|
|
4
|
+
'async *': 'asyncStarValue',
|
|
5
|
+
'await *': 'awaitStarValue',
|
|
6
|
+
boolean: 'booleanValue',
|
|
7
|
+
break: 'breakValue',
|
|
8
|
+
byte: 'byteValue',
|
|
9
|
+
case: 'caseValue',
|
|
10
|
+
catch: 'catchValue',
|
|
11
|
+
char: 'charValue',
|
|
12
|
+
'class *': 'classStarValue',
|
|
13
|
+
'const *': 'constStarValue',
|
|
14
|
+
continue: 'continueValue',
|
|
15
|
+
debugger: 'debuggerValue',
|
|
16
|
+
default: 'defaultValue',
|
|
17
|
+
delete: 'deleteValue',
|
|
18
|
+
do: 'doValue',
|
|
19
|
+
double: 'doubleValue',
|
|
20
|
+
else: 'elseValue',
|
|
21
|
+
'enum *': 'enumStarValue',
|
|
22
|
+
eval: 'evalValue',
|
|
23
|
+
'export *': 'exportStarValue',
|
|
24
|
+
'extends *': 'extendsStarValue',
|
|
25
|
+
false: 'falseValue',
|
|
26
|
+
final: 'finalValue',
|
|
27
|
+
finally: 'finallyValue',
|
|
28
|
+
float: 'floatValue',
|
|
29
|
+
for: 'forValue',
|
|
30
|
+
goto: 'gotoValue',
|
|
31
|
+
if: 'ifValue',
|
|
32
|
+
implements: 'implementsValue',
|
|
33
|
+
function: 'functionValue',
|
|
34
|
+
'import *': 'importStarValue',
|
|
35
|
+
in: 'inValue',
|
|
36
|
+
instanceof: 'instanceofValue',
|
|
37
|
+
int: 'intValue',
|
|
38
|
+
interface: 'interfaceValue',
|
|
39
|
+
'let *': 'letStarValue',
|
|
40
|
+
long: 'longValue',
|
|
41
|
+
native: 'nativeValue',
|
|
42
|
+
new: 'newValue',
|
|
43
|
+
null: 'nullValue',
|
|
44
|
+
package: 'packageValue',
|
|
45
|
+
private: 'privateValue',
|
|
46
|
+
protected: 'protectedValue',
|
|
47
|
+
public: 'publicValue',
|
|
48
|
+
return: 'returnValue',
|
|
49
|
+
short: 'shortValue',
|
|
50
|
+
static: 'staticValue',
|
|
51
|
+
'super *': 'superStarValue',
|
|
52
|
+
switch: 'switchValue',
|
|
53
|
+
synchronized: 'synchronizedValue',
|
|
54
|
+
this: 'thisValue',
|
|
55
|
+
throw: 'throwValue',
|
|
56
|
+
throws: 'throwsValue',
|
|
57
|
+
transient: 'transientValue',
|
|
58
|
+
true: 'trueValue',
|
|
59
|
+
try: 'tryValue',
|
|
60
|
+
typeof: 'typeofValue',
|
|
61
|
+
'using *': 'usingStarValue',
|
|
62
|
+
var: 'varValue',
|
|
63
|
+
void: 'voidValue',
|
|
64
|
+
volatile: 'volatileValue',
|
|
65
|
+
while: 'whileValue',
|
|
66
|
+
with: 'withValue',
|
|
67
|
+
yield: 'yieldValue'
|
|
68
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const sanitizePropertyName: (propertyName: string) => string |
|
|
1
|
+
import type { Stringable } from '../dsl/Stringable.js';
|
|
2
|
+
export declare const sanitizePropertyName: (propertyName: string) => string | Stringable;
|
|
3
3
|
//# sourceMappingURL=sanitizePropertyName.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizePropertyName.d.ts","sourceRoot":"","sources":["../../src/helpers/sanitizePropertyName.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sanitizePropertyName.d.ts","sourceRoot":"","sources":["../../src/helpers/sanitizePropertyName.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD,eAAO,MAAM,oBAAoB,GAAI,cAAc,MAAM,KAAG,MAAM,GAAG,UAYpE,CAAA"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { isIdentifierName
|
|
1
|
+
import { isIdentifierName } from '@babel/helper-validator-identifier';
|
|
2
2
|
import { List } from '../typescript/List.js';
|
|
3
3
|
import { camelCase } from './strings.js';
|
|
4
|
+
import { protectedKeywords } from './protectedKeywords.js';
|
|
4
5
|
export const sanitizePropertyName = (propertyName) => {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
const sanitizedKeyword = protectedKeywords[propertyName];
|
|
7
|
+
if (sanitizedKeyword) {
|
|
8
|
+
return List.toKeyValue(propertyName, sanitizedKeyword);
|
|
7
9
|
}
|
|
8
10
|
if (!isIdentifierName(propertyName)) {
|
|
9
|
-
return List.toKeyValue(propertyName
|
|
11
|
+
return List.toKeyValue(`'${propertyName}'`, camelCase(propertyName));
|
|
10
12
|
}
|
|
11
13
|
return propertyName;
|
|
12
14
|
};
|
|
13
|
-
const sanitizeReservedWord = (propertyName) => {
|
|
14
|
-
const destarred = propertyName.replace(' *', 'Star');
|
|
15
|
-
return `${destarred}Value`;
|
|
16
|
-
};
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protectedKeywords.d.ts","sourceRoot":"","sources":["../../src/helpers/protectedKeywords.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmEpD,CAAA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.protectedKeywords = void 0;
|
|
4
|
+
exports.protectedKeywords = {
|
|
5
|
+
abstract: 'abstractValue',
|
|
6
|
+
arguments: 'argumentsValue',
|
|
7
|
+
'async *': 'asyncStarValue',
|
|
8
|
+
'await *': 'awaitStarValue',
|
|
9
|
+
boolean: 'booleanValue',
|
|
10
|
+
break: 'breakValue',
|
|
11
|
+
byte: 'byteValue',
|
|
12
|
+
case: 'caseValue',
|
|
13
|
+
catch: 'catchValue',
|
|
14
|
+
char: 'charValue',
|
|
15
|
+
'class *': 'classStarValue',
|
|
16
|
+
'const *': 'constStarValue',
|
|
17
|
+
continue: 'continueValue',
|
|
18
|
+
debugger: 'debuggerValue',
|
|
19
|
+
default: 'defaultValue',
|
|
20
|
+
delete: 'deleteValue',
|
|
21
|
+
do: 'doValue',
|
|
22
|
+
double: 'doubleValue',
|
|
23
|
+
else: 'elseValue',
|
|
24
|
+
'enum *': 'enumStarValue',
|
|
25
|
+
eval: 'evalValue',
|
|
26
|
+
'export *': 'exportStarValue',
|
|
27
|
+
'extends *': 'extendsStarValue',
|
|
28
|
+
false: 'falseValue',
|
|
29
|
+
final: 'finalValue',
|
|
30
|
+
finally: 'finallyValue',
|
|
31
|
+
float: 'floatValue',
|
|
32
|
+
for: 'forValue',
|
|
33
|
+
goto: 'gotoValue',
|
|
34
|
+
if: 'ifValue',
|
|
35
|
+
implements: 'implementsValue',
|
|
36
|
+
function: 'functionValue',
|
|
37
|
+
'import *': 'importStarValue',
|
|
38
|
+
in: 'inValue',
|
|
39
|
+
instanceof: 'instanceofValue',
|
|
40
|
+
int: 'intValue',
|
|
41
|
+
interface: 'interfaceValue',
|
|
42
|
+
'let *': 'letStarValue',
|
|
43
|
+
long: 'longValue',
|
|
44
|
+
native: 'nativeValue',
|
|
45
|
+
new: 'newValue',
|
|
46
|
+
null: 'nullValue',
|
|
47
|
+
package: 'packageValue',
|
|
48
|
+
private: 'privateValue',
|
|
49
|
+
protected: 'protectedValue',
|
|
50
|
+
public: 'publicValue',
|
|
51
|
+
return: 'returnValue',
|
|
52
|
+
short: 'shortValue',
|
|
53
|
+
static: 'staticValue',
|
|
54
|
+
'super *': 'superStarValue',
|
|
55
|
+
switch: 'switchValue',
|
|
56
|
+
synchronized: 'synchronizedValue',
|
|
57
|
+
this: 'thisValue',
|
|
58
|
+
throw: 'throwValue',
|
|
59
|
+
throws: 'throwsValue',
|
|
60
|
+
transient: 'transientValue',
|
|
61
|
+
true: 'trueValue',
|
|
62
|
+
try: 'tryValue',
|
|
63
|
+
typeof: 'typeofValue',
|
|
64
|
+
'using *': 'usingStarValue',
|
|
65
|
+
var: 'varValue',
|
|
66
|
+
void: 'voidValue',
|
|
67
|
+
volatile: 'volatileValue',
|
|
68
|
+
while: 'whileValue',
|
|
69
|
+
with: 'withValue',
|
|
70
|
+
yield: 'yieldValue'
|
|
71
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const sanitizePropertyName: (propertyName: string) => string |
|
|
1
|
+
import type { Stringable } from '../dsl/Stringable.js';
|
|
2
|
+
export declare const sanitizePropertyName: (propertyName: string) => string | Stringable;
|
|
3
3
|
//# sourceMappingURL=sanitizePropertyName.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizePropertyName.d.ts","sourceRoot":"","sources":["../../src/helpers/sanitizePropertyName.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sanitizePropertyName.d.ts","sourceRoot":"","sources":["../../src/helpers/sanitizePropertyName.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD,eAAO,MAAM,oBAAoB,GAAI,cAAc,MAAM,KAAG,MAAM,GAAG,UAYpE,CAAA"}
|
|
@@ -4,17 +4,15 @@ exports.sanitizePropertyName = void 0;
|
|
|
4
4
|
const helper_validator_identifier_1 = require("@babel/helper-validator-identifier");
|
|
5
5
|
const List_js_1 = require("../typescript/List.js");
|
|
6
6
|
const strings_js_1 = require("./strings.js");
|
|
7
|
+
const protectedKeywords_js_1 = require("./protectedKeywords.js");
|
|
7
8
|
const sanitizePropertyName = (propertyName) => {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
const sanitizedKeyword = protectedKeywords_js_1.protectedKeywords[propertyName];
|
|
10
|
+
if (sanitizedKeyword) {
|
|
11
|
+
return List_js_1.List.toKeyValue(propertyName, sanitizedKeyword);
|
|
10
12
|
}
|
|
11
13
|
if (!(0, helper_validator_identifier_1.isIdentifierName)(propertyName)) {
|
|
12
|
-
return List_js_1.List.toKeyValue(propertyName
|
|
14
|
+
return List_js_1.List.toKeyValue(`'${propertyName}'`, (0, strings_js_1.camelCase)(propertyName));
|
|
13
15
|
}
|
|
14
16
|
return propertyName;
|
|
15
17
|
};
|
|
16
18
|
exports.sanitizePropertyName = sanitizePropertyName;
|
|
17
|
-
const sanitizeReservedWord = (propertyName) => {
|
|
18
|
-
const destarred = propertyName.replace(' *', 'Star');
|
|
19
|
-
return `${destarred}Value`;
|
|
20
|
-
};
|