Skip to content

use longest match instead of endsWith#5146

Draft
simonLeary42 wants to merge 1 commit intoOSC:masterfrom
simonLeary42:refactor-dynamic-forms7
Draft

use longest match instead of endsWith#5146
simonLeary42 wants to merge 1 commit intoOSC:masterfrom
simonLeary42:refactor-dynamic-forms7

Conversation

@simonLeary42
Copy link
Contributor

@simonLeary42 simonLeary42 commented Mar 10, 2026

You would think that the argument would be a form token, but actually it's a string that may or may not start with a form token:

let match = str.match(`^${token}{1}`);

But then later during an edge case, the argument is expected to also /end/ with a form token:

return element.endsWith(snake_case_str);

So sometimes it's OK to pass a string ClusterFoo, but other times it's only ok to pass a form token Cluster. I don't think this makes sense. A more reliable way to handle this edge case would be to compare the string length of the matched tokens.

@simonLeary42
Copy link
Contributor Author

marked as draft until I add test cases

@simonLeary42 simonLeary42 marked this pull request as draft March 10, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants