protobufjs 7.1.2 → 7.2.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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v7.1.0 (c) 2016, daniel wirtz
3
- * compiled thu, 22 sep 2022 17:16:10 utc
2
+ * protobuf.js v7.2.0 (c) 2016, daniel wirtz
3
+ * compiled tue, 24 jan 2023 20:12:01 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v7.1.0 (c) 2016, daniel wirtz
3
- * compiled thu, 22 sep 2022 17:16:11 utc
2
+ * protobuf.js v7.2.0 (c) 2016, daniel wirtz
3
+ * compiled tue, 24 jan 2023 20:12:01 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
package/dist/protobuf.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v7.1.0 (c) 2016, daniel wirtz
3
- * compiled thu, 22 sep 2022 17:16:10 utc
2
+ * protobuf.js v7.2.0 (c) 2016, daniel wirtz
3
+ * compiled tue, 24 jan 2023 20:12:01 utc
4
4
  * licensed under the bsd-3-clause license
5
5
  * see: https://github.com/dcodeio/protobuf.js for details
6
6
  */
@@ -1530,18 +1530,20 @@ var Enum = require(15),
1530
1530
  * @ignore
1531
1531
  */
1532
1532
  function genValuePartial_fromObject(gen, field, fieldIndex, prop) {
1533
+ var defaultAlreadyEmitted = false;
1533
1534
  /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */
1534
1535
  if (field.resolvedType) {
1535
1536
  if (field.resolvedType instanceof Enum) { gen
1536
1537
  ("switch(d%s){", prop);
1537
1538
  for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) {
1538
1539
  // enum unknown values passthrough
1539
- if (values[keys[i]] === field.typeDefault) { gen
1540
+ if (values[keys[i]] === field.typeDefault && !defaultAlreadyEmitted) { gen
1540
1541
  ("default:")
1541
1542
  ("if(typeof(d%s)===\"number\"){m%s=d%s;break}", prop, prop, prop);
1542
1543
  if (!field.repeated) gen // fallback to default value only for
1543
1544
  // arrays, to avoid leaving holes.
1544
1545
  ("break"); // for non-repeated fields, just ignore
1546
+ defaultAlreadyEmitted = true;
1545
1547
  }
1546
1548
  gen
1547
1549
  ("case%j:", keys[i])
@@ -5523,10 +5525,10 @@ Root.prototype.load = function load(filename, options, callback) {
5523
5525
  /* istanbul ignore if */
5524
5526
  if (!callback)
5525
5527
  return;
5526
- var cb = callback;
5527
- callback = null;
5528
5528
  if (sync)
5529
5529
  throw err;
5530
+ var cb = callback;
5531
+ callback = null;
5530
5532
  cb(err, root);
5531
5533
  }
5532
5534