nv-facutil-slct-ta 1.0.8 → 1.0.9

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 (2) hide show
  1. package/index.js +56 -20
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -86,11 +86,8 @@ BRIEF_MIRR.set("i32a", Int32Array);
86
86
  BRIEF_MIRR.set("i64a", BigInt64Array);
87
87
  BRIEF_MIRR.set("f32a", Float32Array);
88
88
  BRIEF_MIRR.set("f64a", Float64Array);
89
- if (globalThis.Float16Array !== undefined) {BRIEF_MIRR.set("f16a", globalThis.Float16Array);}
90
89
  BRIEF_MIRR.set("dv", DataView);
91
- if (globalThis.Buffer !== undefined) {BRIEF_MIRR.set("buf", globalThis.Buffer);}
92
- if (globalThis.Blob !== undefined) {BRIEF_MIRR.set("blob", globalThis.Blob);}
93
- if (globalThis.File !== undefined) {BRIEF_MIRR.set("file", globalThis.File);}
90
+ BRIEF_MIRR.set("ab", ArrayBuffer);
94
91
  BRIEF_MIRR.set(Uint8Array,"u8a");
95
92
  BRIEF_MIRR.set(Uint8ClampedArray, "u8ca");
96
93
  BRIEF_MIRR.set(Uint16Array, "u16a");
@@ -102,24 +99,15 @@ BRIEF_MIRR.set(Int32Array, "i32a");
102
99
  BRIEF_MIRR.set(BigInt64Array, "i64a");
103
100
  BRIEF_MIRR.set(Float32Array, "f32a");
104
101
  BRIEF_MIRR.set(Float64Array, "f64a");
105
-
106
- if (globalThis.Float16Array !== undefined) {
107
- BRIEF_MIRR.set(globalThis.Float16Array, "f16a");
108
- }
109
-
110
102
  BRIEF_MIRR.set(DataView, "dv");
103
+ BRIEF_MIRR.set(ArrayBuffer, "ab");
111
104
 
112
- if (globalThis.Buffer !== undefined) {
113
- BRIEF_MIRR.set(globalThis.Buffer, "buf");
114
- }
115
-
116
- if (globalThis.Blob !== undefined) {
117
- BRIEF_MIRR.set(globalThis.Blob, "blob");
118
- }
105
+ if (globalThis.Float16Array !== undefined) {BRIEF_MIRR.set("f16a", globalThis.Float16Array);BRIEF_MIRR.set(globalThis.Float16Array, "f16a");}
106
+ if (globalThis.Buffer !== undefined) {BRIEF_MIRR.set("buf", globalThis.Buffer);BRIEF_MIRR.set(globalThis.Buffer, "buf");}
107
+ if (globalThis.Blob !== undefined) {BRIEF_MIRR.set("blob", globalThis.Blob);BRIEF_MIRR.set(globalThis.Blob, "blob");}
108
+ if (globalThis.File !== undefined) {BRIEF_MIRR.set("file", globalThis.File);BRIEF_MIRR.set(globalThis.File, "file");}
109
+ if (globalThis.SharedArrayBuffer !== undefined) {BRIEF_MIRR.set("sab", globalThis.SharedArrayBuffer);BRIEF_MIRR.set(globalThis.SharedArrayBuffer, "sab");}
119
110
 
120
- if (globalThis.File !== undefined) {
121
- BRIEF_MIRR.set(globalThis.File, "file");
122
- }
123
111
  function get_brief_name(Cls) {return BRIEF_MIRR.get(Cls)}
124
112
  function get_cls_from_brief_name(brief) {return BRIEF_MIRR.get(brief.toLowerCase())}
125
113
 
@@ -233,8 +221,48 @@ const to_abrng = (o)=> Array.isArray(o)?o:ta2abrng(o);
233
221
  const is_overlaped = (o0,o1) => is_ab_rng_overlaped(to_abrng(o0),to_abrng(o1));
234
222
 
235
223
 
