Skip to content

Commit

Permalink
Merge pull request #10 from ZIMkaRU/bugfix/fix-merge-to-not-throw-err…
Browse files Browse the repository at this point in the history
…-with-non-obj-in-src

Fix merge to not throw err with non obj in src
  • Loading branch information
prdn authored Oct 27, 2023
2 parents 7af8318 + fc83ee0 commit 9c9b319
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.2.1
- fix: merge should not throw an error with non-plain objects in sources

# 1.2.0
- feat: get
- feat: isEmpty
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bitfinex/lib-js-util-base",
"version": "1.2.0",
"version": "1.2.1",
"description": "general utils",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions src/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ const merge = (target, ...sources) => {
const cloneObj = _cloneObj(target)

for (const source of sources) {
if (!isPlainObject(source)) {
continue
}

const keys = Object.keys(source)

for (const key of keys) {
Expand Down
7 changes: 7 additions & 0 deletions test/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,11 @@ describe('merge', () => {
circularObj.self = circularObj
assert.deepStrictEqual(merge({}, circularObj), Object.assign({}, circularObj))
})

it('should not throw an error with non-plain objects in sources', () => {
const expected = { a: 4 }
const actual = merge({ a: 1 }, expected, undefined, null, true, '', NaN, /x/, Symbol('a'))

assert.deepStrictEqual(actual, expected)
})
})

1 comment on commit 9c9b319

@nodeLogs
Copy link

@nodeLogs nodeLogs commented on 9c9b319 Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear Repository Members,

I apologize for reaching out in this manner and am aware that this might not be the typical way of communication here. However, I am hopeful that @prdn and the rest of the team might notice and acknowledge my message. This is my last chance in seeking assistance.

My colleagues and I have faced a significant issue due to a human error in an Excel file, which led to the wrongful transfer of 130,500.148588 USDT to two incorrect Ethereum addresses. The transactions are linked to these Blockchain Transaction IDs (TXIDs, HASH): 0x8ae3a8bb2420489ae03bce6cc9e5fbfe276436e56859614b3a45f90232141de2 and 0x188988b979d61d2b55f04898c8ab226d8f08fb3bdd83bacc120ddb7dc6e438bf. The funds were mistakenly sent to addresses 0x79EF540F697cF180408Cf9Cd960b0502b344B206 and 0x79EF540F697CF180408cf9cd960B0502b344b207 instead of the intended address 0x79EF540F697CF180408cf9cd960B0502b344b205

We have submitted multiple support tickets (№958241, №264112, and 594233) over the last two months but have not yet received a substantial response or resolution. The situation has been ongoing since May, and the amount in question is substantial for us.

We fully understand that the responsibility for blockchain transactions typically lies with the sender. However, considering that the funds have remained unclaimed for over six months, we are reaching out in hopes of finding a solution. We own the sender's address, have access to it, and can provide the public key to verify our ownership. We are ready to provide any proofs needed, including the private key, to facilitate the resolution of this issue.

I have read about an instance where the technical director of Tether assisted a trader from China in recovering lost USDT, and this gives us hope that our situation might also find a resolution.

We sincerely appreciate any time and consideration you can offer, and are open to any suggestions or steps you might recommend.

Please sign in to comment.