ParseBoolPipe

Defines the built-in ParseBool Pipe

  
class ParseBoolPipe implements PipeTransform> {
  protected exceptionFactory: (error: string) => any
  protected options?: ParseBoolPipeOptions
  transform(value: string | boolean, metadata: ArgumentMetadata): Promise<boolean>
  protected isTrue(value: string | boolean): boolean
  protected isFalse(value: string | boolean): boolean
}

See also

Properties

Property Description
protected exceptionFactory: (error: string) => any
protected options?: ParseBoolPipeOptions Read-only.

Methods

transform()

Method that accesses and performs optional transformation on argument for in-flight requests.


transform(value: string | boolean, metadata: ArgumentMetadata): Promise<boolean>

Parameters

Option Type Description
value string | boolean

currently processed route argument

metadata ArgumentMetadata

contains metadata about the currently processed route argument

Returns

Promise<boolean>

isTrue()


protected isTrue(value: string | boolean): boolean

Parameters

Option Type Description
value string | boolean

currently processed route argument

Returns

boolean true if value is said 'true', ie., if it is equal to the boolean true or the string "true"

isFalse()


protected isFalse(value: string | boolean): boolean

Parameters

Option Type Description
value string | boolean

currently processed route argument

Returns

boolean true if value is said 'false', ie., if it is equal to the boolean false or the string "false"