Skip to content

Endval as option #344

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

Closed
wants to merge 6 commits into from
Closed

Conversation

trymeouteh
Copy link
Contributor

I'm submitting a...

[ ] Bug Fix
[ ] Feature
[ x ] Other (Refactoring, Added tests, Documentation, ...)

Checklist

  • [ x ] Test your changes
  • [ x ] Followed the build steps

Description

Thank you for accepting the recent pull request on making the endVal argument optional by having the method look at the element inner HTML for a value if null or undefined is given as the endVal value. That pull request should cause minor breakage.

This pull request is to modify the CountUp() method by removing the endVal argument and moving endVal as one of the options in the options argument.

This will allow for the following code to work...

// Without options
const countUp = new CountUp('targetId');

// With options
const countUp = new CountUp('targetId', options);

No need to for code like this...

const countUp = new CountUp('targetId', null, options);

Since endVal is now optional, it should be an option, not a required argument for when you want to set some options.

I also updated the tests, the README.md and demo scripts to include these changes to make this pull request as seamless as possible.

All of the updated tests do pass.

This however will cause breaking changes and I would suggest pushing this for a 3.0.0 release.

Does this PR introduce a breaking change?

[ x ] Yes
[ ] No

@inorganik
Copy link
Owner

Thanks for the PR. I agree this would be a breaking change, and thus a major update. But I disagree with changing the function signature to make endVal an option, because most people are not setting the endVal in their html as you are, they are passing it as an arg. I also think libraries shouldn't arbitrarily change method signatures without a really good reason. Think about all the people who would have to update, with no real benefit of doing so. So again thanks, but I'll be closing this.

@inorganik inorganik closed this Jun 24, 2025
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