mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 11:45:49 +00:00
Fix deriveXAddress null behavior (#1964)
* Fix deriveXAddress null behavior * Also check for undefined * Simplify theTag * Add test case for undefined
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
# ripple-address-codec
|
||||
|
||||
## Unreleased
|
||||
- Fixed `encodeXAddress` to handle `null` equivalently to `false`.
|
||||
|
||||
## 4.2.1 (2021-12-1)
|
||||
- Fix issue where npm < 7 could not install the library
|
||||
- Initial pass at linting this codebase with new rules
|
||||
|
||||
@@ -43,8 +43,9 @@ function encodeXAddress(
|
||||
if (tag > MAX_32_BIT_UNSIGNED_INT) {
|
||||
throw new Error('Invalid tag')
|
||||
}
|
||||
const theTag = tag === false ? 0 : tag
|
||||
const flag = tag === false ? 0 : 1
|
||||
const theTag = tag || 0
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Passing null is a common js mistake
|
||||
const flag = tag === false || tag == null ? 0 : 1
|
||||
/* eslint-disable no-bitwise ---
|
||||
* need to use bitwise operations here */
|
||||
const bytes = Buffer.concat([
|
||||
|
||||
Reference in New Issue
Block a user