Skip to content

Commit

Permalink
doc: fix buf.readUIntBE, buf.readUIntLE examples
Browse files Browse the repository at this point in the history
The documentation describing the output from the examples for
buf.readUIntBE and buf.readUIntLE were switched in terms of what the
code would actually output. This patch addresses this by switching the
two lines of example code to be in the same order as the functions are
listed earlier in the documentation.

PR-URL: #8240
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Brian White <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Prince John Wesley <[email protected]>
  • Loading branch information
mozkeeler authored and addaleax committed Aug 25, 2016
1 parent e786656 commit 7f1bb80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -1644,10 +1644,10 @@ Examples:
const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);

// Prints: 1234567890ab
console.log(buf.readUIntLE(0, 6).toString(16));
console.log(buf.readUIntBE(0, 6).toString(16));

// Prints: ab9078563412
console.log(buf.readUIntBE(0, 6).toString(16));
console.log(buf.readUIntLE(0, 6).toString(16));

// Throws an exception: RangeError: Index out of range
console.log(buf.readUIntBE(1, 6).toString(16));
Expand Down

0 comments on commit 7f1bb80

Please sign in to comment.