@creejs/commons-lang 2.1.13 → 2.1.15

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.
@@ -1357,22 +1357,45 @@ function substringsBetween (str, startMarker, endMarker) {
1357
1357
  }
1358
1358
 
1359
1359
  /**
1360
- * Executes a task silently, suppressing any errors or rejections.
1360
+ * @module ExecUtils
1361
+ * @description Utils about how to execute task functions.
1362
+ */
1363
+
1364
+
1365
+ /**
1366
+ * @typedef {{
1367
+ * error: (...args:any[]) => void,
1368
+ * warn: (...args:any[]) => void,
1369
+ * info: (...args:any[]) => void,
1370
+ * debug: (...args:any[]) => void,
1371
+ * trace: (...args:any[]) => void,
1372
+ * isErrorEnabled: () => boolean,
1373
+ * isWarnEnabled: () => boolean,
1374
+ * isInfoEnabled: () => boolean,
1375
+ * isDebugEnabled: () => boolean,
1376
+ * isTraceEnabled: () => boolean,
1377
+ * }} LoggerLike
1378
+ */
1379
+
1380
+ /**
1381
+ * 1. Executes a task silently, suppressing any errors or rejections.
1382
+ * 2. if loggerLike is provided, will log the error via it
1361
1383
  * @param {Function} task - The export function to execute.
1384
+ * @param {LoggerLike} [loggerLike] - The logger-like object to use for logging.
1362
1385
  * @returns {Promise<*>|*} The return value of the task, or a Promise if the task is asynchronous.
1363
1386
  */
1364
- function quiet (task) {
1387
+ function quiet (task, loggerLike) {
1365
1388
  assertFunction(task);
1366
1389
  try {
1367
1390
  const rtnVal = task();
1368
1391
  if (isPromise(rtnVal)) {
1369
- return rtnVal.catch(() => {
1370
- // do nothing
1392
+ return rtnVal.catch((/** @type {any} */ err) => {
1393
+ loggerLike && loggerLike.isErrorEnabled() && loggerLike.error('quiet() with async error:', err);
1371
1394
  })
1372
1395
  }
1373
1396
  return rtnVal
1374
- } catch (e) {
1375
- // do nothing
1397
+ } catch (err) {
1398
+ loggerLike && loggerLike.isErrorEnabled() && loggerLike.error('quiet() with sync error:', err);
1376
1399
  }
1377
1400
  }
1378
1401
 
@@ -1737,6 +1760,7 @@ async function parallelAllSettled (tasks, maxParallel = 5) {
1737
1760
 
1738
1761
  // owned
1739
1762
 
1763
+ // module vars
1740
1764
  const { isPlainObject } = TypeUtils;
1741
1765
 
1742
1766
  /**
@@ -1801,6 +1825,8 @@ function newProxyInstance (cls, args, propertyHandler, sealed = true) {
1801
1825
  return Reflect.construct(proxyCls, args ?? [])
1802
1826
  }
1803
1827
 
1828
+ // owned
1829
+
1804
1830
  /**
1805
1831
  * @module InstanceProxyUtils
1806
1832
  */
@@ -1827,7 +1853,6 @@ var InstanceProxyUtils = {
1827
1853
 
1828
1854
  // owned
1829
1855
 
1830
-
1831
1856
  /**
1832
1857
  * Retrieves all unique method names from a class's prototype chain. *
1833
1858
  * @param {Function} cls - The class to inspect
@@ -1904,8 +1929,6 @@ var ReflectUtils = {
1904
1929
  };
1905
1930
 
1906
1931
  // internal
1907
-
1908
-
1909
1932
  // owned
1910
1933
 
1911
1934
  /**
@@ -1989,6 +2012,8 @@ function equals$1 (src, target) {
1989
2012
  return true
1990
2013
  }
1991
2014
 
2015
+ // owned
2016
+
1992
2017
  var ArrayBufferUtils = {
1993
2018
  readString,
1994
2019
  writeString,