diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-06-28 17:48:50 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-06-28 17:48:50 -0400 |
commit | e3305050a7d35474e9981838b24d54cf1e77f193 (patch) | |
tree | 9c03854b8443b00cedc7afb5b39939527d1c0ddb /src/fields/Schema.ts | |
parent | 7a291cbffb9e609633759cfff8b459e1a32b4fc3 (diff) | |
parent | eb403262aa4c1dd12dba8029fec70552cbce70bc (diff) |
Merge branch 'master' into search_doc
Diffstat (limited to 'src/fields/Schema.ts')
-rw-r--r-- | src/fields/Schema.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/fields/Schema.ts b/src/fields/Schema.ts index 72bce283d..98ef3e087 100644 --- a/src/fields/Schema.ts +++ b/src/fields/Schema.ts @@ -65,9 +65,8 @@ export function makeInterface<T extends Interface[]>(...schemas: T): InterfaceFu return obj; }; return function (doc?: Doc | Doc[]) { - doc = doc || new Doc; - if (doc instanceof Doc) { - return fn(doc); + if (doc instanceof Doc || doc === undefined) { + return fn(doc || new Doc); } else { return doc.map(fn); } |