chain-simple 1.0.1 → 1.0.2
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/built/index.js +6 -4
- package/lib/index.ts +10 -4
- package/package.json +1 -1
package/built/index.js
CHANGED
|
@@ -74,10 +74,11 @@ function makePropertiesChainable(item, config) {
|
|
|
74
74
|
else if (((0, sat_utils_1.isFunction)(item[p]) || (0, sat_utils_1.isAsyncFunction)(item[p])) && (0, sat_utils_1.isPromise)(proxifiedResult)) {
|
|
75
75
|
logger_1.logger.info('In to function or async function and resulter is a promise');
|
|
76
76
|
return function (...arguments_) {
|
|
77
|
-
async function
|
|
77
|
+
const handler = async function () {
|
|
78
78
|
await proxifiedResult;
|
|
79
79
|
return item[p](...arguments_);
|
|
80
|
-
}
|
|
80
|
+
};
|
|
81
|
+
Object.defineProperty(handler, 'name', { value: p });
|
|
81
82
|
proxifiedResult = handler();
|
|
82
83
|
return proxed;
|
|
83
84
|
};
|
|
@@ -85,9 +86,10 @@ function makePropertiesChainable(item, config) {
|
|
|
85
86
|
else if ((0, sat_utils_1.isAsyncFunction)(item[p]) && !(0, sat_utils_1.isPromise)(proxifiedResult)) {
|
|
86
87
|
logger_1.logger.info('In to async function and resulter is a promise');
|
|
87
88
|
return function (...arguments_) {
|
|
88
|
-
async function
|
|
89
|
+
const handler = async function () {
|
|
89
90
|
return item[p](...arguments_);
|
|
90
|
-
}
|
|
91
|
+
};
|
|
92
|
+
Object.defineProperty(handler, 'name', { value: p });
|
|
91
93
|
proxifiedResult = handler();
|
|
92
94
|
return proxed;
|
|
93
95
|
};
|
package/lib/index.ts
CHANGED
|
@@ -88,19 +88,25 @@ function makePropertiesChainable(item, config?: { getEntity: string }) {
|
|
|
88
88
|
} else if ((isFunction(item[p]) || isAsyncFunction(item[p])) && isPromise(proxifiedResult)) {
|
|
89
89
|
logger.info('In to function or async function and resulter is a promise');
|
|
90
90
|
return function (...arguments_) {
|
|
91
|
-
async function
|
|
91
|
+
const handler = async function () {
|
|
92
92
|
await proxifiedResult;
|
|
93
93
|
return item[p](...arguments_);
|
|
94
|
-
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
Object.defineProperty(handler, 'name', { value: p });
|
|
97
|
+
|
|
95
98
|
proxifiedResult = handler();
|
|
96
99
|
return proxed;
|
|
97
100
|
};
|
|
98
101
|
} else if (isAsyncFunction(item[p]) && !isPromise(proxifiedResult)) {
|
|
99
102
|
logger.info('In to async function and resulter is a promise');
|
|
100
103
|
return function (...arguments_) {
|
|
101
|
-
async function
|
|
104
|
+
const handler = async function () {
|
|
102
105
|
return item[p](...arguments_);
|
|
103
|
-
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
Object.defineProperty(handler, 'name', { value: p });
|
|
109
|
+
|
|
104
110
|
proxifiedResult = handler();
|
|
105
111
|
return proxed;
|
|
106
112
|
};
|