aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Doc.ts
diff options
context:
space:
mode:
authoryipstanley <stanley_yip@brown.edu>2019-07-13 17:42:36 -0400
committeryipstanley <stanley_yip@brown.edu>2019-07-13 17:42:36 -0400
commit2d53f5294fdd3ac123503bcbb30b73967f4aba14 (patch)
treebc678894963b3e1625fe710d22fd44e4049c504d /src/new_fields/Doc.ts
parent4390106eb59a90283395ae5a18a0451e43166889 (diff)
parent2e75ca29e6e17d637cdad5992ee55e921559922a (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r--src/new_fields/Doc.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index 0e5f8b4d9..c5f9e7adf 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -12,6 +12,15 @@ import { scriptingGlobal } from "../client/util/Scripting";
import { List } from "./List";
export namespace Field {
+ export function toKeyValueString(doc: Doc, key: string): string {
+ const onDelegate = Object.keys(doc).includes(key);
+
+ let field = FieldValue(doc[key]);
+ if (Field.IsField(field)) {
+ return (onDelegate ? "=" : "") + Field.toScriptString(field);
+ }
+ return "";
+ }
export function toScriptString(field: Field): string {
if (typeof field === "string") {
return `"${field}"`;