express-generator-typescript 2.5.8 → 2.5.10
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Response, Request } from 'express';
|
|
2
|
+
import { isObject } from 'jet-validators';
|
|
2
3
|
import { parseObject, TSchema } from 'jet-validators/utils';
|
|
3
4
|
|
|
4
5
|
import { ValidationErr } from '@src/common/route-errors';
|
|
@@ -17,7 +18,13 @@ export type IRes = Response<unknown, TRecord>;
|
|
|
17
18
|
* Parse a Request object property and throw a Validation error if it fails.
|
|
18
19
|
*/
|
|
19
20
|
export function parseReq<U extends TSchema>(schema: U) {
|
|
20
|
-
|
|
21
|
+
const parseFn = parseObject<U>(schema, _parseReqOnError);
|
|
22
|
+
return (arg: unknown) => {
|
|
23
|
+
if (isObject(arg)) {
|
|
24
|
+
arg = { ...arg };
|
|
25
|
+
}
|
|
26
|
+
return parseFn(arg);
|
|
27
|
+
};
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-generator-typescript",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.10",
|
|
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",
|