(value)
| 2333 | } |
| 2334 | |
| 2335 | function tryConvertBigNumberToString(value) { |
| 2336 | const nativeToString = value && value.toString; |
| 2337 | if (typeof nativeToString === 'function' && nativeToString !== Object.prototype.toString) { |
| 2338 | try { |
| 2339 | const result = nativeToString.call(value); |
| 2340 | if (typeof result === 'string' && result !== '[object Object]') { |
| 2341 | return result; |
| 2342 | } |
| 2343 | } catch (e) {} |
| 2344 | } |
| 2345 | const ctor = getAvailableBigNumberCtor(); |
| 2346 | if (ctor && typeof Object.setPrototypeOf === 'function') { |
| 2347 | try { |
| 2348 | if (!(value instanceof ctor)) { |
| 2349 | Object.setPrototypeOf(value, ctor.prototype); |
| 2350 | } |
| 2351 | if (typeof value.toString === 'function' && value.toString !== Object.prototype.toString) { |
| 2352 | const result = value.toString(); |
| 2353 | if (typeof result === 'string' && result !== '[object Object]') { |
| 2354 | return result; |
| 2355 | } |
| 2356 | } |
| 2357 | } catch (e) {} |
| 2358 | } |
| 2359 | return null; |
| 2360 | } |
| 2361 | |
| 2362 | function rebuildBigNumberFromParts(value) { |
| 2363 | const sign = value.s < 0 ? '-' : ''; |
no test coverage detected