@ztimson/utils 0.24.0 → 0.24.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.mjs CHANGED
@@ -1422,6 +1422,10 @@ function fracToDec(frac) {
1422
1422
  split = split.pop().split("/");
1423
1423
  return whole + Number(split[0]) / Number(split[1]);
1424
1424
  }
1425
+ function asyncFunction(args, fn) {
1426
+ const keys = Object.keys(args);
1427
+ return new Function(...keys, `return (async (${keys.join(",")}) => { ${fn} })(${keys.join(",")})`)(...keys.map((k) => args[k]));
1428
+ }
1425
1429
  function gravatar(email, def = "mp") {
1426
1430
  if (!email) return "";
1427
1431
  return `https://www.gravatar.com/avatar/${md5(email)}?d=${def}`;
@@ -1755,6 +1759,7 @@ export {
1755
1759
  addUnique,
1756
1760
  adjustedInterval,
1757
1761
  arrayDiff,
1762
+ asyncFunction,
1758
1763
  blackOrWhite,
1759
1764
  camelCase,
1760
1765
  caseInsensitiveSort,