Permalink
Browse files

Make genVerifyKey actually generate conditions for 32bit values and b…

…ool, fixes #546
  • Loading branch information...
dcodeIO committed Dec 12, 2016
1 parent 01365ba commit 28a1d26f28daf855c949614ef485237c6bf316e5
@@ -215,7 +215,7 @@ import * as protobuf from "protobufjs";
Module Structure
----------------
The library exports a flat `protobuf` namespace with the following members, ordered by category:
The library exports a flat `protobuf` namespace including but not restricted to the following members, ordered by category:
### Parser
@@ -225,49 +225,19 @@ The library exports a flat `protobuf` namespace with the following members, orde
* **loadSync(filename: `string|string[]`, [root: `Root`]): `Root`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/index.js)]<br />
Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only).
* **tokenize(source: `string`): `Object`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/tokenize.js)]<br />
Tokenizes the given .proto source and returns an object with useful utility functions.
* **parse(source: `string`): `Object`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/parse.js)]<br />
Parses the given .proto source and returns an object with the parsed contents.
* **package: `string|undefined`**<br />
The package name, if declared.
* **imports: `string[]|undefined`**<br />
File names of imported files, if any.
* **weakImports: `string[]|undefined`**<br />
File names of weakly imported files, if any.
* **syntax: `string|undefined`**<br />
Source syntax, if defined.
* **root: `Root`**<br />
The root namespace.
### Serialization
* **Writer** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/writer.js)]<br />
Wire format writer using `Uint8Array` if available, otherwise `Array`.
* **BufferWriter** _extends **Writer**_ [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/writer.js)]<br />
Wire format writer using node buffers.
* **Reader** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/reader.js)]<br />
Wire format reader using `Uint8Array` if available, otherwise `Array`.
* **BufferReader** _extends **Reader**_ [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/reader.js)]<br />
Wire format reader using node buffers.
* **codegen** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/codegen.js)]<br />
A closure for generating functions programmatically.
### Reflection
* **ReflectionObject** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/object.js)]<br />
Base class of all reflection objects.
* **Namespace** _extends **ReflectionObject**_ [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/namespace.js)]<br />
Base class of all reflection objects containing nested objects.
@@ -302,18 +272,11 @@ The library exports a flat `protobuf` namespace with the following members, orde
### Utility
* **types: `Object`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/types.js)]<br />
Common type constants.
* **common(name: `string`, json: `Object`)** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/common.js)]<br />
Provides common type definitions.
* **rpc: `Object`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/rpc.js)]<br />
Streaming RPC helpers.
* **util: `Object`** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/util.js)]<br />
* **util** [[source](https://github.com/dcodeIO/protobuf.js/blob/master/src/util.js)]<br />
Various utility functions.
For less common members, see the API documentation.
Documentation
-------------
@@ -0,0 +1,7 @@
import * as $protobuf from "protobufjs";
%OUTPUT%
$protobuf.roots[%ROOT%] = $root;
export default $root;

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
BIN +9 Bytes (100%) dist/protobuf.min.js.gz
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -211,11 +211,11 @@ function genVerifyKey(gen, field, ref) {
case "uint32":
case "sint32":
case "fixed32":
case "sfixed32":
case "sfixed32": gen
("if(!/^-?(?:0|[1-9]\\d*)$/.test(%s))", ref)
("return%j", invalid(field, "integer key"));
break;
case "bool":
case "bool": gen
("if(!/^true|false|0|1$/.test(%s))", ref)
("return%j", invalid(field, "boolean key"));
break;
@@ -1,6 +1,6 @@
/*
* protobuf.js v6.1.0 TypeScript definitions
* Generated Sun, 11 Dec 2016 23:22:51 UTC
* Generated Mon, 12 Dec 2016 00:01:07 UTC
*/
declare module "protobufjs" {

0 comments on commit 28a1d26

Please sign in to comment.