224
+ ////
225
+ const TACLS_TO_MTHD_HINT = new Map([
226
+ [Uint8ClampedArray, { r: "ru8ca", w: "wu8ca", "?": false }],
227
+ [Uint8Array, { r: "ru8a", w: "wu8a", "?": false }],
228
+ [Int8Array, { r: "ri8a", w: "wi8a", "?": false }],
229
+ [Uint16Array, { r: "ru16a", w: "wu16a", "?": false }],
230
+ [Int16Array, { r: "ri16a", w: "wi16a", "?": false }],
231
+ [Uint32Array, { r: "ru32a", w: "wu32a", "?": false }],
232
+ [Int32Array, { r: "ri32a", w: "wi32a", "?": false }],
233
+ [BigUint64Array, { r: "ru64a", w: "wu64a", "?": false }],
234
+ [BigInt64Array, { r: "ri64a", w: "wi64a", "?": false }],
235
+ [Float32Array, { r: "rf32a", w: "wf32a", "?": true }],
236
+ [Float64Array, { r: "rf64a", w: "wf64a", "?": true }],
237
+ [DataView, { r: "rdv", w: "wdv", "?": false }],
238
+ ]);
239
+ if(globalThis.Float16Array !== undefined) {TACLS_TO_MTHD_HINT.set(globalThis.Float16Array,{ r: "rf16a", w: "wf16a", "?": true })}
240
+ const tacls_to_mthd_hint = (Cls)=>TACLS_TO_MTHD_HINT.get(Cls);
241
+ ////
236
242
 
243
+ const TACLS_OR_ABCLS_TO_MTHD_HINT = new Map(Array.from(TACLS_TO_MTHD_HINT.entries()));
244
+ if(globalThis.Buffer !== undefined) {TACLS_OR_ABCLS_TO_MTHD_HINT.set(globalThis.Buffer, { r: "ru8a", w: "wu8a", "?": false })}
245
+ if(globalThis.SharedArrayBuffer !== undefined) {TACLS_OR_ABCLS_TO_MTHD_HINT.set(globalThis.SharedArrayBuffer,{ r: "ro", w: "wo", "?": false })}
246
+ const tacls_or_abcls_to_mthd_hint = (Cls)=>TACLS_OR_ABCLS_TO_MTHD_HINT.get(Cls);
247
+ ////
237
248
 
249
+ const TACLSNM_TO_TBRIEF = {
250
+ "Uint8Array": "u8a",
251
+ "Uint8ClampedArray": "u8ca",
252
+ "Int8Array": "i8a",
253
+ "Uint16Array": "u16a",
254
+ "Int16Array": "i16a",
255
+ "Uint32Array": "u32a",
256
+ "Int32Array": "i32a",
257
+ "BigUint64Array": "u64a",
258
+ "BigInt64Array": "i64a",
259
+ "Float16Array" : "f16a",
260
+ "Float32Array": "f32a",
261
+ "Float64Array": "f64a",
262
+ "DataView": "dv",
263
+ };
264
+ const taclsnm_to_tbrief = (clsnm/*constructor.name*/)=>TACLSNM_TO_TBRIEF[clsnm];
265
+ const tbrief_to_taclsnm = (tbrief)=>get_cls_from_brief_name(tbrief).name;
238
266
 
239
267
  module.exports = {
240
268
  check_sz_and_algn,
@@ -249,7 +277,10 @@ module.exports = {
249
277
  get_display_name_prefix,
250
278
  get_brief_name,get_cls_from_brief_name,
251
279
  ////
252
- AB_CLSES,TA_CLSES,VWLIKE_CLSES,BUFLIKE_CLSES,
280
+ AB_CLSES,
281
+ TA_CLSES,
282
+ VWLIKE_CLSES,
283
+ BUFLIKE_CLSES,
253
284
  ////
254
285
  cp,
255
286
  setv,
@@ -264,4 +295,9 @@ module.exports = {
264
295
  is_ta_overlaped,
265
296
  to_abrng,
266
297
  is_overlaped,
298
+ ////
299
+ tacls_to_mthd_hint,
300
+ tacls_or_abcls_to_mthd_hint,
301
+ taclsnm_to_tbrief,
302
+ tbrief_to_taclsnm,
267
303
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nv-facutil-slct-ta",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"