Skip to content

Commit

Permalink
fix: added missing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
chulanovskyi-bs committed Nov 14, 2023
1 parent 8372d5b commit 3cc5777
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions forward_engineering/helpers/commentDeactivatedHelper.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const MULTILINE_COMMENT = /(\n\/\*\n[\s\S]*?\n\s\*\/\n)|(\n\/\*\n[\s\S]*?\n\s\*\/)$/gi;
const STARTS_QUERY = ['//', '--'];

module.exports = (_) => {
const commentIfDeactivated = (statement, data, isPartOfLine) => {
if (_.has(data, 'isActivated') && !data.isActivated) {
Expand All @@ -12,7 +15,13 @@ module.exports = (_) => {
return statement;
};

const filterDeactivatedQuery = query => query.replace(MULTILINE_COMMENT, '');

const queryIsDeactivated = (query = '') => STARTS_QUERY.some(startQuery => query.startsWith(startQuery));

return {
commentIfDeactivated,
filterDeactivatedQuery,
queryIsDeactivated
};
};

0 comments on commit 3cc5777

Please sign in to comment.