69 lines
2.4 KiB
JavaScript
69 lines
2.4 KiB
JavaScript
// Module ID: 13033
|
|
// Function ID: 99268
|
|
// Name: ComputeExponentForMagnitude
|
|
// Dependencies: []
|
|
// Exports: ComputeExponentForMagnitude
|
|
|
|
// Module 13033 (ComputeExponentForMagnitude)
|
|
const _module = require(dependencyMap[0]);
|
|
const __importDefaultResult = _module.__importDefault(require(dependencyMap[1]));
|
|
const result = __importDefaultResult.default.set({ toExpPos: 100 });
|
|
|
|
export const ComputeExponentForMagnitude = function ComputeExponentForMagnitude(style, floorResult) {
|
|
let dataLocaleData;
|
|
let notation;
|
|
let numberingSystem;
|
|
({ notation, dataLocaleData, numberingSystem } = style);
|
|
if ("standard" === notation) {
|
|
return 0;
|
|
} else if ("scientific" === notation) {
|
|
return floorResult.toNumber();
|
|
} else if ("engineering" === notation) {
|
|
const divResult = floorResult.div(3);
|
|
floorResult = floorResult.div(3).floor();
|
|
return floorResult.div(3).floor().times(3).toNumber();
|
|
} else {
|
|
require(dependencyMap[2]).invariant("compact" === notation, "Invalid notation");
|
|
if ("currency" === style.style) {
|
|
let str = "name";
|
|
if ("name" !== tmp10) {
|
|
let tmp2 = dataLocaleData.numbers.currency[numberingSystem];
|
|
if (!tmp2) {
|
|
tmp2 = dataLocaleData.numbers.currency[dataLocaleData.numbers.nu[0]];
|
|
}
|
|
let short = tmp2.short;
|
|
}
|
|
if (short) {
|
|
str = __importDefaultResult.default.pow(10, floorResult).toString();
|
|
const _Object = Object;
|
|
const keys = Object.keys(short);
|
|
if (str < keys[0]) {
|
|
return 0;
|
|
} else if (str > keys[keys.length - 1]) {
|
|
return keys[keys.length - 1].length - 1;
|
|
} else {
|
|
const index = keys.indexOf(str);
|
|
if (-1 === index) {
|
|
return 0;
|
|
} else {
|
|
let num7 = 0;
|
|
if ("0" !== short[keys[index]].other) {
|
|
num7 = arr2.length - short[arr2].other.match(/0+/)[0].length;
|
|
const str5 = short[arr2].other;
|
|
}
|
|
return num7;
|
|
}
|
|
}
|
|
const _default = __importDefaultResult.default;
|
|
const str3 = __importDefaultResult.default.pow(10, floorResult);
|
|
} else {
|
|
return 0;
|
|
}
|
|
}
|
|
let tmp = dataLocaleData.numbers.decimal[numberingSystem];
|
|
if (!tmp) {
|
|
tmp = dataLocaleData.numbers.decimal[dataLocaleData.numbers.nu[0]];
|
|
}
|
|
short = "long" === style.compactDisplay ? tmp.long : tmp.short;
|
|
}
|
|
};
|