@thi.ng/api 8.6.3 → 8.7.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
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-01-10T15:20:18Z
3
+ - **Last updated**: 2023-02-05T14:42:21Z
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,12 @@ 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.7.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.7.0) (2023-02-05)
13
+
14
+ #### 🚀 Features
15
+
16
+ - add narrow/widenType() fns ([5ce9938](https://github.com/thi-ng/umbrella/commit/5ce9938))
17
+
12
18
  ## [8.6.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/api@8.6.0) (2022-12-16)
13
19
 
14
20
  #### 🚀 Features
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configurable.d.ts","sourceRoot":"","sources":["../src/decorators/configurable.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,UAAW,OAAO,KAAG,eAG5C,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated.d.ts","sourceRoot":"","sources":["../src/decorators/deprecated.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,SAAU,MAAM;;;MAAsB,eAgB3D,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nomixin.d.ts","sourceRoot":"","sources":["../src/decorators/nomixin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,MAAO,GAAG,MAAM,MAAM,cAAc,kBAAkB,SAEzE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sealed.d.ts","sourceRoot":"","sources":["../src/decorators/sealed.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,MAAM,gBAAiB,QAAQ,SAG3C,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ienable.d.ts","sourceRoot":"","sources":["../src/mixins/ienable.ts"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,qBAmBvB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"igrid.d.ts","sourceRoot":"","sources":["../src/mixins/igrid.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,YAAY,qBAmCvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,qBAwCvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,qBAmDvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,qBAsDvB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inotify.d.ts","sourceRoot":"","sources":["../src/mixins/inotify.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAqB,MAAM,aAAa,CAAC;AAS5D,eAAO,MAAM,gBAAgB,cAAe,GAAG,EAAE,EAAE,KAAK,KAAK,YAU5D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,qBA4CvB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iterable.d.ts","sourceRoot":"","sources":["../src/mixins/iterable.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,SAAU,WAAW,wBAKvC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iwatch.d.ts","sourceRoot":"","sources":["../src/mixins/iwatch.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,WAAW,qBA0BtB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/api",
3
- "version": "8.6.3",
3
+ "version": "8.7.0",
4
4
  "description": "Common, generic types, interfaces & mixins",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -37,12 +37,12 @@
37
37
  "test": "testament test"
38
38
  },
39
39
  "devDependencies": {
40
- "@microsoft/api-extractor": "^7.33.7",
41
- "@thi.ng/testament": "^0.3.9",
42
- "rimraf": "^3.0.2",
40
+ "@microsoft/api-extractor": "^7.34.2",
41
+ "@thi.ng/testament": "^0.3.10",
42
+ "rimraf": "^4.1.2",
43
43
  "tools": "^0.0.1",
44
- "typedoc": "^0.23.22",
45
- "typescript": "^4.9.4"
44
+ "typedoc": "^0.23.24",
45
+ "typescript": "^4.9.5"
46
46
  },
47
47
  "keywords": [
48
48
  "assert",
@@ -225,5 +225,5 @@
225
225
  "default": "./watch.js"
226
226
  }
227
227
  },
228
- "gitHead": "3f0b3e2a7c82aefc7e46fb4338369836b5e1b8cf\n"
228
+ "gitHead": "50ba9c87676fac60c46d2bc0e4d2c7711a374a68\n"
229
229
  }
package/typedarray.d.ts CHANGED
@@ -191,4 +191,63 @@ export declare const uintTypeForBits: (x: number) => UintType;
191
191
  * @param x -
192
192
  */
193
193
  export declare const intTypeForBits: (x: number) => IntType;
