File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { BadRequestException } from '../exceptions/bad-request.exception' ;
2- import { PipeTransform } from '../interfaces/pipe-transform.interface' ;
3- import { Pipe , ArgumentMetadata } from '../index' ;
4- import { isNumeric } from "rxjs/util/isNumeric" ;
1+ import { BadRequestException } from '../exceptions/bad-request.exception' ;
2+ import { PipeTransform } from '../interfaces/pipe-transform.interface' ;
3+ import { ArgumentMetadata , Pipe } from '../index' ;
54
65@Pipe ( )
76export class ParseIntPipe implements PipeTransform < string > {
87 async transform ( value : string , metadata : ArgumentMetadata ) : Promise < number > {
9- if ( 'string' === typeof value && isNumeric ( value ) ) {
8+ if ( 'string' === typeof value && ! isNaN ( parseFloat ( value ) ) && isFinite ( value as any ) ) {
109 return parseInt ( value , 10 ) ;
1110 }
1211 else {
You can’t perform that action at this time.
0 commit comments