bn.js 5.2.1 → 5.2.2

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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/lib/bn.js +1 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -44,7 +44,7 @@ is the list of them in the order of appearance in the function name:
44
44
  ### Postfixes
45
45
 
46
46
  * `n` - the argument of the function must be a plain JavaScript
47
- Number. Decimals are not supported.
47
+ Number. Decimals are not supported. The number passed must be smaller than 0x4000000 (67_108_864). Otherwise, an error is thrown.
48
48
  * `rn` - both argument and return value of the function are plain JavaScript
49
49
  Numbers. Decimals are not supported.
50
50
 
@@ -69,7 +69,7 @@ either `le` (little-endian) or `be` (big-endian).
69
69
  pad to length, throwing if already exceeding
70
70
  * `a.toArrayLike(type, endian, length)` - convert to an instance of `type`,
71
71
  which must behave like an `Array`
72
- * `a.toBuffer(endian, length)` - convert to Node.js Buffer (if available). For
72
+ * `a.toBuffer(endian, length)` - convert to Node.js Buffer (if available). `length` in bytes. For
73
73
  compatibility with browserify and similar tools, use this instead:
74
74
  `a.toArrayLike(Buffer, endian, length)`
75
75
  * `a.bitLength()` - get number of bits occupied
package/lib/bn.js CHANGED
@@ -2008,6 +2008,7 @@
2008
2008
  this.words[i] = carry;
2009
2009
  this.length++;
2010
2010
  }
2011
+ this.length = num === 0 ? 1 : this.length;
2011
2012
 
2012
2013
  return isNegNum ? this.ineg() : this;
2013
2014
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bn.js",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "description": "Big number implementation in pure javascript",
5
5
  "keywords": [
6
6
  "BN",