@thi.ng/api 8.11.1 → 8.11.3

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-04-23T07:02:17Z
3
+ - **Last updated**: 2024-06-21T19:34:38Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [8.11.3](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.11.3) (2024-06-21)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - rename various rest args to be more semantically meaningful ([8088a56](https://github.com/thi-ng/umbrella/commit/8088a56))
17
+ - enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
18
+
12
19
  ## [8.11.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.11.0) (2024-04-20)
13
20
 
14
21
  #### 🚀 Features
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 192 standalone projects, maintained as part
10
+ > This is one of 193 standalone projects, maintained as part
11
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
12
12
  > and anti-framework.
13
13
  >
package/fn.d.ts CHANGED
@@ -42,24 +42,24 @@ export type Fn9<A, B, C, D, E, F, G, H, I, J> = (a: A, b: B, c: C, d: D, e: E, f
42
42
  * A 10-arg function from A,B,C,D,E,F,G,H,I,J to K.
43
43
  */
44
44
  export type Fn10<A, B, C, D, E, F, G, H, I, J, K> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J) => K;
45
- export type FnO<A, B> = (a: A, ...xs: any[]) => B;
46
- export type FnO2<A, B, C> = (a: A, b: B, ...xs: any[]) => C;
47
- export type FnO3<A, B, C, D> = (a: A, b: B, c: C, ...xs: any[]) => D;
48
- export type FnO4<A, B, C, D, E> = (a: A, b: B, c: C, d: D, ...xs: any[]) => E;
49
- export type FnO5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E, ...xs: any[]) => F;
50
- export type FnO6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F, ...xs: any[]) => G;
51
- export type FnO7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, ...xs: any[]) => H;
52
- export type FnO8<A, B, C, D, E, F, G, H, I> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, ...xs: any[]) => I;
53
- export type FnO9<A, B, C, D, E, F, G, H, I, J> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, ...xs: any[]) => J;
54
- export type FnO10<A, B, C, D, E, F, G, H, I, J, K> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, ...xs: any[]) => K;
45
+ export type FnO<A, B> = (a: A, ...args: any[]) => B;
46
+ export type FnO2<A, B, C> = (a: A, b: B, ...args: any[]) => C;
47
+ export type FnO3<A, B, C, D> = (a: A, b: B, c: C, ...args: any[]) => D;
48
+ export type FnO4<A, B, C, D, E> = (a: A, b: B, c: C, d: D, ...args: any[]) => E;
49
+ export type FnO5<A, B, C, D, E, F> = (a: A, b: B, c: C, d: D, e: E, ...args: any[]) => F;
50
+ export type FnO6<A, B, C, D, E, F, G> = (a: A, b: B, c: C, d: D, e: E, f: F, ...args: any[]) => G;
51
+ export type FnO7<A, B, C, D, E, F, G, H> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, ...args: any[]) => H;
52
+ export type FnO8<A, B, C, D, E, F, G, H, I> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, ...args: any[]) => I;
53
+ export type FnO9<A, B, C, D, E, F, G, H, I, J> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, ...args: any[]) => J;
54
+ export type FnO10<A, B, C, D, E, F, G, H, I, J, K> = (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, ...args: any[]) => K;
55
55
  /**
56
56
  * An untyped vararg arg function to type T.
57
57
  */
58
- export type FnAny<T> = (...xs: any[]) => T;
58
+ export type FnAny<T> = (...args: any[]) => T;
59
59
  /**
60
60
  * A typed vararg arg function from A to B.
61
61
  */
62
- export type FnAnyT<A, B> = (...xs: A[]) => B;
62
+ export type FnAnyT<A, B> = (...args: A[]) => B;
63
63
  /**
64
64
  * 1-arg function with arg of type A and return type B (defaults
65
65
  * to A)
package/hiccup.d.ts CHANGED
@@ -7,8 +7,8 @@ export interface IToHiccup {
7
7
  *
8
8
  * @param ctx - user context object
9
9
  * @param attribs - user attribs
10
- * @param xs - additional args
10
+ * @param args - additional args
11
11
  */
12
- toHiccup(ctx?: any, attribs?: any, ...xs: any[]): any;
12
+ toHiccup(ctx?: any, attribs?: any, ...args: any[]): any;
13
13
  }
14
14
  //# sourceMappingURL=hiccup.d.ts.map
package/mixins/igrid.js CHANGED
@@ -56,7 +56,7 @@ const IGrid2DMixin = mixin({
56
56
  });
