express-ext 0.5.9 → 0.5.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-ext",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "description": "express-ext",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/http.ts CHANGED
@@ -245,11 +245,11 @@ export function getRequiredDate(req: Request, res: Response, name: string): Date
245
245
  return date
246
246
  }
247
247
  export function getDate(req: Request, name: string, d?: Date): Date | undefined {
248
- const v = req.params[name]
248
+ const v = req.params[name] as string
249
249
  if (!v || v.length === 0) {
250
250
  return d
251
251
  }
252
- const date = new Date(v)
252
+ const date = new Date(v as string)
253
253
  if (date.toString() === "Invalid Date") {
254
254
  return d
255
255
  }
package/src/view.ts CHANGED
@@ -21,7 +21,7 @@ export function buildId<T>(req: Request, attrs?: Attribute[]): T | undefined {
21
21
  let id = req.params["id"] as string
22
22
  const n = attrs[0].name
23
23
  if ((!id || id.length === 0) && n && n.length > 0) {
24
- id = req.params[n]
24
+ id = req.params[n] as string
25
25
  }
26
26
  if (id && id.length > 0) {
27
27
  if (attrs[0].type === "integer" || attrs[0].type === "number") {
@@ -47,7 +47,7 @@ export function buildId<T>(req: Request, attrs?: Attribute[]): T | undefined {
47
47
  if (isNaN(v as any)) {
48
48
  return undefined
49
49
  }
50
- ids[attr.name] = parseFloat(v)
50
+ ids[attr.name] = parseFloat(v as string)
51
51
  } else {
52
52
  ids[attr.name] = v
53
53
  }