UNPKG

1.28 kBTypeScriptView Raw
1import { ArgumentMetadata } from '../index';
2import { PipeTransform } from '../interfaces/features/pipe-transform.interface';
3import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
4/**
5 * @publicApi
6 */
7export interface ParseFloatPipeOptions {
8 errorHttpStatusCode?: ErrorHttpStatusCode;
9 exceptionFactory?: (error: string) => any;
10 optional?: boolean;
11}
12/**
13 * Defines the built-in ParseFloat Pipe
14 *
15 * @see [Built-in Pipes](https://docs.nestjs.com/pipes#built-in-pipes)
16 *
17 * @publicApi
18 */
19export declare class ParseFloatPipe implements PipeTransform<string> {
20 protected readonly options?: ParseFloatPipeOptions;
21 protected exceptionFactory: (error: string) => any;
22 constructor(options?: ParseFloatPipeOptions);
23 /**
24 * Method that accesses and performs optional transformation on argument for
25 * in-flight requests.
26 *
27 * @param value currently processed route argument
28 * @param metadata contains metadata about the currently processed route argument
29 */
30 transform(value: string, metadata: ArgumentMetadata): Promise<number>;
31 /**
32 * @param value currently processed route argument
33 * @returns `true` if `value` is a valid float number
34 */
35 protected isNumeric(value: string): boolean;
36}