diff options
| author | Sam Wilkins <35748010+samwilkins333@users.noreply.github.com> | 2019-07-11 18:45:57 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-11 18:45:57 -0400 |
| commit | aa17690d3c484e08b35cc6356c73f00eaa5e0df5 (patch) | |
| tree | 6039850b3ff1f463d8ac97ab0fe5a71deb2d6e82 /src/new_fields/Doc.ts | |
| parent | aeb0521e8ad8f1efc8c3a39af9eb5443c5368453 (diff) | |
| parent | 5eb76c1a2da4e7c8371cb62c39ca84d2f79804d3 (diff) | |
Merge pull request #198 from browngraphicslab/layout_refactor
Layout refactor
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)) { |
