aboutsummaryrefslogtreecommitdiff
path: root/lib/util.js
diff options
context:
space:
mode:
authorcel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519>2020-03-23 15:13:58 -0400
committercel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519>2020-03-28 13:55:24 -0400
commite3e4ed19ef47bbbd8a0236011b5d4bf131eed048 (patch)
treee469ec3262387a7ed6c2f4d6b324ebbe1d014cef /lib/util.js
parent661eff54f83248fe168f066648b88112109e1e29 (diff)
downloadpatchfoo-e3e4ed19ef47bbbd8a0236011b5d4bf131eed048.tar.gz
patchfoo-e3e4ed19ef47bbbd8a0236011b5d4bf131eed048.zip
Fix sorting by claimed timestamp
Diffstat (limited to 'lib/util.js')
-rw-r--r--lib/util.js11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/util.js b/lib/util.js
index c5584ee..519289a 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -220,14 +220,11 @@ u.pullSlice = function (start, end) {
}
u.mergeOpts = function (a, b) {
+ if (typeof b !== 'object' || b === null) return b
+ if (typeof a !== 'object' || a === null) return a
var obj = {}, k
- for (k in a) {
- obj[k] = a[k]
- }
- for (k in b) {
- if (b[k] != null) obj[k] = b[k]
- else delete obj[k]
- }
+ for (k in a) obj[k] = k in b ? u.mergeOpts(a[k], b[k]) : a[k]
+ for (k in b) if (!(k in a) && b[k] != null) obj[k] = b[k]
return obj
}