Skip to content
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

feat: add additional string prototype methods #4299

Merged
merged 7 commits into from Dec 21, 2021

Conversation

dnalborczyk
Copy link
Contributor

@dnalborczyk dnalborczyk commented Dec 11, 2021

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

Description

@lukastaegert could you look at match and matchAll if returnsBoolean is what is expected?

@dnalborczyk dnalborczyk changed the title fix: add missing string prototype methods feat: add missing string prototype methods Dec 11, 2021
@codecov
Copy link

codecov bot commented Dec 11, 2021

Codecov Report

Merging #4299 (20b154a) into master (a37e6ad) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4299   +/-   ##
=======================================
  Coverage   98.45%   98.45%           
=======================================
  Files         205      205           
  Lines        7314     7314           
  Branches     2083     2083           
=======================================
  Hits         7201     7201           
  Misses         55       55           
  Partials       58       58           
Impacted Files Coverage Δ
src/ast/values.ts 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a37e6ad...20b154a. Read the comment docs.

@dnalborczyk dnalborczyk changed the title feat: add missing string prototype methods feat: add additional string prototype methods Dec 12, 2021
Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No you are right, .match (and .matchAll) definitely do NOT return booleans. .match returns either an array with extra properties or null, and .matchAll returns an iterator. We should use returnsUnknown for both.
Similarly, .at can return undefined and should therefore also be a returnsUnknown. Checking the other ...at methods, .codePointAt should also be changed to unknown (charAt and charCodeAt seem to return consistent types, though).

Could you adjust those?
Otherwise, I am not sure it makes any sense to mark methods as deprecated, after all, nothing gets every removed from JavaScript so we need to keep supporting it. 😉

@dnalborczyk
Copy link
Contributor Author

dnalborczyk commented Dec 18, 2021

No you are right, .match (and .matchAll) definitely do NOT return booleans. .match returns either an array with extra properties or null, and .matchAll returns an iterator. We should use returnsUnknown for both.

ah, ok. I was about to ask. 😄

Similarly, .at can return undefined and should therefore also be a returnsUnknown. Checking the other ...at methods, .codePointAt should also be changed to unknown (charAt and charCodeAt seem to return consistent types, though). Could you adjust those?

I'll fix those as well.

Otherwise, I am not sure it makes any sense to mark methods as deprecated, after all, nothing gets every removed from JavaScript so we need to keep supporting it. 😉

the comments are more of a reminder. e.g. trimRight and trimLeft are only mentioned in the MDN as a side note, as being an alias for trimStart and trimEnd.

@dnalborczyk
Copy link
Contributor Author

Otherwise, I am not sure it makes any sense to mark methods as deprecated, after all, nothing gets every removed from JavaScript so we need to keep supporting it. 😉

the comments are more of a reminder. e.g. trimRight and trimLeft are only mentioned in the MDN as a side note, as being an alias for trimStart and trimEnd.

in the same vein I'm gonna add those other deprecated "HTML" string methods (blink, link, small, etc.), which are still in V8 (incl. node.js) and possibly other engines.

@lukastaegert lukastaegert merged commit 83af3aa into rollup:master Dec 21, 2021
@dnalborczyk dnalborczyk deleted the string-prototype branch December 30, 2021 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants