Skip to content

Commit 99667c8

Browse files
committed
Docs: Added a few additional notes on core methods to README, see #710
1 parent 9c94813 commit 99667c8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ protobuf.load("awesome.proto", function(err, root) {
135135

136136
**Note:** To avoid redundant assertions where messages are already known to be valid, there is a separate method for encoding and verification.
137137

138+
* `Message.verify` can be used to explicitly perform verification prior to encoding any object where necessary. Instead of throwing, it returns the error message, if any.
138139
* `Message.encode` does not implicitly verify a message but tries to encode whatever is specified, possibly resulting in a runtime error being thrown somewhere down the road.
139-
* `Message.verify` can be used to explicitly perform verification prior to encoding where necessary. Instead of throwing, it returns the error message, if any.
140140
* `Message.decode` throws if a buffer is invalid or missing required fields (a `protobuf.util.ProtocolError` with an `instance` property set to the so far decoded message in the latter case) and doesn't require calling `Message.verify` afterwards.
141+
* `Message.fromObject` and `Message.toObject` safely translate between runtime messages and plain JavaScript objects.
141142

142143
Additionally, promise syntax can be used by omitting the callback, if preferred:
143144

0 commit comments

Comments
 (0)