From 9c0ff9a0b7d73e5e2a12c4f87d1aa586c59adec9 Mon Sep 17 00:00:00 2001 From: jw255 Date: Fri, 13 Apr 2018 21:12:53 +0100 Subject: only 12 failing tests :D --- src/matcher/options.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/matcher') diff --git a/src/matcher/options.ts b/src/matcher/options.ts index 62e4985..5e7114b 100644 --- a/src/matcher/options.ts +++ b/src/matcher/options.ts @@ -18,6 +18,7 @@ const matchNoCurry: if (types.atom(template)) { return template === value; } else if (types.function(template)) { + //console.log("hi there " + value) return template(value); } else if (types.atom(value) || value === undefined) { return false; @@ -82,10 +83,14 @@ export const array = (template: TemplateValue, values?: Value[]) => { if (values === undefined) { return array.bind(null, template); } + //console.trace() + //console.log(values) const m: Checker = types.function(template) ? template : match.bind(null, template); - return values.every(m); + return values.every((item) => { + return true; + }); }; // tslint:disable-next-line:typedef -- cgit v1.2.1 From 8d355d34cd309122e67f694e22f2023db205794f Mon Sep 17 00:00:00 2001 From: jw255 Date: Fri, 13 Apr 2018 22:07:19 +0100 Subject: much better --- src/matcher/options.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/matcher') diff --git a/src/matcher/options.ts b/src/matcher/options.ts index 5e7114b..9c78554 100644 --- a/src/matcher/options.ts +++ b/src/matcher/options.ts @@ -84,7 +84,7 @@ export const array = (template: TemplateValue, values?: Value[]) => { return array.bind(null, template); } //console.trace() - //console.log(values) + console.log(values) const m: Checker = types.function(template) ? template : match.bind(null, template); -- cgit v1.2.1 From 5f687384dfeb807867c5d36bb83f672800599de6 Mon Sep 17 00:00:00 2001 From: jw255 Date: Sat, 14 Apr 2018 18:26:38 +0100 Subject: confirmed matcher doesn't like arrays --- src/matcher/options.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/matcher') diff --git a/src/matcher/options.ts b/src/matcher/options.ts index 9c78554..988d22b 100644 --- a/src/matcher/options.ts +++ b/src/matcher/options.ts @@ -83,14 +83,10 @@ export const array = (template: TemplateValue, values?: Value[]) => { if (values === undefined) { return array.bind(null, template); } - //console.trace() - console.log(values) const m: Checker = types.function(template) ? template : match.bind(null, template); - return values.every((item) => { - return true; - }); + return values.every(m); // }; // tslint:disable-next-line:typedef -- cgit v1.2.1 From 1e6cb08fcdec54f1263eb1f6fdae6e0f438dfc97 Mon Sep 17 00:00:00 2001 From: jw255 Date: Sun, 15 Apr 2018 17:24:10 +0100 Subject: fixed logging --- src/matcher/options.ts | 1 - 1 file changed, 1 deletion(-) (limited to 'src/matcher') diff --git a/src/matcher/options.ts b/src/matcher/options.ts index 988d22b..0513eb3 100644 --- a/src/matcher/options.ts +++ b/src/matcher/options.ts @@ -18,7 +18,6 @@ const matchNoCurry: if (types.atom(template)) { return template === value; } else if (types.function(template)) { - //console.log("hi there " + value) return template(value); } else if (types.atom(value) || value === undefined) { return false; -- cgit v1.2.1 From d628ed540c883764eff623c7a059bcb588c017bc Mon Sep 17 00:00:00 2001 From: jw255 Date: Mon, 16 Apr 2018 16:08:08 +0100 Subject: nothing major --- src/matcher/options.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/matcher') 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); -- cgit v1.2.1 From fb54545484732f149223a63d06eff4c7d98b8410 Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Tue, 17 Apr 2018 17:39:56 +0100 Subject: Fix tests for matcher, and minor import edits --- src/matcher/index.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'src/matcher') diff --git a/src/matcher/index.ts b/src/matcher/index.ts index 99cc18c..0806907 100644 --- a/src/matcher/index.ts +++ b/src/matcher/index.ts @@ -10,6 +10,7 @@ export { export { Atom, + isPresent as anything, isNumber as number, isString as string, isBoolean as boolean, -- cgit v1.2.1