mol_crypto_lib 0.1.1662 → 0.1.1664

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/node.mjs CHANGED
@@ -2617,6 +2617,22 @@ var $;
2617
2617
  return pos - from;
2618
2618
  }
2619
2619
  $.$mol_charset_encode_to = $mol_charset_encode_to;
2620
+ function $mol_charset_encode_size(str) {
2621
+ let size = 0;
2622
+ for (let i = 0; i < str.length; i++) {
2623
+ let code = str.charCodeAt(i);
2624
+ if (code < 0x80)
2625
+ size += 1;
2626
+ else if (code < 0x800)
2627
+ size += 2;
2628
+ else if (code < 0xd800 || code >= 0xe000)
2629
+ size += 3;
2630
+ else
2631
+ size += 4;
2632
+ }
2633
+ return size;
2634
+ }
2635
+ $.$mol_charset_encode_size = $mol_charset_encode_size;
2620
2636
  })($ || ($ = {}));
2621
2637
 
2622
2638
  ;
package/node.test.js CHANGED
@@ -2608,6 +2608,22 @@ var $;
2608
2608
  return pos - from;
2609
2609
  }
2610
2610
  $.$mol_charset_encode_to = $mol_charset_encode_to;
2611
+ function $mol_charset_encode_size(str) {
2612
+ let size = 0;
2613
+ for (let i = 0; i < str.length; i++) {
2614
+ let code = str.charCodeAt(i);
2615
+ if (code < 0x80)
2616
+ size += 1;
2617
+ else if (code < 0x800)
2618
+ size += 2;
2619
+ else if (code < 0xd800 || code >= 0xe000)
2620
+ size += 3;
2621
+ else
2622
+ size += 4;
2623
+ }
2624
+ return size;
2625
+ }
2626
+ $.$mol_charset_encode_size = $mol_charset_encode_size;
2611
2627
  })($ || ($ = {}));
2612
2628
 
2613
2629
  ;