0.2.9 • Published 2 months ago
yeonyu-utils v0.2.9
yeonyu-utils
yeonyu's typescript(javascript) utils to use the frequently
SizeUnit
About the transformation in thousand units. It is based on the premise of a single tone, and the computed value stored in the _result is freeze.
⚠️WARNING
This conversion works within the Browser Number
range calculation and does not guarantee errors.
Constructor parameters
types
UnitType
enum UnitType {
DEFAULT, // K, M, G, T, P, E, Z, Y
BYTE, // KB, MB, GB ...
BIN_BYTE, // KiB, MiB, GiB ...
BPS, // Kbps, Mbps ...
FREQ, // KHz, MHz
}
SizeUnitOptions
interface SizeUnitOptions {
fixedUnit?: number
/**
* if 'true' not use Number.toFixed in the fixed parameter and instead cut off as much as fixed
*/
isCutoffFixed?: boolean;
isBinary?: boolean;
customBase?: number;
customUnits?: string[];
}