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

Refactor exports & Add inject() method #13

Merged
merged 2 commits into from
Feb 28, 2018
Merged

Refactor exports & Add inject() method #13

merged 2 commits into from
Feb 28, 2018

Conversation

lukeed
Copy link
Collaborator

@lukeed lukeed commented Feb 28, 2018

This is my proposed solution to #1 -- it accepts 1 object at a time and pops off the internal mapping's keys as they are used.

I also took the opportunity to apply a default export, as mentioned in #11. Doing so allowed for a simpler to apply a "state" via inject.

const prompt = require('prompts');
//=> the AsyncFunction

const { prompts, prompt } = require('prompts');
//=> non-breaking imports

const { inject } = require('prompts');
//=> or :: prompt.inject

Lastly, I had to do some variable renaming in order to keep the prompt reference to the function & not the variable placeholder.

Tests were added to accommodate the new exports & to assert the new inject() method.

@terkelg
Copy link
Owner

terkelg commented Feb 28, 2018

Looks good to me! We should add this as one of the key feartures in the readme

@terkelg terkelg merged commit 6854b03 into terkelg:master Feb 28, 2018
@lukeed lukeed deleted the feat/inject branch February 28, 2018 08:38
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.

3 participants