Gathering detailed insights and metrics for @moyuyc/inquirer-autocomplete-prompt
Gathering detailed insights and metrics for @moyuyc/inquirer-autocomplete-prompt
Gathering detailed insights and metrics for @moyuyc/inquirer-autocomplete-prompt
Gathering detailed insights and metrics for @moyuyc/inquirer-autocomplete-prompt
Forked from inquirer-autocomplete-prompt, but exported readline as third argument in source for suggesting matched text
npm install @moyuyc/inquirer-autocomplete-prompt
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
ISC License
176 Commits
1 Watchers
26 Branches
1 Contributors
Updated on Oct 25, 2018
Latest Version
1.3.2
Package Id
@moyuyc/inquirer-autocomplete-prompt@1.3.2
Unpacked Size
15.77 kB
Size
5.65 kB
File Count
5
NPM Version
6.4.1
Node Version
9.2.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Forked from inquirer-autocomplete-prompt, but exported readline as third argument in source
for suggesting matched text
Autocomplete prompt for inquirer
npm install --save @moyuyc/inquirer-autocomplete-prompt
This prompt is anonymous, meaning you can register this prompt with the type name you please:
1inquirer.registerPrompt('autocomplete', require('@moyuyc/inquirer-autocomplete-prompt')); 2inquirer.prompt({ 3 type: 'autocomplete', 4 ... 5})
Change autocomplete
to whatever you might prefer.
Note: allowed options written inside square brackets (
[]
) are optional. Others are required.
type
, name
, message
, source
[, pageSize
, filter
, when
, suggestOnly
, validate
, default
, noResultText
, searchText
, throttleWaitMilliseconds
]
See inquirer readme for meaning of all except source and suggestOnly.
Source will be called with previous answers object and the current user input each time the user types.
Source will be called once at at first before the user types anything with undefined as the value. If a new search is triggered by user input it maintains the correct order, meaning that if the first call completes after the second starts, the results of the first call are never displayed.
suggestOnly is default false. Setting it to true turns the input into a normal text input. Meaning that pressing enter selects whatever value you currently have. And pressing tab autocompletes the currently selected value in the list. This way you can accept manual input instead of forcing a selection from the list.
validate is only active when suggestOnly is set to true. It behaves like validate for the input prompt.
default is type of string. Setting it as default value.
noResultText is type of string | null. Setting it as text to view (hide it when null
) when no results. ('No results...'
by default)
searchText is type of string | null. Setting it as text to view (hide it when null
) when is searching. ('Searching...'
by default)
throttleWaitMilliseconds is type of number for throttle search call times (400 by default)
1const autoComplete = require('@moyuyc/inquirer-autocomplete-prompt'); 2inquirer.registerPrompt('autocomplete', autoComplete); 3inquirer 4 .prompt([ 5 { 6 type: 'autocomplete', 7 name: 'from', 8 message: 'Select a state to travel from', 9 source: function(answersSoFar, input, rl) { 10 // e.g. sliceInput('closed #123,#222', { delimiter: '\\s,', cursor: 7 }) 11 // output: { leftIndex: 7, matching: '#123', rightIndex: 11 } 12 // input.slice(0, leftIndex) + matching + input.slice(rightIndex) === input 13 const { matching, leftIndex, rightIndex } = autoComplete.sliceInput( 14 input, 15 // delimiter: 16 // sliceInput 17 // type: string 18 // default: `'\\s'` 19 { ...rl, delimiter: ',\\s' } 20 ); 21 // rl.cursor 22 return myApi.searchStates(input); 23 }, 24 }, 25 ]) 26 .then(function(answers) { 27 //etc 28 });
See also example.js for a working example.
I recommend using this package with fuzzy if you want fuzzy search. Again, see the example for a demonstration of this.
ISC
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
33 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More