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-
3231import { endianness } from './lib/endianness' ;
3332import { pack as packUTF8 , unpack as unpackUTF8 } from './lib/utf8-parser' ;
3433import { 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 */
5452export 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 */
6966export 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 */
8984export 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 */
157149export 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 */
172163export 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 */
191181export 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 */
208197function 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 */
236224function getUnpackLen_ ( buffer , start , end , offset ) {
0 commit comments