@ocap/util 1.24.7 → 1.24.9

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/esm/bn.d.ts CHANGED
@@ -4,3 +4,4 @@ export interface BN extends BaseBN {
4
4
  export declare class BN extends BaseBN {
5
5
  constructor(value: number | string | number[] | Uint8Array | Buffer | BaseBN | null | undefined, base?: number | 'hex', endian?: BaseBN.Endianness);
6
6
  }
7
+ export { BaseBN };
package/esm/bn.js CHANGED
@@ -4,3 +4,4 @@ export class BN extends BaseBN {
4
4
  super(value === null ? '0' : value, base, endian);
5
5
  }
6
6
  }
7
+ export { BaseBN };
package/esm/index.js CHANGED
@@ -10,7 +10,7 @@ import leftPad from 'lodash/padStart';
10
10
  import base58 from 'bs58';
11
11
  import base64 from 'base64-url';
12
12
  import * as utf8 from 'utf8';
13
- import { BN } from './bn';
13
+ import { BN, BaseBN } from './bn';
14
14
  const DID_PREFIX = 'did:abt:';
15
15
  const zero = new BN(0);
16
16
  const negative1 = new BN(-1);
@@ -102,7 +102,10 @@ export const stripHexPrefix = (str) => {
102
102
  * @param {Object} object
103
103
  * @returns {Boolean}
104
104
  */
105
- export const isBN = (object) => object instanceof BN || (object && object.constructor && object.constructor.name === 'BN');
105
+ export const isBN = (object) => object instanceof BN ||
106
+ object instanceof BaseBN ||
107
+ // constructor validation only work for node cause browser bundle will obfuscated code
108
+ (object && object.constructor && object.constructor.name === 'BN');
106
109
  /**
107
110
  * Returns true if object is BigNumber, otherwise false
108
111
  *
package/lib/bn.d.ts CHANGED
@@ -4,3 +4,4 @@ export interface BN extends BaseBN {
4
4
  export declare class BN extends BaseBN {
5
5
  constructor(value: number | string | number[] | Uint8Array | Buffer | BaseBN | null | undefined, base?: number | 'hex', endian?: BaseBN.Endianness);
6
6
  }
7
+ export { BaseBN };
package/lib/bn.js CHANGED
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.BN = void 0;
6
+ exports.BaseBN = exports.BN = void 0;
7
7
  const bn_js_1 = __importDefault(require("bn.js"));
8
+ exports.BaseBN = bn_js_1.default;
8
9
  class BN extends bn_js_1.default {
9
10
  constructor(value, base, endian) {
10
11
  super(value === null ? '0' : value, base, endian);
package/lib/index.js CHANGED
@@ -150,7 +150,10 @@ exports.stripHexPrefix = stripHexPrefix;
150
150
  * @param {Object} object
151
151
  * @returns {Boolean}
152
152
  */
153
- const isBN = (object) => object instanceof bn_1.BN || (object && object.constructor && object.constructor.name === 'BN');
153
+ const isBN = (object) => object instanceof bn_1.BN ||
154
+ object instanceof bn_1.BaseBN ||
155
+ // constructor validation only work for node cause browser bundle will obfuscated code
156
+ (object && object.constructor && object.constructor.name === 'BN');
154
157
  exports.isBN = isBN;
155
158
  /**
156
159
  * Returns true if object is BigNumber, otherwise false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocap/util",
3
- "version": "1.24.7",
3
+ "version": "1.24.9",
4
4
  "description": "utils shared across multiple forge js libs, works in both node.js and browser",
5
5
  "keywords": [
6
6
  "arcblock",
@@ -17,7 +17,7 @@
17
17
  "bs58": "^5.0.0",
18
18
  "lodash": "^4.17.21",
19
19
  "utf8": "^3.0.0",
20
- "@ocap/types": "^1.24.7"
20
+ "@ocap/types": "^1.24.9"
21
21
  },
22
22
  "resolutions": {
23
23
  "elliptic": "6.5.3"