@whitesev/utils 2.9.0 → 2.9.1

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/index.umd.js CHANGED
@@ -5478,7 +5478,7 @@
5478
5478
  }
5479
5479
  const domUtils = new DOMUtils();
5480
5480
 
5481
- const version = "2.9.0";
5481
+ const version = "2.9.1";
5482
5482
 
5483
5483
  class Utils {
5484
5484
  windowApi;
@@ -8196,6 +8196,21 @@
8196
8196
  this.windowApi.clearInterval(timeId);
8197
8197
  }
8198
8198
  }
8199
+ createFunction(...args) {
8200
+ let isAsync = args[args.length - 1];
8201
+ if (typeof isAsync !== "boolean") {
8202
+ isAsync = false;
8203
+ }
8204
+ args.splice(args.length - 1, 1);
8205
+ if (isAsync) {
8206
+ const AsyncFunctionConstructor = Object.getPrototypeOf(async function () { }).constructor;
8207
+ return new AsyncFunctionConstructor(...args);
8208
+ }
8209
+ else {
8210
+ const FunctionConstructor = Object.getPrototypeOf(function () { }).constructor;
8211
+ return new FunctionConstructor(...args);
8212
+ }
8213
+ }
8199
8214
  }
8200
8215
  const utils = new Utils();
8201
8216