Skip to content

Commit 649b2b3

Browse files
committed
docs: minor fixes
1 parent 689426c commit 649b2b3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ returned from the `parse` method.
103103
Parse bytes as an integer and store it in a variable named `name`. `name`
104104
should consist only of alphanumeric characters and start with an alphabet.
105105
Number of bits can be chosen from 8, 16, 32 and 64. Byte-ordering can be either
106-
`l` for little endian or `b` for big endian. With no prefix, it parses as a
107-
signed number, with `u` prefixed as an unsigned number. The runtime type
106+
`le` for little endian or `be` for big endian. With no prefix, it parses as a
107+
signed number, with `u` prefix as an unsigned number. The runtime type
108108
returned by the 8, 16, 32 bit methods is `number` while the type
109109
returned by the 64 bit is `bigint`.
110110

111111
**Note:** [u]int64{be,le} methods only work if your runtime is node v12.0.0 or
112-
greater. Lower version will throw a runtime error.
112+
greater. Lower versions will throw a runtime error.
113113

114114
```javascript
115115
const parser = new Parser()
@@ -156,7 +156,7 @@ the following keys:
156156
- `greedy` - (Optional, defaults to `false`) If true, then this parser reads
157157
until it reaches the end of the buffer. Will consume zero-bytes.
158158
- `stripNull` - (Optional, must be used with `length`) If true, then strip
159-
null characters from end of the string
159+
null characters from end of the string.
160160

161161
### buffer(name[, options])
162162
Parse bytes as a buffer. Its type will be the same as the input to
@@ -182,8 +182,8 @@ keys:
182182
Parse bytes as an array. `options` is an object which can have the following
183183
keys:
184184

185-
- `type` - (Required) Type of the array element. Can be a string or an user
186-
defined Parser object. If it's a string, you have to choose from [u]int{8,
185+
- `type` - (Required) Type of the array element. Can be a string or a user
186+
defined `Parser` object. If it's a string, you have to choose from [u]int{8,
187187
16, 32}{le, be}.
188188
- `length` - (either `length`, `lengthInBytes`, or `readUntil` is required)
189189
Length of the array. Can be a number, string or a function. Use number for
@@ -261,7 +261,7 @@ the chosen parser is directly embedded into the current object. `options` is
261261
an object which can have the following keys:
262262

263263
- `tag` - (Required) The value used to determine which parser to use from the
264-
`choices` Can be a string pointing to another field or a function.
264+
`choices`. Can be a string pointing to another field or a function.
265265
- `choices` - (Required) An object which key is an integer and value is the
266266
parser which is executed when `tag` equals the key value.
267267
- `defaultChoice` - (Optional) In case if the tag value doesn't match any of
@@ -298,7 +298,7 @@ Useful for parsing binary formats such as ELF where the offset of a field is
298298
pointed by another field.
299299

300300
- `type` - (Required) Can be a string `[u]int{8, 16, 32, 64}{le, be}`
301-
or an user defined Parser object.
301+
or a user defined `Parser` object.
302302
- `offset` - (Required) Indicates absolute offset from the beginning of the
303303
input buffer. Can be a number, string or a function.
304304

@@ -516,8 +516,8 @@ These options can be used in all parsers.
516516
numbers and so on). If `assert` is a `string` or `number`, the actual parsed
517517
result will be compared with it with `===` (strict equality check), and an
518518
exception is thrown if they mismatch. On the other hand, if `assert` is a
519-
function, that function is executed with one argument (parsed result) and if
520-
it returns false, an exception is thrown.
519+
function, that function is executed with one argument (the parsed result)
520+
and if it returns false, an exception is thrown.
521521

522522
```javascript
523523
// simple maginc number validation

0 commit comments

Comments
 (0)