Skip to content

Commit e6d2fb9

Browse files
made it a one-liner
1 parent 0a9606f commit e6d2fb9

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/long.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,8 @@ export class Long extends BSONValue {
243243
* @returns The corresponding Long value
244244
*/
245245
static fromBigInt(value: bigint, unsigned?: boolean): Long {
246-
/* eslint-disable no-bigint-usage/no-bigint-literals */
247-
const bit32Mask = 0xffffffffn;
248-
249-
const lowBits = value & bit32Mask;
250-
const highBits = (value >> 32n) & bit32Mask;
251-
/* eslint-enable no-bigint-usage/no-bigint-literals */
252-
return new Long(Number(lowBits), Number(highBits), unsigned);
246+
// eslint-disable-next-line no-bigint-usage/no-bigint-literals
247+
return new Long(Number(value & 0xffffffffn), Number((value >> 32n) & 0xffffffffn), unsigned);
253248
}
254249

255250
/**

0 commit comments

Comments
 (0)