mnemonica 0.9.943 → 0.9.944
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const compileNewModificatorFunctionBody: (FunctionName: string, asClass?: boolean) =>
|
|
1
|
+
declare const compileNewModificatorFunctionBody: (FunctionName: string, asClass?: boolean) => (ConstructHandler: any, CreationHandler: any, SymbolConstructorName: symbol) => any;
|
|
2
2
|
export default compileNewModificatorFunctionBody;
|
|
@@ -1,32 +1,41 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, '__esModule', { value : true });
|
|
3
|
+
const getClassConstructor = (ConstructHandler, CreationHandler) => {
|
|
4
|
+
return class extends ConstructHandler {
|
|
5
|
+
constructor (...args) {
|
|
6
|
+
const answer = super(...args);
|
|
7
|
+
return CreationHandler.call(this, answer);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
const getFunctionConstructor = (ConstructHandler, CreationHandler) => {
|
|
12
|
+
return function (...args) {
|
|
13
|
+
const answer = ConstructHandler.call(this, ...args);
|
|
14
|
+
return CreationHandler.call(this, answer);
|
|
15
|
+
};
|
|
16
|
+
};
|
|
3
17
|
const compileNewModificatorFunctionBody = function (FunctionName, asClass = false) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return CreationHandler_${dt}.call(this, answer);
|
|
18
|
+
return function (ConstructHandler, CreationHandler, SymbolConstructorName) {
|
|
19
|
+
return function () {
|
|
20
|
+
let ModificationBody;
|
|
21
|
+
if (asClass) {
|
|
22
|
+
ModificationBody = getClassConstructor(ConstructHandler, CreationHandler);
|
|
10
23
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Object.defineProperty(${FunctionName}, SymbolConstructorName, {
|
|
24
|
+
else {
|
|
25
|
+
ModificationBody = getFunctionConstructor(ConstructHandler, CreationHandler);
|
|
26
|
+
}
|
|
27
|
+
ModificationBody.prototype.constructor = ModificationBody;
|
|
28
|
+
Object.defineProperty(ModificationBody.prototype.constructor, 'name', {
|
|
29
|
+
value : FunctionName,
|
|
30
|
+
writable : false
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(ModificationBody, SymbolConstructorName, {
|
|
22
33
|
get () {
|
|
23
|
-
return
|
|
34
|
+
return FunctionName;
|
|
24
35
|
}
|
|
25
36
|
});
|
|
26
|
-
|
|
27
|
-
return ${FunctionName};
|
|
28
|
-
|
|
37
|
+
return ModificationBody;
|
|
29
38
|
};
|
|
30
|
-
|
|
39
|
+
};
|
|
31
40
|
};
|
|
32
41
|
exports.default = compileNewModificatorFunctionBody;
|