express-generator-typescript 2.0.5 → 2.0.6
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.
|
@@ -8,15 +8,18 @@ import { ParamInvalidError } from '@shared/errors';
|
|
|
8
8
|
// **** Types **** //
|
|
9
9
|
|
|
10
10
|
type TParam = string | number | boolean | null | object;
|
|
11
|
-
type
|
|
11
|
+
type TValidatorFn = ((arg: TParam) => boolean);
|
|
12
|
+
type TParamFull = TParam | TValidatorFn;
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
// **** Functions **** //
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
* Make sure parameter of the specified type. If the type
|
|
18
|
-
* used as the default type
|
|
19
|
-
* which must return 'true' or 'false'.
|
|
18
|
+
* Make sure parameter is of the specified type. If the type is not provided then 'string' is
|
|
19
|
+
* used as the default type. Instead of a type you can also pass a validator function
|
|
20
|
+
* which must return 'true' or 'false'. Return false if invalid.
|
|
21
|
+
*
|
|
22
|
+
* Example argument: [id, 'number], id is the incoming variable, 'number' is the type.
|
|
20
23
|
*
|
|
21
24
|
* Example 1: validate(email, [user, 'object'], [isAdmin, 'boolean'])
|
|
22
25
|
* Example 2: validate(password) // will check that password is a string
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-generator-typescript",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
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",
|