Skip to content

Commit 6258f15

Browse files
committed
Update docstrings
1 parent 886c234 commit 6258f15

File tree

5 files changed

+7
-19
lines changed

5 files changed

+7
-19
lines changed

lib/parsers/binary/index.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@
2323
*/
2424

2525
/**
26-
* @fileoverview JavaScript binary parser for any browser or environment.
26+
* @fileoverview binary parser.
2727
* @see https://github.com/rochars/byte-data
28+
* @see https://github.com/rochars/wavefile
2829
*/
2930

30-
/** @module byte-data */
31-
3231
import { endianness } from './lib/endianness';
3332
import { pack as packUTF8, unpack as unpackUTF8 } from './lib/utf8-parser';
3433
import { IntParser } from './lib/int-parser';
@@ -49,7 +48,6 @@ export function unpackString(buffer, index=0, end=buffer.length) {
4948
* Write a string of UTF-8 characters as a byte buffer.
5049
* @param {string} str The string to pack.
5150
* @return {!Array<number>} The UTF-8 string bytes.
52-
* @throws {TypeError} If 'str' is not a string.
5351
*/
5452
export function packString(str) {
5553
/** @type {!Array<number>} */
@@ -64,7 +62,6 @@ export function packString(str) {
6462
* @param {!(Uint8Array|Array<number>)} buffer The output buffer.
6563
* @param {number} [index=0] The buffer index to start writing.
6664
* @return {number} The next index to write in the buffer.
67-
* @throws {TypeError} If 'str' is not a string.
6865
*/
6966
export function packStringTo(str, buffer, index=0) {
7067
return packUTF8(str, buffer, index);
@@ -83,8 +80,6 @@ export function packStringTo(str, buffer, index=0) {
8380
* @param {number} [index=0] The buffer index to start writing.
8481
* @return {number} The next index to write.
8582
* @throws {Error} If the type definition is not valid.
86-
* @throws {RangeError} On overflow if clamp is set to false.
87-
* @throws {TypeError} If 'values' is not a array of numbers.
8883
*/
8984
export function packArrayTo(values, theType, buffer, index=0) {
9085
theType = theType || {};
@@ -150,9 +145,6 @@ export function unpackArrayTo(
150145
* @param {number} [index=0] The buffer index to write.
151146
* @return {number} The next index to write.
152147
* @throws {Error} If the type definition is not valid.
153-
* @throws {RangeError} On overflow if clamp is set to false.
154-
* @throws {TypeError} If 'value' is not a number.
155-
* @throws {TypeError} If 'value' is not a int and type is int.
156148
*/
157149
export function packTo(value, theType, buffer, index=0) {
158150
return packArrayTo([value], theType, buffer, index);
@@ -167,7 +159,6 @@ export function packTo(value, theType, buffer, index=0) {
167159
* be: (boolean|undefined)}} theType The type definition.
168160
* @return {!Array<number>} The packed value.
169161
* @throws {Error} If the type definition is not valid.
170-
* @throws {TypeError} If 'value' is not a number.
171162
*/
172163
export function pack(value, theType) {
173164
/** @type {!Array<number>} */
@@ -186,7 +177,6 @@ export function pack(value, theType) {
186177
* @param {number} [index=0] The buffer index to read.
187178
* @return {number}
188179
* @throws {Error} If the type definition is not valid.
189-
* @throws {Error} On bad input buffer length if on safe mode.
190180
*/
191181
export function unpack(buffer, theType, index=0) {
192182
let output = [];
@@ -202,7 +192,6 @@ export function unpack(buffer, theType, index=0) {
202192
* @param {number} start The buffer index to start reading.
203193
* @param {number} end The buffer index to stop reading.
204194
* @param {!Object} parser The parser.
205-
* @throws {Error} If the type definition is not valid.
206195
* @private
207196
*/
208197
function unpack_(buffer, output, start, end, parser) {
@@ -230,7 +219,6 @@ function copyBuffer_(buffer) {
230219
* @param {number} start The buffer index to start reading.
231220
* @param {number} end The buffer index to stop reading.
232221
* @param {number} offset The number of bytes used by the type.
233-
* @throws {Error} On bad buffer length, if safe.
234222
* @private
235223
*/
236224
function getUnpackLen_(buffer, start, end, offset) {

lib/parsers/binary/lib/endianness.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/**
2626
* @fileoverview A function to swap endianness in byte buffers.
2727
* @see https://github.com/rochars/byte-data
28+
* @see https://github.com/rochars/wavefile
2829
*/
2930

3031
/**

lib/parsers/binary/lib/float-parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
/**
2828
* @fileoverview Encode and decode IEEE 754 floating point numbers.
2929
* @see https://github.com/rochars/byte-data
30+
* @see https://github.com/rochars/wavefile
3031
* @see https://bitbucket.org/lindenlab/llsd/raw/7d2646cd3f9b4c806e73aebc4b32bd81e4047fdc/js/typedarray.js
3132
* @see https://github.com/kazuho/ieee754.js/blob/master/ieee754.js
3233
*/
@@ -84,7 +85,6 @@ export class FloatParser {
8485
* @param {number} num The number.
8586
* @param {number} index The index to write on the buffer.
8687
* @return {number} The next index to write on the buffer.
87-
* @throws {TypeError} If input is not a number.
8888
*/
8989
pack(buffer, num, index) {
9090
// Round overflows

lib/parsers/binary/lib/int-parser.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/**
2626
* @fileoverview Encode and decode int numbers to and from byte buffers.
2727
* @see https://github.com/rochars/byte-data
28+
* @see https://github.com/rochars/wavefile
2829
*/
2930

3031
/**
@@ -74,8 +75,6 @@ export class IntParser {
7475
* @param {number} num The number. Overflows are truncated.
7576
* @param {number} [index=0] The index being written in the byte buffer.
7677
* @return {number} The next index to write on the byte buffer.
77-
* @throws {RangeError} On overflow if clamp is set to false.
78-
* @throws {TypeError} If num is not a number.
7978
*/
8079
pack(buffer, num, index=0) {
8180
num = this.clamp_(Math.round(num));

lib/parsers/binary/lib/utf8-parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
*/
2424

2525
/**
26-
* @fileoverview Functions to serialize and deserialize UTF-8 strings.
26+
* @fileoverview Encode and decode UTF8 strings to and from byte buffers.
2727
* @see https://github.com/rochars/byte-data
28+
* @see https://github.com/rochars/wavefile
2829
* @see https://encoding.spec.whatwg.org/#the-encoding
2930
* @see https://encoding.spec.whatwg.org/#utf-8-encoder
3031
*/
@@ -109,7 +110,6 @@ export function unpack(buffer, start=0, end=buffer.length) {
109110
* @param {!Uint8Array|!Array<number>} buffer The buffer to pack the string to.
110111
* @param {number=} index The buffer index to start writing.
111112
* @return {number} The next index to write in the buffer.
112-
* @throws {TypeError} If 'str' is not a string.
113113
*/
114114
export function pack(str, buffer, index=0) {
115115
/** @type {number} */

0 commit comments

Comments
 (0)