From f480ef91b72b091242a06b31812a026c9defcf3f Mon Sep 17 00:00:00 2001 From: Antoine Niek Date: Thu, 5 Dec 2024 16:50:50 -0500 Subject: [PATCH] Fix section.toObj to match specs --- .../encoder/section/AbstractLazilyEncodableSection.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/modules/cmpapi/src/encoder/section/AbstractLazilyEncodableSection.ts b/modules/cmpapi/src/encoder/section/AbstractLazilyEncodableSection.ts index 2905891..4873707 100644 --- a/modules/cmpapi/src/encoder/section/AbstractLazilyEncodableSection.ts +++ b/modules/cmpapi/src/encoder/section/AbstractLazilyEncodableSection.ts @@ -80,14 +80,7 @@ export abstract class AbstractLazilyEncodableSection implements EncodableSection //Overriden public toObj(): any { - let obj = {}; - for (let i = 0; i < this.segments.length; i++) { - let segmentObject = this.segments[i].toObj(); - for (const [fieldName, value] of Object.entries(segmentObject)) { - obj[fieldName] = value; - } - } - return obj; + return this.segments.map((s) => s.toObj()); } public encode(): string {