unit-data-converter
Version:
Data(Ex: MB, KB, PB, GB) -> B(byte) or B(byte) -> Data(Ex: MB, KB, PB, GB) etc.
18 lines (11 loc) • 401 B
JavaScript
const { toSetUnit } = require('..');
/** toSetUnit Function */
console.log(toSetUnit('1100 MB', false, true, "GB"));
//1.07421875(int)
console.log(toSetUnit('1100 MB', true, false, "GB"));
//1.07421875 GB(string)
console.log(toSetUnit('1100 MB', false, false, "GB"));
//1.07421875(string)
console.log(toSetUnit('1100 MB', true, true, "GB"));
//Error: Is string vaule
/** End */