diff options
| -rw-r--r-- | challenge-207/ealvar3z/blog.txt | 1 | ||||
| -rw-r--r-- | challenge-207/ealvar3z/js/ch-1.js | 31 | ||||
| -rw-r--r-- | challenge-207/ealvar3z/rust/.gitignore | 3 |
3 files changed, 32 insertions, 3 deletions
diff --git a/challenge-207/ealvar3z/blog.txt b/challenge-207/ealvar3z/blog.txt new file mode 100644 index 0000000000..4e03b8b035 --- /dev/null +++ b/challenge-207/ealvar3z/blog.txt @@ -0,0 +1 @@ +https://eax.bearblog.dev/king-of-strings/ diff --git a/challenge-207/ealvar3z/js/ch-1.js b/challenge-207/ealvar3z/js/ch-1.js new file mode 100644 index 0000000000..936504111f --- /dev/null +++ b/challenge-207/ealvar3z/js/ch-1.js @@ -0,0 +1,31 @@ +#!/usr/bin/node + +const assert = require("assert"); + +// Tests + +const test_one = ["Hello", "Alaska", "Dad", "Peace"]; +const test_two = ["OMG", "Bye"]; + +const _1 = test_one.filter(task_one); +const _2 = test_two.filter(task_one); + +console.log(_1); +console.log(_2); + +assert.deepStrictEqual(_1, ["Alaska", "Dad"]); +assert.deepStrictEqual(_2, []); + +// Implementation + +const q = /[qwertyuiop]+/i; +const a = /[asdfghjkl]+/i; +const z = /[zxcvbnm]+/i; + +function task_one(w) { + const compile = `^(${q.source}|${a.source}|${z.source})$`; + const re = new RegExp(compile, "i"); + return re.test(w); +} + + diff --git a/challenge-207/ealvar3z/rust/.gitignore b/challenge-207/ealvar3z/rust/.gitignore deleted file mode 100644 index 9a30948bdd..0000000000 --- a/challenge-207/ealvar3z/rust/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/target -Cargo.toml -Cargo.lock |
