aboutsummaryrefslogtreecommitdiff
path: root/src/matcher/options.ts
diff options
context:
space:
mode:
authorTom Harley2018-02-07 14:18:55 +0000
committerTom Harley2018-02-07 14:18:55 +0000
commit5e482ce4408f2e1926d1e9af3270a52ffcc83df6 (patch)
tree49ba0e37e404502aa4e31f8cd86657a08046ce7a /src/matcher/options.ts
parentmatching now supports nested functions (diff)
downloadmedicine-5e482ce4408f2e1926d1e9af3270a52ffcc83df6.tar.gz
medicine-5e482ce4408f2e1926d1e9af3270a52ffcc83df6.zip

added literal matching

Diffstat (limited to 'src/matcher/options.ts')
-rw-r--r--src/matcher/options.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/matcher/options.ts b/src/matcher/options.ts
index e93c2fd..2e65105 100644
--- a/src/matcher/options.ts
+++ b/src/matcher/options.ts
@@ -9,9 +9,12 @@ export function match(template: Object, value?: Object) {
let f;
if (types.object(template[k])) {
f = match(template[k]);
- } else {
+ } else if (types.function(template[k])) {
f = template[k];
+ } else {
+ f = (v) => v === template[k];
}
+
if (!f(value[k])) {
return false;
}