@nestjs/common 8.2.4 → 8.2.5
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/LICENSE +1 -1
- package/package.json +1 -1
- package/pipes/default-value.pipe.js +1 -1
- package/utils/shared.utils.d.ts +6 -5
- package/utils/shared.utils.js +8 -6
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(The MIT License)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2017-
|
|
3
|
+
Copyright (c) 2017-2022 Kamil Mysliwiec <https://kamilmysliwiec.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ let DefaultValuePipe = class DefaultValuePipe {
|
|
|
17
17
|
}
|
|
18
18
|
transform(value, _metadata) {
|
|
19
19
|
if (shared_utils_1.isNil(value) ||
|
|
20
|
-
(
|
|
20
|
+
(shared_utils_1.isNumber(value) && isNaN(value))) {
|
|
21
21
|
return this.defaultValue;
|
|
22
22
|
}
|
|
23
23
|
return value;
|
package/utils/shared.utils.d.ts
CHANGED
|
@@ -9,9 +9,10 @@ export declare const addLeadingSlash: (path?: string) => string;
|
|
|
9
9
|
export declare const validatePath: (path?: string) => string;
|
|
10
10
|
export declare const normalizePath: (path?: string) => string;
|
|
11
11
|
export declare const stripEndSlash: (path: string) => string;
|
|
12
|
-
export declare const isFunction: (
|
|
13
|
-
export declare const isString: (
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
12
|
+
export declare const isFunction: (val: any) => boolean;
|
|
13
|
+
export declare const isString: (val: any) => val is string;
|
|
14
|
+
export declare const isNumber: (val: any) => val is number;
|
|
15
|
+
export declare const isConstructor: (val: any) => boolean;
|
|
16
|
+
export declare const isNil: (val: any) => val is null;
|
|
16
17
|
export declare const isEmpty: (array: any) => boolean;
|
|
17
|
-
export declare const isSymbol: (
|
|
18
|
+
export declare const isSymbol: (val: any) => val is symbol;
|
package/utils/shared.utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSymbol = exports.isEmpty = exports.isNil = exports.isConstructor = exports.isString = exports.isFunction = exports.stripEndSlash = exports.normalizePath = exports.validatePath = exports.addLeadingSlash = exports.isPlainObject = exports.isObject = exports.isUndefined = void 0;
|
|
3
|
+
exports.isSymbol = exports.isEmpty = exports.isNil = exports.isConstructor = exports.isNumber = exports.isString = exports.isFunction = exports.stripEndSlash = exports.normalizePath = exports.validatePath = exports.addLeadingSlash = exports.isPlainObject = exports.isObject = exports.isUndefined = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
5
5
|
const isUndefined = (obj) => typeof obj === 'undefined';
|
|
6
6
|
exports.isUndefined = isUndefined;
|
|
@@ -41,15 +41,17 @@ const normalizePath = (path) => path
|
|
|
41
41
|
exports.normalizePath = normalizePath;
|
|
42
42
|
const stripEndSlash = (path) => path[path.length - 1] === '/' ? path.slice(0, path.length - 1) : path;
|
|
43
43
|
exports.stripEndSlash = stripEndSlash;
|
|
44
|
-
const isFunction = (
|
|
44
|
+
const isFunction = (val) => typeof val === 'function';
|
|
45
45
|
exports.isFunction = isFunction;
|
|
46
|
-
const isString = (
|
|
46
|
+
const isString = (val) => typeof val === 'string';
|
|
47
47
|
exports.isString = isString;
|
|
48
|
-
const
|
|
48
|
+
const isNumber = (val) => typeof val === 'number';
|
|
49
|
+
exports.isNumber = isNumber;
|
|
50
|
+
const isConstructor = (val) => val === 'constructor';
|
|
49
51
|
exports.isConstructor = isConstructor;
|
|
50
|
-
const isNil = (
|
|
52
|
+
const isNil = (val) => exports.isUndefined(val) || val === null;
|
|
51
53
|
exports.isNil = isNil;
|
|
52
54
|
const isEmpty = (array) => !(array && array.length > 0);
|
|
53
55
|
exports.isEmpty = isEmpty;
|
|
54
|
-
const isSymbol = (
|
|
56
|
+
const isSymbol = (val) => typeof val === 'symbol';
|
|
55
57
|
exports.isSymbol = isSymbol;
|