103
103
104
104
### Utility
105
105
106
- * Long.** isLong** (obj: ` * ` ): ` boolean ` <br />
106
+ * type ** LongLike** : ` Long | number | bigint | string ` <br />
107
+ Any value or object that either is or can be converted to a Long.
108
+
109
+ * Long.** isLong** (obj: ` any ` ): ` boolean ` <br />
107
110
Tests if the specified object is a Long.
108
111
109
112
* Long.** fromBits** (lowBits: ` number ` , highBits: ` number ` , unsigned?: ` boolean ` ): ` Long ` <br />
@@ -124,28 +127,31 @@ API
124
127
* Long.** fromNumber** (value: ` number ` , unsigned?: ` boolean ` ): ` Long ` <br />
125
128
Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
126
129
130
+ * Long.** fromBigInt** (value: ` bigint ` , unsigned?: ` boolean ` ): ` Long ` <br />
131
+ Returns a Long representing the given big integer.
132
+
127
133
* Long.** fromString** (str: ` string ` , unsigned?: ` boolean ` , radix?: ` number ` )<br />
128
134
Long.** fromString** (str: ` string ` , radix: ` number ` )<br />
129
135
Returns a Long representation of the given string, written using the specified radix.
130
136
131
- * Long.** fromValue** (val: ` * ` , unsigned?: ` boolean ` ): ` Long ` <br />
137
+ * Long.** fromValue** (val: ` LongLike ` , unsigned?: ` boolean ` ): ` Long ` <br />
132
138
Converts the specified value to a Long using the appropriate from* function for its type.
133
139
134
140
### Methods
135
141
136
- * Long#** add** (addend: ` Long | number | string ` ): ` Long ` <br />
142
+ * Long#** add** (addend: ` LongLike ` ): ` Long ` <br />
137
143
Returns the sum of this and the specified Long.
138
144
139
- * Long#** and** (other: ` Long | number | string ` ): ` Long ` <br />
145
+ * Long#** and** (other: ` LongLike ` ): ` Long ` <br />
140
146
Returns the bitwise AND of this Long and the specified.
141
147
142
- * Long#** compare** /** comp** (other: ` Long | number | string ` ): ` number ` <br />
148
+ * Long#** compare** /** comp** (other: ` LongLike ` ): ` number ` <br />
143
149
Compares this Long's value with the specified's. Returns ` 0 ` if they are the same, ` 1 ` if the this is greater and ` -1 ` if the given one is greater.
144
150
145
- * Long#** divide** /** div** (divisor: ` Long | number | string ` ): ` Long ` <br />
151
+ * Long#** divide** /** div** (divisor: ` LongLike ` ): ` Long ` <br />
146
152
Returns this Long divided by the specified.
147
153
148
- * Long#** equals** /** eq** (other: ` Long | number | string ` ): ` boolean ` <br />
154
+ * Long#** equals** /** eq** (other: ` LongLike ` ): ` boolean ` <br />
149
155
Tests if this Long's value equals the specified's.
150
156
151
157
* Long#** getHighBits** (): ` number ` <br />
@@ -163,10 +169,10 @@ API
163
169
* Long#** getNumBitsAbs** (): ` number ` <br />
164
170
Gets the number of bits needed to represent the absolute value of this Long.
165
171
166
- * Long#** greaterThan** /** gt** (other: ` Long | number | string ` ): ` boolean ` <br />
172
+ * Long#** greaterThan** /** gt** (other: ` LongLike ` ): ` boolean ` <br />
167
173
Tests if this Long's value is greater than the specified's.
168
174
169
- * Long#** greaterThanOrEqual** /** gte** /** ge** (other: ` Long | number | string ` ): ` boolean ` <br />
175
+ * Long#** greaterThanOrEqual** /** gte** /** ge** (other: ` LongLike ` ): ` boolean ` <br />
170
176
Tests if this Long's value is greater than or equal the specified's.
171
177
172
178
* Long#** isEven** (): ` boolean ` <br />
@@ -184,16 +190,16 @@ API
184
190
* Long#** isZero** /** eqz** (): ` boolean ` <br />
185
191
Tests if this Long's value equals zero.
186
192
187
- * Long#** lessThan** /** lt** (other: ` Long | number | string ` ): ` boolean ` <br />
193
+ * Long#** lessThan** /** lt** (other: ` LongLike ` ): ` boolean ` <br />
188
194
Tests if this Long's value is less than the specified's.
189
195
190
- * Long#** lessThanOrEqual** /** lte** /** le** (other: ` Long | number | string ` ): ` boolean ` <br />
196
+ * Long#** lessThanOrEqual** /** lte** /** le** (other: ` LongLike ` ): ` boolean ` <br />
191
197
Tests if this Long's value is less than or equal the specified's.
192
198
193
- * Long#** modulo** /** mod** /** rem** (divisor: ` Long | number | string ` ): ` Long ` <br />
199
+ * Long#** modulo** /** mod** /** rem** (divisor: ` LongLike ` ): ` Long ` <br />
194
200
Returns this Long modulo the specified.
195
201
196
- * Long#** multiply** /** mul** (multiplier: ` Long | number | string ` ): ` Long ` <br />
202
+ * Long#** multiply** /** mul** (multiplier: ` LongLike ` ): ` Long ` <br />
197
203
Returns the product of this and the specified Long.
198
204
199
205
* Long#** negate** /** neg** (): ` Long ` <br />
@@ -208,28 +214,28 @@ API
208
214
* Long#** countTrailingZeros** /** ctz** (): ` number ` <br />
209
215
Returns count trailing zeros of this Long.
210
216
211
- * Long#** notEquals** /** neq** /** ne** (other: ` Long | number | string ` ): ` boolean ` <br />
217
+ * Long#** notEquals** /** neq** /** ne** (other: ` LongLike ` ): ` boolean ` <br />
212
218
Tests if this Long's value differs from the specified's.
213
219
214
- * Long#** or** (other: ` Long | number | string ` ): ` Long ` <br />
220
+ * Long#** or** (other: ` LongLike ` ): ` Long ` <br />
215
221
Returns the bitwise OR of this Long and the specified.
216
222
217
- * Long#** shiftLeft** /** shl** (numBits: ` Long | number | string ` ): ` Long ` <br />
223
+ * Long#** shiftLeft** /** shl** (numBits: ` Long | number ` ): ` Long ` <br />
218
224
Returns this Long with bits shifted to the left by the given amount.
219
225
220
- * Long#** shiftRight** /** shr** (numBits: ` Long | number | string ` ): ` Long ` <br />
226
+ * Long#** shiftRight** /** shr** (numBits: ` Long | number ` ): ` Long ` <br />
221
227
Returns this Long with bits arithmetically shifted to the right by the given amount.
222
228
223
- * Long#** shiftRightUnsigned** /** shru** /** shr_u** (numBits: ` Long | number | string ` ): ` Long ` <br />
229
+ * Long#** shiftRightUnsigned** /** shru** /** shr_u** (numBits: ` Long | number ` ): ` Long ` <br />
224
230
Returns this Long with bits logically shifted to the right by the given amount.
225
231
226
- * Long#** rotateLeft** /** rotl** (numBits: ` Long | number | string ` ): ` Long ` <br />
232
+ * Long#** rotateLeft** /** rotl** (numBits: ` Long | number ` ): ` Long ` <br />
227
233
Returns this Long with bits rotated to the left by the given amount.
228
234
229
- * Long#** rotateRight** /** rotr** (numBits: ` Long | number | string ` ): ` Long ` <br />
235
+ * Long#** rotateRight** /** rotr** (numBits: ` Long | number ` ): ` Long ` <br />
230
236
Returns this Long with bits rotated to the right by the given amount.
231
237
232
- * Long#** subtract** /** sub** (subtrahend: ` Long | number | string ` ): ` Long ` <br />
238
+ * Long#** subtract** /** sub** (subtrahend: ` LongLike ` ): ` Long ` <br />
233
239
Returns the difference of this and the specified Long.
234
240
235
241
* Long#** toBytes** (le?: ` boolean ` ): ` number[] ` <br />
247
253
* Long#** toNumber** (): ` number ` <br />
248
254
Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
249
255
256
+ * Long#** toBigInt** (): ` bigint ` <br />
257
+ Converts the Long to its big integer representation.
258
+
250
259
* Long#** toSigned** (): ` Long ` <br />
251
260
Converts this Long to signed.
252
261
0 commit comments