Transformer bug?
paul-uz opened this issue ยท 5 comments
The docs state
The transformation only impacts what is shown while editing. It does not modify the answers hash.
To me, this reads as that the output in the terminal is "transformed" but the data for the answer is untouched; however this is not the case.
In the pizza.js
example, this transformer is set
transformer: (answer: Answers) => (answer ? '๐' : '๐'),
If you log out answer
from inquirer.prompt(confirmation).then((answer) => {...
, with the transformer in place, its now an emoji. Without the transformer, answer
is a bool.
Hi, I think that's because you're reading the documentation of @inquirer/input
while using the inquirer
package (the depreciated version).
Those packages APIs do not work completely in the same way.
Oh right. Can we get some updated docs/examples?
I'm not sure I understand what you need. Each packages have their own docs.
If you're looking for code examples using the new API (@inquirer/prompts
, etc), there's a bunch in here https://github.com/SBoudrias/Inquirer.js/tree/master/packages/demo/demos
The issue is that the docs for transformer don't match what it actually seems to do, and you mentioned that something was deprecated.
I just want some clear docs.
The docs on confirm
are already pretty clear. If you're confused on what exactly the transform property does, you can see the provided example from the link that SBoudrias sent before.
If you still think that the docs are unclear, and that they do not match the actual functionality, submit a pull request with your desired changes.