Skip to content

Commit

Permalink
buffer: also alias BigUInt methods
Browse files Browse the repository at this point in the history
These were overlooked in 5864fca because of the extra
`Big` in the name. :)

Refs: #34729

PR-URL: #34960
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
addaleax authored and nodejs-github-bot committed Sep 2, 2020
1 parent b90fff4 commit 42a793e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
16 changes: 16 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,10 @@ values.
added:
- v12.0.0
- v10.20.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/34960
description: This function is also available as `buf.readBigUint64BE()`.
-->

* `offset` {integer} Number of bytes to skip before starting to read. Must
Expand All @@ -1400,6 +1404,10 @@ console.log(buf.readBigUInt64BE(0));
added:
- v12.0.0
- v10.20.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/34960
description: This function is also available as `buf.readBigUint64LE()`.
-->

* `offset` {integer} Number of bytes to skip before starting to read. Must
Expand Down Expand Up @@ -2304,6 +2312,10 @@ console.log(buf);
added:
- v12.0.0
- v10.20.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/34960
description: This function is also available as `buf.writeBigUint64BE()`.
-->

* `value` {bigint} Number to be written to `buf`.
Expand All @@ -2327,6 +2339,10 @@ console.log(buf);
added:
- v12.0.0
- v10.20.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/34960
description: This function is also available as `buf.writeBigUint64LE()`.
-->

* `value` {bigint} Number to be written to `buf`.
Expand Down
4 changes: 4 additions & 0 deletions lib/internal/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,10 +952,14 @@ class FastBuffer extends Uint8Array {}
function addBufferPrototypeMethods(proto) {
proto.readBigUInt64LE = readBigUInt64LE,
proto.readBigUInt64BE = readBigUInt64BE,
proto.readBigUint64LE = readBigUInt64LE,
proto.readBigUint64BE = readBigUInt64BE,
proto.readBigInt64LE = readBigInt64LE,
proto.readBigInt64BE = readBigInt64BE,
proto.writeBigUInt64LE = writeBigUInt64LE,
proto.writeBigUInt64BE = writeBigUInt64BE,
proto.writeBigUint64LE = writeBigUInt64LE,
proto.writeBigUint64BE = writeBigUInt64BE,
proto.writeBigInt64LE = writeBigInt64LE,
proto.writeBigInt64BE = writeBigInt64BE,

Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-buffer-writeuint.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ const assert = require('assert');
}

for (const fn of [
'UInt8', 'UInt16LE', 'UInt16BE', 'UInt32LE', 'UInt32BE', 'UIntLE', 'UIntBE'
'UInt8', 'UInt16LE', 'UInt16BE', 'UInt32LE', 'UInt32BE', 'UIntLE', 'UIntBE',
'BigUInt64LE', 'BigUInt64BE',
]) {
const p = Buffer.prototype;
const lowerFn = fn.replace(/UInt/, 'Uint');
Expand Down

0 comments on commit 42a793e

Please sign in to comment.