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

Do not copy Function#length #23

Merged
merged 5 commits into from
Jun 11, 2019
Merged

Do not copy Function#length #23

merged 5 commits into from
Jun 11, 2019

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Jun 11, 2019

Fixes #13. Previous PR at #18.

This prevents copying Function#length. That property should reflect the actual parameters length, not the one of the function that is being copied.

For example:

const original = value => value
const wrapper = () => original(true)
mimicFn(wrapper, original)
// This should be 0 not 1
console.log(wrapper.length)

This was referenced Jun 11, 2019
index.d.ts Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
@ehmicky
Copy link
Collaborator Author

ehmicky commented Jun 11, 2019

Fixed.

@sindresorhus sindresorhus merged commit c229a73 into sindresorhus:master Jun 11, 2019
@ehmicky ehmicky deleted the feature/no-length branch June 11, 2019 12:31
@sindresorhus
Copy link
Owner

Do you intend to handle the other issues you opened soon or should I do a new release now?

@ehmicky
Copy link
Collaborator Author

ehmicky commented Jun 11, 2019

I intend to fix them now. This might be one at a time (to avoid conflicts) depending on the issue though.

@ehmicky ehmicky mentioned this pull request Jun 13, 2019
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.

[PR proposal] Custom function.length
2 participants