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

Usage example is wrong #24

Closed
jeanbmar opened this issue Aug 26, 2022 · 2 comments
Closed

Usage example is wrong #24

jeanbmar opened this issue Aug 26, 2022 · 2 comments

Comments

@jeanbmar
Copy link

jeanbmar commented Aug 26, 2022

I was not sure if the example was wrong or if I was just dumb:

import pDebounce from 'p-debounce';

const expensiveCall = async (input) => input;

const debouncedFn = pDebounce(expensiveCall, 200);

for (const number of [1, 2, 3]) {
  console.log(await debouncedFn(number));
}

outputs:

1
2
3

README says:

3
3
3

Also I'm not sure this example demonstrates the value of the lib. Calling expensiveCall alone in the for loop would produce the same output.

@Zhell1
Copy link

Zhell1 commented Dec 16, 2022

can confirm, came here to say this

@Zhell1
Copy link

Zhell1 commented Dec 16, 2022

just opened a PR to fix the examples, they are both wrong actually

here it is: #25

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

No branches or pull requests

2 participants