aboutsummaryrefslogtreecommitdiff
path: root/src/matcher/options.ts
diff options
context:
space:
mode:
authorjw2552018-04-16 16:08:08 +0100
committerjw2552018-04-16 16:08:08 +0100
commitd628ed540c883764eff623c7a059bcb588c017bc (patch)
tree18e5a1a24fe2fca3bc12103419b1c74be08e9e4f /src/matcher/options.ts
parentfile upload works, i thnk (diff)
downloadmedicine-d628ed540c883764eff623c7a059bcb588c017bc.tar.gz
medicine-d628ed540c883764eff623c7a059bcb588c017bc.zip

nothing major

Diffstat (limited to 'src/matcher/options.ts')
-rw-r--r--src/matcher/options.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/matcher/options.ts b/src/matcher/options.ts
index 0513eb3..967a6f9 100644
--- a/src/matcher/options.ts
+++ b/src/matcher/options.ts
@@ -15,13 +15,20 @@ export type Value =
const matchNoCurry:
(template: TemplateValue, value: Value | undefined) => boolean =
(template: TemplateValue, value: Value | undefined): boolean => {
+ console.log("matchNoCurry()")
+ console.log(template)
+ console.log(value)
if (types.atom(template)) {
+ console.log("atom")
return template === value;
} else if (types.function(template)) {
+ console.log("function")
return template(value);
} else if (types.atom(value) || value === undefined) {
+ console.log("atom2")
return false;
} else if (types.object(template)) {
+ console.log("object")
return Object.keys(template)
.every((key: string): boolean => {
const v: Value | undefined = value[key];
@@ -34,7 +41,11 @@ const matchNoCurry:
// tslint:disable-next-line:typedef
export const match = (template: TemplateValue, value?: Value) => {
+ console.log("match()")
+ console.log(template)
+ console.log(value)
if (value === undefined) {
+ console.log("is undefined")
return matchNoCurry.bind(null, template);
}
return matchNoCurry(template, value);