1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-03 17:49:16 +02:00

Update to @returns in all jsdoc

This commit is contained in:
Jeff Schiller 2022-04-27 13:31:18 -07:00
parent bab0864bf8
commit 84514d1617
11 changed files with 57 additions and 57 deletions

View file

@ -80,7 +80,7 @@ export class Untarrer extends UntarrerInternal {
* as Transferable and sent to a Worker thread once start() is called. * as Transferable and sent to a Worker thread once start() is called.
* @param {Object|string} options An optional object of options, or a string * @param {Object|string} options An optional object of options, or a string
* representing where the path to the unarchiver script files. * representing where the path to the unarchiver script files.
* @return {Unarchiver} * @returns {Unarchiver}
*/ */
export function getUnarchiver(ab, options = {}) { export function getUnarchiver(ab, options = {}) {
return getUnarchiverInternal(ab, createWorkerFn, options); return getUnarchiverInternal(ab, createWorkerFn, options);

View file

@ -239,7 +239,7 @@ export class UnarchiveExtractEvent extends UnarchiveEvent {
/** /**
* This method must be overridden by the subclass to return the script filename. * This method must be overridden by the subclass to return the script filename.
* @return {string} The MIME type of the archive. * @returns {string} The MIME type of the archive.
* @protected. * @protected.
*/ */
getMIMEType() { getMIMEType() {
@ -248,7 +248,7 @@ export class UnarchiveExtractEvent extends UnarchiveEvent {
/** /**
* This method must be overridden by the subclass to return the script filename. * This method must be overridden by the subclass to return the script filename.
* @return {string} The script filename. * @returns {string} The script filename.
* @protected. * @protected.
*/ */
getScriptFileName() { getScriptFileName() {
@ -287,7 +287,7 @@ export class UnarchiveExtractEvent extends UnarchiveEvent {
/** /**
* Create an UnarchiveEvent out of the object sent back from the Worker. * Create an UnarchiveEvent out of the object sent back from the Worker.
* @param {Object} obj * @param {Object} obj
* @return {UnarchiveEvent} * @returns {UnarchiveEvent}
* @private * @private
*/ */
createUnarchiveEvent_(obj) { createUnarchiveEvent_(obj) {
@ -437,7 +437,7 @@ export class UntarrerInternal extends Unarchiver {
* @param {Function(string):Worker} createWorkerFn A function that creates a Worker from a script file. * @param {Function(string):Worker} createWorkerFn A function that creates a Worker from a script file.
* @param {Object|string} options An optional object of options, or a string representing where * @param {Object|string} options An optional object of options, or a string representing where
* the path to the unarchiver script files. * the path to the unarchiver script files.
* @return {Unarchiver} * @returns {Unarchiver}
*/ */
export function getUnarchiverInternal(ab, createWorkerFn, options = {}) { export function getUnarchiverInternal(ab, createWorkerFn, options = {}) {
if (ab.byteLength < 10) { if (ab.byteLength < 10) {

View file

@ -77,7 +77,7 @@ export class Untarrer extends UntarrerInternal {
* as Transferable and sent to a Worker thread once start() is called. * as Transferable and sent to a Worker thread once start() is called.
* @param {Object|string} options An optional object of options, or a string * @param {Object|string} options An optional object of options, or a string
* representing where the path to the unarchiver script files. * representing where the path to the unarchiver script files.
* @return {Unarchiver} * @returns {Unarchiver}
*/ */
export function getUnarchiver(ab, options = {}) { export function getUnarchiver(ab, options = {}) {
return getUnarchiverInternal(ab, createWorkerFn, options); return getUnarchiverInternal(ab, createWorkerFn, options);

View file

@ -57,7 +57,7 @@ function InitCRC() {
/** /**
* @param {number} startCRC * @param {number} startCRC
* @param {Uint8Array} arr * @param {Uint8Array} arr
* @return {number} * @returns {number}
*/ */
function CRC(startCRC, arr) { function CRC(startCRC, arr) {
if (CRCTab[1] == 0) { if (CRCTab[1] == 0) {
@ -204,7 +204,7 @@ const VM_OpType = {
* variables that use the above enums. * variables that use the above enums.
* @param {Object} obj * @param {Object} obj
* @param {number} val * @param {number} val
* @return {string} The key/enum value as a string. * @returns {string} The key/enum value as a string.
*/ */
function findKeyForValue(obj, val) { function findKeyForValue(obj, val) {
for (let key in obj) { for (let key in obj) {
@ -248,7 +248,7 @@ class VM_PreparedOperand {
this.Addr = null; this.Addr = null;
}; };
/** @return {string} */ /** @returns {string} */
toString() { toString() {
if (this.Type === null) { if (this.Type === null) {
return 'Error: Type was null in VM_PreparedOperand'; return 'Error: Type was null in VM_PreparedOperand';
@ -278,7 +278,7 @@ class VM_PreparedCommand {
this.Op2 = new VM_PreparedOperand(); this.Op2 = new VM_PreparedOperand();
} }
/** @return {string} */ /** @returns {string} */
toString(indent) { toString(indent) {
if (this.OpCode === null) { if (this.OpCode === null) {
return 'Error: OpCode was null in VM_PreparedCommand'; return 'Error: OpCode was null in VM_PreparedCommand';
@ -319,7 +319,7 @@ class VM_PreparedProgram {
this.FilteredData = null; this.FilteredData = null;
} }
/** @return {string} */ /** @returns {string} */
toString() { toString() {
let s = '{\n Cmd: [\n'; let s = '{\n Cmd: [\n';
for (let i = 0; i < this.Cmd.length; ++i) { for (let i = 0; i < this.Cmd.length; ++i) {
@ -471,7 +471,7 @@ class RarVM {
/** /**
* @param {Uint8Array} code * @param {Uint8Array} code
* @return {VM_StandardFilters} * @returns {VM_StandardFilters}
*/ */
isStandardFilter(code) { isStandardFilter(code) {
const codeCRC = (CRC(0xffffffff, code, code.length) ^ 0xffffffff) >>> 0; const codeCRC = (CRC(0xffffffff, code, code.length) ^ 0xffffffff) >>> 0;
@ -574,7 +574,7 @@ class RarVM {
/** /**
* @param {Array<VM_PreparedCommand>} preparedCodes * @param {Array<VM_PreparedCommand>} preparedCodes
* @return {boolean} * @returns {boolean}
*/ */
executeCode(preparedCodes) { executeCode(preparedCodes) {
let codeIndex = 0; let codeIndex = 0;
@ -971,7 +971,7 @@ class RarVM {
* Static function that reads in the next set of bits for the VM * Static function that reads in the next set of bits for the VM
* (might return 4, 8, 16 or 32 bits). * (might return 4, 8, 16 or 32 bits).
* @param {bitjs.io.BitStream} bstream A RTL bit stream. * @param {bitjs.io.BitStream} bstream A RTL bit stream.
* @return {number} The value of the bits read. * @returns {number} The value of the bits read.
*/ */
static readData(bstream) { static readData(bstream) {
// Read in the first 2 bits. // Read in the first 2 bits.

View file

@ -90,7 +90,7 @@
* bit7 of byte0, then jumps to bit0 of byte1, etc. * bit7 of byte0, then jumps to bit0 of byte1, etc.
* @param {number} n The number of bits to peek, must be a positive integer. * @param {number} n The number of bits to peek, must be a positive integer.
* @param {boolean=} movePointers Whether to move the pointer, defaults false. * @param {boolean=} movePointers Whether to move the pointer, defaults false.
* @return {number} The peeked bits, as an unsigned number. * @returns {number} The peeked bits, as an unsigned number.
*/ */
peekBits_ltm(n, opt_movePointers) { peekBits_ltm(n, opt_movePointers) {
const NUM = parseInt(n, 10); const NUM = parseInt(n, 10);
@ -148,7 +148,7 @@
* bit0 of byte0, then goes to bit7 of byte1, etc. * bit0 of byte0, then goes to bit7 of byte1, etc.
* @param {number} n The number of bits to peek. Must be a positive integer. * @param {number} n The number of bits to peek. Must be a positive integer.
* @param {boolean=} movePointers Whether to move the pointer, defaults false. * @param {boolean=} movePointers Whether to move the pointer, defaults false.
* @return {number} The peeked bits, as an unsigned number. * @returns {number} The peeked bits, as an unsigned number.
*/ */
peekBits_mtl(n, opt_movePointers) { peekBits_mtl(n, opt_movePointers) {
const NUM = parseInt(n, 10); const NUM = parseInt(n, 10);
@ -211,7 +211,7 @@
/** /**
* Reads n bits out of the stream, consuming them (moving the bit pointer). * Reads n bits out of the stream, consuming them (moving the bit pointer).
* @param {number} n The number of bits to read. Must be a positive integer. * @param {number} n The number of bits to read. Must be a positive integer.
* @return {number} The read bits, as an unsigned number. * @returns {number} The read bits, as an unsigned number.
*/ */
readBits(n) { readBits(n) {
return this.peekBits(n, true); return this.peekBits(n, true);
@ -223,7 +223,7 @@
* bits in the current byte. * bits in the current byte.
* @param {number} n The number of bytes to peek. Must be a positive integer. * @param {number} n The number of bytes to peek. Must be a positive integer.
* @param {boolean=} movePointers Whether to move the pointer, defaults false. * @param {boolean=} movePointers Whether to move the pointer, defaults false.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
peekBytes(n, opt_movePointers) { peekBytes(n, opt_movePointers) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -276,7 +276,7 @@
/** /**
* @param {number} n The number of bytes to read. * @param {number} n The number of bytes to read.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
readBytes(n) { readBytes(n) {
return this.peekBytes(n, true); return this.peekBytes(n, true);

View file

@ -93,7 +93,7 @@
* Peeks at the next n bytes as an unsigned number but does not advance the * Peeks at the next n bytes as an unsigned number but does not advance the
* pointer. * pointer.
* @param {number} n The number of bytes to peek at. Must be a positive integer. * @param {number} n The number of bytes to peek at. Must be a positive integer.
* @return {number} The n bytes interpreted as an unsigned number. * @returns {number} The n bytes interpreted as an unsigned number.
*/ */
peekNumber(n) { peekNumber(n) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -134,7 +134,7 @@
* Returns the next n bytes as an unsigned number (or -1 on error) * Returns the next n bytes as an unsigned number (or -1 on error)
* and advances the stream pointer n bytes. * and advances the stream pointer n bytes.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {number} The n bytes interpreted as an unsigned number. * @returns {number} The n bytes interpreted as an unsigned number.
*/ */
readNumber(n) { readNumber(n) {
const num = this.peekNumber(n); const num = this.peekNumber(n);
@ -147,7 +147,7 @@
* Returns the next n bytes as a signed number but does not advance the * Returns the next n bytes as a signed number but does not advance the
* pointer. * pointer.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {number} The bytes interpreted as a signed number. * @returns {number} The bytes interpreted as a signed number.
*/ */
peekSignedNumber(n) { peekSignedNumber(n) {
let num = this.peekNumber(n); let num = this.peekNumber(n);
@ -163,7 +163,7 @@
/** /**
* Returns the next n bytes as a signed number and advances the stream pointer. * Returns the next n bytes as a signed number and advances the stream pointer.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {number} The bytes interpreted as a signed number. * @returns {number} The bytes interpreted as a signed number.
*/ */
readSignedNumber(n) { readSignedNumber(n) {
const num = this.peekSignedNumber(n); const num = this.peekSignedNumber(n);
@ -177,7 +177,7 @@
* is true. * is true.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @param {boolean} movePointers Whether to move the pointers. * @param {boolean} movePointers Whether to move the pointers.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
peekBytes(n, movePointers) { peekBytes(n, movePointers) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -223,7 +223,7 @@
/** /**
* Reads the next n bytes as a sub-array. * Reads the next n bytes as a sub-array.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
readBytes(n) { readBytes(n) {
return this.peekBytes(n, true); return this.peekBytes(n, true);
@ -232,7 +232,7 @@
/** /**
* Peeks at the next n bytes as an ASCII string but does not advance the pointer. * Peeks at the next n bytes as an ASCII string but does not advance the pointer.
* @param {number} n The number of bytes to peek at. Must be a positive integer. * @param {number} n The number of bytes to peek at. Must be a positive integer.
* @return {string} The next n bytes as a string. * @returns {string} The next n bytes as a string.
*/ */
peekString(n) { peekString(n) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -267,7 +267,7 @@
* Returns the next n bytes as an ASCII string and advances the stream pointer * Returns the next n bytes as an ASCII string and advances the stream pointer
* n bytes. * n bytes.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {string} The next n bytes as a string. * @returns {string} The next n bytes as a string.
*/ */
readString(n) { readString(n) {
const strToReturn = this.peekString(n); const strToReturn = this.peekString(n);
@ -292,7 +292,7 @@
/** /**
* Creates a new ByteStream from this ByteStream that can be read / peeked. * Creates a new ByteStream from this ByteStream that can be read / peeked.
* @return {ByteStream} A clone of this ByteStream. * @returns {ByteStream} A clone of this ByteStream.
*/ */
tee() { tee() {
const clone = new ByteStream(this.bytes.buffer); const clone = new ByteStream(this.bytes.buffer);

View file

@ -16,7 +16,7 @@ let loadingPromise = undefined;
let api = undefined; let api = undefined;
/** /**
* @return {Promise<Object>} Returns the API object. * @returns {Promise<Object>} Returns the API object.
*/ */
function loadWebPShimApi() { function loadWebPShimApi() {
if (api) { return Promise.resolve(api); } if (api) { return Promise.resolve(api); }

View file

@ -94,7 +94,7 @@ bitjs.io.BitStream =
* bit7 of byte0, then jumps to bit0 of byte1, etc. * bit7 of byte0, then jumps to bit0 of byte1, etc.
* @param {number} n The number of bits to peek, must be a positive integer. * @param {number} n The number of bits to peek, must be a positive integer.
* @param {boolean=} movePointers Whether to move the pointer, defaults false. * @param {boolean=} movePointers Whether to move the pointer, defaults false.
* @return {number} The peeked bits, as an unsigned number. * @returns {number} The peeked bits, as an unsigned number.
*/ */
peekBits_ltm(n, opt_movePointers) { peekBits_ltm(n, opt_movePointers) {
const NUM = parseInt(n, 10); const NUM = parseInt(n, 10);
@ -152,7 +152,7 @@ bitjs.io.BitStream =
* bit0 of byte0, then goes to bit7 of byte1, etc. * bit0 of byte0, then goes to bit7 of byte1, etc.
* @param {number} n The number of bits to peek. Must be a positive integer. * @param {number} n The number of bits to peek. Must be a positive integer.
* @param {boolean=} movePointers Whether to move the pointer, defaults false. * @param {boolean=} movePointers Whether to move the pointer, defaults false.
* @return {number} The peeked bits, as an unsigned number. * @returns {number} The peeked bits, as an unsigned number.
*/ */
peekBits_mtl(n, opt_movePointers) { peekBits_mtl(n, opt_movePointers) {
const NUM = parseInt(n, 10); const NUM = parseInt(n, 10);
@ -215,7 +215,7 @@ bitjs.io.BitStream =
/** /**
* Reads n bits out of the stream, consuming them (moving the bit pointer). * Reads n bits out of the stream, consuming them (moving the bit pointer).
* @param {number} n The number of bits to read. Must be a positive integer. * @param {number} n The number of bits to read. Must be a positive integer.
* @return {number} The read bits, as an unsigned number. * @returns {number} The read bits, as an unsigned number.
*/ */
readBits(n) { readBits(n) {
return this.peekBits(n, true); return this.peekBits(n, true);
@ -227,7 +227,7 @@ bitjs.io.BitStream =
* bits in the current byte. * bits in the current byte.
* @param {number} n The number of bytes to peek. Must be a positive integer. * @param {number} n The number of bytes to peek. Must be a positive integer.
* @param {boolean=} movePointers Whether to move the pointer, defaults false. * @param {boolean=} movePointers Whether to move the pointer, defaults false.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
peekBytes(n, opt_movePointers) { peekBytes(n, opt_movePointers) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -280,7 +280,7 @@ bitjs.io.BitStream =
/** /**
* @param {number} n The number of bytes to read. * @param {number} n The number of bytes to read.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
readBytes(n) { readBytes(n) {
return this.peekBytes(n, true); return this.peekBytes(n, true);

View file

@ -92,7 +92,7 @@ export const BitStream =
* bit7 of byte0, then jumps to bit0 of byte1, etc. * bit7 of byte0, then jumps to bit0 of byte1, etc.
* @param {number} n The number of bits to peek, must be a positive integer. * @param {number} n The number of bits to peek, must be a positive integer.
* @param {boolean=} movePointers Whether to move the pointer, defaults false. * @param {boolean=} movePointers Whether to move the pointer, defaults false.
* @return {number} The peeked bits, as an unsigned number. * @returns {number} The peeked bits, as an unsigned number.
*/ */
peekBits_ltm(n, opt_movePointers) { peekBits_ltm(n, opt_movePointers) {
const NUM = parseInt(n, 10); const NUM = parseInt(n, 10);
@ -150,7 +150,7 @@ export const BitStream =
* bit0 of byte0, then goes to bit7 of byte1, etc. * bit0 of byte0, then goes to bit7 of byte1, etc.
* @param {number} n The number of bits to peek. Must be a positive integer. * @param {number} n The number of bits to peek. Must be a positive integer.
* @param {boolean=} movePointers Whether to move the pointer, defaults false. * @param {boolean=} movePointers Whether to move the pointer, defaults false.
* @return {number} The peeked bits, as an unsigned number. * @returns {number} The peeked bits, as an unsigned number.
*/ */
peekBits_mtl(n, opt_movePointers) { peekBits_mtl(n, opt_movePointers) {
const NUM = parseInt(n, 10); const NUM = parseInt(n, 10);
@ -213,7 +213,7 @@ export const BitStream =
/** /**
* Reads n bits out of the stream, consuming them (moving the bit pointer). * Reads n bits out of the stream, consuming them (moving the bit pointer).
* @param {number} n The number of bits to read. Must be a positive integer. * @param {number} n The number of bits to read. Must be a positive integer.
* @return {number} The read bits, as an unsigned number. * @returns {number} The read bits, as an unsigned number.
*/ */
readBits(n) { readBits(n) {
return this.peekBits(n, true); return this.peekBits(n, true);
@ -225,7 +225,7 @@ export const BitStream =
* bits in the current byte. * bits in the current byte.
* @param {number} n The number of bytes to peek. Must be a positive integer. * @param {number} n The number of bytes to peek. Must be a positive integer.
* @param {boolean=} movePointers Whether to move the pointer, defaults false. * @param {boolean=} movePointers Whether to move the pointer, defaults false.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
peekBytes(n, opt_movePointers) { peekBytes(n, opt_movePointers) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -278,7 +278,7 @@ export const BitStream =
/** /**
* @param {number} n The number of bytes to read. * @param {number} n The number of bytes to read.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
readBytes(n) { readBytes(n) {
return this.peekBytes(n, true); return this.peekBytes(n, true);

View file

@ -97,7 +97,7 @@ bitjs.io.ByteStream =
* Peeks at the next n bytes as an unsigned number but does not advance the * Peeks at the next n bytes as an unsigned number but does not advance the
* pointer. * pointer.
* @param {number} n The number of bytes to peek at. Must be a positive integer. * @param {number} n The number of bytes to peek at. Must be a positive integer.
* @return {number} The n bytes interpreted as an unsigned number. * @returns {number} The n bytes interpreted as an unsigned number.
*/ */
peekNumber(n) { peekNumber(n) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -138,7 +138,7 @@ bitjs.io.ByteStream =
* Returns the next n bytes as an unsigned number (or -1 on error) * Returns the next n bytes as an unsigned number (or -1 on error)
* and advances the stream pointer n bytes. * and advances the stream pointer n bytes.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {number} The n bytes interpreted as an unsigned number. * @returns {number} The n bytes interpreted as an unsigned number.
*/ */
readNumber(n) { readNumber(n) {
const num = this.peekNumber(n); const num = this.peekNumber(n);
@ -151,7 +151,7 @@ bitjs.io.ByteStream =
* Returns the next n bytes as a signed number but does not advance the * Returns the next n bytes as a signed number but does not advance the
* pointer. * pointer.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {number} The bytes interpreted as a signed number. * @returns {number} The bytes interpreted as a signed number.
*/ */
peekSignedNumber(n) { peekSignedNumber(n) {
let num = this.peekNumber(n); let num = this.peekNumber(n);
@ -167,7 +167,7 @@ bitjs.io.ByteStream =
/** /**
* Returns the next n bytes as a signed number and advances the stream pointer. * Returns the next n bytes as a signed number and advances the stream pointer.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {number} The bytes interpreted as a signed number. * @returns {number} The bytes interpreted as a signed number.
*/ */
readSignedNumber(n) { readSignedNumber(n) {
const num = this.peekSignedNumber(n); const num = this.peekSignedNumber(n);
@ -181,7 +181,7 @@ bitjs.io.ByteStream =
* is true. * is true.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @param {boolean} movePointers Whether to move the pointers. * @param {boolean} movePointers Whether to move the pointers.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
peekBytes(n, movePointers) { peekBytes(n, movePointers) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -227,7 +227,7 @@ bitjs.io.ByteStream =
/** /**
* Reads the next n bytes as a sub-array. * Reads the next n bytes as a sub-array.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
readBytes(n) { readBytes(n) {
return this.peekBytes(n, true); return this.peekBytes(n, true);
@ -236,7 +236,7 @@ bitjs.io.ByteStream =
/** /**
* Peeks at the next n bytes as an ASCII string but does not advance the pointer. * Peeks at the next n bytes as an ASCII string but does not advance the pointer.
* @param {number} n The number of bytes to peek at. Must be a positive integer. * @param {number} n The number of bytes to peek at. Must be a positive integer.
* @return {string} The next n bytes as a string. * @returns {string} The next n bytes as a string.
*/ */
peekString(n) { peekString(n) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -271,7 +271,7 @@ bitjs.io.ByteStream =
* Returns the next n bytes as an ASCII string and advances the stream pointer * Returns the next n bytes as an ASCII string and advances the stream pointer
* n bytes. * n bytes.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {string} The next n bytes as a string. * @returns {string} The next n bytes as a string.
*/ */
readString(n) { readString(n) {
const strToReturn = this.peekString(n); const strToReturn = this.peekString(n);
@ -296,7 +296,7 @@ bitjs.io.ByteStream =
/** /**
* Creates a new ByteStream from this ByteStream that can be read / peeked. * Creates a new ByteStream from this ByteStream that can be read / peeked.
* @return {ByteStream} A clone of this ByteStream. * @returns {ByteStream} A clone of this ByteStream.
*/ */
tee() { tee() {
const clone = new ByteStream(this.bytes.buffer); const clone = new ByteStream(this.bytes.buffer);

View file

@ -95,7 +95,7 @@ export const ByteStream =
* Peeks at the next n bytes as an unsigned number but does not advance the * Peeks at the next n bytes as an unsigned number but does not advance the
* pointer. * pointer.
* @param {number} n The number of bytes to peek at. Must be a positive integer. * @param {number} n The number of bytes to peek at. Must be a positive integer.
* @return {number} The n bytes interpreted as an unsigned number. * @returns {number} The n bytes interpreted as an unsigned number.
*/ */
peekNumber(n) { peekNumber(n) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -136,7 +136,7 @@ export const ByteStream =
* Returns the next n bytes as an unsigned number (or -1 on error) * Returns the next n bytes as an unsigned number (or -1 on error)
* and advances the stream pointer n bytes. * and advances the stream pointer n bytes.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {number} The n bytes interpreted as an unsigned number. * @returns {number} The n bytes interpreted as an unsigned number.
*/ */
readNumber(n) { readNumber(n) {
const num = this.peekNumber(n); const num = this.peekNumber(n);
@ -149,7 +149,7 @@ export const ByteStream =
* Returns the next n bytes as a signed number but does not advance the * Returns the next n bytes as a signed number but does not advance the
* pointer. * pointer.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {number} The bytes interpreted as a signed number. * @returns {number} The bytes interpreted as a signed number.
*/ */
peekSignedNumber(n) { peekSignedNumber(n) {
let num = this.peekNumber(n); let num = this.peekNumber(n);
@ -165,7 +165,7 @@ export const ByteStream =
/** /**
* Returns the next n bytes as a signed number and advances the stream pointer. * Returns the next n bytes as a signed number and advances the stream pointer.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {number} The bytes interpreted as a signed number. * @returns {number} The bytes interpreted as a signed number.
*/ */
readSignedNumber(n) { readSignedNumber(n) {
const num = this.peekSignedNumber(n); const num = this.peekSignedNumber(n);
@ -179,7 +179,7 @@ export const ByteStream =
* is true. * is true.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @param {boolean} movePointers Whether to move the pointers. * @param {boolean} movePointers Whether to move the pointers.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
peekBytes(n, movePointers) { peekBytes(n, movePointers) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -225,7 +225,7 @@ export const ByteStream =
/** /**
* Reads the next n bytes as a sub-array. * Reads the next n bytes as a sub-array.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {Uint8Array} The subarray. * @returns {Uint8Array} The subarray.
*/ */
readBytes(n) { readBytes(n) {
return this.peekBytes(n, true); return this.peekBytes(n, true);
@ -234,7 +234,7 @@ export const ByteStream =
/** /**
* Peeks at the next n bytes as an ASCII string but does not advance the pointer. * Peeks at the next n bytes as an ASCII string but does not advance the pointer.
* @param {number} n The number of bytes to peek at. Must be a positive integer. * @param {number} n The number of bytes to peek at. Must be a positive integer.
* @return {string} The next n bytes as a string. * @returns {string} The next n bytes as a string.
*/ */
peekString(n) { peekString(n) {
const num = parseInt(n, 10); const num = parseInt(n, 10);
@ -269,7 +269,7 @@ export const ByteStream =
* Returns the next n bytes as an ASCII string and advances the stream pointer * Returns the next n bytes as an ASCII string and advances the stream pointer
* n bytes. * n bytes.
* @param {number} n The number of bytes to read. Must be a positive integer. * @param {number} n The number of bytes to read. Must be a positive integer.
* @return {string} The next n bytes as a string. * @returns {string} The next n bytes as a string.
*/ */
readString(n) { readString(n) {
const strToReturn = this.peekString(n); const strToReturn = this.peekString(n);
@ -294,7 +294,7 @@ export const ByteStream =
/** /**
* Creates a new ByteStream from this ByteStream that can be read / peeked. * Creates a new ByteStream from this ByteStream that can be read / peeked.
* @return {ByteStream} A clone of this ByteStream. * @returns {ByteStream} A clone of this ByteStream.
*/ */
tee() { tee() {
const clone = new ByteStream(this.bytes.buffer); const clone = new ByteStream(this.bytes.buffer);