diff options
author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-07-12 11:21:20 -0400 |
---|---|---|
committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-07-12 11:21:20 -0400 |
commit | bde549beec0b9644ff0e39585989b1a6795750eb (patch) | |
tree | f979165fe3029c3228e75fc91d59c15181f0ef48 /src/new_fields/Doc.ts | |
parent | a7fa75a9b8e5811f81d6cdf92d680ab2cfb38fed (diff) | |
parent | 490f6843d3523260e6dce81de24676908c4d4b60 (diff) |
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r-- | src/new_fields/Doc.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index d28a29e40..0e5f8b4d9 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -202,6 +202,18 @@ export namespace Doc { } return protos; } + + /** + * This function is intended to model Object.assign({}, {}) [https://mzl.la/1Mo3l21], which copies + * the values of the properties of a source object into the target. + * + * This is just a specific, Dash-authored version that serves the same role for our + * Doc class. + * + * @param doc the target document into which you'd like to insert the new fields + * @param fields the fields to project onto the target. Its type signature defines a mapping from some string key + * to a potentially undefined field, where each entry in this mapping is optional. + */ export function assign<K extends string>(doc: Doc, fields: Partial<Record<K, Opt<Field>>>) { for (const key in fields) { if (fields.hasOwnProperty(key)) { |