Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function formatUnits(value, unitName) {
if (typeof (unitName) === "string") {
const index = names.indexOf(unitName);
if (index !== -1) {
unitName = 3 * index;
}
}
return formatFixed(value, (unitName != null) ? unitName : 18);
}
export function parseUnits(value, unitName) {
export function formatUnits(value: BigNumberish, unitName?: string | BigNumberish): string {
if (typeof(unitName) === "string") {
const index = names.indexOf(unitName);
if (index !== -1) { unitName = 3 * index; }
}
return formatFixed(value, (unitName != null) ? unitName: 18);
}