enquirer icon indicating copy to clipboard operation
enquirer copied to clipboard

Form doesn't return properties when skip is used

Open adriancmiranda opened this issue 5 years ago • 0 comments

Hey, guys! I'm trying to make a form with a skip option, but the result is always an empty object when I use this property.

const { Form } = require('enquirer');

const prompt = new Form({
	name: 'bugs',
	choices: [
		{ name: 'url', message: 'url', initial: '' },
		{ name: 'email', message: 'email', initial: '' },
	],
	skip() {
		return true;
	},
	message() {
		return 'bugs';
	},
});

prompt.run()
	.then(value => console.log('Answer:', value))
	.catch(console.error);

returns

{}

should returns

{ url: '', email: '' }

I'm using OSX 10.15.3, node v10.16.2 and npm 6.14.5

Seems like the problem is here: enquirer/lib/prompts/form.js#submit but I don't know yet, perhaps this method should be run before it

adriancmiranda avatar Oct 31 '20 16:10 adriancmiranda