From 8f2adaa0731d63a34c6c6d31d7cd8900fdd9e9a7 Mon Sep 17 00:00:00 2001 From: Elizeu Santos Date: Wed, 15 Nov 2017 13:58:19 -0200 Subject: [PATCH 1/3] Implements getFlag method --- ui/src/lib/RegexBuilder.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ui/src/lib/RegexBuilder.js b/ui/src/lib/RegexBuilder.js index 5e96bf1..e0f626b 100644 --- a/ui/src/lib/RegexBuilder.js +++ b/ui/src/lib/RegexBuilder.js @@ -1,12 +1,12 @@ -import { REGEX_FLAGS } from '../constants'; +import { REGEX_FLAGS } from "../constants"; export default class RegexBuilder { constructor(rawData) { const data = (() => { - if (typeof rawData === 'string') { + if (typeof rawData === "string") { const decoded = decodeURIComponent(atob(rawData)); return JSON.parse(decoded); - } else if (typeof rawData === 'object' && rawData !== null) { + } else if (typeof rawData === "object" && rawData !== null) { return rawData; } return {}; @@ -15,7 +15,7 @@ export default class RegexBuilder { this.flags = {}; this.source = data.regex || null; this.testString = data.test_string || null; - this.matchType = data.match_type || 'match'; + this.matchType = data.match_type || "match"; this.setFlags(data.flags); } @@ -24,7 +24,7 @@ export default class RegexBuilder { regex: this.source, flags: this.getFlag(), match_type: this.matchType, - test_string: this.testString, + test_string: this.testString }; } @@ -39,11 +39,15 @@ export default class RegexBuilder { .reduce( (acc, [key, value]) => ({ ...acc, - [key]: false, + [key]: false }), {} ); } - getFlag() {} + getFlag() { + return Object.keys(this.flags) + .filter(key => this.flags[key]) + .reduce((acc, cValue) => acc | REGEX_FLAGS[cValue], 0); + } } From 74fe452baa2a8b28acaa21d21ec2012a90ad11e2 Mon Sep 17 00:00:00 2001 From: Elizeu Santos Date: Wed, 15 Nov 2017 15:32:01 -0200 Subject: [PATCH 2/3] REFACTORY --- ui/src/lib/RegexBuilder.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/src/lib/RegexBuilder.js b/ui/src/lib/RegexBuilder.js index e0f626b..407d50d 100644 --- a/ui/src/lib/RegexBuilder.js +++ b/ui/src/lib/RegexBuilder.js @@ -1,12 +1,12 @@ -import { REGEX_FLAGS } from "../constants"; +import { REGEX_FLAGS } from '../constants'; export default class RegexBuilder { constructor(rawData) { const data = (() => { - if (typeof rawData === "string") { + if (typeof rawData === 'string') { const decoded = decodeURIComponent(atob(rawData)); return JSON.parse(decoded); - } else if (typeof rawData === "object" && rawData !== null) { + } else if (typeof rawData === 'object' && rawData !== null) { return rawData; } return {}; @@ -15,7 +15,7 @@ export default class RegexBuilder { this.flags = {}; this.source = data.regex || null; this.testString = data.test_string || null; - this.matchType = data.match_type || "match"; + this.matchType = data.match_type || 'match'; this.setFlags(data.flags); } @@ -24,7 +24,7 @@ export default class RegexBuilder { regex: this.source, flags: this.getFlag(), match_type: this.matchType, - test_string: this.testString + test_string: this.testString, }; } @@ -39,14 +39,14 @@ export default class RegexBuilder { .reduce( (acc, [key, value]) => ({ ...acc, - [key]: false + [key]: false, }), {} ); } getFlag() { - return Object.keys(this.flags) + return Object.keys(REGEX_FLAGS) .filter(key => this.flags[key]) .reduce((acc, cValue) => acc | REGEX_FLAGS[cValue], 0); } From 593e3185bb2edf639ae3d7f0cce4c395b17f2f10 Mon Sep 17 00:00:00 2001 From: Elizeu Santos Date: Sun, 19 Nov 2017 15:59:03 -0200 Subject: [PATCH 3/3] Update node version to the latest LTS version. --- ui/.nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/.nvmrc b/ui/.nvmrc index 2dc0523..ad8f873 100644 --- a/ui/.nvmrc +++ b/ui/.nvmrc @@ -1 +1 @@ -v8.6.0 +v8.9.1