Repository navigation
refactor(query-builder): replace deprecated substr with modern alternatives - #12149
Conversation
Review Summary by QodoReplace deprecated substr with modern string methods
WalkthroughsDescription• Replace deprecated substr() with modern string methods • Use startsWith() and endsWith() for prefix/suffix checks • Use bracket notation for single character access • Improve code readability and maintainability Diagramflowchart LR
A["substr method calls"] -- "refactor to modern alternatives" --> B["startsWith/endsWith/bracket notation"]
B --> C["Improved code quality"]
File Changes1. src/query-builder/QueryBuilder.ts
|
commit: |
Code Review by Qodo
1. Deprecated substr remains
|
There was a problem hiding this comment.
Pull request overview
This PR modernizes two usages of the deprecated String.prototype.substr() method in the query builder code, replacing them with startsWith()/endsWith() in QueryBuilder.ts and bracket notation in SelectQueryBuilder.ts. The substr method has been deprecated in favor of substring or other modern string APIs.
Changes:
- Replace
substr(0, 1)andsubstr(-1)withstartsWith("(")andendsWith(")")inQueryBuilder.ts - Replace
substr(0, 1)with bracket access[0]inSelectQueryBuilder.ts
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/query-builder/QueryBuilder.ts |
Replaced substr(0, 1) / substr(-1) with startsWith() / endsWith() for subquery detection |
src/query-builder/SelectQueryBuilder.ts |
Replaced substr(0, 1) with bracket notation [0] for first-character check |
|
Persistent review updated to latest commit 3e5faca |
|
Persistent review updated to latest commit d333731 |
d333731 to
53458c3
Compare
|
Persistent review updated to latest commit 53458c3 |
Deploying typeorm with
|
| Latest commit: |
aa1a90a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4b472d3f.typeorm.pages.dev |
| Branch Preview URL: | https://worktree-agent-a4e93fb6.typeorm.pages.dev |
|
Persistent review updated to latest commit f347bdc |
|
Persistent review updated to latest commit 52168e9 |
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewⓘ The new review experience is currently in Beta. Learn more Previous review resultsReview updated until commit 5f1944f Results up to commit 52168e9
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewResults up to commit f347bdc
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewResults up to commit 53458c3
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewResults up to commit d333731
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewResults up to commit 3e5faca
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewResults up to commit b95b465
Great, no issues found!Qodo reviewed your code and found no material issues that require review |
|
Persistent review updated to latest commit 80f6b21 |
80f6b21 to
ce81355
Compare
|
Persistent review updated to latest commit ce81355 |
|
Persistent review updated to latest commit e2ba89d |
|
Persistent review updated to latest commit d8116c8 |
|
Persistent review updated to latest commit c9aa5cc |
|
|
Persistent review updated to latest commit aa1a90a |



Description
String.substr is deprecated, so I've updated the code to use newer functions.