Skip to content

Improve clarity of example comments #2

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

karlhorky
Copy link

Hi @ljharb, hope things are good with you!

Reading the comments in the readme examples left me a bit confused - if Array.prototype.findLastIndex is not present, then why would it need to be deleted? I swapped "not present" and "present" in the examples, in case my understanding is correct.

Alternatives considered: maybe I'm misunderstanding the comment and it is indeed correct as it is

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

sorry for the delay.

Comment on lines -39 to 40
/* when Array#findLastIndex is not present */
/* when Array#findLastIndex is present */
delete Array.prototype.findLastIndex;
Copy link
Member

Choose a reason for hiding this comment

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

the comment refers to the .shim() call being made when it's not present. the delete is so that evalmd doesn't fail in an engine where it is present.

Comment on lines -50 to 51
/* when Array#findLastIndex is present */
/* when Array#findLastIndex is not present */
var shimmed = findLastIndex.shim();
Copy link
Member

Choose a reason for hiding this comment

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

similarly, it's present here for this shim() call

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.

2 participants