improvement(utils): share escapeRegExp, compareStrings and isRecordLike - #8052
Merged
Merged
Conversation
…haracter class Replaces the nine inline copies of the escape body the name-based sweep missed, folds the catalog cursor comparator into compareStrings, and gives linear-regex its metacharacter test from the same source the escaper uses.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
escapeRegExp,hasRegexMetacharacterandcompareStringsto@sim/utils/string, and replaces the duplicated copies across apps and packagesescapeRegExp: 9 named copies plus 9 inlinereplace(/[.*+?^${}()|[\]\\]/g, '\\$&')bodies, spanningapps/sim,apps/desktopandpackages/emcn.executor/constantsno longer exports it, sotools/http/utilsdrops its only edge to that modulecompareStrings: 7 identical copies in the secret-provenance and matcher code, plus the catalog cursor comparator that argued the same case in its own wordsisRecordLike: adopts the helper@sim/utils/objectalready exported, replacing 8 identical localisRecordcopies. ServiceNow keeps its domain-typed name but delegates the predicateisPlainText's metacharacter test, which previously each declared their ownNo behavior changes: every removed body was character-identical to the shared one. Two copies are deliberately left alone — the Pi search one is source text injected into a sandbox and cannot import, and
ts-sdkis published without a@sim/utilsdependency.Type of Change
Testing
bun run type-checkclean in apps/sim, apps/desktop, packages/{utils,emcn,sim-cli}bun run lint,bun run check:audits(47/47),bun run test:scripts(351),check-block-registry,docs-manifest:checkall passChecklist
🤖 Generated with Claude Code