Skip to content

Commit

Permalink
feat: rename timeoutToDefault to useDefaultOnTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
loopingz committed Oct 5, 2020
1 parent 64439bc commit ef7c387
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Available options:
| input | Input stream to read from | [Stream](https://nodejs.org/api/process.html#process_process_stdin) | process.stdin |
| output | Output stream to write to | [Stream](https://nodejs.org/api/process.html#process_process_stdout) | process.stdout |
| timeout | Timeout in ms | number | 0 |
| timeoutToDefault | Return default value if timed out | boolean | false |
| useDefaultOnTimeout | Return default value if timed out | boolean | false |

The same **options** are available to **all functions** but with different default values.

Expand Down
2 changes: 1 addition & 1 deletion lib/getOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function getOptions(options) {
retry: true,
trim: true,
default: undefined,
timeoutToDefault: false,
useDefaultOnTimeout: false,

// `read` package options
silent: false,
Expand Down
2 changes: 1 addition & 1 deletion lib/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function prompt(message, options) {
timeout: options.timeout,
});
} catch (err) {
if (err.message !== 'timed out' || !options.default || !options.timeoutToDefault) {
if (err.message !== 'timed out' || !options.default || !options.useDefaultOnTimeout) {
throw err;
}
value = options.default;
Expand Down

0 comments on commit ef7c387

Please sign in to comment.