nortax-ts
Version:
Norwegian Tax Calculator - TypeScript Implementation
58 lines (57 loc) • 2.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TABLES_2025 = exports.TABLES_2020_TO_2024 = exports.TABLES_TO_2019 = void 0;
exports.isValidTableForYear = isValidTableForYear;
// prettier-ignore
exports.TABLES_TO_2019 = [
"7100", "7101", "4000", "7102", "8000", "7103", "7104", "7105",
"7106", "7107", "7108", "7109", "7110", "7111", "7112", "7113",
"7114", "7115", "7116", "7117", "7118", "7119", "7120", "4000",
"7121", "8000", "7122", "7123", "7124", "7125", "7126", "7127",
"7128", "7129", "7130", "7131", "7132", "7133"
];
// prettier-ignore
exports.TABLES_2020_TO_2024 = [
"7100", "7101", "7102", "7103", "7104", "7105", "7106", "7107",
"7108", "7109", "7110", "7111", "7112", "7113", "7114", "7115",
"7116", "7117", "7118", "7119", "7120", "7121", "7122", "7123",
"7124", "7125", "7126", "7127", "7128", "7129", "7130", "7131",
"7132", "7133", "7150", "7160", "7170", "7300", "7350", "7500",
"7550", "7700", "6300", "6350", "6500", "6550", "6700", "0100",
"0101"
];
// prettier-ignore
exports.TABLES_2025 = [
"8000", "8010", "8020", "8030", "8040", "8050", "8060", "8070",
"8080", "8090", "8100", "8110", "8120", "8130", "8140", "8150",
"8160", "8170", "8180", "8190", "8200", "8210", "8220", "8230",
"8240", "8250", "8260", "8270", "8280", "8290", "8300", "8310",
"8320", "8330", "8340", "8350", "8360", "8370", "8380", "8390",
"8400", "9010", "9020", "9030", "9040", "9050", "9060", "9070",
"9080", "9090", "9100", "9110", "9120", "9130", "9140", "9150",
"9160", "9170", "9180", "9190", "9200", "9210", "9220", "9230",
"9240", "9250", "9260", "9270", "9280", "9290", "9300", "9310",
"9320", "9330", "9340", "9350", "9360", "9370", "9380", "9390",
"9400"
];
function isValidTableTo2019(table) {
return exports.TABLES_TO_2019.includes(table);
}
function isValidTable2020To2024(table) {
return exports.TABLES_2020_TO_2024.includes(table);
}
function isValidTable2025(table) {
return exports.TABLES_2025.includes(table);
}
function isValidTableForYear(table, year) {
if (year <= 2019) {
return isValidTableTo2019(table);
}
else if (year >= 2020 && year <= 2024) {
return isValidTable2020To2024(table);
}
else if (year === 2025 || year === 2026) {
return isValidTable2025(table);
}
return false;
}