cafe-utility 16.1.1 → 16.2.0

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.
Files changed (3) hide show
  1. package/index.d.ts +2 -0
  2. package/index.js +8 -1
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -357,6 +357,7 @@ interface Newable<T> extends Function {
357
357
  new (...args: any[]): T;
358
358
  }
359
359
  declare function findInstance<T, K extends T>(array: T[], type: Newable<K>): Optional<K>;
360
+ declare function interleave<T, K>(arrayA: T[], arrayB: K[]): (T | K)[];
360
361
  type Playbook<T> = {
361
362
  ttl: number;
362
363
  ttlMax?: number;
@@ -445,6 +446,7 @@ export declare const Arrays: {
445
446
  bringToFront: typeof bringToFront;
446
447
  bringToFrontInPlace: typeof bringToFrontInPlace;
447
448
  findInstance: typeof findInstance;
449
+ interleave: typeof interleave;
448
450
  };
449
451
  export declare const System: {
450
452
  sleepMillis: typeof sleepMillis;
package/index.js CHANGED
@@ -1737,6 +1737,12 @@ function findInstance(n, e) {
1737
1737
  const t = n.find(r => r instanceof e)
1738
1738
  return new Optional(t)
1739
1739
  }
1740
+ function interleave(n, e) {
1741
+ const t = [],
1742
+ r = Math.max(n.length, e.length)
1743
+ for (let o = 0; o < r; o++) n[o] && t.push(n[o]), e[o] && t.push(e[o])
1744
+ return t
1745
+ }
1740
1746
  function tickPlaybook(n) {
1741
1747
  if (n.length === 0) return null
1742
1748
  const e = n[0]
@@ -2017,7 +2023,8 @@ function raycastCircle(n, e, t) {
2017
2023
  requireNumberArgument,
2018
2024
  bringToFront,
2019
2025
  bringToFrontInPlace,
2020
- findInstance
2026
+ findInstance,
2027
+ interleave
2021
2028
  }),
2022
2029
  (exports.System = { sleepMillis, forever, scheduleMany, waitFor, expandError }),
2023
2030
  (exports.Numbers = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cafe-utility",
3
- "version": "16.1.1",
3
+ "version": "16.2.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "exports": {