LearnNewsExamplesServices
Frontmatter
id2371
titlemodel.Component: enhance the dataVariableRegex
stateClosed
labels
enhancement
assigneestobiu
createdAtJun 15, 2021, 8:30 PM
updatedAtJun 15, 2021, 10:21 PM
githubUrlhttps://github.com/neomjs/neo/issues/2371
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 15, 2021, 10:21 PM

model.Component: enhance the dataVariableRegex

Closed v8.1.0 enhancement
tobiu
tobiu commented on Jun 15, 2021, 8:30 PM
const dataVariableRegex  = /(data|[a-z])((?!(\.[a-z_]\w*\(\)))\.[a-z_]\w*)+/gi;

this one worked for template literals containing data variables or 1 letter vars (dist/prod).

however, there is a catch :)

Screenshot 2021-06-15 at 20 29 31

in case we want to support methods including dots, we need more polishing.

new idea:

const dataVariableRegex  = /(data|(?<!\w)[a-z])((?!(\.[a-z_]\w*\(\)))\.[a-z_]\w*)+/gi;

Screenshot 2021-06-15 at 20 29 40

tobiu added the enhancement label on Jun 15, 2021, 8:30 PM
tobiu assigned to @tobiu on Jun 15, 2021, 8:30 PM
tobiu
tobiu Jun 15, 2021, 8:50 PM

it does get more tricky: dist/prod does not only minify method names.

data => DateUtil.convertToyyyymmdd(data.currentDate)

does get transformed into:

e=>s.Z.convertToyyyymmdd(e.currentDate)

tobiu referenced in commit 218c5d3 - "model.Component: enhance the dataVariableRegex #2371 PoC" on Jun 15, 2021, 10:06 PM
tobiu referenced in commit 9c6b645 - "model.Component: enhance the dataVariableRegex #2371" on Jun 15, 2021, 10:17 PM
tobiu closed this issue on Jun 15, 2021, 10:21 PM