protobufjs 7.1.1 → 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.
package/dist/protobuf.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * protobuf.js v7.1.0 (c) 2016, daniel wirtz
3
- * compiled fri, 09 sep 2022 03:02:57 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])
@@ -3356,9 +3358,8 @@ Object.defineProperty(Namespace.prototype, "nestedArray", {
3356
3358
  /**
3357
3359
  * Any nested object descriptor.
3358
3360
  * @typedef AnyNestedObject
3359
- * @type {IEnum|IType|IService|AnyExtensionField|INamespace}
3361
+ * @type {IEnum|IType|IService|AnyExtensionField|INamespace|IOneOf}
3360
3362
  */
3361
- // ^ BEWARE: VSCode hangs forever when using more than 5 types (that's why AnyExtensionField exists in the first place)
3362
3363
 
3363
3364
  /**
3364
3365
  * Converts this namespace to a namespace descriptor.
@@ -5524,10 +5525,10 @@ Root.prototype.load = function load(filename, options, callback) {
5524
5525
  /* istanbul ignore if */
5525
5526
  if (!callback)
5526
5527
  return;
5527
- var cb = callback;
5528
- callback = null;
5529
5528
  if (sync)
5530
5529
  throw err;
5530
+ var cb = callback;
5531
+ callback = null;
5531
5532
  cb(err, root);
5532
5533
  }
5533
5534