@utilix-tech/sdk 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Full release notes for all Utilix surfaces (browser tools, REST API, SDKs, MCP server) live at [utilix.tech/changelog](https://utilix.tech/changelog). This file tracks just this package.
4
4
 
5
+ ## 0.11.0
6
+ - Added IBAN Validator / Formatter (`validateIban`) and Loan / Mortgage Calculator (`calculateLoan`).
7
+ - (npm publish for this version was retried after fixing a CI pin: `npm install -g npm@latest` started pulling npm 12, which requires Node >=22 and broke on this job's pinned Node 20 — now pinned to the npm 11 line.)
8
+
5
9
  ## 0.10.0
6
10
  - Added robots.txt Validator and Credit Card Number Validator.
7
11
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @utilix-tech/sdk
2
2
 
3
- **531 developer utility functions for Node.js: runs locally, no API key required.**
3
+ **533 developer utility functions for Node.js: runs locally, no API key required.**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@utilix-tech/sdk?style=flat-square&color=cb3837)](https://www.npmjs.com/package/@utilix-tech/sdk)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/@utilix-tech/sdk?style=flat-square)](https://www.npmjs.com/package/@utilix-tech/sdk)
@@ -242,7 +242,7 @@ getNextRuns("*/5 * * * *", 5); // next 5 run timestamps
242
242
  ### `/units`: Conversions
243
243
 
244
244
  ```ts
245
- import { convertBytes, pxToAll, convert, formatValue, validateCardNumber } from "@utilix-tech/sdk/units";
245
+ import { convertBytes, pxToAll, convert, formatValue, validateCardNumber, validateIban, calculateLoan } from "@utilix-tech/sdk/units";
246
246
 
247
247
  // File sizes
248
248
  convertBytes(1073741824, "GB"); // 1
@@ -264,6 +264,14 @@ formatValue(1234567.89, { locale: "en-US", currency: "USD" });
264
264
  // Credit card Luhn checksum + network detection
265
265
  validateCardNumber("4111 1111 1111 1111");
266
266
  // { valid: true, network: "Visa", length: 16, formatted: "4111 1111 1111 1111" }
267
+
268
+ // IBAN mod-97 checksum + formatting
269
+ validateIban("DE89 3704 0044 0532 0130 00");
270
+ // { valid: true, countryCode: "DE", checksumValid: true, formatted: "DE89 3704 0044 0532 0130 00", ... }
271
+
272
+ // Loan / mortgage amortization
273
+ calculateLoan(200000, 6.5, 360);
274
+ // { monthlyPayment: 1264.14, totalInterest: 255085.82, termMonths: 360, schedule: [...] }
267
275
  ```
268
276
 
269
277
  ---
@@ -16,6 +16,7 @@ __export(units_exports, {
16
16
  bumpVersion: () => bumpVersion,
17
17
  calcAspectRatio: () => calcAspectRatio,
18
18
  calcSubnet: () => calcSubnet,
19
+ calculateLoan: () => calculateLoan,
19
20
  compareSemver: () => compareSemver,
20
21
  convert: () => convert,
21
22
  convertBytes: () => convertBytes,
@@ -61,6 +62,7 @@ __export(units_exports, {
61
62
  splitSubnet: () => splitSubnet,
62
63
  symbolicToPermissions: () => symbolicToPermissions,
63
64
  validateCardNumber: () => validateCardNumber,
65
+ validateIban: () => validateIban,
64
66
  viewportToPx: () => viewportToPx
65
67
  });
66
68
  function pxToAll(px, baseFontSize = 16, viewportWidth = 1440, viewportHeight = 900) {
@@ -953,5 +955,165 @@ function validateCardNumber(input) {
953
955
  const formatted = formatCardNumber(digits, network);
954
956
  return { valid, network, length: digits.length, formatted };
955
957
  }
958
+ var IBAN_COUNTRY_LENGTHS = {
959
+ AD: 24,
960
+ AE: 23,
961
+ AL: 28,
962
+ AT: 20,
963
+ AZ: 28,
964
+ BA: 20,
965
+ BE: 16,
966
+ BG: 22,
967
+ BH: 22,
968
+ BR: 29,
969
+ BY: 28,
970
+ CH: 21,
971
+ CR: 22,
972
+ CY: 28,
973
+ CZ: 24,
974
+ DE: 22,
975
+ DK: 18,
976
+ DO: 28,
977
+ EE: 20,
978
+ EG: 29,
979
+ ES: 24,
980
+ FI: 18,
981
+ FO: 18,
982
+ FR: 27,
983
+ GB: 22,
984
+ GE: 22,
985
+ GI: 23,
986
+ GL: 18,
987
+ GR: 27,
988
+ GT: 28,
989
+ HR: 21,
990
+ HU: 28,
991
+ IE: 22,
992
+ IL: 23,
993
+ IQ: 23,
994
+ IS: 26,
995
+ IT: 27,
996
+ JO: 30,
997
+ KW: 30,
998
+ KZ: 20,
999
+ LB: 28,
1000
+ LC: 32,
1001
+ LI: 21,
1002
+ LT: 20,
1003
+ LU: 20,
1004
+ LV: 21,
1005
+ LY: 25,
1006
+ MC: 27,
1007
+ MD: 24,
1008
+ ME: 22,
1009
+ MK: 19,
1010
+ MR: 27,
1011
+ MT: 31,
1012
+ MU: 30,
1013
+ NL: 18,
1014
+ NO: 15,
1015
+ PK: 24,
1016
+ PL: 28,
1017
+ PS: 29,
1018
+ PT: 25,
1019
+ QA: 29,
1020
+ RO: 24,
1021
+ RS: 22,
1022
+ SA: 24,
1023
+ SC: 31,
1024
+ SE: 24,
1025
+ SI: 19,
1026
+ SK: 24,
1027
+ SM: 27,
1028
+ ST: 25,
1029
+ SV: 28,
1030
+ TL: 23,
1031
+ TN: 24,
1032
+ TR: 26,
1033
+ UA: 29,
1034
+ VA: 22,
1035
+ VG: 24,
1036
+ XK: 20
1037
+ };
1038
+ function ibanMod97(numeric) {
1039
+ let remainder = 0;
1040
+ for (let i = 0; i < numeric.length; i += 7) {
1041
+ remainder = parseInt(String(remainder) + numeric.substr(i, 7), 10) % 97;
1042
+ }
1043
+ return remainder;
1044
+ }
1045
+ function formatIban(cleaned) {
1046
+ return cleaned.match(/.{1,4}/g)?.join(" ") ?? cleaned;
1047
+ }
1048
+ function validateIban(input) {
1049
+ if (!input || !input.trim()) return { error: "Input is empty" };
1050
+ const cleaned = input.replace(/\s/g, "").toUpperCase();
1051
+ if (!/^[A-Z0-9]+$/.test(cleaned)) return { error: "IBAN must contain only letters and digits" };
1052
+ if (cleaned.length < 4 || cleaned.length > 34) {
1053
+ return { error: `IBAN length (${cleaned.length}) is outside the valid range of 4-34 characters` };
1054
+ }
1055
+ if (!/^[A-Z]{2}\d{2}/.test(cleaned)) {
1056
+ return { error: "IBAN must start with a 2-letter country code followed by 2 check digits" };
1057
+ }
1058
+ const countryCode = cleaned.slice(0, 2);
1059
+ const checkDigits = cleaned.slice(2, 4);
1060
+ const bban = cleaned.slice(4);
1061
+ const rearranged = cleaned.slice(4) + cleaned.slice(0, 4);
1062
+ const numeric = rearranged.split("").map((ch) => /[A-Z]/.test(ch) ? String(ch.charCodeAt(0) - 55) : ch).join("");
1063
+ const checksumValid = ibanMod97(numeric) === 1;
1064
+ const expectedLength = IBAN_COUNTRY_LENGTHS[countryCode] ?? null;
1065
+ const lengthValid = expectedLength === null ? null : cleaned.length === expectedLength;
1066
+ const valid = checksumValid && lengthValid !== false;
1067
+ return {
1068
+ valid,
1069
+ formatted: formatIban(cleaned),
1070
+ countryCode,
1071
+ checkDigits,
1072
+ bban,
1073
+ length: cleaned.length,
1074
+ expectedLength,
1075
+ checksumValid,
1076
+ lengthValid
1077
+ };
1078
+ }
1079
+ function round2(n) {
1080
+ return Math.round(n * 100) / 100;
1081
+ }
1082
+ function calculateLoan(principal, annualRatePercent, termMonths) {
1083
+ if (!Number.isFinite(principal) || principal <= 0) return { error: "Principal must be a positive number" };
1084
+ if (!Number.isFinite(annualRatePercent) || annualRatePercent < 0) {
1085
+ return { error: "Annual interest rate must be zero or a positive number" };
1086
+ }
1087
+ if (!Number.isInteger(termMonths) || termMonths <= 0) {
1088
+ return { error: "Term must be a positive whole number of months" };
1089
+ }
1090
+ const monthlyRate = annualRatePercent / 100 / 12;
1091
+ let monthlyPayment;
1092
+ if (monthlyRate === 0) {
1093
+ monthlyPayment = principal / termMonths;
1094
+ } else {
1095
+ const factor = Math.pow(1 + monthlyRate, termMonths);
1096
+ monthlyPayment = principal * monthlyRate * factor / (factor - 1);
1097
+ }
1098
+ const schedule = [];
1099
+ let balance = round2(principal);
1100
+ let totalPayment = 0;
1101
+ for (let month = 1; month <= termMonths; month++) {
1102
+ const interest = monthlyRate === 0 ? 0 : round2(balance * monthlyRate);
1103
+ let principalPortion = round2(monthlyPayment) - interest;
1104
+ if (month === termMonths || principalPortion > balance) principalPortion = balance;
1105
+ const payment = round2(principalPortion + interest);
1106
+ balance = round2(balance - principalPortion);
1107
+ totalPayment += payment;
1108
+ schedule.push({ month, payment, principal: round2(principalPortion), interest, balance: Math.max(balance, 0) });
1109
+ }
1110
+ return {
1111
+ monthlyPayment: round2(monthlyPayment),
1112
+ totalPayment: round2(totalPayment),
1113
+ totalInterest: round2(totalPayment - principal),
1114
+ termMonths,
1115
+ schedule
1116
+ };
1117
+ }
956
1118
 
957
- export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_VIEWPORTS, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, compareSemver, convert, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, units_exports, validateCardNumber, viewportToPx };
1119
+ export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_VIEWPORTS, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateLoan, compareSemver, convert, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, units_exports, validateCardNumber, validateIban, viewportToPx };
package/dist/index.cjs CHANGED
@@ -6621,6 +6621,7 @@ __export(units_exports, {
6621
6621
  bumpVersion: () => bumpVersion,
6622
6622
  calcAspectRatio: () => calcAspectRatio,
6623
6623
  calcSubnet: () => calcSubnet,
6624
+ calculateLoan: () => calculateLoan,
6624
6625
  compareSemver: () => compareSemver,
6625
6626
  convert: () => convert,
6626
6627
  convertBytes: () => convertBytes,
@@ -6666,6 +6667,7 @@ __export(units_exports, {
6666
6667
  splitSubnet: () => splitSubnet,
6667
6668
  symbolicToPermissions: () => symbolicToPermissions,
6668
6669
  validateCardNumber: () => validateCardNumber,
6670
+ validateIban: () => validateIban,
6669
6671
  viewportToPx: () => viewportToPx
6670
6672
  });
6671
6673
  function pxToAll(px, baseFontSize = 16, viewportWidth = 1440, viewportHeight = 900) {
@@ -7558,6 +7560,166 @@ function validateCardNumber(input) {
7558
7560
  const formatted = formatCardNumber(digits, network);
7559
7561
  return { valid, network, length: digits.length, formatted };
7560
7562
  }
7563
+ var IBAN_COUNTRY_LENGTHS = {
7564
+ AD: 24,
7565
+ AE: 23,
7566
+ AL: 28,
7567
+ AT: 20,
7568
+ AZ: 28,
7569
+ BA: 20,
7570
+ BE: 16,
7571
+ BG: 22,
7572
+ BH: 22,
7573
+ BR: 29,
7574
+ BY: 28,
7575
+ CH: 21,
7576
+ CR: 22,
7577
+ CY: 28,
7578
+ CZ: 24,
7579
+ DE: 22,
7580
+ DK: 18,
7581
+ DO: 28,
7582
+ EE: 20,
7583
+ EG: 29,
7584
+ ES: 24,
7585
+ FI: 18,
7586
+ FO: 18,
7587
+ FR: 27,
7588
+ GB: 22,
7589
+ GE: 22,
7590
+ GI: 23,
7591
+ GL: 18,
7592
+ GR: 27,
7593
+ GT: 28,
7594
+ HR: 21,
7595
+ HU: 28,
7596
+ IE: 22,
7597
+ IL: 23,
7598
+ IQ: 23,
7599
+ IS: 26,
7600
+ IT: 27,
7601
+ JO: 30,
7602
+ KW: 30,
7603
+ KZ: 20,
7604
+ LB: 28,
7605
+ LC: 32,
7606
+ LI: 21,
7607
+ LT: 20,
7608
+ LU: 20,
7609
+ LV: 21,
7610
+ LY: 25,
7611
+ MC: 27,
7612
+ MD: 24,
7613
+ ME: 22,
7614
+ MK: 19,
7615
+ MR: 27,
7616
+ MT: 31,
7617
+ MU: 30,
7618
+ NL: 18,
7619
+ NO: 15,
7620
+ PK: 24,
7621
+ PL: 28,
7622
+ PS: 29,
7623
+ PT: 25,
7624
+ QA: 29,
7625
+ RO: 24,
7626
+ RS: 22,
7627
+ SA: 24,
7628
+ SC: 31,
7629
+ SE: 24,
7630
+ SI: 19,
7631
+ SK: 24,
7632
+ SM: 27,
7633
+ ST: 25,
7634
+ SV: 28,
7635
+ TL: 23,
7636
+ TN: 24,
7637
+ TR: 26,
7638
+ UA: 29,
7639
+ VA: 22,
7640
+ VG: 24,
7641
+ XK: 20
7642
+ };
7643
+ function ibanMod97(numeric) {
7644
+ let remainder = 0;
7645
+ for (let i = 0; i < numeric.length; i += 7) {
7646
+ remainder = parseInt(String(remainder) + numeric.substr(i, 7), 10) % 97;
7647
+ }
7648
+ return remainder;
7649
+ }
7650
+ function formatIban(cleaned) {
7651
+ return cleaned.match(/.{1,4}/g)?.join(" ") ?? cleaned;
7652
+ }
7653
+ function validateIban(input) {
7654
+ if (!input || !input.trim()) return { error: "Input is empty" };
7655
+ const cleaned = input.replace(/\s/g, "").toUpperCase();
7656
+ if (!/^[A-Z0-9]+$/.test(cleaned)) return { error: "IBAN must contain only letters and digits" };
7657
+ if (cleaned.length < 4 || cleaned.length > 34) {
7658
+ return { error: `IBAN length (${cleaned.length}) is outside the valid range of 4-34 characters` };
7659
+ }
7660
+ if (!/^[A-Z]{2}\d{2}/.test(cleaned)) {
7661
+ return { error: "IBAN must start with a 2-letter country code followed by 2 check digits" };
7662
+ }
7663
+ const countryCode = cleaned.slice(0, 2);
7664
+ const checkDigits = cleaned.slice(2, 4);
7665
+ const bban = cleaned.slice(4);
7666
+ const rearranged = cleaned.slice(4) + cleaned.slice(0, 4);
7667
+ const numeric = rearranged.split("").map((ch) => /[A-Z]/.test(ch) ? String(ch.charCodeAt(0) - 55) : ch).join("");
7668
+ const checksumValid = ibanMod97(numeric) === 1;
7669
+ const expectedLength = IBAN_COUNTRY_LENGTHS[countryCode] ?? null;
7670
+ const lengthValid = expectedLength === null ? null : cleaned.length === expectedLength;
7671
+ const valid = checksumValid && lengthValid !== false;
7672
+ return {
7673
+ valid,
7674
+ formatted: formatIban(cleaned),
7675
+ countryCode,
7676
+ checkDigits,
7677
+ bban,
7678
+ length: cleaned.length,
7679
+ expectedLength,
7680
+ checksumValid,
7681
+ lengthValid
7682
+ };
7683
+ }
7684
+ function round2(n) {
7685
+ return Math.round(n * 100) / 100;
7686
+ }
7687
+ function calculateLoan(principal, annualRatePercent, termMonths) {
7688
+ if (!Number.isFinite(principal) || principal <= 0) return { error: "Principal must be a positive number" };
7689
+ if (!Number.isFinite(annualRatePercent) || annualRatePercent < 0) {
7690
+ return { error: "Annual interest rate must be zero or a positive number" };
7691
+ }
7692
+ if (!Number.isInteger(termMonths) || termMonths <= 0) {
7693
+ return { error: "Term must be a positive whole number of months" };
7694
+ }
7695
+ const monthlyRate = annualRatePercent / 100 / 12;
7696
+ let monthlyPayment;
7697
+ if (monthlyRate === 0) {
7698
+ monthlyPayment = principal / termMonths;
7699
+ } else {
7700
+ const factor = Math.pow(1 + monthlyRate, termMonths);
7701
+ monthlyPayment = principal * monthlyRate * factor / (factor - 1);
7702
+ }
7703
+ const schedule = [];
7704
+ let balance = round2(principal);
7705
+ let totalPayment = 0;
7706
+ for (let month = 1; month <= termMonths; month++) {
7707
+ const interest = monthlyRate === 0 ? 0 : round2(balance * monthlyRate);
7708
+ let principalPortion = round2(monthlyPayment) - interest;
7709
+ if (month === termMonths || principalPortion > balance) principalPortion = balance;
7710
+ const payment = round2(principalPortion + interest);
7711
+ balance = round2(balance - principalPortion);
7712
+ totalPayment += payment;
7713
+ schedule.push({ month, payment, principal: round2(principalPortion), interest, balance: Math.max(balance, 0) });
7714
+ }
7715
+ return {
7716
+ monthlyPayment: round2(monthlyPayment),
7717
+ totalPayment: round2(totalPayment),
7718
+ totalInterest: round2(totalPayment - principal),
7719
+ termMonths,
7720
+ schedule
7721
+ };
7722
+ }
7561
7723
 
7562
7724
  // src/tools/network.ts
7563
7725
  var network_exports = {};
@@ -17452,12 +17614,12 @@ function readGpsCoordinate(r, entries, valueTag, refTag) {
17452
17614
  function gcd2(a, b) {
17453
17615
  return b === 0 ? a : gcd2(b, a % b);
17454
17616
  }
17455
- function round2(n) {
17617
+ function round22(n) {
17456
17618
  return Math.round(n * 100) / 100;
17457
17619
  }
17458
17620
  function formatExposureTime(num, den) {
17459
17621
  if (num === 0) return "0s";
17460
- if (num >= den) return `${round2(num / den)}s`;
17622
+ if (num >= den) return `${round22(num / den)}s`;
17461
17623
  const divisor = gcd2(num, den) || 1;
17462
17624
  const n = num / divisor;
17463
17625
  const d = den / divisor;
@@ -17546,14 +17708,14 @@ function readExifData(bytes) {
17546
17708
  const fEntry = findEntry(sub.entries, 33437);
17547
17709
  if (fEntry) {
17548
17710
  const rat = readRational(r, fEntry);
17549
- if (rat && rat.den !== 0) result.fNumber = round2(rat.num / rat.den);
17711
+ if (rat && rat.den !== 0) result.fNumber = round22(rat.num / rat.den);
17550
17712
  }
17551
17713
  const isoEntry = findEntry(sub.entries, 34855);
17552
17714
  if (isoEntry) result.isoSpeed = tu16(r, isoEntry.valueOffsetField);
17553
17715
  const focalEntry = findEntry(sub.entries, 37386);
17554
17716
  if (focalEntry) {
17555
17717
  const rat = readRational(r, focalEntry);
17556
- if (rat && rat.den !== 0) result.focalLength = round2(rat.num / rat.den);
17718
+ if (rat && rat.den !== 0) result.focalLength = round22(rat.num / rat.den);
17557
17719
  }
17558
17720
  }
17559
17721
  }
package/dist/index.d.cts CHANGED
@@ -5,7 +5,7 @@ export { t as text } from './text-Bbx-tZ43.cjs';
5
5
  export { d as data } from './data-D8XTI7Du.cjs';
6
6
  export { g as generators } from './generators-BGtRGpJZ.cjs';
7
7
  export { t as time } from './time-DbT8fjaF.cjs';
8
- export { u as units } from './units-DRT6W-vu.cjs';
8
+ export { u as units } from './units-BG387sch.cjs';
9
9
  export { n as network } from './network-DaNoZ5ER.cjs';
10
10
  export { a as api } from './api-Xl7OzIgq.cjs';
11
11
  export { c as code } from './code-BUqyaofO.cjs';
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { t as text } from './text-Bbx-tZ43.js';
5
5
  export { d as data } from './data-D8XTI7Du.js';
6
6
  export { g as generators } from './generators-BGtRGpJZ.js';
7
7
  export { t as time } from './time-DbT8fjaF.js';
8
- export { u as units } from './units-DRT6W-vu.js';
8
+ export { u as units } from './units-BG387sch.js';
9
9
  export { n as network } from './network-DaNoZ5ER.js';
10
10
  export { a as api } from './api-Xl7OzIgq.js';
11
11
  export { c as code } from './code-BUqyaofO.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { media_exports as media } from './chunk-GUUYEIU6.js';
2
- export { units_exports as units } from './chunk-YVFM5WYI.js';
2
+ export { units_exports as units } from './chunk-GGDDCTFM.js';
3
3
  export { network_exports as network } from './chunk-OB56VNKJ.js';
4
4
  export { api_exports as api } from './chunk-Q3B3YWOA.js';
5
5
  export { code_exports as code } from './chunk-V5S6OJ4A.js';
@@ -891,6 +891,166 @@ function validateCardNumber(input) {
891
891
  const formatted = formatCardNumber(digits, network);
892
892
  return { valid, network, length: digits.length, formatted };
893
893
  }
894
+ var IBAN_COUNTRY_LENGTHS = {
895
+ AD: 24,
896
+ AE: 23,
897
+ AL: 28,
898
+ AT: 20,
899
+ AZ: 28,
900
+ BA: 20,
901
+ BE: 16,
902
+ BG: 22,
903
+ BH: 22,
904
+ BR: 29,
905
+ BY: 28,
906
+ CH: 21,
907
+ CR: 22,
908
+ CY: 28,
909
+ CZ: 24,
910
+ DE: 22,
911
+ DK: 18,
912
+ DO: 28,
913
+ EE: 20,
914
+ EG: 29,
915
+ ES: 24,
916
+ FI: 18,
917
+ FO: 18,
918
+ FR: 27,
919
+ GB: 22,
920
+ GE: 22,
921
+ GI: 23,
922
+ GL: 18,
923
+ GR: 27,
924
+ GT: 28,
925
+ HR: 21,
926
+ HU: 28,
927
+ IE: 22,
928
+ IL: 23,
929
+ IQ: 23,
930
+ IS: 26,
931
+ IT: 27,
932
+ JO: 30,
933
+ KW: 30,
934
+ KZ: 20,
935
+ LB: 28,
936
+ LC: 32,
937
+ LI: 21,
938
+ LT: 20,
939
+ LU: 20,
940
+ LV: 21,
941
+ LY: 25,
942
+ MC: 27,
943
+ MD: 24,
944
+ ME: 22,
945
+ MK: 19,
946
+ MR: 27,
947
+ MT: 31,
948
+ MU: 30,
949
+ NL: 18,
950
+ NO: 15,
951
+ PK: 24,
952
+ PL: 28,
953
+ PS: 29,
954
+ PT: 25,
955
+ QA: 29,
956
+ RO: 24,
957
+ RS: 22,
958
+ SA: 24,
959
+ SC: 31,
960
+ SE: 24,
961
+ SI: 19,
962
+ SK: 24,
963
+ SM: 27,
964
+ ST: 25,
965
+ SV: 28,
966
+ TL: 23,
967
+ TN: 24,
968
+ TR: 26,
969
+ UA: 29,
970
+ VA: 22,
971
+ VG: 24,
972
+ XK: 20
973
+ };
974
+ function ibanMod97(numeric) {
975
+ let remainder = 0;
976
+ for (let i = 0; i < numeric.length; i += 7) {
977
+ remainder = parseInt(String(remainder) + numeric.substr(i, 7), 10) % 97;
978
+ }
979
+ return remainder;
980
+ }
981
+ function formatIban(cleaned) {
982
+ return cleaned.match(/.{1,4}/g)?.join(" ") ?? cleaned;
983
+ }
984
+ function validateIban(input) {
985
+ if (!input || !input.trim()) return { error: "Input is empty" };
986
+ const cleaned = input.replace(/\s/g, "").toUpperCase();
987
+ if (!/^[A-Z0-9]+$/.test(cleaned)) return { error: "IBAN must contain only letters and digits" };
988
+ if (cleaned.length < 4 || cleaned.length > 34) {
989
+ return { error: `IBAN length (${cleaned.length}) is outside the valid range of 4-34 characters` };
990
+ }
991
+ if (!/^[A-Z]{2}\d{2}/.test(cleaned)) {
992
+ return { error: "IBAN must start with a 2-letter country code followed by 2 check digits" };
993
+ }
994
+ const countryCode = cleaned.slice(0, 2);
995
+ const checkDigits = cleaned.slice(2, 4);
996
+ const bban = cleaned.slice(4);
997
+ const rearranged = cleaned.slice(4) + cleaned.slice(0, 4);
998
+ const numeric = rearranged.split("").map((ch) => /[A-Z]/.test(ch) ? String(ch.charCodeAt(0) - 55) : ch).join("");
999
+ const checksumValid = ibanMod97(numeric) === 1;
1000
+ const expectedLength = IBAN_COUNTRY_LENGTHS[countryCode] ?? null;
1001
+ const lengthValid = expectedLength === null ? null : cleaned.length === expectedLength;
1002
+ const valid = checksumValid && lengthValid !== false;
1003
+ return {
1004
+ valid,
1005
+ formatted: formatIban(cleaned),
1006
+ countryCode,
1007
+ checkDigits,
1008
+ bban,
1009
+ length: cleaned.length,
1010
+ expectedLength,
1011
+ checksumValid,
1012
+ lengthValid
1013
+ };
1014
+ }
1015
+ function round2(n) {
1016
+ return Math.round(n * 100) / 100;
1017
+ }
1018
+ function calculateLoan(principal, annualRatePercent, termMonths) {
1019
+ if (!Number.isFinite(principal) || principal <= 0) return { error: "Principal must be a positive number" };
1020
+ if (!Number.isFinite(annualRatePercent) || annualRatePercent < 0) {
1021
+ return { error: "Annual interest rate must be zero or a positive number" };
1022
+ }
1023
+ if (!Number.isInteger(termMonths) || termMonths <= 0) {
1024
+ return { error: "Term must be a positive whole number of months" };
1025
+ }
1026
+ const monthlyRate = annualRatePercent / 100 / 12;
1027
+ let monthlyPayment;
1028
+ if (monthlyRate === 0) {
1029
+ monthlyPayment = principal / termMonths;
1030
+ } else {
1031
+ const factor = Math.pow(1 + monthlyRate, termMonths);
1032
+ monthlyPayment = principal * monthlyRate * factor / (factor - 1);
1033
+ }
1034
+ const schedule = [];
1035
+ let balance = round2(principal);
1036
+ let totalPayment = 0;
1037
+ for (let month = 1; month <= termMonths; month++) {
1038
+ const interest = monthlyRate === 0 ? 0 : round2(balance * monthlyRate);
1039
+ let principalPortion = round2(monthlyPayment) - interest;
1040
+ if (month === termMonths || principalPortion > balance) principalPortion = balance;
1041
+ const payment = round2(principalPortion + interest);
1042
+ balance = round2(balance - principalPortion);
1043
+ totalPayment += payment;
1044
+ schedule.push({ month, payment, principal: round2(principalPortion), interest, balance: Math.max(balance, 0) });
1045
+ }
1046
+ return {
1047
+ monthlyPayment: round2(monthlyPayment),
1048
+ totalPayment: round2(totalPayment),
1049
+ totalInterest: round2(totalPayment - principal),
1050
+ termMonths,
1051
+ schedule
1052
+ };
1053
+ }
894
1054
 
895
1055
  exports.BASE_LABELS = BASE_LABELS;
896
1056
  exports.BASE_PREFIXES = BASE_PREFIXES;
@@ -905,6 +1065,7 @@ exports.autoFormat = autoFormat;
905
1065
  exports.bumpVersion = bumpVersion;
906
1066
  exports.calcAspectRatio = calcAspectRatio;
907
1067
  exports.calcSubnet = calcSubnet;
1068
+ exports.calculateLoan = calculateLoan;
908
1069
  exports.compareSemver = compareSemver;
909
1070
  exports.convert = convert;
910
1071
  exports.convertBytes = convertBytes;
@@ -950,4 +1111,5 @@ exports.sortVersions = sortVersions;
950
1111
  exports.splitSubnet = splitSubnet;
951
1112
  exports.symbolicToPermissions = symbolicToPermissions;
952
1113
  exports.validateCardNumber = validateCardNumber;
1114
+ exports.validateIban = validateIban;
953
1115
  exports.viewportToPx = viewportToPx;
@@ -1 +1 @@
1
- export { A as AspectRatioResult, B as BASE_LABELS, a as BASE_PREFIXES, b as BYTE_UNITS, c as BaseConvertResult, d as ByteConvertResult, e as ByteUnit, C as COMMON_CURRENCIES, f as COMMON_LOCALES, g as COMMON_PERMISSIONS, h as COMMON_RATIOS, i as COMMON_SIZES, j as COMMON_VIEWPORTS, k as CardValidationResult, D as Dimensions, F as FilePermissions, l as FormatOptions, I as IpConversion, N as NotationStyle, m as NumberBase, P as Permission, n as PxConvertResult, S as SemverVersion, o as SubnetInfo, V as ViewportConvertResult, p as autoFormat, q as bumpVersion, r as calcAspectRatio, s as calcSubnet, t as compareSemver, v as convert, w as convertBytes, x as convertIp, y as coverBox, z as decimalToIp, E as decimalToIpCidr, G as describePermissions, H as fitIntoBox, J as formatNumber, K as formatValue, L as formatVwValue, M as formatWithSeparator, O as gcd, Q as ipFromBinary, R as ipFromDecimal, T as ipFromHex, U as ipToBinary, W as ipToDecimal, X as ipToDecimalCidr, Y as ipToHex, Z as ipToOctal, _ as isValid, $ as isValidCidr, a0 as isValidIp, a1 as isValidIpv4, a2 as octalToPermissions, a3 as parseFileSize, a4 as parseInput, a5 as parseNumberString, a6 as parseSemver, a7 as permissionsToChmod, a8 as permissionsToOctal, a9 as permissionsToSymbolic, aa as ptToPx, ab as pxToAll, ac as pxToViewport, ad as remToPx, ae as satisfiesRange, af as scaleByHeight, ag as scaleByWidth, ah as sortVersions, ai as splitSubnet, aj as symbolicToPermissions, ak as validateCardNumber, al as viewportToPx } from '../units-DRT6W-vu.cjs';
1
+ export { A as AmortizationRow, a as AspectRatioResult, B as BASE_LABELS, b as BASE_PREFIXES, c as BYTE_UNITS, d as BaseConvertResult, e as ByteConvertResult, f as ByteUnit, C as COMMON_CURRENCIES, g as COMMON_LOCALES, h as COMMON_PERMISSIONS, i as COMMON_RATIOS, j as COMMON_SIZES, k as COMMON_VIEWPORTS, l as CardValidationResult, D as Dimensions, F as FilePermissions, m as FormatOptions, I as IbanValidationResult, n as IpConversion, L as LoanResult, N as NotationStyle, o as NumberBase, P as Permission, p as PxConvertResult, S as SemverVersion, q as SubnetInfo, V as ViewportConvertResult, r as autoFormat, s as bumpVersion, t as calcAspectRatio, v as calcSubnet, w as calculateLoan, x as compareSemver, y as convert, z as convertBytes, E as convertIp, G as coverBox, H as decimalToIp, J as decimalToIpCidr, K as describePermissions, M as fitIntoBox, O as formatNumber, Q as formatValue, R as formatVwValue, T as formatWithSeparator, U as gcd, W as ipFromBinary, X as ipFromDecimal, Y as ipFromHex, Z as ipToBinary, _ as ipToDecimal, $ as ipToDecimalCidr, a0 as ipToHex, a1 as ipToOctal, a2 as isValid, a3 as isValidCidr, a4 as isValidIp, a5 as isValidIpv4, a6 as octalToPermissions, a7 as parseFileSize, a8 as parseInput, a9 as parseNumberString, aa as parseSemver, ab as permissionsToChmod, ac as permissionsToOctal, ad as permissionsToSymbolic, ae as ptToPx, af as pxToAll, ag as pxToViewport, ah as remToPx, ai as satisfiesRange, aj as scaleByHeight, ak as scaleByWidth, al as sortVersions, am as splitSubnet, an as symbolicToPermissions, ao as validateCardNumber, ap as validateIban, aq as viewportToPx } from '../units-BG387sch.cjs';
@@ -1 +1 @@
1
- export { A as AspectRatioResult, B as BASE_LABELS, a as BASE_PREFIXES, b as BYTE_UNITS, c as BaseConvertResult, d as ByteConvertResult, e as ByteUnit, C as COMMON_CURRENCIES, f as COMMON_LOCALES, g as COMMON_PERMISSIONS, h as COMMON_RATIOS, i as COMMON_SIZES, j as COMMON_VIEWPORTS, k as CardValidationResult, D as Dimensions, F as FilePermissions, l as FormatOptions, I as IpConversion, N as NotationStyle, m as NumberBase, P as Permission, n as PxConvertResult, S as SemverVersion, o as SubnetInfo, V as ViewportConvertResult, p as autoFormat, q as bumpVersion, r as calcAspectRatio, s as calcSubnet, t as compareSemver, v as convert, w as convertBytes, x as convertIp, y as coverBox, z as decimalToIp, E as decimalToIpCidr, G as describePermissions, H as fitIntoBox, J as formatNumber, K as formatValue, L as formatVwValue, M as formatWithSeparator, O as gcd, Q as ipFromBinary, R as ipFromDecimal, T as ipFromHex, U as ipToBinary, W as ipToDecimal, X as ipToDecimalCidr, Y as ipToHex, Z as ipToOctal, _ as isValid, $ as isValidCidr, a0 as isValidIp, a1 as isValidIpv4, a2 as octalToPermissions, a3 as parseFileSize, a4 as parseInput, a5 as parseNumberString, a6 as parseSemver, a7 as permissionsToChmod, a8 as permissionsToOctal, a9 as permissionsToSymbolic, aa as ptToPx, ab as pxToAll, ac as pxToViewport, ad as remToPx, ae as satisfiesRange, af as scaleByHeight, ag as scaleByWidth, ah as sortVersions, ai as splitSubnet, aj as symbolicToPermissions, ak as validateCardNumber, al as viewportToPx } from '../units-DRT6W-vu.js';
1
+ export { A as AmortizationRow, a as AspectRatioResult, B as BASE_LABELS, b as BASE_PREFIXES, c as BYTE_UNITS, d as BaseConvertResult, e as ByteConvertResult, f as ByteUnit, C as COMMON_CURRENCIES, g as COMMON_LOCALES, h as COMMON_PERMISSIONS, i as COMMON_RATIOS, j as COMMON_SIZES, k as COMMON_VIEWPORTS, l as CardValidationResult, D as Dimensions, F as FilePermissions, m as FormatOptions, I as IbanValidationResult, n as IpConversion, L as LoanResult, N as NotationStyle, o as NumberBase, P as Permission, p as PxConvertResult, S as SemverVersion, q as SubnetInfo, V as ViewportConvertResult, r as autoFormat, s as bumpVersion, t as calcAspectRatio, v as calcSubnet, w as calculateLoan, x as compareSemver, y as convert, z as convertBytes, E as convertIp, G as coverBox, H as decimalToIp, J as decimalToIpCidr, K as describePermissions, M as fitIntoBox, O as formatNumber, Q as formatValue, R as formatVwValue, T as formatWithSeparator, U as gcd, W as ipFromBinary, X as ipFromDecimal, Y as ipFromHex, Z as ipToBinary, _ as ipToDecimal, $ as ipToDecimalCidr, a0 as ipToHex, a1 as ipToOctal, a2 as isValid, a3 as isValidCidr, a4 as isValidIp, a5 as isValidIpv4, a6 as octalToPermissions, a7 as parseFileSize, a8 as parseInput, a9 as parseNumberString, aa as parseSemver, ab as permissionsToChmod, ac as permissionsToOctal, ad as permissionsToSymbolic, ae as ptToPx, af as pxToAll, ag as pxToViewport, ah as remToPx, ai as satisfiesRange, aj as scaleByHeight, ak as scaleByWidth, al as sortVersions, am as splitSubnet, an as symbolicToPermissions, ao as validateCardNumber, ap as validateIban, aq as viewportToPx } from '../units-BG387sch.js';
@@ -1,2 +1,2 @@
1
- export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_VIEWPORTS, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, compareSemver, convert, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, validateCardNumber, viewportToPx } from '../chunk-YVFM5WYI.js';
1
+ export { BASE_LABELS, BASE_PREFIXES, BYTE_UNITS, COMMON_CURRENCIES, COMMON_LOCALES, COMMON_PERMISSIONS, COMMON_RATIOS, COMMON_SIZES, COMMON_VIEWPORTS, autoFormat, bumpVersion, calcAspectRatio, calcSubnet, calculateLoan, compareSemver, convert, convertBytes, convertIp, coverBox, decimalToIp, decimalToIpCidr, describePermissions, fitIntoBox, formatNumber, formatValue, formatVwValue, formatWithSeparator, gcd, ipFromBinary, ipFromDecimal, ipFromHex, ipToBinary, ipToDecimal, ipToDecimalCidr, ipToHex, ipToOctal, isValid, isValidCidr, isValidIp, isValidIpv4, octalToPermissions, parseFileSize, parseInput, parseNumberString, parseSemver, permissionsToChmod, permissionsToOctal, permissionsToSymbolic, ptToPx, pxToAll, pxToViewport, remToPx, satisfiesRange, scaleByHeight, scaleByWidth, sortVersions, splitSubnet, symbolicToPermissions, validateCardNumber, validateIban, viewportToPx } from '../chunk-GGDDCTFM.js';
2
2
  import '../chunk-MLKGABMK.js';
@@ -13,6 +13,8 @@
13
13
  * - cidr-calc : calcSubnet, splitSubnet, isValidCidr, isValidIp, ipToDecimal (cidr), decimalToIp (cidr)
14
14
  * - semver : parseSemver, isValid, compareSemver, satisfiesRange, bumpVersion, sortVersions
15
15
  * - credit-card-validator : validateCardNumber
16
+ * - iban-validator : validateIban
17
+ * - loan-calculator : calculateLoan
16
18
  */
17
19
  interface PxConvertResult {
18
20
  px: number;
@@ -236,7 +238,49 @@ interface CardValidationResult {
236
238
  declare function validateCardNumber(input: string): CardValidationResult | {
237
239
  error: string;
238
240
  };
241
+ interface IbanValidationResult {
242
+ valid: boolean;
243
+ formatted: string;
244
+ countryCode: string;
245
+ checkDigits: string;
246
+ bban: string;
247
+ length: number;
248
+ expectedLength: number | null;
249
+ checksumValid: boolean;
250
+ lengthValid: boolean | null;
251
+ }
252
+ /**
253
+ * Validate an IBAN via the mod-97 checksum defined by ISO 13616 and format
254
+ * it into the standard human-readable grouped form. Also cross-checks the
255
+ * total length against the country's registered fixed length where known.
256
+ */
257
+ declare function validateIban(input: string): IbanValidationResult | {
258
+ error: string;
259
+ };
260
+ interface AmortizationRow {
261
+ month: number;
262
+ payment: number;
263
+ principal: number;
264
+ interest: number;
265
+ balance: number;
266
+ }
267
+ interface LoanResult {
268
+ monthlyPayment: number;
269
+ totalPayment: number;
270
+ totalInterest: number;
271
+ termMonths: number;
272
+ schedule: AmortizationRow[];
273
+ }
274
+ /**
275
+ * Compute the monthly payment, total interest, and full amortization
276
+ * schedule for a fixed-rate loan or mortgage, given the principal, annual
277
+ * interest rate (as a percent, e.g. 6.5), and term in months.
278
+ */
279
+ declare function calculateLoan(principal: number, annualRatePercent: number, termMonths: number): LoanResult | {
280
+ error: string;
281
+ };
239
282
 
283
+ type units_AmortizationRow = AmortizationRow;
240
284
  type units_AspectRatioResult = AspectRatioResult;
241
285
  declare const units_BASE_LABELS: typeof BASE_LABELS;
242
286
  declare const units_BASE_PREFIXES: typeof BASE_PREFIXES;
@@ -254,7 +298,9 @@ type units_CardValidationResult = CardValidationResult;
254
298
  type units_Dimensions = Dimensions;
255
299
  type units_FilePermissions = FilePermissions;
256
300
  type units_FormatOptions = FormatOptions;
301
+ type units_IbanValidationResult = IbanValidationResult;
257
302
  type units_IpConversion = IpConversion;
303
+ type units_LoanResult = LoanResult;
258
304
  type units_NotationStyle = NotationStyle;
259
305
  type units_NumberBase = NumberBase;
260
306
  type units_Permission = Permission;
@@ -266,6 +312,7 @@ declare const units_autoFormat: typeof autoFormat;
266
312
  declare const units_bumpVersion: typeof bumpVersion;
267
313
  declare const units_calcAspectRatio: typeof calcAspectRatio;
268
314
  declare const units_calcSubnet: typeof calcSubnet;
315
+ declare const units_calculateLoan: typeof calculateLoan;
269
316
  declare const units_compareSemver: typeof compareSemver;
270
317
  declare const units_convert: typeof convert;
271
318
  declare const units_convertBytes: typeof convertBytes;
@@ -311,9 +358,10 @@ declare const units_sortVersions: typeof sortVersions;
311
358
  declare const units_splitSubnet: typeof splitSubnet;
312
359
  declare const units_symbolicToPermissions: typeof symbolicToPermissions;
313
360
  declare const units_validateCardNumber: typeof validateCardNumber;
361
+ declare const units_validateIban: typeof validateIban;
314
362
  declare const units_viewportToPx: typeof viewportToPx;
315
363
  declare namespace units {
316
- export { type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BaseConvertResult as BaseConvertResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_Dimensions as Dimensions, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IpConversion as IpConversion, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SubnetInfo as SubnetInfo, type units_ViewportConvertResult as ViewportConvertResult, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_compareSemver as compareSemver, units_convert as convert, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateCardNumber as validateCardNumber, units_viewportToPx as viewportToPx };
364
+ export { type units_AmortizationRow as AmortizationRow, type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BaseConvertResult as BaseConvertResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_Dimensions as Dimensions, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IbanValidationResult as IbanValidationResult, type units_IpConversion as IpConversion, type units_LoanResult as LoanResult, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SubnetInfo as SubnetInfo, type units_ViewportConvertResult as ViewportConvertResult, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_calculateLoan as calculateLoan, units_compareSemver as compareSemver, units_convert as convert, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateCardNumber as validateCardNumber, units_validateIban as validateIban, units_viewportToPx as viewportToPx };
317
365
  }
318
366
 
319
- export { isValidCidr as $, type AspectRatioResult as A, BASE_LABELS as B, COMMON_CURRENCIES as C, type Dimensions as D, decimalToIpCidr as E, type FilePermissions as F, describePermissions as G, fitIntoBox as H, type IpConversion as I, formatNumber as J, formatValue as K, formatVwValue as L, formatWithSeparator as M, type NotationStyle as N, gcd as O, type Permission as P, ipFromBinary as Q, ipFromDecimal as R, type SemverVersion as S, ipFromHex as T, ipToBinary as U, type ViewportConvertResult as V, ipToDecimal as W, ipToDecimalCidr as X, ipToHex as Y, ipToOctal as Z, isValid as _, BASE_PREFIXES as a, isValidIp as a0, isValidIpv4 as a1, octalToPermissions as a2, parseFileSize as a3, parseInput as a4, parseNumberString as a5, parseSemver as a6, permissionsToChmod as a7, permissionsToOctal as a8, permissionsToSymbolic as a9, ptToPx as aa, pxToAll as ab, pxToViewport as ac, remToPx as ad, satisfiesRange as ae, scaleByHeight as af, scaleByWidth as ag, sortVersions as ah, splitSubnet as ai, symbolicToPermissions as aj, validateCardNumber as ak, viewportToPx as al, BYTE_UNITS as b, type BaseConvertResult as c, type ByteConvertResult as d, type ByteUnit as e, COMMON_LOCALES as f, COMMON_PERMISSIONS as g, COMMON_RATIOS as h, COMMON_SIZES as i, COMMON_VIEWPORTS as j, type CardValidationResult as k, type FormatOptions as l, type NumberBase as m, type PxConvertResult as n, type SubnetInfo as o, autoFormat as p, bumpVersion as q, calcAspectRatio as r, calcSubnet as s, compareSemver as t, units as u, convert as v, convertBytes as w, convertIp as x, coverBox as y, decimalToIp as z };
367
+ export { ipToDecimalCidr as $, type AmortizationRow as A, BASE_LABELS as B, COMMON_CURRENCIES as C, type Dimensions as D, convertIp as E, type FilePermissions as F, coverBox as G, decimalToIp as H, type IbanValidationResult as I, decimalToIpCidr as J, describePermissions as K, type LoanResult as L, fitIntoBox as M, type NotationStyle as N, formatNumber as O, type Permission as P, formatValue as Q, formatVwValue as R, type SemverVersion as S, formatWithSeparator as T, gcd as U, type ViewportConvertResult as V, ipFromBinary as W, ipFromDecimal as X, ipFromHex as Y, ipToBinary as Z, ipToDecimal as _, type AspectRatioResult as a, ipToHex as a0, ipToOctal as a1, isValid as a2, isValidCidr as a3, isValidIp as a4, isValidIpv4 as a5, octalToPermissions as a6, parseFileSize as a7, parseInput as a8, parseNumberString as a9, parseSemver as aa, permissionsToChmod as ab, permissionsToOctal as ac, permissionsToSymbolic as ad, ptToPx as ae, pxToAll as af, pxToViewport as ag, remToPx as ah, satisfiesRange as ai, scaleByHeight as aj, scaleByWidth as ak, sortVersions as al, splitSubnet as am, symbolicToPermissions as an, validateCardNumber as ao, validateIban as ap, viewportToPx as aq, BASE_PREFIXES as b, BYTE_UNITS as c, type BaseConvertResult as d, type ByteConvertResult as e, type ByteUnit as f, COMMON_LOCALES as g, COMMON_PERMISSIONS as h, COMMON_RATIOS as i, COMMON_SIZES as j, COMMON_VIEWPORTS as k, type CardValidationResult as l, type FormatOptions as m, type IpConversion as n, type NumberBase as o, type PxConvertResult as p, type SubnetInfo as q, autoFormat as r, bumpVersion as s, calcAspectRatio as t, units as u, calcSubnet as v, calculateLoan as w, compareSemver as x, convert as y, convertBytes as z };
@@ -13,6 +13,8 @@
13
13
  * - cidr-calc : calcSubnet, splitSubnet, isValidCidr, isValidIp, ipToDecimal (cidr), decimalToIp (cidr)
14
14
  * - semver : parseSemver, isValid, compareSemver, satisfiesRange, bumpVersion, sortVersions
15
15
  * - credit-card-validator : validateCardNumber
16
+ * - iban-validator : validateIban
17
+ * - loan-calculator : calculateLoan
16
18
  */
17
19
  interface PxConvertResult {
18
20
  px: number;
@@ -236,7 +238,49 @@ interface CardValidationResult {
236
238
  declare function validateCardNumber(input: string): CardValidationResult | {
237
239
  error: string;
238
240
  };
241
+ interface IbanValidationResult {
242
+ valid: boolean;
243
+ formatted: string;
244
+ countryCode: string;
245
+ checkDigits: string;
246
+ bban: string;
247
+ length: number;
248
+ expectedLength: number | null;
249
+ checksumValid: boolean;
250
+ lengthValid: boolean | null;
251
+ }
252
+ /**
253
+ * Validate an IBAN via the mod-97 checksum defined by ISO 13616 and format
254
+ * it into the standard human-readable grouped form. Also cross-checks the
255
+ * total length against the country's registered fixed length where known.
256
+ */
257
+ declare function validateIban(input: string): IbanValidationResult | {
258
+ error: string;
259
+ };
260
+ interface AmortizationRow {
261
+ month: number;
262
+ payment: number;
263
+ principal: number;
264
+ interest: number;
265
+ balance: number;
266
+ }
267
+ interface LoanResult {
268
+ monthlyPayment: number;
269
+ totalPayment: number;
270
+ totalInterest: number;
271
+ termMonths: number;
272
+ schedule: AmortizationRow[];
273
+ }
274
+ /**
275
+ * Compute the monthly payment, total interest, and full amortization
276
+ * schedule for a fixed-rate loan or mortgage, given the principal, annual
277
+ * interest rate (as a percent, e.g. 6.5), and term in months.
278
+ */
279
+ declare function calculateLoan(principal: number, annualRatePercent: number, termMonths: number): LoanResult | {
280
+ error: string;
281
+ };
239
282
 
283
+ type units_AmortizationRow = AmortizationRow;
240
284
  type units_AspectRatioResult = AspectRatioResult;
241
285
  declare const units_BASE_LABELS: typeof BASE_LABELS;
242
286
  declare const units_BASE_PREFIXES: typeof BASE_PREFIXES;
@@ -254,7 +298,9 @@ type units_CardValidationResult = CardValidationResult;
254
298
  type units_Dimensions = Dimensions;
255
299
  type units_FilePermissions = FilePermissions;
256
300
  type units_FormatOptions = FormatOptions;
301
+ type units_IbanValidationResult = IbanValidationResult;
257
302
  type units_IpConversion = IpConversion;
303
+ type units_LoanResult = LoanResult;
258
304
  type units_NotationStyle = NotationStyle;
259
305
  type units_NumberBase = NumberBase;
260
306
  type units_Permission = Permission;
@@ -266,6 +312,7 @@ declare const units_autoFormat: typeof autoFormat;
266
312
  declare const units_bumpVersion: typeof bumpVersion;
267
313
  declare const units_calcAspectRatio: typeof calcAspectRatio;
268
314
  declare const units_calcSubnet: typeof calcSubnet;
315
+ declare const units_calculateLoan: typeof calculateLoan;
269
316
  declare const units_compareSemver: typeof compareSemver;
270
317
  declare const units_convert: typeof convert;
271
318
  declare const units_convertBytes: typeof convertBytes;
@@ -311,9 +358,10 @@ declare const units_sortVersions: typeof sortVersions;
311
358
  declare const units_splitSubnet: typeof splitSubnet;
312
359
  declare const units_symbolicToPermissions: typeof symbolicToPermissions;
313
360
  declare const units_validateCardNumber: typeof validateCardNumber;
361
+ declare const units_validateIban: typeof validateIban;
314
362
  declare const units_viewportToPx: typeof viewportToPx;
315
363
  declare namespace units {
316
- export { type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BaseConvertResult as BaseConvertResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_Dimensions as Dimensions, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IpConversion as IpConversion, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SubnetInfo as SubnetInfo, type units_ViewportConvertResult as ViewportConvertResult, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_compareSemver as compareSemver, units_convert as convert, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateCardNumber as validateCardNumber, units_viewportToPx as viewportToPx };
364
+ export { type units_AmortizationRow as AmortizationRow, type units_AspectRatioResult as AspectRatioResult, units_BASE_LABELS as BASE_LABELS, units_BASE_PREFIXES as BASE_PREFIXES, units_BYTE_UNITS as BYTE_UNITS, type units_BaseConvertResult as BaseConvertResult, type units_ByteConvertResult as ByteConvertResult, type units_ByteUnit as ByteUnit, units_COMMON_CURRENCIES as COMMON_CURRENCIES, units_COMMON_LOCALES as COMMON_LOCALES, units_COMMON_PERMISSIONS as COMMON_PERMISSIONS, units_COMMON_RATIOS as COMMON_RATIOS, units_COMMON_SIZES as COMMON_SIZES, units_COMMON_VIEWPORTS as COMMON_VIEWPORTS, type units_CardValidationResult as CardValidationResult, type units_Dimensions as Dimensions, type units_FilePermissions as FilePermissions, type units_FormatOptions as FormatOptions, type units_IbanValidationResult as IbanValidationResult, type units_IpConversion as IpConversion, type units_LoanResult as LoanResult, type units_NotationStyle as NotationStyle, type units_NumberBase as NumberBase, type units_Permission as Permission, type units_PxConvertResult as PxConvertResult, type units_SemverVersion as SemverVersion, type units_SubnetInfo as SubnetInfo, type units_ViewportConvertResult as ViewportConvertResult, units_autoFormat as autoFormat, units_bumpVersion as bumpVersion, units_calcAspectRatio as calcAspectRatio, units_calcSubnet as calcSubnet, units_calculateLoan as calculateLoan, units_compareSemver as compareSemver, units_convert as convert, units_convertBytes as convertBytes, units_convertIp as convertIp, units_coverBox as coverBox, units_decimalToIp as decimalToIp, units_decimalToIpCidr as decimalToIpCidr, units_describePermissions as describePermissions, units_fitIntoBox as fitIntoBox, units_formatNumber as formatNumber, units_formatValue as formatValue, units_formatVwValue as formatVwValue, units_formatWithSeparator as formatWithSeparator, units_gcd as gcd, units_ipFromBinary as ipFromBinary, units_ipFromDecimal as ipFromDecimal, units_ipFromHex as ipFromHex, units_ipToBinary as ipToBinary, units_ipToDecimal as ipToDecimal, units_ipToDecimalCidr as ipToDecimalCidr, units_ipToHex as ipToHex, units_ipToOctal as ipToOctal, units_isValid as isValid, units_isValidCidr as isValidCidr, units_isValidIp as isValidIp, units_isValidIpv4 as isValidIpv4, units_octalToPermissions as octalToPermissions, units_parseFileSize as parseFileSize, units_parseInput as parseInput, units_parseNumberString as parseNumberString, units_parseSemver as parseSemver, units_permissionsToChmod as permissionsToChmod, units_permissionsToOctal as permissionsToOctal, units_permissionsToSymbolic as permissionsToSymbolic, units_ptToPx as ptToPx, units_pxToAll as pxToAll, units_pxToViewport as pxToViewport, units_remToPx as remToPx, units_satisfiesRange as satisfiesRange, units_scaleByHeight as scaleByHeight, units_scaleByWidth as scaleByWidth, units_sortVersions as sortVersions, units_splitSubnet as splitSubnet, units_symbolicToPermissions as symbolicToPermissions, units_validateCardNumber as validateCardNumber, units_validateIban as validateIban, units_viewportToPx as viewportToPx };
317
365
  }
318
366
 
319
- export { isValidCidr as $, type AspectRatioResult as A, BASE_LABELS as B, COMMON_CURRENCIES as C, type Dimensions as D, decimalToIpCidr as E, type FilePermissions as F, describePermissions as G, fitIntoBox as H, type IpConversion as I, formatNumber as J, formatValue as K, formatVwValue as L, formatWithSeparator as M, type NotationStyle as N, gcd as O, type Permission as P, ipFromBinary as Q, ipFromDecimal as R, type SemverVersion as S, ipFromHex as T, ipToBinary as U, type ViewportConvertResult as V, ipToDecimal as W, ipToDecimalCidr as X, ipToHex as Y, ipToOctal as Z, isValid as _, BASE_PREFIXES as a, isValidIp as a0, isValidIpv4 as a1, octalToPermissions as a2, parseFileSize as a3, parseInput as a4, parseNumberString as a5, parseSemver as a6, permissionsToChmod as a7, permissionsToOctal as a8, permissionsToSymbolic as a9, ptToPx as aa, pxToAll as ab, pxToViewport as ac, remToPx as ad, satisfiesRange as ae, scaleByHeight as af, scaleByWidth as ag, sortVersions as ah, splitSubnet as ai, symbolicToPermissions as aj, validateCardNumber as ak, viewportToPx as al, BYTE_UNITS as b, type BaseConvertResult as c, type ByteConvertResult as d, type ByteUnit as e, COMMON_LOCALES as f, COMMON_PERMISSIONS as g, COMMON_RATIOS as h, COMMON_SIZES as i, COMMON_VIEWPORTS as j, type CardValidationResult as k, type FormatOptions as l, type NumberBase as m, type PxConvertResult as n, type SubnetInfo as o, autoFormat as p, bumpVersion as q, calcAspectRatio as r, calcSubnet as s, compareSemver as t, units as u, convert as v, convertBytes as w, convertIp as x, coverBox as y, decimalToIp as z };
367
+ export { ipToDecimalCidr as $, type AmortizationRow as A, BASE_LABELS as B, COMMON_CURRENCIES as C, type Dimensions as D, convertIp as E, type FilePermissions as F, coverBox as G, decimalToIp as H, type IbanValidationResult as I, decimalToIpCidr as J, describePermissions as K, type LoanResult as L, fitIntoBox as M, type NotationStyle as N, formatNumber as O, type Permission as P, formatValue as Q, formatVwValue as R, type SemverVersion as S, formatWithSeparator as T, gcd as U, type ViewportConvertResult as V, ipFromBinary as W, ipFromDecimal as X, ipFromHex as Y, ipToBinary as Z, ipToDecimal as _, type AspectRatioResult as a, ipToHex as a0, ipToOctal as a1, isValid as a2, isValidCidr as a3, isValidIp as a4, isValidIpv4 as a5, octalToPermissions as a6, parseFileSize as a7, parseInput as a8, parseNumberString as a9, parseSemver as aa, permissionsToChmod as ab, permissionsToOctal as ac, permissionsToSymbolic as ad, ptToPx as ae, pxToAll as af, pxToViewport as ag, remToPx as ah, satisfiesRange as ai, scaleByHeight as aj, scaleByWidth as ak, sortVersions as al, splitSubnet as am, symbolicToPermissions as an, validateCardNumber as ao, validateIban as ap, viewportToPx as aq, BASE_PREFIXES as b, BYTE_UNITS as c, type BaseConvertResult as d, type ByteConvertResult as e, type ByteUnit as f, COMMON_LOCALES as g, COMMON_PERMISSIONS as h, COMMON_RATIOS as i, COMMON_SIZES as j, COMMON_VIEWPORTS as k, type CardValidationResult as l, type FormatOptions as m, type IpConversion as n, type NumberBase as o, type PxConvertResult as p, type SubnetInfo as q, autoFormat as r, bumpVersion as s, calcAspectRatio as t, units as u, calcSubnet as v, calculateLoan as w, compareSemver as x, convert as y, convertBytes as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utilix-tech/sdk",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "154+ developer utility tools for Node.js: JSON, encoding, hashing, color, CSS, network and more. Runs locally, no API key required.",
5
5
  "author": "Utilix <hello@utilix.tech>",
6
6
  "license": "MIT",