-
Notifications
You must be signed in to change notification settings - Fork 199
Add String methods #1566
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
Merged
Merged
Add String methods #1566
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b2547d4
Add String methods
petele 1be727b
Update features/strings.yml
petele 87a1125
Update features/strings.yml
petele 38c0128
Merge branch 'main' into strings
petele 3e93647
re-run dist
petele edbdef8
Merge branch 'main' into strings
petele fbfed65
Merge branch 'main' into strings
petele 30bbca3
Add `primitive-types` group
petele 83a90dc
Merge remote-tracking branch 'refs/remotes/origin/strings' into strings
petele a58a33f
Apply suggestions from code review
petele 0b3f70a
Merge branch 'main' into strings
petele f7f6726
rename to string
petele fcb849e
Split string functions into smaller features
petele 85dad23
update `caniuse` fields
petele 4ba196c
Merge branch 'main' into strings
petele 8e186b2
Merge branch 'main' into strings
petele 68bf7f2
Apply suggestions from code review
petele feeb3fc
Merge branch 'main' into strings
petele 3785dd4
rename to strings
petele 048aeac
Rename string-pad feature
ddbeck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| name: String at() | ||
| description: The `at()` method of strings returns the character (one UTF-16 code unit) at an index, including negative indices for getting the character relative to the end of the string. Also known as the relative indexing method. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| compat_features: | ||
| - javascript.builtins.String.at |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Generated from: string-at.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: low | ||
| baseline_low_date: 2022-03-14 | ||
| support: | ||
| chrome: "92" | ||
| chrome_android: "92" | ||
| edge: "92" | ||
| firefox: "90" | ||
| firefox_android: "90" | ||
| safari: "15.4" | ||
| safari_ios: "15.4" | ||
| compat_features: | ||
| - javascript.builtins.String.at |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| name: String codePointAt() and fromCodePoint() | ||
| description: The `codePointAt()` method returns the numeric value of the UTF-16 code point at an index of the string. The `fromCodePoint()` method returns a string created from one or more code points. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| compat_features: | ||
| - javascript.builtins.String.codePointAt | ||
| - javascript.builtins.String.fromCodePoint |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Generated from: string-codepoint.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: high | ||
| baseline_low_date: 2015-09-30 | ||
| baseline_high_date: 2018-03-30 | ||
| support: | ||
| chrome: "41" | ||
| chrome_android: "41" | ||
| edge: "12" | ||
| firefox: "29" | ||
| firefox_android: "29" | ||
| safari: "9" | ||
| safari_ios: "9" | ||
| compat_features: | ||
| - javascript.builtins.String.codePointAt | ||
| - javascript.builtins.String.fromCodePoint |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| name: String includes() | ||
| description: The `includes()` method of strings returns whether a search string appears within the string. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| caniuse: es6-string-includes | ||
| compat_features: | ||
| - javascript.builtins.String.includes |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated from: string-includes.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: high | ||
| baseline_low_date: 2015-09-30 | ||
| baseline_high_date: 2018-03-30 | ||
| support: | ||
| chrome: "41" | ||
| chrome_android: "41" | ||
| edge: "12" | ||
| firefox: "40" | ||
| firefox_android: "40" | ||
| safari: "9" | ||
| safari_ios: "9" | ||
| compat_features: | ||
| - javascript.builtins.String.includes |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| name: String matchAll() | ||
| description: The `matchAll()` method of strings matches a string against a regular expression and returns an iterator of all results, including capturing groups. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| compat_features: | ||
| - javascript.builtins.String.matchAll |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated from: string-matchall.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: high | ||
| baseline_low_date: 2020-01-15 | ||
| baseline_high_date: 2022-07-15 | ||
| support: | ||
| chrome: "73" | ||
| chrome_android: "73" | ||
| edge: "79" | ||
| firefox: "67" | ||
| firefox_android: "67" | ||
| safari: "13" | ||
| safari_ios: "13" | ||
| compat_features: | ||
| - javascript.builtins.String.matchAll |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| name: String normalize() | ||
| description: The `normalize()` method of strings returns a Unicode normal form of a string as a new string. More than one code point sequence can represent the same characters. You can use the `normalize()` method to find canonically or compatibly equivalent strings. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| compat_features: | ||
| - javascript.builtins.String.normalize |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated from: string-normalize.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: high | ||
| baseline_low_date: 2016-09-20 | ||
| baseline_high_date: 2019-03-20 | ||
| support: | ||
| chrome: "34" | ||
| chrome_android: "34" | ||
| edge: "12" | ||
| firefox: "31" | ||
| firefox_android: "31" | ||
| safari: "10" | ||
| safari_ios: "10" | ||
| compat_features: | ||
| - javascript.builtins.String.normalize |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| name: String padStart() and padEnd() | ||
| description: The `padStart()` and `padEnd()` methods of strings return a string lengthened to a minimum number of characters by adding characters to the start or end of the string. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| caniuse: pad-start-end | ||
| compat_features: | ||
| - javascript.builtins.String.padEnd | ||
| - javascript.builtins.String.padStart |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Generated from: string-pad.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: high | ||
| baseline_low_date: 2017-04-05 | ||
| baseline_high_date: 2019-10-05 | ||
| support: | ||
| chrome: "57" | ||
| chrome_android: "57" | ||
| edge: "15" | ||
| firefox: "48" | ||
| firefox_android: "48" | ||
| safari: "10" | ||
| safari_ios: "10" | ||
| compat_features: | ||
| - javascript.builtins.String.padEnd | ||
| - javascript.builtins.String.padStart |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| name: String raw() | ||
| description: The `String.raw()` static method interpolates template literal substitutions, but ignores escape sequences. It is the tag function for template literals. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| compat_features: | ||
| - javascript.builtins.String.raw |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated from: string-raw.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: high | ||
| baseline_low_date: 2015-09-30 | ||
| baseline_high_date: 2018-03-30 | ||
| support: | ||
| chrome: "41" | ||
| chrome_android: "41" | ||
| edge: "12" | ||
| firefox: "34" | ||
| firefox_android: "34" | ||
| safari: "9" | ||
| safari_ios: "9" | ||
| compat_features: | ||
| - javascript.builtins.String.raw |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| name: String repeat() | ||
| description: The `repeat()` method of strings returns the original string repeated a number of times. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| compat_features: | ||
| - javascript.builtins.String.repeat |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated from: string-repeat.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: high | ||
| baseline_low_date: 2015-09-30 | ||
| baseline_high_date: 2018-03-30 | ||
| support: | ||
| chrome: "41" | ||
| chrome_android: "36" | ||
| edge: "12" | ||
| firefox: "24" | ||
| firefox_android: "24" | ||
| safari: "9" | ||
| safari_ios: "9" | ||
| compat_features: | ||
| - javascript.builtins.String.repeat |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| name: String replaceAll() | ||
| description: The `replaceAll()` method of strings returns a new string where all matches of a pattern (a string or regular expression) have been substituted with a replacement string. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| compat_features: | ||
| - javascript.builtins.String.replaceAll |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated from: string-replaceall.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: high | ||
| baseline_low_date: 2020-08-27 | ||
| baseline_high_date: 2023-02-27 | ||
| support: | ||
| chrome: "85" | ||
| chrome_android: "85" | ||
| edge: "85" | ||
| firefox: "77" | ||
| firefox_android: "79" | ||
| safari: "13.1" | ||
| safari_ios: "13.4" | ||
| compat_features: | ||
| - javascript.builtins.String.replaceAll |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| name: String startsWith() and endsWith() | ||
| description: The `startsWith()` and `endsWith()` methods of strings returns whether a search string appears at the beginning or end of the provided string. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| compat_features: | ||
| - javascript.builtins.String.endsWith | ||
| - javascript.builtins.String.startsWith |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Generated from: string-startsends-with.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: high | ||
| baseline_low_date: 2015-09-30 | ||
| baseline_high_date: 2018-03-30 | ||
| support: | ||
| chrome: "41" | ||
| chrome_android: "36" | ||
| edge: "12" | ||
| firefox: "17" | ||
| firefox_android: "17" | ||
| safari: "9" | ||
| safari_ios: "9" | ||
| compat_features: | ||
| - javascript.builtins.String.endsWith | ||
| - javascript.builtins.String.startsWith |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| name: String trimStart() and trimEnd() | ||
| description: The `trimStart()` and `trimEnd()` methods of strings return a new string with whitespace removed from the beginning or end of the string. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| compat_features: | ||
| - javascript.builtins.String.trimEnd | ||
| - javascript.builtins.String.trimStart |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Generated from: string-trim-startend.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: high | ||
| baseline_low_date: 2020-01-15 | ||
| baseline_high_date: 2022-07-15 | ||
| support: | ||
| chrome: "66" | ||
| chrome_android: "66" | ||
| edge: "79" | ||
| firefox: "61" | ||
| firefox_android: "61" | ||
| safari: "12" | ||
| safari_ios: "12" | ||
| compat_features: | ||
| - javascript.builtins.String.trimEnd | ||
| - javascript.builtins.String.trimStart |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| name: String isWellFormed() and toWellFormed() | ||
| description: The `isWellFormed()` method of strings returns a boolean indicating if the string contains any Unicode lone surrogates. The `toWellFormed()` method returns a new string where all lone surrogates are replaced by the Unicode replacement character. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: string | ||
| compat_features: | ||
| - javascript.builtins.String.isWellFormed | ||
| - javascript.builtins.String.toWellFormed |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated from: string-wellformed.yml | ||
| # Do not edit this file by hand. Edit the source file instead! | ||
|
|
||
| status: | ||
| baseline: low | ||
| baseline_low_date: 2023-10-24 | ||
| support: | ||
| chrome: "111" | ||
| chrome_android: "111" | ||
| edge: "111" | ||
| firefox: "119" | ||
| firefox_android: "119" | ||
| safari: "16.4" | ||
| safari_ios: "16.4" | ||
| compat_features: | ||
| - javascript.builtins.String.isWellFormed | ||
| - javascript.builtins.String.toWellFormed |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: String (initial support) | ||
| description: The string type (and `String` object) represents a sequence of characters. | ||
| spec: https://tc39.es/ecma262/multipage/text-processing.html#sec-string-objects | ||
| group: primitive-types | ||
| status: | ||
| compute_from: javascript.builtins.String | ||
| compat_features: | ||
| - javascript.builtins.String | ||
| - javascript.builtins.String.String | ||
| - javascript.builtins.String.charAt | ||
| - javascript.builtins.String.charCodeAt | ||
| - javascript.builtins.String.concat | ||
| - javascript.builtins.String.fromCharCode | ||
| - javascript.builtins.String.indexOf | ||
| - javascript.builtins.String.lastIndexOf | ||
| - javascript.builtins.String.length | ||
| - javascript.builtins.String.match | ||
| - javascript.builtins.String.replace | ||
| - javascript.builtins.String.search | ||
| - javascript.builtins.String.slice | ||
| - javascript.builtins.String.split | ||
| - javascript.builtins.String.substring | ||
| - javascript.builtins.String.toLowerCase | ||
| - javascript.builtins.String.toString | ||
| - javascript.builtins.String.toUpperCase | ||
| - javascript.builtins.String.trim | ||
| - javascript.builtins.String.unicode_code_point_escapes | ||
| - javascript.builtins.String.valueOf | ||
| - javascript.builtins.String.@@iterator | ||
petele marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - javascript.grammar.string_literals | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.