malinajs 0.6.53 → 0.6.54
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/compile.js +2 -12
- package/malina.js +3 -13
- package/package.json +1 -1
- package/runtime.js +1 -1
package/compile.js
CHANGED
|
@@ -19,7 +19,7 @@ function assert(x, info) {
|
|
|
19
19
|
|
|
20
20
|
function toCamelCase(name) {
|
|
21
21
|
assert(name[name.length - 1] !== '-', 'Wrong name');
|
|
22
|
-
return name.replace(/(\-\w)/g, function(part) {
|
|
22
|
+
return name.replace(/(?<!-)(\-\w)/g, function(part) {
|
|
23
23
|
return part[1].toUpperCase();
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -55,19 +55,10 @@ function detectExpressionType(name) {
|
|
|
55
55
|
let ast = acorn.parse(name, {allowReturnOutsideFunction: true});
|
|
56
56
|
|
|
57
57
|
function checkIdentificator(body) {
|
|
58
|
-
if(body.length != 1) return;
|
|
59
|
-
if(body[0].type != 'ExpressionStatement') return;
|
|
60
|
-
if(body[0].expression.type != 'Identifier') return;
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function checkMemberIdentificator(body) {
|
|
65
58
|
if(body.length != 1) return;
|
|
66
59
|
if(body[0].type != 'ExpressionStatement') return;
|
|
67
60
|
let obj = body[0].expression;
|
|
68
|
-
|
|
69
|
-
if(obj.property.type != 'Identifier') return;
|
|
70
|
-
return true;
|
|
61
|
+
return obj.type == 'Identifier' || obj.type == 'MemberExpression';
|
|
71
62
|
}
|
|
72
63
|
|
|
73
64
|
function checkFunction(body) {
|
|
@@ -79,7 +70,6 @@ function detectExpressionType(name) {
|
|
|
79
70
|
}
|
|
80
71
|
|
|
81
72
|
if(checkIdentificator(ast.body)) return 'identifier';
|
|
82
|
-
if(checkMemberIdentificator(ast.body)) return 'identifier';
|
|
83
73
|
if(checkFunction(ast.body)) return 'function';
|
|
84
74
|
|
|
85
75
|
return;
|
package/malina.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
function toCamelCase(name) {
|
|
22
22
|
assert(name[name.length - 1] !== '-', 'Wrong name');
|
|
23
|
-
return name.replace(/(\-\w)/g, function(part) {
|
|
23
|
+
return name.replace(/(?<!-)(\-\w)/g, function(part) {
|
|
24
24
|
return part[1].toUpperCase();
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -56,19 +56,10 @@
|
|
|
56
56
|
let ast = acorn.parse(name, {allowReturnOutsideFunction: true});
|
|
57
57
|
|
|
58
58
|
function checkIdentificator(body) {
|
|
59
|
-
if(body.length != 1) return;
|
|
60
|
-
if(body[0].type != 'ExpressionStatement') return;
|
|
61
|
-
if(body[0].expression.type != 'Identifier') return;
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function checkMemberIdentificator(body) {
|
|
66
59
|
if(body.length != 1) return;
|
|
67
60
|
if(body[0].type != 'ExpressionStatement') return;
|
|
68
61
|
let obj = body[0].expression;
|
|
69
|
-
|
|
70
|
-
if(obj.property.type != 'Identifier') return;
|
|
71
|
-
return true;
|
|
62
|
+
return obj.type == 'Identifier' || obj.type == 'MemberExpression';
|
|
72
63
|
}
|
|
73
64
|
|
|
74
65
|
function checkFunction(body) {
|
|
@@ -80,7 +71,6 @@
|
|
|
80
71
|
}
|
|
81
72
|
|
|
82
73
|
if(checkIdentificator(ast.body)) return 'identifier';
|
|
83
|
-
if(checkMemberIdentificator(ast.body)) return 'identifier';
|
|
84
74
|
if(checkFunction(ast.body)) return 'function';
|
|
85
75
|
|
|
86
76
|
return;
|
|
@@ -5898,7 +5888,7 @@
|
|
|
5898
5888
|
return {event, fn};
|
|
5899
5889
|
}
|
|
5900
5890
|
|
|
5901
|
-
const version = '0.6.
|
|
5891
|
+
const version = '0.6.54';
|
|
5902
5892
|
|
|
5903
5893
|
|
|
5904
5894
|
async function compile(source, config = {}) {
|
package/package.json
CHANGED
package/runtime.js
CHANGED