@trenskow/reader 0.1.84 → 0.1.86

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.
Files changed (2) hide show
  1. package/lib/interview.js +14 -1
  2. package/package.json +2 -2
package/lib/interview.js CHANGED
@@ -124,7 +124,20 @@ const interview = async (schema, {
124
124
 
125
125
  initial = undefined;
126
126
 
127
- return await (await isvalid())(answer, schema);
127
+ return await (await isvalid())(answer, schema, {
128
+ defaults: {
129
+ pre: (data, schema) => {
130
+
131
+ if (schema.type !== Boolean) return data;
132
+
133
+ if (['yes', 'y', 'true', '1'].includes(String(data).toLowerCase())) return true;
134
+ if (['no', 'n', 'false', '0'].includes(String(data).toLowerCase())) return false;
135
+
136
+ return data;
137
+
138
+ }
139
+ }
140
+ });
128
141
 
129
142
  } catch (error) {
130
143
  print.err.bold(error.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trenskow/reader",
3
- "version": "0.1.84",
3
+ "version": "0.1.86",
4
4
  "description": "A simple package to ask questions of a stream.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@trenskow/print": "^0.1.53",
35
- "isvalid": "^4.2.22",
35
+ "isvalid": "^4.2.23",
36
36
  "keyd": "^2.1.56",
37
37
  "puqeue": "^1.1.31"
38
38
  }