@thi.ng/api 8.0.2 → 8.1.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.
package/CHANGELOG.md CHANGED
@@ -3,17 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [8.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@8.0.1...@thi.ng/api@8.0.2) (2021-10-15)
6
+ # [8.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@8.0.6...@thi.ng/api@8.1.0) (2021-11-03)
7
7
 
8
- **Note:** Version bump only for package @thi.ng/api
9
8
 
9
+ ### Features
10
10
 
11
-
12
-
13
-
14
- ## [8.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@8.0.0...@thi.ng/api@8.0.1) (2021-10-13)
15
-
16
- **Note:** Version bump only for package @thi.ng/api
11
+ * **api:** add asInt() coercion helper ([49cd772](https://github.com/thi-ng/umbrella/commit/49cd772a328b7c71fb16ed3041e03832ebd1f884))
12
+ * **api:** add IGrid2D/3D interfaces ([e57ad7e](https://github.com/thi-ng/umbrella/commit/e57ad7e8139512bf4146c4c70ef693b810eee24a))
17
13
 
18
14
 
19
15
 
@@ -70,31 +66,31 @@ Also:
70
66
 
71
67
 
72
68
 
73
- # [7.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@7.1.9...@thi.ng/api@7.2.0) (2021-09-03)
69
+ # [7.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@7.1.9...@thi.ng/api@7.2.0) (2021-09-03)
74
70
 
75
- ### Features
71
+ ### Features
76
72
 
77
- - **api:** add DeepArrayValue type ([a309fac](https://github.com/thi-ng/umbrella/commit/a309faca831651f611b9b056d9c7587f85b60087))
73
+ - **api:** add DeepArrayValue type ([a309fac](https://github.com/thi-ng/umbrella/commit/a309faca831651f611b9b056d9c7587f85b60087))
78
74
 
79
- # [7.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@7.0.0...@thi.ng/api@7.1.0) (2021-03-03)
75
+ # [7.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@7.0.0...@thi.ng/api@7.1.0) (2021-03-03)
80
76
 
81
- ### Features
77
+ ### Features
82
78
 
83
- - **api:** add StringOrSym type alias ([fb92c9d](https://github.com/thi-ng/umbrella/commit/fb92c9d93b4e795f60118e1167d5adb1bb108380))
79
+ - **api:** add StringOrSym type alias ([fb92c9d](https://github.com/thi-ng/umbrella/commit/fb92c9d93b4e795f60118e1167d5adb1bb108380))
84
80
 
85
- # [7.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@6.13.6...@thi.ng/api@7.0.0) (2021-02-20)
81
+ # [7.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@6.13.6...@thi.ng/api@7.0.0) (2021-02-20)
86
82
 
87
- ### Features
83
+ ### Features
88
84
 
89
- - **api:** add Range type ([5d94974](https://github.com/thi-ng/umbrella/commit/5d94974c34ca81513d40743f2a9b9a3ed20146d3))
90
- - **api:** add typedArrayType() classifier ([5c81fd8](https://github.com/thi-ng/umbrella/commit/5c81fd859514401c2c419b2ed3ec0f12025356c3))
91
- - **api:** more finely grained typedarray types ([8316d05](https://github.com/thi-ng/umbrella/commit/8316d058f0b5f760afd89e8590619670210a970a))
92
- - **api:** replace Type enum w/ strings consts ([a333d41](https://github.com/thi-ng/umbrella/commit/a333d418222972373cc1f9b256def2f79610d3fa))
85
+ - **api:** add Range type ([5d94974](https://github.com/thi-ng/umbrella/commit/5d94974c34ca81513d40743f2a9b9a3ed20146d3))
86
+ - **api:** add typedArrayType() classifier ([5c81fd8](https://github.com/thi-ng/umbrella/commit/5c81fd859514401c2c419b2ed3ec0f12025356c3))
87
+ - **api:** more finely grained typedarray types ([8316d05](https://github.com/thi-ng/umbrella/commit/8316d058f0b5f760afd89e8590619670210a970a))
88
+ - **api:** replace Type enum w/ strings consts ([a333d41](https://github.com/thi-ng/umbrella/commit/a333d418222972373cc1f9b256def2f79610d3fa))
93
89
 
94
- ### BREAKING CHANGES
90
+ ### BREAKING CHANGES
95
91
 
96
- - **api:** replace Type enum w/ string consts
97
- - update Type, UintType, IntType, FloatType aliases
92
+ - **api:** replace Type enum w/ string consts
93
+ - update Type, UintType, IntType, FloatType aliases
98
94
  - update GL2TYPE, TYPE2GL, SIZEOF, TYPEDARRAY_CTORS tables
99
95
  - add asNativeType(), asGLType() conversions
100
96
  - add sizeOf()
@@ -220,156 +216,156 @@ Also:
220
216
  ### Features
221
217
 
222
218
  - **api:** add common logging types & default impls ([4578604](https://github.com/thi-ng/umbrella/commit/4578604))
223
- - **api:** update ILogger, freeze NULL_LOGGER ([27ff8de](https://github.com/thi-ng/umbrella/commit/27ff8de))
219
+ - **api:** update ILogger, freeze NULL_LOGGER ([27ff8de](https://github.com/thi-ng/umbrella/commit/27ff8de))
224
220
 
225
- # [6.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.1.0...@thi.ng/api@6.0.0) (2019-03-28)
221
+ # [6.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.1.0...@thi.ng/api@6.0.0) (2019-03-28)
226
222
 
227
- ### Features
223
+ ### Features
228
224
 
229
- - **api:** add new types, update existing ([560eb90](https://github.com/thi-ng/umbrella/commit/560eb90))
225
+ - **api:** add new types, update existing ([560eb90](https://github.com/thi-ng/umbrella/commit/560eb90))
230
226
 
231
- ### BREAKING CHANGES
227
+ ### BREAKING CHANGES
232
228
 
233
- - **api:** split up, remove & update various interfaces
234
- - split IAssociative => IAssoc, IAssocIn
235
- - update IDissoc, add IDissocIn
236
- - split IGet => IGet, IGetIn
237
- - update IInto generics & return type
238
- - update ISet, remove IImmutableSet
239
- - update IStack, remove IImmutableStack
229
+ - **api:** split up, remove & update various interfaces
230
+ - split IAssociative => IAssoc, IAssocIn
231
+ - update IDissoc, add IDissocIn
232
+ - split IGet => IGet, IGetIn
233
+ - update IInto generics & return type
234
+ - update ISet, remove IImmutableSet
235
+ - update IStack, remove IImmutableStack
240
236
 
241
- # [5.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.0.3...@thi.ng/api@5.1.0) (2019-03-10)
237
+ # [5.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.0.3...@thi.ng/api@5.1.0) (2019-03-10)
242
238
 
243
- ### Features
239
+ ### Features
244
240
 
245
- - **api:** add additional Fn arities ([33c7dfe](https://github.com/thi-ng/umbrella/commit/33c7dfe))
246
- - **api:** add more Fn type aliases, update existing ([3707e61](https://github.com/thi-ng/umbrella/commit/3707e61))
241
+ - **api:** add additional Fn arities ([33c7dfe](https://github.com/thi-ng/umbrella/commit/33c7dfe))
242
+ - **api:** add more Fn type aliases, update existing ([3707e61](https://github.com/thi-ng/umbrella/commit/3707e61))
247
243
 
248
- # [5.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.2.4...@thi.ng/api@5.0.0) (2019-01-21)
244
+ # [5.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.2.4...@thi.ng/api@5.0.0) (2019-01-21)
249
245
 
250
- ### Bug Fixes
246
+ ### Bug Fixes
251
247
 
252
- - **api:** update assert(), re-export mixin() ([9f91cfa](https://github.com/thi-ng/umbrella/commit/9f91cfa))
248
+ - **api:** update assert(), re-export mixin() ([9f91cfa](https://github.com/thi-ng/umbrella/commit/9f91cfa))
253
249
 
254
- ### Build System
250
+ ### Build System
255
251
 
256
- - **api:** update package build scripts / outputs ([f913d7b](https://github.com/thi-ng/umbrella/commit/f913d7b))
252
+ - **api:** update package build scripts / outputs ([f913d7b](https://github.com/thi-ng/umbrella/commit/f913d7b))
257
253
 
258
- ### Features
254
+ ### Features
259
255
 
260
- - **api:** add assert() ([d381ace](https://github.com/thi-ng/umbrella/commit/d381ace))
256
+ - **api:** add assert() ([d381ace](https://github.com/thi-ng/umbrella/commit/d381ace))
261
257
 
262
- ### BREAKING CHANGES
258
+ ### BREAKING CHANGES
263
259
 
264
- - **api:** rename mixins to avoid name clashes, update decorators
265
- - append `Mixin` suffix to all mixins (i.e. `INotify` => `INotifyMixin`)
266
- - update re-exports of mixins & decorators (no more nested child namespace)
260
+ - **api:** rename mixins to avoid name clashes, update decorators
261
+ - append `Mixin` suffix to all mixins (i.e. `INotify` => `INotifyMixin`)
262
+ - update re-exports of mixins & decorators (no more nested child namespace)
267
263
 
268
- # [4.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.1.1...@thi.ng/api@4.2.0) (2018-09-22)
264
+ # [4.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.1.1...@thi.ng/api@4.2.0) (2018-09-22)
269
265
 
270
- ### Features
266
+ ### Features
271
267
 
272
- - **api:** add `IToHiccup` interface ([e390a54](https://github.com/thi-ng/umbrella/commit/e390a54))
268
+ - **api:** add `IToHiccup` interface ([e390a54](https://github.com/thi-ng/umbrella/commit/e390a54))
273
269
 
274
- # [4.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.0.6...@thi.ng/api@4.1.0) (2018-08-24)
270
+ # [4.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@4.0.6...@thi.ng/api@4.1.0) (2018-08-24)
275
271
 
276
- ### Features
272
+ ### Features
277
273
 
278
- - **api:** add new/move type aliases into api.ts ([cf30ba2](https://github.com/thi-ng/umbrella/commit/cf30ba2))
279
- - **api:** add NumericArray and TypedArray types ([519394b](https://github.com/thi-ng/umbrella/commit/519394b))
274
+ - **api:** add new/move type aliases into api.ts ([cf30ba2](https://github.com/thi-ng/umbrella/commit/cf30ba2))
275
+ - **api:** add NumericArray and TypedArray types ([519394b](https://github.com/thi-ng/umbrella/commit/519394b))
280
276
 
281
- # [4.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@3.0.1...@thi.ng/api@4.0.0) (2018-05-12)
277
+ # [4.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@3.0.1...@thi.ng/api@4.0.0) (2018-05-12)
282
278
 
283
- ### Code Refactoring
279
+ ### Code Refactoring
284
280
 
285
- - **api:** update interfaces, add docs ([9b38860](https://github.com/thi-ng/umbrella/commit/9b38860))
281
+ - **api:** update interfaces, add docs ([9b38860](https://github.com/thi-ng/umbrella/commit/9b38860))
286
282
 
287
- ### BREAKING CHANGES
283
+ ### BREAKING CHANGES
288
284
 
289
- - **api:** IBind, IEnable now include generics, update IIndexed, IMeta, ISet, IStack
290
- - add IInto
291
- - add IImmutableSet
292
- - add IImmutableStack
293
- - minor update IEnabled mixin
285
+ - **api:** IBind, IEnable now include generics, update IIndexed, IMeta, ISet, IStack
286
+ - add IInto
287
+ - add IImmutableSet
288
+ - add IImmutableStack
289
+ - minor update IEnabled mixin
294
290
 
295
- # [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.3.2...@thi.ng/api@3.0.0) (2018-05-10)
291
+ # [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.3.2...@thi.ng/api@3.0.0) (2018-05-10)
296
292
 
297
- ### Code Refactoring
293
+ ### Code Refactoring
298
294
 
299
- - **api:** remove obsolete files from package ([f051ca3](https://github.com/thi-ng/umbrella/commit/f051ca3))
295
+ - **api:** remove obsolete files from package ([f051ca3](https://github.com/thi-ng/umbrella/commit/f051ca3))
300
296
 
301
- ### BREAKING CHANGES
297
+ ### BREAKING CHANGES
302
298
 
303
- - **api:** @thi.ng/api now only contains type declarations, decorators and mixins. All other features have been moved to new dedicated packages:
304
- - @thi.ng/bench
305
- - @thi.ng/compare
306
- - @thi.ng/equiv
307
- - @thi.ng/errors
299
+ - **api:** @thi.ng/api now only contains type declarations, decorators and mixins. All other features have been moved to new dedicated packages:
300
+ - @thi.ng/bench
301
+ - @thi.ng/compare
302
+ - @thi.ng/equiv
303
+ - @thi.ng/errors
308
304
 
309
- ## [2.3.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.3.0...@thi.ng/api@2.3.1) (2018-04-29)
305
+ ## [2.3.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.3.0...@thi.ng/api@2.3.1) (2018-04-29)
310
306
 
311
- ### Performance Improvements
307
+ ### Performance Improvements
312
308
 
313
- - **api:** major speedup equivObject(), update equivSet() ([7fdf172](https://github.com/thi-ng/umbrella/commit/7fdf172))
309
+ - **api:** major speedup equivObject(), update equivSet() ([7fdf172](https://github.com/thi-ng/umbrella/commit/7fdf172))
314
310
 
315
- # [2.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.2.0...@thi.ng/api@2.3.0) (2018-04-26)
311
+ # [2.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.2.0...@thi.ng/api@2.3.0) (2018-04-26)
316
312
 
317
- ### Features
313
+ ### Features
318
314
 
319
- - **api:** support more types in equiv(), add tests ([2ac8bff](https://github.com/thi-ng/umbrella/commit/2ac8bff))
315
+ - **api:** support more types in equiv(), add tests ([2ac8bff](https://github.com/thi-ng/umbrella/commit/2ac8bff))
320
316
 
321
- # [2.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.1.3...@thi.ng/api@2.2.0) (2018-04-08)
317
+ # [2.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.1.3...@thi.ng/api@2.2.0) (2018-04-08)
322
318
 
323
- ### Features
319
+ ### Features
324
320
 
325
- - **api:** add bench() & timed() utils ([d310345](https://github.com/thi-ng/umbrella/commit/d310345))
321
+ - **api:** add bench() & timed() utils ([d310345](https://github.com/thi-ng/umbrella/commit/d310345))
326
322
 
327
- ## [2.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.1.0...@thi.ng/api@2.1.1) (2018-03-28)
323
+ ## [2.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.1.0...@thi.ng/api@2.1.1) (2018-03-28)
328
324
 
329
- ### Bug Fixes
325
+ ### Bug Fixes
330
326
 
331
- - **api:** illegalState() creates IllegalStateError ([2b7e99b](https://github.com/thi-ng/umbrella/commit/2b7e99b))
327
+ - **api:** illegalState() creates IllegalStateError ([2b7e99b](https://github.com/thi-ng/umbrella/commit/2b7e99b))
332
328
 
333
- # [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.0.4...@thi.ng/api@2.1.0) (2018-03-21)
329
+ # [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.0.4...@thi.ng/api@2.1.0) (2018-03-21)
334
330
 
335
- ### Features
331
+ ### Features
336
332
 
337
- - **api:** add error types & ctor fns ([4d3785f](https://github.com/thi-ng/umbrella/commit/4d3785f))
333
+ - **api:** add error types & ctor fns ([4d3785f](https://github.com/thi-ng/umbrella/commit/4d3785f))
338
334
 
339
- ## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.0.0...@thi.ng/api@2.0.1) (2018-02-02)
335
+ ## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.0.0...@thi.ng/api@2.0.1) (2018-02-02)
340
336
 
341
- ### Bug Fixes
337
+ ### Bug Fixes
342
338
 
343
- - **api:** update compare() & equiv() ([110a9de](https://github.com/thi-ng/umbrella/commit/110a9de))
339
+ - **api:** update compare() & equiv() ([110a9de](https://github.com/thi-ng/umbrella/commit/110a9de))
344
340
 
345
- # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.5.0...@thi.ng/api@2.0.0) (2018-02-01)
341
+ # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.5.0...@thi.ng/api@2.0.0) (2018-02-01)
346
342
 
347
- ### Bug Fixes
343
+ ### Bug Fixes
348
344
 
349
- - **api:** fix equiv string handling, update tests ([1354e29](https://github.com/thi-ng/umbrella/commit/1354e29))
345
+ - **api:** fix equiv string handling, update tests ([1354e29](https://github.com/thi-ng/umbrella/commit/1354e29))
350
346
 
351
- ### Features
347
+ ### Features
352
348
 
353
- - **api:** update equiv() null handling, add tests ([878520e](https://github.com/thi-ng/umbrella/commit/878520e))
349
+ - **api:** update equiv() null handling, add tests ([878520e](https://github.com/thi-ng/umbrella/commit/878520e))
354
350
 
355
- ### BREAKING CHANGES
351
+ ### BREAKING CHANGES
356
352
 
357
- - **api:** equiv now treats null & undefined as equal
353
+ - **api:** equiv now treats null & undefined as equal
358
354
 
359
- # [1.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.4.2...@thi.ng/api@1.5.0) (2018-01-31)
355
+ # [1.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.4.2...@thi.ng/api@1.5.0) (2018-01-31)
360
356
 
361
- ### Features
357
+ ### Features
362
358
 
363
- - **api:** add Predicate2 & StatefulPredicate2 types ([fbf8453](https://github.com/thi-ng/umbrella/commit/fbf8453))
359
+ - **api:** add Predicate2 & StatefulPredicate2 types ([fbf8453](https://github.com/thi-ng/umbrella/commit/fbf8453))
364
360
 
365
- # [1.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.3.0...@thi.ng/api@1.4.0) (2018-01-29)
361
+ # [1.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.3.0...@thi.ng/api@1.4.0) (2018-01-29)
366
362
 
367
- ### Features
363
+ ### Features
368
364
 
369
- - **api:** update IWatch & mixin, boolean returns ([bddd5ce](https://github.com/thi-ng/umbrella/commit/bddd5ce))
365
+ - **api:** update IWatch & mixin, boolean returns ([bddd5ce](https://github.com/thi-ng/umbrella/commit/bddd5ce))
370
366
 
371
- # [1.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.2.1...@thi.ng/api@1.3.0) (2018-01-28)
367
+ # [1.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.2.1...@thi.ng/api@1.3.0) (2018-01-28)
372
368
 
373
- ### Features
369
+ ### Features
374
370
 
375
371
  - **api:** add StatefulPredicate ([c74353b](https://github.com/thi-ng/umbrella/commit/c74353b))
package/README.md CHANGED
@@ -60,7 +60,7 @@ node --experimental-repl-await
60
60
  > const api = await import("@thi.ng/api");
61
61
  ```
62
62
 
63
- Package sizes (gzipped, pre-treeshake): ESM: 1.73 KB
63
+ Package sizes (gzipped, pre-treeshake): ESM: 1.75 KB
64
64
 
65
65
  ## Dependencies
66
66
 
package/grid.d.ts ADDED
@@ -0,0 +1,89 @@
1
+ import type { TypedArray, UIntArray } from "./typedarray.js";
2
+ export interface IGrid2D<T extends any[] | TypedArray = UIntArray, P = number> {
3
+ readonly width: number;
4
+ readonly height: number;
5
+ readonly stride: number;
6
+ readonly rowStride: number;
7
+ readonly data: T;
8
+ /**
9
+ * Returns value at given position. If pos is outside the defined region,
10
+ * returns a suitable zero value.
11
+ *
12
+ * @param x -
13
+ * @param y -
14
+ */
15
+ getAt(x: number, y: number): P;
16
+ /**
17
+ * Non-boundschecked version of {@link IGrid2D.getAt}. Assumes given
18
+ * position is valid.
19
+ *
20
+ * @param x -
21
+ * @param y -
22
+ */
23
+ getAtUnsafe(x: number, y: number): P;
24
+ /**
25
+ * Writes value at given position. Has no effect if outside of the defined
26
+ * region.
27
+ *
28
+ * @param x -
29
+ * @param y -
30
+ * @param col -
31
+ */
32
+ setAt(x: number, y: number, col: P): this;
33
+ /**
34
+ * Non-boundschecked version of {@link IGrid2D.setAt}. Assumes given
35
+ * position is valid.
36
+ *
37
+ * @param x -
38
+ * @param y -
39
+ */
40
+ setAtUnsafe(x: number, y: number, col: P): this;
41
+ }
42
+ export interface IGrid3D<T extends any[] | TypedArray = UIntArray, P = number> {
43
+ readonly width: number;
44
+ readonly height: number;
45
+ readonly depth: number;
46
+ readonly stride: number;
47
+ readonly rowStride: number;
48
+ readonly sliceStride: number;
49
+ readonly data: T;
50
+ /**
51
+ * Returns value at given position. If pos is outside the defined region,
52
+ * returns a suitable zero value.
53
+ *
54
+ * @param x -
55
+ * @param y -
56
+ * @param z -
57
+ */
58
+ getAt(x: number, y: number, z: number): P;
59
+ /**
60
+ * Non-boundschecked version of {@link IGrid3D.getAt}. Assumes given
61
+ * position is valid.
62
+ *
63
+ * @param x -
64
+ * @param y -
65
+ * @param z -
66
+ */
67
+ getAtUnsafe(x: number, y: number, z: number): P;
68
+ /**
69
+ * Writes value at given position. Has no effect if outside of the defined
70
+ * region.
71
+ *
72
+ * @param x -
73
+ * @param y -
74
+ * @param z -
75
+ * @param col -
76
+ */
77
+ setAt(x: number, y: number, z: number, col: P): this;
78
+ /**
79
+ * Non-boundschecked version of {@link IGrid3D.setAt}. Assumes given
80
+ * position is valid.
81
+ *
82
+ * @param x -
83
+ * @param y -
84
+ * @param z -
85
+ * @param col -
86
+ */
87
+ setAtUnsafe(x: number, y: number, z: number, col: P): this;
88
+ }
89
+ //# sourceMappingURL=grid.d.ts.map
package/grid.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./equiv.js";
13
13
  export * from "./event.js";
14
14
  export * from "./fn.js";
15
15
  export * from "./get.js";
16
+ export * from "./grid.js";
16
17
  export * from "./hash.js";
17
18
  export * from "./hiccup.js";
18
19
  export * from "./id.js";
package/index.js CHANGED
@@ -13,6 +13,7 @@ export * from "./equiv.js";
13
13
  export * from "./event.js";
14
14
  export * from "./fn.js";
15
15
  export * from "./get.js";
16
+ export * from "./grid.js";
16
17
  export * from "./hash.js";
17
18
  export * from "./hiccup.js";
18
19
  export * from "./id.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/api",
3
- "version": "8.0.2",
3
+ "version": "8.1.0",
4
4
  "description": "Common, generic types, interfaces & mixins",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -34,7 +34,7 @@
34
34
  "test": "testament test"
35
35
  },
36
36
  "devDependencies": {
37
- "@thi.ng/testament": "^0.1.2"
37
+ "@thi.ng/testament": "^0.1.6"
38
38
  },
39
39
  "keywords": [
40
40
  "assert",
@@ -126,6 +126,9 @@
126
126
  "./get": {
127
127
  "import": "./get.js"
128
128
  },
129
+ "./grid": {
130
+ "import": "./grid.js"
131
+ },
129
132
  "./hash": {
130
133
  "import": "./hash.js"
131
134
  },
@@ -211,5 +214,5 @@
211
214
  "import": "./watch.js"
212
215
  }
213
216
  },
214
- "gitHead": "3c5f903104da150588946a94bb118ad559ad395d"
217
+ "gitHead": "852cd2450617c86d15d18477dc634f17f04202eb"
215
218
  }
package/typedarray.d.ts CHANGED
@@ -108,6 +108,10 @@ export declare const asNativeType: (type: GLType | Type) => Type;
108
108
  * @param type -
109
109
  */
110
110
  export declare const asGLType: (type: GLType | Type) => GLType;
111
+ /**
112
+ * Coerces given numeric args to integer values.
113
+ */
114
+ export declare const asInt: (...args: number[]) => number[];
111
115
  /**
112
116
  * Returns byte size for given {@link Type} ID or {@link GLType} enum.
113
117
  *
package/typedarray.js CHANGED
@@ -111,6 +111,10 @@ export const asGLType = (type) => {
111
111
  const t = TYPE2GL[type];
112
112
  return t !== undefined ? t : type;
113
113
  };
114
+ /**
115
+ * Coerces given numeric args to integer values.
116
+ */
117
+ export const asInt = (...args) => args.map((x) => x | 0);
114
118
  /**
115
119
  * Returns byte size for given {@link Type} ID or {@link GLType} enum.
116
120
  *