protobufjs 8.3.0 → 8.4.0

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/README.md CHANGED
@@ -116,6 +116,7 @@ Common `ConversionOptions` are:
116
116
 
117
117
  | Option | Effect |
118
118
  |--------|--------|
119
+ | `longs: BigInt` | Converts 64-bit values to bigint values |
119
120
  | `longs: String` | Converts 64-bit values to decimal strings |
120
121
  | `longs: Number` | Converts 64-bit values to JS numbers (may lose precision) |
121
122
  | `enums: String` | Converts enum values to names |
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v8.3.0 (c) 2016, daniel wirtz
3
- * compiled wed, 13 may 2026 21:15:34 utc
2
+ * protobuf.js v8.4.0 (c) 2016, daniel wirtz
3
+ * compiled mon, 18 may 2026 17:55:10 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -251,7 +251,9 @@ function genValuePartial_toObject(gen, field, fieldIndex, dstProp, srcProp) {
251
251
  case "sint64":
252
252
  case "fixed64":
253
253
  case "sfixed64": gen
254
- ("if(typeof m%s===\"number\")", srcProp)
254
+ ("if(typeof BigInt!==\"undefined\"&&o.longs===BigInt)")
255
+ ("d%s=typeof m%s===\"number\"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()", dstProp, srcProp, srcProp, srcProp, srcProp, isUnsigned)
256
+ ("else if(typeof m%s===\"number\")", srcProp)
255
257
  ("d%s=o.longs===String?String(m%s):m%s", dstProp, srcProp, srcProp)
256
258
  ("else") // Long-like
257
259
  ("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", dstProp, srcProp, srcProp, srcProp, isUnsigned ? "true": "", srcProp);
@@ -319,9 +321,9 @@ converter.toObject = function toObject(mtype) {
319
321
  else if (field.long) gen
320
322
  ("if(util.Long){")
321
323
  ("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned)
322
- ("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop)
324
+ ("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():typeof BigInt!==\"undefined\"&&o.longs===BigInt?n.toBigInt():n", prop)
323
325
  ("}else")
324
- ("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber());
326
+ ("d%s=o.longs===String?%j:typeof BigInt!==\"undefined\"&&o.longs===BigInt?BigInt(%j):%i", prop, field.typeDefault.toString(), field.typeDefault.toString(), field.typeDefault.toNumber());
325
327
  else if (field.bytes) {
326
328
  var arrayDefault = Array.prototype.slice.call(field.typeDefault);
327
329
  gen
@@ -5151,7 +5153,7 @@ Type.prototype.fromObject = function fromObject(object) { // eslint-disable-line
5151
5153
  * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}.
5152
5154
  * @interface IConversionOptions
5153
5155
  * @property {Function} [longs] Long conversion type.
5154
- * Valid values are `String` and `Number` (the global types).
5156
+ * Valid values are `BigInt`, `String` and `Number` (the global types).
5155
5157
  * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library.
5156
5158
  * @property {Function} [enums] Enum value conversion type.
5157
5159
  * Only valid value is `String` (the global type).
@@ -7345,7 +7347,7 @@ module.exports = pool;
7345
7347
  * @param {number} start Start offset
7346
7348
  * @param {number} end End offset
7347
7349
  * @returns {Uint8Array} Buffer slice
7348
- * @this {Uint8Array}
7350
+ * @this Uint8Array
7349
7351
  */
7350
7352
 
7351
7353
  /**