@inquirer/confirm 1.0.10 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -11,7 +11,11 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
11
11
  const prefix = (0, core_1.usePrefix)();
12
12
  (0, core_1.useKeypress)((key, rl) => {
13
13
  if ((0, core_1.isEnterKey)(key)) {
14
- const answer = value ? /^y(es)?/i.test(value) : config.default !== false;
14
+ let answer = config.default !== false;
15
+ if (/^(y|yes)?/i.test(value))
16
+ answer = true;
17
+ else if (/^(n|no)?/i.test(value))
18
+ answer = false;
15
19
  if (typeof config.transformer === 'function') {
16
20
  setValue(config.transformer(answer));
17
21
  }
@@ -6,7 +6,11 @@ export default createPrompt((config, done) => {
6
6
  const prefix = usePrefix();
7
7
  useKeypress((key, rl) => {
8
8
  if (isEnterKey(key)) {
9
- const answer = value ? /^y(es)?/i.test(value) : config.default !== false;
9
+ let answer = config.default !== false;
10
+ if (/^(y|yes)?/i.test(value))
11
+ answer = true;
12
+ else if (/^(n|no)?/i.test(value))
13
+ answer = false;
10
14
  if (typeof config.transformer === 'function') {
11
15
  setValue(config.transformer(answer));
12
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/confirm",
3
- "version": "1.0.10",
3
+ "version": "2.0.0",
4
4
  "description": "Inquirer confirm prompt",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "typings": "./dist/cjs/types/index.d.cts",
@@ -54,16 +54,16 @@
54
54
  "license": "MIT",
55
55
  "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/confirm/README.md",
56
56
  "dependencies": {
57
- "@inquirer/core": "^1.2.2",
58
- "@inquirer/type": "^1.0.4",
57
+ "@inquirer/core": "^2.0.0",
58
+ "@inquirer/type": "^1.1.0",
59
59
  "chalk": "^4.1.2"
60
60
  },
61
61
  "scripts": {
62
62
  "tsc": "yarn run clean && yarn run tsc:esm && yarn run tsc:cjs",
63
63
  "clean": "rm -rf dist",
64
- "tsc:esm": "tsc -p ./tsconfig.esm.json",
64
+ "tsc:esm": "tsc -p ./tsconfig.json",
65
65
  "tsc:cjs": "tsc -p ./tsconfig.cjs.json && yarn run fix-ext",
66
- "fix-ext": "node --no-warnings=ExperimentalWarning --loader=ts-node/esm ../../tools/rename-ext.mts"
66
+ "fix-ext": "node --no-warnings=ExperimentalWarning --loader=ts-node/esm ../../tools/fix-ext.mts"
67
67
  },
68
68
  "publishConfig": {
69
69
  "access": "public"
@@ -83,5 +83,5 @@
83
83
  }
84
84
  }
85
85
  },
86
- "gitHead": "4ade5f25d271c6f814efc7a21bdeb1a4d1ee6cf8"
86
+ "gitHead": "86531864067faf1d6e76f1581c9aa72cb1b03753"
87
87
  }