express-generator-typescript 2.5.18 → 2.5.19

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.
@@ -37,25 +37,31 @@ export interface IUser {
37
37
  */
38
38
  function newUser(user?: Partial<IUser>): IUser {
39
39
  const retVal = { ...DEFAULT_USER_VALS(), ...user };
40
- return parseUser(retVal);
40
+ return parseUser(true)(retVal);
41
41
  }
42
42
 
43
43
  /**
44
- * Check is a user object.
44
+ * Check is a user object. For the route validation.
45
45
  */
46
46
  function testUser(arg: unknown, errCb?: TParseOnError): arg is IUser {
47
- return !!parseUser(arg, errCb);
47
+ return !!parseUser()(arg, errCb);
48
48
  }
49
49
 
50
50
  /**
51
- * Validate a user object.
51
+ * Parse a user object.
52
52
  */
53
- const parseUser = parseObject<IUser>({
54
- id: isRelationalKey,
55
- name: isString,
56
- email: isString,
57
- created: transIsDate,
58
- });
53
+ function parseUser(throwErr?: boolean) {
54
+ return parseObject<IUser>({
55
+ id: isRelationalKey,
56
+ name: isString,
57
+ email: isString,
58
+ created: transIsDate,
59
+ }, errors => {
60
+ if (throwErr) {
61
+ throw new Error(JSON.stringify(errors));
62
+ }
63
+ });
64
+ }
59
65
 
60
66
 
61
67
  /******************************************************************************
@@ -1 +1 @@
1
- {"users":[{"id":937353914582,"name":"Bill","created":"2025-03-10T08:02:45.482Z","email":"sean.maxwell@gmail.com"},{"id":564064331076,"name":"John Smith","created":"2025-03-10T08:02:45.482Z","email":"john.smith@gmail.com"},{"id":491773368070,"name":"Gordan Freeman","created":"2025-03-10T08:02:45.482Z","email":"gordan.freeman@gmail.com"}]}
1
+ {"users":[{"id":64898245208,"name":"John Smith","created":"2025-03-10T08:17:36.414Z","email":"john.smith@gmail.com"},{"id":77834125799,"name":"Gordan Freeman","created":"2025-03-10T08:17:36.414Z","email":"gordan.freeman@gmail.com"}]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-generator-typescript",
3
- "version": "2.5.18",
3
+ "version": "2.5.19",
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",