-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: cucumber refactor and capture steps (#77)
* chore: cucumber refactor and capture steps * fix: duration
- Loading branch information
1 parent
5f5d98c
commit af9fb39
Showing
5 changed files
with
319 additions
and
163 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const { unescape } = require('html-escaper'); | ||
|
||
|
||
class BaseParser { | ||
|
||
/** | ||
* @param {string} value | ||
* @returns | ||
*/ | ||
parseText(value) { | ||
return value ? unescape(value) : value; | ||
} | ||
|
||
/** | ||
* | ||
* @param {string[]} parent_tags | ||
* @param {string[]} child_tags | ||
*/ | ||
mergeTags(parent_tags, child_tags) { | ||
if (!parent_tags) { | ||
parent_tags = []; | ||
} | ||
if (!child_tags) { | ||
child_tags = []; | ||
} | ||
for (const tag of parent_tags) { | ||
if (child_tags.indexOf(tag) === -1) { | ||
child_tags.push(tag); | ||
} | ||
} | ||
} | ||
|
||
mergeMetadata(parent_metadata, child_metadata) { | ||
if (!parent_metadata) { | ||
parent_metadata = {}; | ||
} | ||
if (!child_metadata) { | ||
child_metadata = {}; | ||
} | ||
for (const [key, value] of Object.entries(parent_metadata)) { | ||
if (!child_metadata[key]) { | ||
child_metadata[key] = value; | ||
} | ||
} | ||
} | ||
} | ||
|
||
module.exports = { BaseParser } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.