194
+ /**
195
+ * Returns the next smaller {@link IntType} for given type (or the same type if
196
+ * already the narrowest).
197
+ *
198
+ * @param t
199
+ */
200
+ export declare const narrowInt: (t: IntType | "i64") => "i32" | "i8" | "i16";
201
+ /**
202
+ * Returns the next larger {@link IntType} for given type (or the same type if
203
+ * already the widest).
204
+ *
205
+ * @param t
206
+ */
207
+ export declare const widenInt: (t: IntType) => "i32" | "i64" | "i16";
208
+ /**
209
+ * Returns the next smaller {@link UintType} for given type (or the same type if
210
+ * already the narrowest).
211
+ *
212
+ * @remarks
213
+ * If type is `u8c`, returns `u8`.
214
+ *
215
+ * @param t
216
+ */
217
+ export declare const narrowUint: (t: UintType | "u64") => "u8" | "u16" | "u32";
218
+ /**
219
+ * Returns the next larger {@link UintType} for given type (or the same type if
220
+ * already the widest).
221
+ *
222
+ * @param t
223
+ */
224
+ export declare const widenUint: (t: UintType) => "u16" | "u32" | "u64";
225
+ /**
226
+ * Returns the next smaller {@link FloatType} for given type (or the same type
227
+ * if already the narrowest).
228
+ *
229
+ * @param t
230
+ */
231
+ export declare const narrowFloat: (t: FloatType) => string;
232
+ /**
233
+ * Returns the next larger {@link FloatType} for given type (or the same type if
234
+ * already the widest).
235
+ *
236
+ * @param t
237
+ */
238
+ export declare const widenFloat: (t: FloatType) => string;
239
+ /**
240
+ * Returns the next smaller type (i.e. {@link IntType}, {@link UintType} or
241
+ * {@link FloatType}) for given type (or the same type if already the smallest).
242
+ *
243
+ * @param t
244
+ */
245
+ export declare const narrowType: (t: Type | BigType) => string;
246
+ /**
247
+ * Returns the next larger type (i.e. {@link IntType}, {@link UintType} or
248
+ * {@link FloatType}) for given type (or the same type if already the widest).
249
+ *
250
+ * @param t
251
+ */
252
+ export declare const widenType: (t: Type | BigType) => string;
194
253
  //# sourceMappingURL=typedarray.d.ts.map
package/typedarray.js CHANGED
@@ -190,3 +190,76 @@ export const uintTypeForBits = (x) => x > 16 ? "u32" : x > 8 ? "u16" : "u8";
190
190
  * @param x -
191
191
  */
192
192
  export const intTypeForBits = (x) => x > 16 ? "i32" : x > 8 ? "i16" : "i8";
193
+ /**
194
+ * Returns the next smaller {@link IntType} for given type (or the same type if
195
+ * already the narrowest).
196
+ *
197
+ * @param t
198
+ */
199
+ export const narrowInt = (t) => t === "i64" ? "i32" : t === "i32" ? "i16" : t === "i16" ? "i8" : "i8";
200
+ /**
201
+ * Returns the next larger {@link IntType} for given type (or the same type if
202
+ * already the widest).
203
+ *
204
+ * @param t
205
+ */
206
+ export const widenInt = (t) => t === "i8" ? "i16" : t === "i16" ? "i32" : t === "i32" ? "i64" : "i64";
207
+ /**
208
+ * Returns the next smaller {@link UintType} for given type (or the same type if
209
+ * already the narrowest).
210
+ *
211
+ * @remarks
212
+ * If type is `u8c`, returns `u8`.
213
+ *
214
+ * @param t
215
+ */
216
+ export const narrowUint = (t) => t === "u64" ? "u32" : t === "u32" ? "u16" : t === "u16" ? "u8" : "u8";
217
+ /**
218
+ * Returns the next larger {@link UintType} for given type (or the same type if
219
+ * already the widest).
220
+ *
221
+ * @param t
222
+ */
223
+ export const widenUint = (t) => t === "u8" || t === "u8c"
224
+ ? "u16"
225
+ : t === "u16"
226
+ ? "u32"
227
+ : t === "u32"
228
+ ? "u64"
229
+ : "u64";
230
+ /**
231
+ * Returns the next smaller {@link FloatType} for given type (or the same type
232
+ * if already the narrowest).
233
+ *
234
+ * @param t
235
+ */
236
+ export const narrowFloat = (t) => (t === "f64" ? "f32" : "f32");
237
+ /**
238
+ * Returns the next larger {@link FloatType} for given type (or the same type if
239
+ * already the widest).
240
+ *
241
+ * @param t
242
+ */
243
+ export const widenFloat = (t) => (t === "f32" ? "f64" : "f64");
244
+ /**
245
+ * Returns the next smaller type (i.e. {@link IntType}, {@link UintType} or
246
+ * {@link FloatType}) for given type (or the same type if already the smallest).
247
+ *
248
+ * @param t
249
+ */
250
+ export const narrowType = (t) => t[0] === "i"
251
+ ? narrowInt(t)
252
+ : t[0] === "u"
253
+ ? narrowUint(t)
254
+ : narrowFloat(t);
255
+ /**
256
+ * Returns the next larger type (i.e. {@link IntType}, {@link UintType} or
257
+ * {@link FloatType}) for given type (or the same type if already the widest).
258
+ *
259
+ * @param t
260
+ */
261
+ export const widenType = (t) => t[0] === "i"
262
+ ? widenInt(t)
263
+ : t[0] === "u"
264
+ ? widenUint(t)
265
+ : widenFloat(t);