From 04ab492a6c5779d5987188b1c2d33ec5e34592a3 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Thu, 12 Mar 2020 20:49:25 -0400 Subject: from last --- src/new_fields/Doc.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/new_fields') diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index 53f666fce..50adf0392 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -377,7 +377,8 @@ export namespace Doc { index = allowProtos && index !== -1 ? index : list.reduce((p, v, i) => (v instanceof Doc && Doc.AreProtosEqual(v, toFind)) ? i : p, -1); return index; // list.findIndex(doc => doc === toFind || Doc.AreProtosEqual(doc, toFind)); } - export function RemoveDocFromList(listDoc: Doc, key: string, doc: Doc) { + export function RemoveDocFromList(listDoc: Doc, fieldKey: string | undefined, doc: Doc) { + const key = fieldKey ? fieldKey : Doc.LayoutFieldKey(listDoc); if (listDoc[key] === undefined) { Doc.GetProto(listDoc)[key] = new List(); } @@ -391,7 +392,8 @@ export namespace Doc { } return false; } - export function AddDocToList(listDoc: Doc, key: string, doc: Doc, relativeTo?: Doc, before?: boolean, first?: boolean, allowDuplicates?: boolean, reversed?: boolean) { + export function AddDocToList(listDoc: Doc, fieldKey: string | undefined, doc: Doc, relativeTo?: Doc, before?: boolean, first?: boolean, allowDuplicates?: boolean, reversed?: boolean) { + const key = fieldKey ? fieldKey : Doc.LayoutFieldKey(listDoc); if (listDoc[key] === undefined) { Doc.GetProto(listDoc)[key] = new List(); } -- cgit v1.2.3-70-g09d2