57
57
  const IGrid3DMixin = mixin({
58
58
  order() {
59
- return strideOrder(this.stride);
59
+ return __strideOrder(this.stride);
60
60
  },
61
61
  includes(x, y, z) {
62
62
  const size = this.size;
@@ -85,7 +85,7 @@ const IGrid3DMixin = mixin({
85
85
  });
86
86
  const IGrid4DMixin = mixin({
87
87
  order() {
88
- return strideOrder(this.stride);
88
+ return __strideOrder(this.stride);
89
89
  },
90
90
  includes(x, y, z, w) {
91
91
  const size = this.size;
@@ -112,7 +112,7 @@ const IGrid4DMixin = mixin({
112
112
  return true;
113
113
  }
114
114
  });
115
- const strideOrder = (strides) => [...strides].map((x, i) => [x, i]).sort((a, b) => Math.abs(b[0]) - Math.abs(a[0])).map((x) => x[1]);
115
+ const __strideOrder = (strides) => [...strides].map((x, i) => [x, i]).sort((a, b) => Math.abs(b[0]) - Math.abs(a[0])).map((x) => x[1]);
116
116
  export {
117
117
  IGrid1DMixin,
118
118
  IGrid2DMixin,
package/mixins/inotify.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { EVENT_ALL } from "../api.js";
2
2
  import { mixin } from "../mixin.js";
3
3
  const inotify_dispatch = (listeners, e) => {
4
- if (!listeners)
5
- return false;
4
+ if (!listeners) return false;
6
5
  for (let i = 0, n = listeners.length, l; i < n; i++) {
7
6
  l = listeners[i];
8
7
  l[0].call(l[1], e);
@@ -24,8 +23,7 @@ const INotifyMixin = mixin({
24
23
  },
25
24
  removeListener(id, fn, scope) {
26
25
  let listeners;
27
- if (!(listeners = this._listeners))
28
- return false;
26
+ if (!(listeners = this._listeners)) return false;
29
27
  const l = listeners[id];
30
28
  if (l) {
31
29
  const idx = this.__listener(l, fn, scope);
@@ -39,8 +37,7 @@ const INotifyMixin = mixin({
39
37
  },
40
38
  notify(e) {
41
39
  let listeners;
42
- if (!(listeners = this._listeners))
43
- return false;
40
+ if (!(listeners = this._listeners)) return false;
44
41
  e.target === void 0 && (e.target = this);
45
42
  const res = inotify_dispatch(listeners[e.id], e);
46
43
  return inotify_dispatch(listeners[EVENT_ALL], e) || res;
package/mixins/iwatch.js CHANGED
@@ -9,8 +9,7 @@ const IWatchMixin = mixin({
9
9
  return true;
10
10
  },
11
11
  removeWatch(id) {
12
- if (!this._watches)
13
- return;
12
+ if (!this._watches) return;
14
13
  if (this._watches[id]) {
15
14
  delete this._watches[id];
16
15
  return true;
@@ -18,8 +17,7 @@ const IWatchMixin = mixin({
18
17
  return false;
19
18
  },
20
19
  notifyWatches(oldState, newState) {
21
- if (!this._watches)
22
- return;
20
+ if (!this._watches) return;
23
21
  const w = this._watches;
24
22
  for (let id in w) {
25
23
  w[id](id, oldState, newState);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/api",
3
- "version": "8.11.1",
3
+ "version": "8.11.3",
4
4
  "description": "Common, generic types, interfaces & mixins",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -10,7 +10,7 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/thi-ng/umbrella.git"
12
12
  },
13
- "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/api#readme",
13
+ "homepage": "https://thi.ng/api",
14
14
  "funding": [
15
15
  {
16
16
  "type": "github",
@@ -39,10 +39,10 @@
39
39
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
40
40
  },
41
41
  "devDependencies": {
42
- "@microsoft/api-extractor": "^7.43.0",
43
- "esbuild": "^0.20.2",
44
- "typedoc": "^0.25.12",
45
- "typescript": "^5.4.3"
42
+ "@microsoft/api-extractor": "^7.47.0",
43
+ "esbuild": "^0.21.5",
44
+ "typedoc": "^0.25.13",
45
+ "typescript": "^5.5.2"
46
46
  },
47
47
  "keywords": [
48
48
  "assert",
@@ -228,5 +228,5 @@
228
228
  "default": "./watch.js"
229
229
  }
230
230
  },
231
- "gitHead": "5dd66c18a3862a3af69a5b2f49563f7cbdd960c2\n"
231
+ "gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
232
232
  }
package/typedarray.js CHANGED
@@ -88,14 +88,13 @@ const asGLType = (type) => {
88
88
  };
89
89
  const asInt = (...args) => args.map((x) => x | 0);
90
90
  const sizeOf = (type) => SIZEOF[type] || SIZEOF[asNativeType(type)];
91
- function typedArray(type, ...xs) {
91
+ function typedArray(type, ...args) {
92
92
  const ctor = BIGINT_ARRAY_CTORS[type];
93
- return new (ctor || TYPEDARRAY_CTORS[asNativeType(type)])(...xs);
93
+ return new (ctor || TYPEDARRAY_CTORS[asNativeType(type)])(...args);
94
94
  }
95
95
  function typedArrayOfVec(type, data, stride) {
96
96
  const $data = Array.isArray(data) ? data : [...data];
97
- if (stride === void 0)
98
- stride = $data[0].length;
97
+ if (stride === void 0) stride = $data[0].length;
99
98
  const num = $data.length;
100
99
  const res = typedArray(type, num * stride);
101
100
  for (let i = 0, j = 0; i < num; i++, j += stride) {
@@ -104,11 +103,9 @@ function typedArrayOfVec(type, data, stride) {
104
103
  return res;
105
104
  }
106
105
  const typedArrayType = (x) => {
107
- if (Array.isArray(x))
108
- return "f64";
106
+ if (Array.isArray(x)) return "f64";
109
107
  for (let id in TYPEDARRAY_CTORS) {
110
- if (x instanceof TYPEDARRAY_CTORS[id])
111
- return id;
108
+ if (x instanceof TYPEDARRAY_CTORS[id]) return id;
112
109
  }
113
110
  return "f64";
114
111
  };