nv-facutil-slct-ta 1.1.0 → 1.1.2

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 +37 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -171,6 +171,18 @@ const DUMP_ONE_BYTE_TYPE_MP = {
171
171
  255: Float64Array,
172
172
  }
173
173
 
174
+ const CLS2BYT = new Map([
175
+ [Uint8Array,0],
176
+ [Uint16Array,1],
177
+ [Uint32Array,2],
178
+ [BigUint64Array,3],
179
+ [Float64Array,255]
180
+ ]);
181
+
182
+ function get_byt_from_cls(Cls) {
183
+ return CLS2BYT.get(Cls)
184
+ }
185
+
174
186
  function get_cls_from_dump_fst_byte(byt) {
175
187
  return DUMP_ONE_BYTE_TYPE_MP[byt]??Float64Array
176
188
  }
@@ -378,6 +390,28 @@ const ele_tbrief_to_tacls = (t)=>ELE_TBRIEF_TO_TACLS[t];
378
390
  const tacls_to_ele_tbrief = (Cls)=>TACLS_TO_ELE_TBRIEF.get(Cls);
379
391
 
380
392
 
393
+ const max_tacls = (...Clss) => {
394
+ let max = Clss[0];
395
+ for (let i = 1; i < Clss.length; i++) {
396
+ let c = Clss[i];
397
+ if (c.BYTES_PER_ELEMENT > max.BYTES_PER_ELEMENT) {
398
+ max = c;
399
+ }
400
+ }
401
+ return max;
402
+ };
403
+
404
+ const min_tacls = (...Clss) => {
405
+ let min = Clss[0];
406
+ for (let i = 1; i < Clss.length; i++) {
407
+ let c = Clss[i];
408
+ if (c.BYTES_PER_ELEMENT < min.BYTES_PER_ELEMENT) {
409
+ min = c;
410
+ }
411
+ }
412
+ return min;
413
+ };
414
+
381
415
  module.exports = {
382
416
  tcate,
383
417
  ////
@@ -386,6 +420,7 @@ module.exports = {
386
420
  calc_prepad_sz, calc_pstpad_sz,
387
421
  calc_max_incr_cnt,
388
422
  get_ta_cls_with_max_cnt,
423
+ get_byt_from_cls,
389
424
  get_cls_from_dump_fst_byte,
390
425
  get_fst_byte_for_dump,
391
426
  set_fst_byte_for_dump,
@@ -428,4 +463,6 @@ module.exports = {
428
463
  ////
429
464
  ele_tbrief_to_tacls,
430
465
  tacls_to_ele_tbrief,
466
+ ////
467
+ min_tacls,max_tacls
431
468
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nv-facutil-slct-ta",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"