Skip to content

Commit

Permalink
Update protoc.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Oct 26, 2022
1 parent 5ac776c commit 13d208e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/protoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ protoc.Field = class extends protoc.Object {
if (!Number.isInteger(id) || id < 0) {
throw new protoc.Error('Identifier must be a non-negative integer.');
}
if (rule && !/^required|optional|repeated$/.test(rule = rule.toString().toLowerCase())) {
if (rule && rule !== 'required' && rule !== 'optional' && rule !== 'repeated') {
throw new protoc.Error('Rule must be a string.');
}
this.id = id;
Expand Down Expand Up @@ -763,7 +763,7 @@ protoc.Parser = class {
this._parseField(parent, token, reference);
break;
default:
if (!this._syntax !== 'proto3' || !protoc.Parser._isTypeReference(token)) {
if (this._syntax === 'proto3' || !protoc.Parser._isTypeReference(token)) {
throw this._parseError(token);
}
this._tokenizer.push(token);
Expand Down

0 comments on commit 13d208e

Please sign in to comment.