aboutsummaryrefslogtreecommitdiff
path: root/src/matcher/options.ts
diff options
context:
space:
mode:
authorTom Harley2018-02-07 12:48:48 +0000
committerTom Harley2018-02-07 12:50:02 +0000
commitf60e3d9858f6037db3b27d5574ac95310127d302 (patch)
tree73d93b7a57862bfae9a560fafb983d076a1ba637 /src/matcher/options.ts
parentremoved types from options.ts to remove ts-node ambiguity (diff)
downloadmedicine-f60e3d9858f6037db3b27d5574ac95310127d302.tar.gz
medicine-f60e3d9858f6037db3b27d5574ac95310127d302.zip

matching now supports nested functions

Diffstat (limited to 'src/matcher/options.ts')
-rw-r--r--src/matcher/options.ts8
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;
}
}