UNPKG

@nova-ui/bits

Version:

SolarWinds Nova Framework

29 lines (28 loc) 1.58 kB
import { PipeTransform } from "@angular/core"; import { UnitOption } from "../constants/unit-conversion.constants"; import { UnitConversionService } from "../services/unit-conversion.service"; import * as i0 from "@angular/core"; /** * <example-url>./../examples/index.html#/pipes/unit-conversion</example-url> * * Pipe for converting a large quantity of a small basic unit to a smaller approximation of the same quantity in a larger unit. This can be useful for * displaying larger values in a limited amount of space. */ export declare class UnitConversionPipe implements PipeTransform { private unitConversionService; constructor(unitConversionService: UnitConversionService); /** * Gets a string representation of the conversion of a large quantity of a small basic unit to a smaller quantity of a larger unit. * For example, a quantity of 1024 in bytes is output as "1 KB". * * @param value The value to convert * @param scale The number of significant digits to the right of the decimal to include in the converted value * @param plusSign Specify whether to prefix positive values with a '+' * @param unit The basic unit to use for the conversion result's unit label * * @returns {string} The conversion result appended with the converted unit label */ transform(value: any, scale?: number, plusSign?: boolean, unit?: UnitOption): string; static ɵfac: i0.ɵɵFactoryDeclaration<UnitConversionPipe, never>; static ɵpipe: i0.ɵɵPipeDeclaration<UnitConversionPipe, "unitConversion", false>; }