Browse Source

save by clone, not by id

Kieran Gibb 2 years ago
parent
commit
50bfef2e87
No known key found for this signature in database
2 changed files with 8 additions and 8 deletions
  1. 2
    2
      lib/key-handler.js
  2. 6
    6
      yarn.lock

+ 2
- 2
lib/key-handler.js View File

@@ -18,8 +18,8 @@ const KeyHandler = module.exports = (collection) => ({
18 18
     Object.keys(clone).forEach((k) => {
19 19
       if (crypto.isKey(clone[k])) clone[k] = clone[k].toString('hex')
20 20
     })
21
-    if (crypto.isKey(id)) collection.byKey[id.toString('hex')] = clone
22
-    if (isName(id)|| clone.name) collection.byName[clone.name] = clone
21
+    if (crypto.isKey(clone.address)) collection.byKey[clone.address.toString('hex')] = clone
22
+    if (isName(clone.name)) collection.byName[clone.name] = clone
23 23
     return true
24 24
   },
25 25
   delete: (id) => {

+ 6
- 6
yarn.lock View File

@@ -52,9 +52,9 @@
52 52
     js-tokens "^4.0.0"
53 53
 
54 54
 "@babel/parser@^7.4.3", "@babel/parser@^7.7.4":
55
-  version "7.7.4"
56
-  resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.4.tgz#75ab2d7110c2cf2fa949959afb05fa346d2231bb"
57
-  integrity sha512-jIwvLO0zCL+O/LmEJQjWA75MQTWwx3c3u2JOTDK5D3/9egrWRRA0/0hk9XXywYnXZVVpzrBYeIQTmhwUaePI9g==
55
+  version "7.7.5"
56
+  resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71"
57
+  integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig==
58 58
 
59 59
 "@babel/template@^7.4.0", "@babel/template@^7.7.4":
60 60
   version "7.7.4"
@@ -407,9 +407,9 @@ error-ex@^1.3.1:
407 407
     is-arrayish "^0.2.1"
408 408
 
409 409
 es-abstract@^1.12.0, es-abstract@^1.5.0:
410
-  version "1.16.2"
411
-  resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.2.tgz#4e874331645e9925edef141e74fc4bd144669d34"
412
-  integrity sha512-jYo/J8XU2emLXl3OLwfwtuFfuF2w6DYPs+xy9ZfVyPkDcrauu6LYrw/q2TyCtrbc/KUdCiC5e9UajRhgNkVopA==
410
+  version "1.16.3"
411
+  resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.3.tgz#52490d978f96ff9f89ec15b5cf244304a5bca161"
412
+  integrity sha512-WtY7Fx5LiOnSYgF5eg/1T+GONaGmpvpPdCpSnYij+U2gDTL0UPfWrhDw7b2IYb+9NQJsYpCA0wOQvZfsd6YwRw==
413 413
   dependencies:
414 414
     es-to-primitive "^1.2.1"
415 415
     function-bind "^1.1.1"