From 3fd191a2d031e1a186a4eb2e009887399a4bc347 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Sat, 18 May 2019 10:50:28 -0400 Subject: more fixes to maximizing docs to default to showing the same prototype each time. --- src/new_fields/Doc.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/new_fields') diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index a7aa571f8..020f764a2 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -177,6 +177,12 @@ export namespace Doc { return r || r2 || r3 || r4 ? true : false; } + // gets the document's prototype or returns the document if it is a prototype + export function GetProto(doc: Doc) { + return Object.getOwnPropertyNames(doc).indexOf("isPrototype") === -1 ? doc.proto! : doc; + } + + export function MakeAlias(doc: Doc) { const proto = Object.getOwnPropertyNames(doc).indexOf("isPrototype") === -1 ? doc.proto : undefined; const alias = new Doc; -- cgit v1.2.3-70-g09d2