Skip to content

Commit be25319

Browse files
authored
fix(common): ParseIntPipe handle number value
handle `number` as `string` instead of throw an error values may be parsed by other global pipes provided by other modules we expect `ParseIntPipe` to return int value. it's doesn't break the logic.
1 parent 432dc3b commit be25319

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/common/pipes/parse-int.pipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class ParseIntPipe implements PipeTransform<string> {
2020
*/
2121
async transform(value: string, metadata: ArgumentMetadata): Promise<number> {
2222
const isNumeric =
23-
'string' === typeof value &&
23+
['string', 'number'].includes(typeof value) &&
2424
!isNaN(parseFloat(value)) &&
2525
isFinite(value as any);
2626
if (!isNumeric) {

0 commit comments

Comments
 (0)