hevy-shared 1.0.719 → 1.0.720

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/built/utils.js +12 -4
  2. package/package.json +1 -1
package/built/utils.js CHANGED
@@ -550,10 +550,18 @@ const generateUserGroup = (userId, numGroups) => {
550
550
  if (!['8', '9', 'a', 'b', 'c', 'd'].includes(variant.toLowerCase())) {
551
551
  return { isSuccess: false, error: 'invalid-variant' };
552
552
  }
553
- return {
554
- isSuccess: true,
555
- value: Number(BigInt(`0x${tail}`) % BigInt(numGroups)),
556
- };
553
+ let value;
554
+ try {
555
+ const idHexString = `0x${tail}`;
556
+ const idBigInt = BigInt(idHexString);
557
+ const numGroupsBigInt = BigInt(numGroups);
558
+ const remainderBigInt = idBigInt % numGroupsBigInt;
559
+ value = Number(remainderBigInt);
560
+ }
561
+ catch (e) {
562
+ throw new Error(`generateUserGroup: tail="${tail}": ${e === null || e === void 0 ? void 0 : e.message}`);
563
+ }
564
+ return { isSuccess: true, value };
557
565
  };
558
566
  exports.generateUserGroup = generateUserGroup;
559
567
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hevy-shared",
3
- "version": "1.0.719",
3
+ "version": "1.0.720",
4
4
  "description": "",
5
5
  "main": "built/index.js",
6
6
  "types": "built/index.d.ts",