From 3cc5777857130c34621bf0c5437e7ff7e1b51166 Mon Sep 17 00:00:00 2001 From: oleg_chulanovskyi Date: Tue, 14 Nov 2023 11:27:33 +0200 Subject: [PATCH] fix: added missing functions --- forward_engineering/helpers/commentDeactivatedHelper.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/forward_engineering/helpers/commentDeactivatedHelper.js b/forward_engineering/helpers/commentDeactivatedHelper.js index 5369d8b1..3666fe07 100644 --- a/forward_engineering/helpers/commentDeactivatedHelper.js +++ b/forward_engineering/helpers/commentDeactivatedHelper.js @@ -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) { @@ -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 }; };