New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix(47969): String.prototypr.replace docs fix #50041
Merged
Merged
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3cade4c
String.prototype.replace docs fix.
navya9singh 04df1e1
Follow up changes to es5.d.ts
navya9singh 34c3b9c
Fixed changes to previous commit:
navya9singh 472584f
Changes to resolve pr comments
navya9singh 29e50b3
Rewording documentation
navya9singh 0507192
Accepting baselines
navya9singh 906510e
Fixes for pr
navya9singh 305f4bd
Merge branch 'main' into fix/47969
navya9singh abc58bd
Fixing baseline errors
navya9singh 8e71f42
Fixing pr comments
navya9singh File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -429,8 +429,8 @@ interface String { | |||||
|
||||||
/** | ||||||
* Replaces text in a string, using a regular expression or search string. | ||||||
* @param searchValue A string to search for. | ||||||
* @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. | ||||||
* @param searchValue A string or regular expression to search for. | ||||||
* @param replaceValue A string containing the text to replace. When the {@linkcode searchValue} is a string, only the first match is replaced. If the {@linkcode searchValue} is a RegExp, all matches are replaced if the g flag is set. Otherwise only the first one is. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I would reword this to highlight the interesting global regex case first, and try to cover strings and sticky regexes later.
Suggested change
|
||||||
*/ | ||||||
replace(searchValue: string | RegExp, replaceValue: string): string; | ||||||
|
||||||
|
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Suggestion, dunno if the stdlib has its own style rules about JSDoc. Also
@@replace
is technically the name for the method—it's only accessed viaSymbol.replace
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the formatting improvement, but I think
@@replace
is only useful for people who have read the spec.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm fine with
[Symbol.replace]
. FWIW, on MDN we consistently useRegExp.prototype[@@replace]()
so I hope it's not that obscure, but I can understand.