From 03c61a731926352c38cdb2c94af13ec712379bbc Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 28 Aug 2020 23:50:45 +0200 Subject: [PATCH 1/2] buffer: also alias BigUInt methods These were overlooked in 5864fca7bc96b because of the extra `Big` in the name. :) Refs: https://github.com/nodejs/node/pull/34729 --- doc/api/buffer.md | 16 ++++++++++++++++ lib/internal/buffer.js | 4 ++++ test/parallel/test-buffer-writeuint.js | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 50d1a97fff2167..0f7a5ea6630cd7 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -1379,6 +1379,10 @@ values. added: - v12.0.0 - v10.20.0 +changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/????? + description: This function is also available as `buf.readBigUint64BE()`. --> * `offset` {integer} Number of bytes to skip before starting to read. Must @@ -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/????? + description: This function is also available as `buf.readBigUint64LE()`. --> * `offset` {integer} Number of bytes to skip before starting to read. Must @@ -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/????? + description: This function is also available as `buf.writeBigUint64BE()`. --> * `value` {bigint} Number to be written to `buf`. @@ -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/????? + description: This function is also available as `buf.writeBigUint64LE()`. --> * `value` {bigint} Number to be written to `buf`. diff --git a/lib/internal/buffer.js b/lib/internal/buffer.js index cb0e1a4f683721..f76f40830b4867 100644 --- a/lib/internal/buffer.js +++ b/lib/internal/buffer.js @@ -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, diff --git a/test/parallel/test-buffer-writeuint.js b/test/parallel/test-buffer-writeuint.js index 8ca99abc3ddfb7..7667d9381900dd 100644 --- a/test/parallel/test-buffer-writeuint.js +++ b/test/parallel/test-buffer-writeuint.js @@ -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'); From 248674b95872cfdc4cf69c5a48d0a335ea052e7a Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 28 Aug 2020 23:56:33 +0200 Subject: [PATCH 2/2] fixup! buffer: also alias BigUInt methods --- doc/api/buffer.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 0f7a5ea6630cd7..ad8fd00b110f18 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -1381,7 +1381,7 @@ added: - v10.20.0 changes: - version: REPLACEME - pr-url: https://github.com/nodejs/node/pull/????? + pr-url: https://github.com/nodejs/node/pull/34960 description: This function is also available as `buf.readBigUint64BE()`. --> @@ -1406,7 +1406,7 @@ added: - v10.20.0 changes: - version: REPLACEME - pr-url: https://github.com/nodejs/node/pull/????? + pr-url: https://github.com/nodejs/node/pull/34960 description: This function is also available as `buf.readBigUint64LE()`. --> @@ -2314,7 +2314,7 @@ added: - v10.20.0 changes: - version: REPLACEME - pr-url: https://github.com/nodejs/node/pull/????? + pr-url: https://github.com/nodejs/node/pull/34960 description: This function is also available as `buf.writeBigUint64BE()`. --> @@ -2341,7 +2341,7 @@ added: - v10.20.0 changes: - version: REPLACEME - pr-url: https://github.com/nodejs/node/pull/????? + pr-url: https://github.com/nodejs/node/pull/34960 description: This function is also available as `buf.writeBigUint64LE()`. -->