diff options
author | Lionel Han <47760119+IGoByJoe@users.noreply.github.com> | 2020-06-29 14:42:36 -0700 |
---|---|---|
committer | Lionel Han <47760119+IGoByJoe@users.noreply.github.com> | 2020-06-29 14:42:36 -0700 |
commit | 2646aa86bc6d676e848028601f9a4fedeefe35be (patch) | |
tree | 42d208346a283f788268c9d74de7dcc835bd84a6 /src/fields/Schema.ts | |
parent | 992a65ec6f828dda0adcd3cd121896f07f64af87 (diff) | |
parent | 73bbc602fb964c82999faccfdde8eeca6fbf08c4 (diff) |
pull
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); } |