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

Add: answers hash as second argument to placeholder function #11

Open
wannabewayno opened this issue Nov 10, 2021 · 0 comments
Open

Add: answers hash as second argument to placeholder function #11

wannabewayno opened this issue Nov 10, 2021 · 0 comments

Comments

@wannabewayno
Copy link

Hi Adam,

Thanks for taking the time to make this publicly available!
Having the placeholder also receive the answers hash has helped me with a situation I needed.
I'd be more than happy to submit a pull request if you're happy for me to contribute.

Here are the proposed changes

index.js

   const choices = [
     ...this.getChoices().slice(0, this.selected),
-    this.getPlaceholder(this.selected),
+    this.getPlaceholder(this.selected, this.previousAnswers),

README.md

--**placeholder** (*String*|*Function*) The name to display as a placeholder for chosen line. If defined as a function, the first parameter will be index of currently chosen answer. (optional) default: `INSERT HERE`.
+-**placeholder** (*String*|*Function*) The name to display as a placeholder for chosen line. If defined as a function, the first parameter will be index of currently chosen answer; the second argument will be the current answers hash. (optional)
+default: `INSERT HERE`.
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

1 participant