index.cjs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. 'use strict';
  2. function clamp(n, min, max) {
  3. return Math.min(max, Math.max(min, n));
  4. }
  5. function sum(...args) {
  6. return flattenArrayable(args).reduce((a, b) => a + b, 0);
  7. }
  8. function toArray(array) {
  9. array = array ?? [];
  10. return Array.isArray(array) ? array : [array];
  11. }
  12. function flattenArrayable(array) {
  13. return toArray(array).flat(1);
  14. }
  15. function mergeArrayable(...args) {
  16. return args.flatMap((i) => toArray(i));
  17. }
  18. function partition(array, ...filters) {
  19. const result = new Array(filters.length + 1).fill(null).map(() => []);
  20. array.forEach((e, idx, arr) => {
  21. let i = 0;
  22. for (const filter of filters) {
  23. if (filter(e, idx, arr)) {
  24. result[i].push(e);
  25. return;
  26. }
  27. i += 1;
  28. }
  29. result[i].push(e);
  30. });
  31. return result;
  32. }
  33. function uniq(array) {
  34. return Array.from(new Set(array));
  35. }
  36. function uniqueBy(array, equalFn) {
  37. return array.reduce((acc, cur) => {
  38. const index = acc.findIndex((item) => equalFn(cur, item));
  39. if (index === -1)
  40. acc.push(cur);
  41. return acc;
  42. }, []);
  43. }
  44. function last(array) {
  45. return at(array, -1);
  46. }
  47. function remove(array, value) {
  48. if (!array)
  49. return false;
  50. const index = array.indexOf(value);
  51. if (index >= 0) {
  52. array.splice(index, 1);
  53. return true;
  54. }
  55. return false;
  56. }
  57. function at(array, index) {
  58. const len = array.length;
  59. if (!len)
  60. return void 0;
  61. if (index < 0)
  62. index += len;
  63. return array[index];
  64. }
  65. function range(...args) {
  66. let start, stop, step;
  67. if (args.length === 1) {
  68. start = 0;
  69. step = 1;
  70. [stop] = args;
  71. } else {
  72. [start, stop, step = 1] = args;
  73. }
  74. const arr = [];
  75. let current = start;
  76. while (current < stop) {
  77. arr.push(current);
  78. current += step || 1;
  79. }
  80. return arr;
  81. }
  82. function move(arr, from, to) {
  83. arr.splice(to, 0, arr.splice(from, 1)[0]);
  84. return arr;
  85. }
  86. function clampArrayRange(n, arr) {
  87. return clamp(n, 0, arr.length - 1);
  88. }
  89. function sample(arr, count) {
  90. return Array.from({ length: count }, (_) => arr[Math.round(Math.random() * (arr.length - 1))]);
  91. }
  92. function shuffle(array) {
  93. for (let i = array.length - 1; i > 0; i--) {
  94. const j = Math.floor(Math.random() * (i + 1));
  95. [array[i], array[j]] = [array[j], array[i]];
  96. }
  97. return array;
  98. }
  99. const assert = (condition, message) => {
  100. if (!condition)
  101. throw new Error(message);
  102. };
  103. const toString = (v) => Object.prototype.toString.call(v);
  104. const getTypeName = (v) => {
  105. if (v === null)
  106. return "null";
  107. const type = toString(v).slice(8, -1).toLowerCase();
  108. return typeof v === "object" || typeof v === "function" ? type : typeof v;
  109. };
  110. const noop = () => {
  111. };
  112. function notNullish(v) {
  113. return v != null;
  114. }
  115. function noNull(v) {
  116. return v !== null;
  117. }
  118. function notUndefined(v) {
  119. return v !== void 0;
  120. }
  121. function isTruthy(v) {
  122. return Boolean(v);
  123. }
  124. const isDef = (val) => typeof val !== "undefined";
  125. const isBoolean = (val) => typeof val === "boolean";
  126. const isFunction = (val) => typeof val === "function";
  127. const isNumber = (val) => typeof val === "number";
  128. const isString = (val) => typeof val === "string";
  129. const isObject = (val) => toString(val) === "[object Object]";
  130. const isUndefined = (val) => toString(val) === "[object Undefined]";
  131. const isNull = (val) => toString(val) === "[object Null]";
  132. const isRegExp = (val) => toString(val) === "[object RegExp]";
  133. const isDate = (val) => toString(val) === "[object Date]";
  134. const isWindow = (val) => typeof window !== "undefined" && toString(val) === "[object Window]";
  135. const isBrowser = typeof window !== "undefined";
  136. function slash(str) {
  137. return str.replace(/\\/g, "/");
  138. }
  139. function ensurePrefix(prefix, str) {
  140. if (!str.startsWith(prefix))
  141. return prefix + str;
  142. return str;
  143. }
  144. function ensureSuffix(suffix, str) {
  145. if (!str.endsWith(suffix))
  146. return str + suffix;
  147. return str;
  148. }
  149. function template(str, ...args) {
  150. return str.replace(/{(\d+)}/g, (match, key) => {
  151. const index = Number(key);
  152. if (Number.isNaN(index))
  153. return match;
  154. return args[index];
  155. });
  156. }
  157. const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
  158. function randomStr(size = 16, dict = urlAlphabet) {
  159. let id = "";
  160. let i = size;
  161. const len = dict.length;
  162. while (i--)
  163. id += dict[Math.random() * len | 0];
  164. return id;
  165. }
  166. function capitalize(str) {
  167. return str[0].toUpperCase() + str.slice(1).toLowerCase();
  168. }
  169. const timestamp = () => +Date.now();
  170. function batchInvoke(functions) {
  171. functions.forEach((fn) => fn && fn());
  172. }
  173. function invoke(fn) {
  174. return fn();
  175. }
  176. function tap(value, callback) {
  177. callback(value);
  178. return value;
  179. }
  180. function objectMap(obj, fn) {
  181. return Object.fromEntries(
  182. Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)
  183. );
  184. }
  185. function isKeyOf(obj, k) {
  186. return k in obj;
  187. }
  188. function objectKeys(obj) {
  189. return Object.keys(obj);
  190. }
  191. function objectEntries(obj) {
  192. return Object.entries(obj);
  193. }
  194. function deepMerge(target, ...sources) {
  195. if (!sources.length)
  196. return target;
  197. const source = sources.shift();
  198. if (source === void 0)
  199. return target;
  200. if (isMergableObject(target) && isMergableObject(source)) {
  201. objectKeys(source).forEach((key) => {
  202. if (isMergableObject(source[key])) {
  203. if (!target[key])
  204. target[key] = {};
  205. deepMerge(target[key], source[key]);
  206. } else {
  207. target[key] = source[key];
  208. }
  209. });
  210. }
  211. return deepMerge(target, ...sources);
  212. }
  213. function isMergableObject(item) {
  214. return isObject(item) && !Array.isArray(item);
  215. }
  216. function objectPick(obj, keys, omitUndefined = false) {
  217. return keys.reduce((n, k) => {
  218. if (k in obj) {
  219. if (!omitUndefined || obj[k] !== void 0)
  220. n[k] = obj[k];
  221. }
  222. return n;
  223. }, {});
  224. }
  225. function clearUndefined(obj) {
  226. Object.keys(obj).forEach((key) => obj[key] === void 0 ? delete obj[key] : {});
  227. return obj;
  228. }
  229. function hasOwnProperty(obj, v) {
  230. if (obj == null)
  231. return false;
  232. return Object.prototype.hasOwnProperty.call(obj, v);
  233. }
  234. function createSingletonPromise(fn) {
  235. let _promise;
  236. function wrapper() {
  237. if (!_promise)
  238. _promise = fn();
  239. return _promise;
  240. }
  241. wrapper.reset = async () => {
  242. const _prev = _promise;
  243. _promise = void 0;
  244. if (_prev)
  245. await _prev;
  246. };
  247. return wrapper;
  248. }
  249. function sleep(ms, callback) {
  250. return new Promise(
  251. (resolve) => setTimeout(async () => {
  252. await (callback == null ? void 0 : callback());
  253. resolve();
  254. }, ms)
  255. );
  256. }
  257. function createPromiseLock() {
  258. const locks = [];
  259. return {
  260. async run(fn) {
  261. const p = fn();
  262. locks.push(p);
  263. try {
  264. return await p;
  265. } finally {
  266. remove(locks, p);
  267. }
  268. },
  269. async wait() {
  270. await Promise.allSettled(locks);
  271. },
  272. isWaiting() {
  273. return Boolean(locks.length);
  274. },
  275. clear() {
  276. locks.length = 0;
  277. }
  278. };
  279. }
  280. function createControlledPromise() {
  281. let resolve, reject;
  282. const promise = new Promise((_resolve, _reject) => {
  283. resolve = _resolve;
  284. reject = _reject;
  285. });
  286. promise.resolve = resolve;
  287. promise.reject = reject;
  288. return promise;
  289. }
  290. /* eslint-disable no-undefined,no-param-reassign,no-shadow */
  291. /**
  292. * Throttle execution of a function. Especially useful for rate limiting
  293. * execution of handlers on events like resize and scroll.
  294. *
  295. * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
  296. * are most useful.
  297. * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
  298. * as-is, to `callback` when the throttled-function is executed.
  299. * @param {object} [options] - An object to configure options.
  300. * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
  301. * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
  302. * one final time after the last throttled-function call. (After the throttled-function has not been called for
  303. * `delay` milliseconds, the internal counter is reset).
  304. * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
  305. * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
  306. * callback will never executed if both noLeading = true and noTrailing = true.
  307. * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
  308. * false (at end), schedule `callback` to execute after `delay` ms.
  309. *
  310. * @returns {Function} A new, throttled, function.
  311. */
  312. function throttle (delay, callback, options) {
  313. var _ref = options || {},
  314. _ref$noTrailing = _ref.noTrailing,
  315. noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,
  316. _ref$noLeading = _ref.noLeading,
  317. noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,
  318. _ref$debounceMode = _ref.debounceMode,
  319. debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;
  320. /*
  321. * After wrapper has stopped being called, this timeout ensures that
  322. * `callback` is executed at the proper times in `throttle` and `end`
  323. * debounce modes.
  324. */
  325. var timeoutID;
  326. var cancelled = false; // Keep track of the last time `callback` was executed.
  327. var lastExec = 0; // Function to clear existing timeout
  328. function clearExistingTimeout() {
  329. if (timeoutID) {
  330. clearTimeout(timeoutID);
  331. }
  332. } // Function to cancel next exec
  333. function cancel(options) {
  334. var _ref2 = options || {},
  335. _ref2$upcomingOnly = _ref2.upcomingOnly,
  336. upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
  337. clearExistingTimeout();
  338. cancelled = !upcomingOnly;
  339. }
  340. /*
  341. * The `wrapper` function encapsulates all of the throttling / debouncing
  342. * functionality and when executed will limit the rate at which `callback`
  343. * is executed.
  344. */
  345. function wrapper() {
  346. for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
  347. arguments_[_key] = arguments[_key];
  348. }
  349. var self = this;
  350. var elapsed = Date.now() - lastExec;
  351. if (cancelled) {
  352. return;
  353. } // Execute `callback` and update the `lastExec` timestamp.
  354. function exec() {
  355. lastExec = Date.now();
  356. callback.apply(self, arguments_);
  357. }
  358. /*
  359. * If `debounceMode` is true (at begin) this is used to clear the flag
  360. * to allow future `callback` executions.
  361. */
  362. function clear() {
  363. timeoutID = undefined;
  364. }
  365. if (!noLeading && debounceMode && !timeoutID) {
  366. /*
  367. * Since `wrapper` is being called for the first time and
  368. * `debounceMode` is true (at begin), execute `callback`
  369. * and noLeading != true.
  370. */
  371. exec();
  372. }
  373. clearExistingTimeout();
  374. if (debounceMode === undefined && elapsed > delay) {
  375. if (noLeading) {
  376. /*
  377. * In throttle mode with noLeading, if `delay` time has
  378. * been exceeded, update `lastExec` and schedule `callback`
  379. * to execute after `delay` ms.
  380. */
  381. lastExec = Date.now();
  382. if (!noTrailing) {
  383. timeoutID = setTimeout(debounceMode ? clear : exec, delay);
  384. }
  385. } else {
  386. /*
  387. * In throttle mode without noLeading, if `delay` time has been exceeded, execute
  388. * `callback`.
  389. */
  390. exec();
  391. }
  392. } else if (noTrailing !== true) {
  393. /*
  394. * In trailing throttle mode, since `delay` time has not been
  395. * exceeded, schedule `callback` to execute `delay` ms after most
  396. * recent execution.
  397. *
  398. * If `debounceMode` is true (at begin), schedule `clear` to execute
  399. * after `delay` ms.
  400. *
  401. * If `debounceMode` is false (at end), schedule `callback` to
  402. * execute after `delay` ms.
  403. */
  404. timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
  405. }
  406. }
  407. wrapper.cancel = cancel; // Return the wrapper function.
  408. return wrapper;
  409. }
  410. /* eslint-disable no-undefined */
  411. /**
  412. * Debounce execution of a function. Debouncing, unlike throttling,
  413. * guarantees that a function is only executed a single time, either at the
  414. * very beginning of a series of calls, or at the very end.
  415. *
  416. * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
  417. * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
  418. * to `callback` when the debounced-function is executed.
  419. * @param {object} [options] - An object to configure options.
  420. * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
  421. * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
  422. * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
  423. *
  424. * @returns {Function} A new, debounced function.
  425. */
  426. function debounce (delay, callback, options) {
  427. var _ref = options || {},
  428. _ref$atBegin = _ref.atBegin,
  429. atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;
  430. return throttle(delay, callback, {
  431. debounceMode: atBegin !== false
  432. });
  433. }
  434. /*
  435. How it works:
  436. `this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.
  437. */
  438. class Node {
  439. value;
  440. next;
  441. constructor(value) {
  442. this.value = value;
  443. }
  444. }
  445. class Queue {
  446. #head;
  447. #tail;
  448. #size;
  449. constructor() {
  450. this.clear();
  451. }
  452. enqueue(value) {
  453. const node = new Node(value);
  454. if (this.#head) {
  455. this.#tail.next = node;
  456. this.#tail = node;
  457. } else {
  458. this.#head = node;
  459. this.#tail = node;
  460. }
  461. this.#size++;
  462. }
  463. dequeue() {
  464. const current = this.#head;
  465. if (!current) {
  466. return;
  467. }
  468. this.#head = this.#head.next;
  469. this.#size--;
  470. return current.value;
  471. }
  472. clear() {
  473. this.#head = undefined;
  474. this.#tail = undefined;
  475. this.#size = 0;
  476. }
  477. get size() {
  478. return this.#size;
  479. }
  480. * [Symbol.iterator]() {
  481. let current = this.#head;
  482. while (current) {
  483. yield current.value;
  484. current = current.next;
  485. }
  486. }
  487. }
  488. function pLimit(concurrency) {
  489. if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
  490. throw new TypeError('Expected `concurrency` to be a number from 1 and up');
  491. }
  492. const queue = new Queue();
  493. let activeCount = 0;
  494. const next = () => {
  495. activeCount--;
  496. if (queue.size > 0) {
  497. queue.dequeue()();
  498. }
  499. };
  500. const run = async (fn, resolve, args) => {
  501. activeCount++;
  502. const result = (async () => fn(...args))();
  503. resolve(result);
  504. try {
  505. await result;
  506. } catch {}
  507. next();
  508. };
  509. const enqueue = (fn, resolve, args) => {
  510. queue.enqueue(run.bind(undefined, fn, resolve, args));
  511. (async () => {
  512. // This function needs to wait until the next microtask before comparing
  513. // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
  514. // when the run function is dequeued and called. The comparison in the if-statement
  515. // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
  516. await Promise.resolve();
  517. if (activeCount < concurrency && queue.size > 0) {
  518. queue.dequeue()();
  519. }
  520. })();
  521. };
  522. const generator = (fn, ...args) => new Promise(resolve => {
  523. enqueue(fn, resolve, args);
  524. });
  525. Object.defineProperties(generator, {
  526. activeCount: {
  527. get: () => activeCount,
  528. },
  529. pendingCount: {
  530. get: () => queue.size,
  531. },
  532. clearQueue: {
  533. value: () => {
  534. queue.clear();
  535. },
  536. },
  537. });
  538. return generator;
  539. }
  540. const VOID = Symbol("p-void");
  541. class PInstance extends Promise {
  542. constructor(items = [], options) {
  543. super(() => {
  544. });
  545. this.items = items;
  546. this.options = options;
  547. this.promises = /* @__PURE__ */ new Set();
  548. }
  549. get promise() {
  550. var _a;
  551. let batch;
  552. const items = [...Array.from(this.items), ...Array.from(this.promises)];
  553. if ((_a = this.options) == null ? void 0 : _a.concurrency) {
  554. const limit = pLimit(this.options.concurrency);
  555. batch = Promise.all(items.map((p2) => limit(() => p2)));
  556. } else {
  557. batch = Promise.all(items);
  558. }
  559. return batch.then((l) => l.filter((i) => i !== VOID));
  560. }
  561. add(...args) {
  562. args.forEach((i) => {
  563. this.promises.add(i);
  564. });
  565. }
  566. map(fn) {
  567. return new PInstance(
  568. Array.from(this.items).map(async (i, idx) => {
  569. const v = await i;
  570. if (v === VOID)
  571. return VOID;
  572. return fn(v, idx);
  573. }),
  574. this.options
  575. );
  576. }
  577. filter(fn) {
  578. return new PInstance(
  579. Array.from(this.items).map(async (i, idx) => {
  580. const v = await i;
  581. const r = await fn(v, idx);
  582. if (!r)
  583. return VOID;
  584. return v;
  585. }),
  586. this.options
  587. );
  588. }
  589. forEach(fn) {
  590. return this.map(fn).then();
  591. }
  592. reduce(fn, initialValue) {
  593. return this.promise.then((array) => array.reduce(fn, initialValue));
  594. }
  595. clear() {
  596. this.promises.clear();
  597. }
  598. then(fn) {
  599. const p2 = this.promise;
  600. if (fn)
  601. return p2.then(fn);
  602. else
  603. return p2;
  604. }
  605. catch(fn) {
  606. return this.promise.catch(fn);
  607. }
  608. finally(fn) {
  609. return this.promise.finally(fn);
  610. }
  611. }
  612. function p(items, options) {
  613. return new PInstance(items, options);
  614. }
  615. exports.assert = assert;
  616. exports.at = at;
  617. exports.batchInvoke = batchInvoke;
  618. exports.capitalize = capitalize;
  619. exports.clamp = clamp;
  620. exports.clampArrayRange = clampArrayRange;
  621. exports.clearUndefined = clearUndefined;
  622. exports.createControlledPromise = createControlledPromise;
  623. exports.createPromiseLock = createPromiseLock;
  624. exports.createSingletonPromise = createSingletonPromise;
  625. exports.debounce = debounce;
  626. exports.deepMerge = deepMerge;
  627. exports.ensurePrefix = ensurePrefix;
  628. exports.ensureSuffix = ensureSuffix;
  629. exports.flattenArrayable = flattenArrayable;
  630. exports.getTypeName = getTypeName;
  631. exports.hasOwnProperty = hasOwnProperty;
  632. exports.invoke = invoke;
  633. exports.isBoolean = isBoolean;
  634. exports.isBrowser = isBrowser;
  635. exports.isDate = isDate;
  636. exports.isDef = isDef;
  637. exports.isFunction = isFunction;
  638. exports.isKeyOf = isKeyOf;
  639. exports.isNull = isNull;
  640. exports.isNumber = isNumber;
  641. exports.isObject = isObject;
  642. exports.isRegExp = isRegExp;
  643. exports.isString = isString;
  644. exports.isTruthy = isTruthy;
  645. exports.isUndefined = isUndefined;
  646. exports.isWindow = isWindow;
  647. exports.last = last;
  648. exports.mergeArrayable = mergeArrayable;
  649. exports.move = move;
  650. exports.noNull = noNull;
  651. exports.noop = noop;
  652. exports.notNullish = notNullish;
  653. exports.notUndefined = notUndefined;
  654. exports.objectEntries = objectEntries;
  655. exports.objectKeys = objectKeys;
  656. exports.objectMap = objectMap;
  657. exports.objectPick = objectPick;
  658. exports.p = p;
  659. exports.partition = partition;
  660. exports.randomStr = randomStr;
  661. exports.range = range;
  662. exports.remove = remove;
  663. exports.sample = sample;
  664. exports.shuffle = shuffle;
  665. exports.slash = slash;
  666. exports.sleep = sleep;
  667. exports.sum = sum;
  668. exports.tap = tap;
  669. exports.template = template;
  670. exports.throttle = throttle;
  671. exports.timestamp = timestamp;
  672. exports.toArray = toArray;
  673. exports.toString = toString;
  674. exports.uniq = uniq;
  675. exports.uniqueBy = uniqueBy;