From e4de8262a3c5e7f4b250be443795d8361422b523 Mon Sep 17 00:00:00 2001 From: "Colton Wolkins (Laptop)" Date: Fri, 5 Jan 2024 15:58:07 -0700 Subject: [PATCH 1/2] fix: use concat instead of push and spread Signed-off-by: Colton Wolkins (Laptop) --- src/lib/peer2.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/peer2.ts b/src/lib/peer2.ts index 7058865..e11e74d 100644 --- a/src/lib/peer2.ts +++ b/src/lib/peer2.ts @@ -238,7 +238,7 @@ export default class DIDPeer { }) .map(DIDPeer.transformOldServiceStyleToNew) - doc.service.push(...services) + doc.service.concat(services) break } From e7996c78f0ced4803c22d04c9a8822c1a84edd9b Mon Sep 17 00:00:00 2001 From: "Colton Wolkins (Laptop)" Date: Fri, 5 Jan 2024 15:59:10 -0700 Subject: [PATCH 2/2] fix: follow similar format as other parsing sections Signed-off-by: Colton Wolkins (Laptop) --- src/lib/peer2.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/peer2.ts b/src/lib/peer2.ts index e11e74d..6e52504 100644 --- a/src/lib/peer2.ts +++ b/src/lib/peer2.ts @@ -157,7 +157,6 @@ export default class DIDPeer { const doc: any = { "@context": "https://www.w3.org/ns/did/v1", id: did, - service: [], } let serviceIndex = 0; @@ -238,6 +237,9 @@ export default class DIDPeer { }) .map(DIDPeer.transformOldServiceStyleToNew) + if (!Array.isArray(doc.service)) { + doc.service = []; + } doc.service.concat(services) break }