- return new Promise ( resolve => {
- prompt.start()
- const schema = {
- properties: {
- password: {
- hidden:true,
- required:true
- }
- }
- }
- prompt.get(schema, function(err, result) {
- if (err) {
- console.log(err.message)
- }
- resolve(result.password)
- })
+ return new Promise((res, rej) => {
+ prompt.start()
+ const schema = {
+ properties: {
+ password: {
+ hidden: true,
+ required: true
+ }
+ }
+ }
+ prompt.get(schema, function (err, result) {
+ if (err) {
+ return rej(err)
+ }
+ return res(result.password)
+ })