Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enquirer/prompt-password
This repository has been archived, use the built-in password prompt in Enquirer instead.
https://github.com/enquirer/prompt-password
enquirer mask password plugin prompt zxcvbn
Last synced: 6 days ago
JSON representation
This repository has been archived, use the built-in password prompt in Enquirer instead.
- Host: GitHub
- URL: https://github.com/enquirer/prompt-password
- Owner: enquirer
- License: mit
- Created: 2016-08-29T02:44:23.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-08T07:54:06.000Z (over 7 years ago)
- Last Synced: 2024-11-09T13:20:37.821Z (11 days ago)
- Topics: enquirer, mask, password, plugin, prompt, zxcvbn
- Language: JavaScript
- Homepage: https://github.com/enquirer/enquirer
- Size: 45.9 KB
- Stars: 8
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prompt-password [![NPM version](https://img.shields.io/npm/v/prompt-password.svg?style=flat)](https://www.npmjs.com/package/prompt-password) [![NPM monthly downloads](https://img.shields.io/npm/dm/prompt-password.svg?style=flat)](https://npmjs.org/package/prompt-password) [![NPM total downloads](https://img.shields.io/npm/dt/prompt-password.svg?style=flat)](https://npmjs.org/package/prompt-password) [![Linux Build Status](https://img.shields.io/travis/enquirer/prompt-password.svg?style=flat&label=Travis)](https://travis-ci.org/enquirer/prompt-password)
> Password prompt. Can be used as a standalone prompt, or as a plugin for [Enquirer](http://enquirer.io).
![prompt-password example](https://raw.githubusercontent.com/enquirer/prompt-password/master/docs/example.gif)
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save prompt-password
```## Usage
```js
var Prompt = require('..');
var prompt = new Prompt({
type: 'password',
message: 'Enter your password please',
name: 'password'
});prompt.run()
.then(function(answers) {
console.log(answers)
});
```### mask function
Use [prompt-password-strength](https://github.com/enquirer/prompt-password-strength), or pass a function to customize how the input is masked:
```js
var Prompt = require('..');
var prompt = new Prompt({
type: 'password',
message: 'Enter your password please',
name: 'password',
mask: function(input) {
return '█' + new Array(String(input).length).join('█');
}
});prompt.run()
.then(function(answers) {
console.log(answers)
});
```## Enquirer usage
Use the `.register` method to add the "password" prompt type to [enquirer](http://enquirer.io):
```js
var Enquirer = require('enquirer');
var enquirer = new Enquirer();enquirer.register('password', require('prompt-password'));
// questions can be an array or object
var questions = {
type: 'password',
message: 'Enter your password please',
name: 'password'
};enquirer.ask(questions)
.then(function(answers) {
console.log(answers)
});
```## Attribution
Based on the `password` prompt in inquirer.
## About
### Related projects
* [enquirer](https://www.npmjs.com/package/enquirer): Intuitive, plugin-based prompt system for node.js. | [homepage](http://enquirer.io "Intuitive, plugin-based prompt system for node.js.")
* [prompt-base](https://www.npmjs.com/package/prompt-base): Base prompt module used for creating custom prompts. | [homepage](https://github.com/enquirer/prompt-base "Base prompt module used for creating custom prompts.")
* [prompt-question](https://www.npmjs.com/package/prompt-question): Question object, used by Enquirer and prompt plugins. | [homepage](https://github.com/enquirer/prompt-question "Question object, used by Enquirer and prompt plugins.")### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 05, 2017._