bireader 1.0.41 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -289,12 +289,13 @@ Common functions for setup, movement, manipulation and math shared by both.
289
289
  <tr>
290
290
  <td>Name</td>
291
291
  <td>new bireader(<b>data</b>, byteOffset, bitOffset, endianess, strict)</td>
292
- <td align="center" rowspan="2"><b>Buffer or Uint8Array</b>, byte offset (default 0), bit offset (default 0), endian big or little (default little), strict mode true to restrict extending initially supplied data (default true for reader, false for writer)</td>
293
- <td rowspan="2">Start with new Constructor.<br><b>Note:</b> Data can always be found with .data</td>
292
+ <td align="center" rowspan="2"><b>Buffer or Uint8Array</b>, byte offset (default 0), bit offset (default 0), endian big or little (default little), strict mode true to restrict extending initially supplied data (default true for reader, false for writer)
293
+ </td>
294
+ <td rowspan="2">Start with new Constructor.<br><br><b>Note:</b> Data can always be found with .data. Also biwrite can created without data and will default to a supplied offset as a Buffer (if available) or Uint8Array.</td>
294
295
  </tr>
295
296
  <tr>
296
297
  <td>Name</td>
297
- <td>new biwriter(<b>data</b>, byteOffset, bitOffset, endianess, strict)</td>
298
+ <td>new biwriter(data, byteOffset, bitOffset, endianess, strict)</td>
298
299
  </tr>
299
300
  <tr>
300
301
  <td>Name</td>
package/lib/cjs/index.js CHANGED
@@ -681,7 +681,7 @@ function wbit(_this, value, bits, unsigned, endian) {
681
681
  return;
682
682
  }
683
683
  if (bits <= 0 || bits > 32) {
684
- throw new Error('Bit length must be between 1 and 32.');
684
+ throw new Error('Bit length must be between 1 and 32. Got ' + bits);
685
685
  }
686
686
  if (unsigned == true) {
687
687
  if (value < 0 || value > Math.pow(2, bits)) {
@@ -741,7 +741,7 @@ function rbit(_this, bits, unsigned, endian) {
741
741
  return 0;
742
742
  }
743
743
  if (bits <= 0 || bits > 32) {
744
- throw new Error('Bit length must be between 1 and 32.');
744
+ throw new Error('Bit length must be between 1 and 32. Got ' + bits);
745
745
  }
746
746
  const size_needed = ((((bits - 1) + _this.bitoffset) / 8) + _this.offset);
747
747
  if (bits <= 0 || size_needed > _this.size) {