@pepperi/components
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.1.
20 lines (16 loc) • 511 B
text/typescript
import {Pipe, PipeTransform} from "@angular/core";
({ name: 'quantitySelectorNumber' })
export class QuantitySelectorNumber implements PipeTransform {
transform(value: string, allowDecimal: boolean): string {
const tmpValue = parseFloat(value);
if (tmpValue === 0) {
return '0';
}
else if (allowDecimal) {
return tmpValue.toString();
}
else {
return parseInt(value).toString();
}
}
}