diff options
| author | Tom Harley | 2018-02-07 12:48:48 +0000 |
|---|---|---|
| committer | Tom Harley | 2018-02-07 12:50:02 +0000 |
| commit | f60e3d9858f6037db3b27d5574ac95310127d302 (patch) | |
| tree | 73d93b7a57862bfae9a560fafb983d076a1ba637 /src/matcher/options.ts | |
| parent | removed types from options.ts to remove ts-node ambiguity (diff) | |
| download | medicine-f60e3d9858f6037db3b27d5574ac95310127d302.tar.gz medicine-f60e3d9858f6037db3b27d5574ac95310127d302.zip | |
matching now supports nested functions
Diffstat (limited to 'src/matcher/options.ts')
| -rw-r--r-- | src/matcher/options.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/matcher/options.ts b/src/matcher/options.ts index b356c7b..e93c2fd 100644 --- a/src/matcher/options.ts +++ b/src/matcher/options.ts @@ -6,7 +6,13 @@ export function match(template: Object, value?: Object) { } for (let k of Object.keys(template)) { - if (!template[k](value[k])) { + let f; + if (types.object(template[k])) { + f = match(template[k]); + } else { + f = template[k]; + } + if (!f(value[k])) { return false; } } |
