protobufjs 8.0.0 → 8.0.1

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.
@@ -518,10 +518,11 @@ Field.prototype.toDescriptor = function toDescriptor(edition) {
518
518
  // Handle extension field
519
519
  descriptor.extendee = this.extensionField ? this.extensionField.parent.fullName : this.extend;
520
520
 
521
- // Handle part of oneof
522
- if (this.partOf)
521
+ // Handle part of oneof (only meaningful for message types)
522
+ if (this.partOf && this.parent instanceof Type) {
523
523
  if ((descriptor.oneofIndex = this.parent.oneofsArray.indexOf(this.partOf)) < 0)
524
524
  throw Error("missing oneof");
525
+ }
525
526
 
526
527
  if (this.options) {
527
528
  descriptor.options = toDescriptorOptions(this.options, exports.FieldOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "protobufjs",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "versionScheme": "~",
5
5
  "description": "Protocol Buffers for JavaScript (& TypeScript).",
6
6
  "author": "Daniel Wirtz <dcode+protobufjs@dcode.io>",
package/src/message.js CHANGED
@@ -13,8 +13,12 @@ var util = require("./util/minimal");
13
13
  function Message(properties) {
14
14
  // not used internally
15
15
  if (properties)
16
- for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
17
- this[keys[i]] = properties[keys[i]];
16
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) {
17
+ var key = keys[i];
18
+ if (key === "__proto__")
19
+ continue;
20
+ this[key] = properties[key];
21
+ }
18
22
  }
19
23
 
20
24
  /**
@@ -136,4 +140,4 @@ Message.prototype.toJSON = function toJSON() {
136
140
  return this.$type.toObject(this, util.toJSONOptions);
137
141
  };
138
142
 
139
- /*eslint-enable valid-jsdoc*/
143
+ /*eslint-enable valid-jsdoc*/
package/src/type.js CHANGED
@@ -29,6 +29,7 @@ var Enum = require("./enum"),
29
29
  * @param {Object.<string,*>} [options] Declared options
30
30
  */
31
31
  function Type(name, options) {
32
+ name = name.replace(/\W/g, "");
32
33
  Namespace.call(this, name, options);
33
34
 
34
35
  /**
package/tsconfig.json CHANGED
@@ -3,6 +3,6 @@
3
3
  "target": "ES5",
4
4
  "experimentalDecorators": true,
5
5
  "emitDecoratorMetadata": true,
6
- "esModuleInterop": true,
6
+ "esModuleInterop": true
7
7
  }
8
- }
8
+ }