express-generator-typescript 2.5.1 → 2.5.3
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/README.md +1 -1
- package/lib/project-files/src/util/validators.ts +15 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ The quickest way to get started is use npx and pass in the name of the project y
|
|
|
49
49
|
|
|
50
50
|
Create the app:<br/>
|
|
51
51
|
With no options: `$ npx express-generator-typescript`<br/>
|
|
52
|
-
With all options (order doesn't matter): `$ npx express-generator-typescript --
|
|
52
|
+
With all options (order doesn't matter): `$ npx express-generator-typescript --use-yarn "project name"`
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
Start your express-generator-typescript app in development mode at `http://localhost:3000/`:
|
|
@@ -150,7 +150,7 @@ function _checkType<T>(type: string) {
|
|
|
150
150
|
* Transform a value before checking it.
|
|
151
151
|
*/
|
|
152
152
|
function _transform<T>(
|
|
153
|
-
transFn:
|
|
153
|
+
transFn: (arg: unknown) => T,
|
|
154
154
|
vldt: ((arg: unknown) => arg is T),
|
|
155
155
|
): TValidateWithTransform<T> {
|
|
156
156
|
return (arg: unknown, cb?: (arg: T) => void): arg is T => {
|
|
@@ -285,26 +285,26 @@ function _parseObjCoreHelper(
|
|
|
285
285
|
schema: TSchema,
|
|
286
286
|
arg: unknown,
|
|
287
287
|
onError?: TParseOnError<false>,
|
|
288
|
-
) {
|
|
288
|
+
): unknown {
|
|
289
289
|
if (!isObj(arg)) {
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
292
|
-
const retVal
|
|
292
|
+
const retVal = (arg as TBasicObj);
|
|
293
293
|
for (const key in schema) {
|
|
294
|
-
const schemaProp = schema[key]
|
|
295
|
-
|
|
294
|
+
const schemaProp = schema[key],
|
|
295
|
+
val = retVal[key];
|
|
296
296
|
// Nested object
|
|
297
297
|
if (typeof schemaProp === 'object') {
|
|
298
298
|
const childVal = _parseObjCoreHelper(schemaProp, val, onError);
|
|
299
|
-
if (childVal
|
|
300
|
-
val = childVal;
|
|
301
|
-
} else {
|
|
299
|
+
if (childVal === undefined) {
|
|
302
300
|
return undefined;
|
|
303
301
|
}
|
|
304
302
|
// Run validator
|
|
305
303
|
} else if (typeof schemaProp === 'function') {
|
|
306
304
|
try {
|
|
307
|
-
if (!schemaProp(val, (tval: unknown) =>
|
|
305
|
+
if (!schemaProp(val, (tval: unknown) => {
|
|
306
|
+
retVal[key] = tval;
|
|
307
|
+
})) {
|
|
308
308
|
return onError?.(key, val);
|
|
309
309
|
}
|
|
310
310
|
} catch (err) {
|
|
@@ -315,7 +315,12 @@ function _parseObjCoreHelper(
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
|
|
318
|
+
}
|
|
319
|
+
// Purse keys not in schema
|
|
320
|
+
for (const key in retVal) {
|
|
321
|
+
if (!(key in schema)) {
|
|
322
|
+
Reflect.deleteProperty(arg, key);
|
|
323
|
+
}
|
|
319
324
|
}
|
|
320
325
|
// Return
|
|
321
326
|
return retVal;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-generator-typescript",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.3",
|
|
4
4
|
"description": "Generate new Express applications similar to express-generate which but sets it up to use TypeScript instead",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"express-generator-typescript": "node bin/cli.js",
|