mortctl 0.1.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/README.md +234 -0
- package/dist/commands/eligible.d.ts +6 -0
- package/dist/commands/eligible.d.ts.map +1 -0
- package/dist/commands/eligible.js +115 -0
- package/dist/commands/eligible.js.map +1 -0
- package/dist/commands/limits.d.ts +6 -0
- package/dist/commands/limits.d.ts.map +1 -0
- package/dist/commands/limits.js +89 -0
- package/dist/commands/limits.js.map +1 -0
- package/dist/commands/ltv.d.ts +6 -0
- package/dist/commands/ltv.d.ts.map +1 -0
- package/dist/commands/ltv.js +96 -0
- package/dist/commands/ltv.js.map +1 -0
- package/dist/commands/payment.d.ts +6 -0
- package/dist/commands/payment.d.ts.map +1 -0
- package/dist/commands/payment.js +98 -0
- package/dist/commands/payment.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/calculations.d.ts +52 -0
- package/dist/lib/calculations.d.ts.map +1 -0
- package/dist/lib/calculations.js +270 -0
- package/dist/lib/calculations.js.map +1 -0
- package/dist/lib/eligibility.d.ts +33 -0
- package/dist/lib/eligibility.d.ts.map +1 -0
- package/dist/lib/eligibility.js +296 -0
- package/dist/lib/eligibility.js.map +1 -0
- package/dist/types.d.ts +179 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/jest.config.js +8 -0
- package/package.json +46 -0
- package/src/commands/eligible.ts +121 -0
- package/src/commands/limits.ts +91 -0
- package/src/commands/ltv.ts +97 -0
- package/src/commands/payment.ts +100 -0
- package/src/index.ts +32 -0
- package/src/lib/calculations.ts +314 -0
- package/src/lib/eligibility.ts +343 -0
- package/src/types.ts +216 -0
- package/tests/calculations.test.ts +154 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* mortctl payment command - Calculate monthly payment breakdown
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createPaymentCommand = createPaymentCommand;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const calculations_1 = require("../lib/calculations");
|
|
9
|
+
function createPaymentCommand() {
|
|
10
|
+
const payment = new commander_1.Command('payment')
|
|
11
|
+
.description('Calculate monthly payment breakdown (PITI)')
|
|
12
|
+
.requiredOption('--loan-amount <amount>', 'Loan amount')
|
|
13
|
+
.requiredOption('--rate <percent>', 'Interest rate (e.g., 6.5)')
|
|
14
|
+
.option('--term <years>', 'Loan term in years', '30')
|
|
15
|
+
.option('--property-value <amount>', 'Property value (for PMI/tax estimates)')
|
|
16
|
+
.option('--credit-score <score>', 'Credit score (for PMI)', '720')
|
|
17
|
+
.option('--taxes <amount>', 'Annual property taxes')
|
|
18
|
+
.option('--insurance <amount>', 'Annual homeowners insurance')
|
|
19
|
+
.option('--hoa <amount>', 'Monthly HOA dues', '0')
|
|
20
|
+
.option('--format <type>', 'Output format (json|table)', 'table')
|
|
21
|
+
.action(async (options) => {
|
|
22
|
+
try {
|
|
23
|
+
const loanAmount = parseFloat(options.loanAmount);
|
|
24
|
+
const rate = parseFloat(options.rate);
|
|
25
|
+
const term = parseInt(options.term);
|
|
26
|
+
const propertyValue = options.propertyValue ? parseFloat(options.propertyValue) : loanAmount * 1.25;
|
|
27
|
+
const scenario = {
|
|
28
|
+
propertyValue,
|
|
29
|
+
loanAmount,
|
|
30
|
+
downPayment: propertyValue - loanAmount,
|
|
31
|
+
interestRate: rate,
|
|
32
|
+
termYears: term,
|
|
33
|
+
creditScore: parseInt(options.creditScore),
|
|
34
|
+
propertyType: 'single-family',
|
|
35
|
+
occupancy: 'primary',
|
|
36
|
+
purpose: 'purchase',
|
|
37
|
+
propertyTaxes: options.taxes ? parseFloat(options.taxes) : undefined,
|
|
38
|
+
homeownersInsurance: options.insurance ? parseFloat(options.insurance) : undefined,
|
|
39
|
+
hoaDues: parseFloat(options.hoa),
|
|
40
|
+
};
|
|
41
|
+
const breakdown = (0, calculations_1.calculatePaymentBreakdown)(scenario);
|
|
42
|
+
const ltv = (loanAmount / propertyValue * 100);
|
|
43
|
+
// Calculate total interest over life of loan
|
|
44
|
+
const piOnly = (0, calculations_1.calculateMonthlyPayment)(loanAmount, rate, term);
|
|
45
|
+
const totalPayments = piOnly * term * 12;
|
|
46
|
+
const totalInterest = totalPayments - loanAmount;
|
|
47
|
+
if (options.format === 'json') {
|
|
48
|
+
console.log(JSON.stringify({
|
|
49
|
+
loanAmount,
|
|
50
|
+
interestRate: rate,
|
|
51
|
+
termYears: term,
|
|
52
|
+
ltv: Math.round(ltv * 100) / 100,
|
|
53
|
+
breakdown,
|
|
54
|
+
lifetime: {
|
|
55
|
+
totalPayments: Math.round(totalPayments),
|
|
56
|
+
totalInterest: Math.round(totalInterest),
|
|
57
|
+
},
|
|
58
|
+
}, null, 2));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.log('═══════════════════════════════════════════════════════════════');
|
|
62
|
+
console.log('MONTHLY PAYMENT BREAKDOWN');
|
|
63
|
+
console.log('═══════════════════════════════════════════════════════════════');
|
|
64
|
+
console.log('');
|
|
65
|
+
console.log(`Loan Amount: $${loanAmount.toLocaleString()}`);
|
|
66
|
+
console.log(`Interest Rate: ${rate}%`);
|
|
67
|
+
console.log(`Term: ${term} years`);
|
|
68
|
+
console.log(`LTV: ${ltv.toFixed(1)}%`);
|
|
69
|
+
console.log('');
|
|
70
|
+
console.log('PAYMENT BREAKDOWN');
|
|
71
|
+
console.log('───────────────────────────────────────────────────────────────');
|
|
72
|
+
console.log(`Principal & Interest: $${breakdown.principalAndInterest.toLocaleString().padStart(10)}`);
|
|
73
|
+
console.log(`Property Taxes: $${breakdown.propertyTaxes.toLocaleString().padStart(10)}`);
|
|
74
|
+
console.log(`Homeowners Insurance: $${breakdown.homeownersInsurance.toLocaleString().padStart(10)}`);
|
|
75
|
+
if (breakdown.mortgageInsurance > 0) {
|
|
76
|
+
console.log(`Mortgage Insurance: $${breakdown.mortgageInsurance.toLocaleString().padStart(10)}`);
|
|
77
|
+
}
|
|
78
|
+
if (breakdown.hoaDues > 0) {
|
|
79
|
+
console.log(`HOA Dues: $${breakdown.hoaDues.toLocaleString().padStart(10)}`);
|
|
80
|
+
}
|
|
81
|
+
console.log('───────────────────────────────────────────────────────────────');
|
|
82
|
+
console.log(`TOTAL PAYMENT: $${breakdown.totalPayment.toLocaleString().padStart(10)}`);
|
|
83
|
+
console.log('');
|
|
84
|
+
console.log('LOAN LIFETIME');
|
|
85
|
+
console.log('───────────────────────────────────────────────────────────────');
|
|
86
|
+
console.log(`Total Payments: $${Math.round(totalPayments).toLocaleString()}`);
|
|
87
|
+
console.log(`Total Interest: $${Math.round(totalInterest).toLocaleString()}`);
|
|
88
|
+
console.log('═══════════════════════════════════════════════════════════════');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
console.error(`Error: ${error.message}`);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return payment;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=payment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment.js","sourceRoot":"","sources":["../../src/commands/payment.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAMH,oDA2FC;AA/FD,yCAAoC;AACpC,sDAAyF;AAGzF,SAAgB,oBAAoB;IAClC,MAAM,OAAO,GAAG,IAAI,mBAAO,CAAC,SAAS,CAAC;SACnC,WAAW,CAAC,4CAA4C,CAAC;SACzD,cAAc,CAAC,wBAAwB,EAAE,aAAa,CAAC;SACvD,cAAc,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;SAC/D,MAAM,CAAC,gBAAgB,EAAE,oBAAoB,EAAE,IAAI,CAAC;SACpD,MAAM,C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,EAAE,CAAC,EAAE,CAAC,CAAC;gBACjG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAChB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;gBAC7B,OAAO,CAAC,GAAG,CAAC,iEAAiE,CAAC,CAAC;gBAC/E,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;gBACnF,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;gBACnF,OAAO,CAAC,GAAG,CAAC,iEAAiE,CAAC,CAAC;YACjF,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* mortctl - Mortgage underwriting calculations and eligibility
|
|
4
|
+
* Part of the LendCtl Suite
|
|
5
|
+
*/
|
|
6
|
+
export * from './lib/calculations';
|
|
7
|
+
export * from './lib/eligibility';
|
|
8
|
+
export * from './types';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAwBH,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* mortctl - Mortgage underwriting calculations and eligibility
|
|
5
|
+
* Part of the LendCtl Suite
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
const commander_1 = require("commander");
|
|
23
|
+
const ltv_1 = require("./commands/ltv");
|
|
24
|
+
const eligible_1 = require("./commands/eligible");
|
|
25
|
+
const payment_1 = require("./commands/payment");
|
|
26
|
+
const limits_1 = require("./commands/limits");
|
|
27
|
+
const program = new commander_1.Command();
|
|
28
|
+
program
|
|
29
|
+
.name('mortctl')
|
|
30
|
+
.description('Mortgage underwriting calculations and eligibility - part of the LendCtl Suite')
|
|
31
|
+
.version('0.1.0');
|
|
32
|
+
// Add commands
|
|
33
|
+
program.addCommand((0, ltv_1.createLtvCommand)());
|
|
34
|
+
program.addCommand((0, eligible_1.createEligibleCommand)());
|
|
35
|
+
program.addCommand((0, payment_1.createPaymentCommand)());
|
|
36
|
+
program.addCommand((0, limits_1.createLimitsCommand)());
|
|
37
|
+
program.parse();
|
|
38
|
+
// Export library components for programmatic use
|
|
39
|
+
__exportStar(require("./lib/calculations"), exports);
|
|
40
|
+
__exportStar(require("./lib/eligibility"), exports);
|
|
41
|
+
__exportStar(require("./types"), exports);
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA;;;GAGG;;;;;;;;;;;;;;;;AAEH,yCAAoC;AACpC,wCAAkD;AAClD,kDAA4D;AAC5D,gDAA0D;AAC1D,8CAAwD;AAExD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,gFAAgF,CAAC;KAC7F,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,eAAe;AACf,OAAO,CAAC,UAAU,CAAC,IAAA,sBAAgB,GAAE,CAAC,CAAC;AACvC,OAAO,CAAC,UAAU,CAAC,IAAA,gCAAqB,GAAE,CAAC,CAAC;AAC5C,OAAO,CAAC,UAAU,CAAC,IAAA,8BAAoB,GAAE,CAAC,CAAC;AAC3C,OAAO,CAAC,UAAU,CAAC,IAAA,4BAAmB,GAAE,CAAC,CAAC;AAE1C,OAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,iDAAiD;AACjD,qDAAmC;AACnC,oDAAkC;AAClC,0CAAwB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core mortgage calculations
|
|
3
|
+
*/
|
|
4
|
+
import { LtvResult, PmiInputs, PmiResult, LoanScenario, PaymentBreakdown, LoanLimits } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* 2026 Conforming Loan Limits (estimated)
|
|
7
|
+
*/
|
|
8
|
+
export declare const LOAN_LIMITS_2026: LoanLimits;
|
|
9
|
+
/**
|
|
10
|
+
* High-cost counties (sample - would be comprehensive in production)
|
|
11
|
+
*/
|
|
12
|
+
export declare const HIGH_COST_COUNTIES: Record<string, number>;
|
|
13
|
+
/**
|
|
14
|
+
* Get conforming loan limit for a county
|
|
15
|
+
*/
|
|
16
|
+
export declare function getConformingLimit(county?: string, units?: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* Calculate monthly P&I payment
|
|
19
|
+
*/
|
|
20
|
+
export declare function calculateMonthlyPayment(principal: number, annualRate: number, termYears: number): number;
|
|
21
|
+
/**
|
|
22
|
+
* Calculate LTV/CLTV/HCLTV
|
|
23
|
+
*/
|
|
24
|
+
export declare function calculateLtv(propertyValue: number, loanAmount: number, secondLien?: number, heloc?: number): LtvResult;
|
|
25
|
+
/**
|
|
26
|
+
* Calculate PMI
|
|
27
|
+
*/
|
|
28
|
+
export declare function calculatePmi(inputs: PmiInputs): PmiResult;
|
|
29
|
+
/**
|
|
30
|
+
* Calculate full payment breakdown
|
|
31
|
+
*/
|
|
32
|
+
export declare function calculatePaymentBreakdown(scenario: LoanScenario): PaymentBreakdown;
|
|
33
|
+
/**
|
|
34
|
+
* Calculate FHA MIP (Mortgage Insurance Premium)
|
|
35
|
+
*/
|
|
36
|
+
export declare function calculateFhaMip(loanAmount: number, ltv: number, termYears: number): {
|
|
37
|
+
upfront: number;
|
|
38
|
+
monthly: number;
|
|
39
|
+
annualRate: number;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Calculate VA Funding Fee
|
|
43
|
+
*/
|
|
44
|
+
export declare function calculateVaFundingFee(loanAmount: number, downPaymentPercent: number, firstTimeUse: boolean, reservist?: boolean): number;
|
|
45
|
+
/**
|
|
46
|
+
* Calculate USDA Guarantee Fee
|
|
47
|
+
*/
|
|
48
|
+
export declare function calculateUsdaFee(loanAmount: number): {
|
|
49
|
+
upfront: number;
|
|
50
|
+
annual: number;
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=calculations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculations.d.ts","sourceRoot":"","sources":["../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gB,CAAC,UAAU,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CASxF"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Core mortgage calculations
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.HIGH_COST_COUNTIES = exports.LOAN_LIMITS_2026 = void 0;
|
|
7
|
+
exports.getConformingLimit = getConformingLimit;
|
|
8
|
+
exports.calculateMonthlyPayment = calculateMonthlyPayment;
|
|
9
|
+
exports.calculateLtv = calculateLtv;
|
|
10
|
+
exports.calculatePmi = calculatePmi;
|
|
11
|
+
exports.calculatePaymentBreakdown = calculatePaymentBreakdown;
|
|
12
|
+
exports.calculateFhaMip = calculateFhaMip;
|
|
13
|
+
exports.calculateVaFundingFee = calculateVaFundingFee;
|
|
14
|
+
exports.calculateUsdaFee = calculateUsdaFee;
|
|
15
|
+
/**
|
|
16
|
+
* 2026 Conforming Loan Limits (estimated)
|
|
17
|
+
*/
|
|
18
|
+
exports.LOAN_LIMITS_2026 = {
|
|
19
|
+
baseline: 766550, // Standard conforming limit
|
|
20
|
+
highCost: 1149825, // High-cost area ceiling (150% of baseline)
|
|
21
|
+
fhaFloor: 498257, // FHA floor
|
|
22
|
+
fhaCeiling: 1149825, // FHA ceiling (same as high-cost)
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* High-cost counties (sample - would be comprehensive in production)
|
|
26
|
+
*/
|
|
27
|
+
exports.HIGH_COST_COUNTIES = {
|
|
28
|
+
'Los Angeles, CA': 1149825,
|
|
29
|
+
'San Francisco, CA': 1149825,
|
|
30
|
+
'New York, NY': 1149825,
|
|
31
|
+
'Kings, NY': 1149825,
|
|
32
|
+
'Queens, NY': 1149825,
|
|
33
|
+
'Bronx, NY': 1149825,
|
|
34
|
+
'San Diego, CA': 1006250,
|
|
35
|
+
'Orange, CA': 1149825,
|
|
36
|
+
'Santa Clara, CA': 1149825,
|
|
37
|
+
'Alameda, CA': 1149825,
|
|
38
|
+
'Seattle, WA': 977500,
|
|
39
|
+
'King, WA': 977500,
|
|
40
|
+
'Honolulu, HI': 1149825,
|
|
41
|
+
'Washington, DC': 1149825,
|
|
42
|
+
'Montgomery, MD': 1149825,
|
|
43
|
+
'Fairfax, VA': 1149825,
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Get conforming loan limit for a county
|
|
47
|
+
*/
|
|
48
|
+
function getConformingLimit(county, units = 1) {
|
|
49
|
+
let baseLimit = exports.LOAN_LIMITS_2026.baseline;
|
|
50
|
+
if (county && exports.HIGH_COST_COUNTIES[county]) {
|
|
51
|
+
baseLimit = exports.HIGH_COST_COUNTIES[county];
|
|
52
|
+
}
|
|
53
|
+
// Multi-unit adjustments
|
|
54
|
+
const unitMultipliers = {
|
|
55
|
+
1: 1,
|
|
56
|
+
2: 1.28,
|
|
57
|
+
3: 1.55,
|
|
58
|
+
4: 1.92,
|
|
59
|
+
};
|
|
60
|
+
return Math.round(baseLimit * (unitMultipliers[units] || 1));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Calculate monthly P&I payment
|
|
64
|
+
*/
|
|
65
|
+
function calculateMonthlyPayment(principal, annualRate, termYears) {
|
|
66
|
+
const monthlyRate = annualRate / 100 / 12;
|
|
67
|
+
const numPayments = termYears * 12;
|
|
68
|
+
if (monthlyRate === 0) {
|
|
69
|
+
return principal / numPayments;
|
|
70
|
+
}
|
|
71
|
+
const payment = principal *
|
|
72
|
+
(monthlyRate * Math.pow(1 + monthlyRate, numPayments)) /
|
|
73
|
+
(Math.pow(1 + monthlyRate, numPayments) - 1);
|
|
74
|
+
return Math.round(payment * 100) / 100;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Calculate LTV/CLTV/HCLTV
|
|
78
|
+
*/
|
|
79
|
+
function calculateLtv(propertyValue, loanAmount, secondLien = 0, heloc = 0) {
|
|
80
|
+
const ltv = (loanAmount / propertyValue) * 100;
|
|
81
|
+
const cltv = ((loanAmount + secondLien) / propertyValue) * 100;
|
|
82
|
+
const hcltv = ((loanAmount + secondLien + heloc) / propertyValue) * 100;
|
|
83
|
+
const pmiRequired = ltv > 80;
|
|
84
|
+
return {
|
|
85
|
+
ltv: Math.round(ltv * 100) / 100,
|
|
86
|
+
cltv: Math.round(cltv * 100) / 100,
|
|
87
|
+
hcltv: Math.round(hcltv * 100) / 100,
|
|
88
|
+
pmiRequired,
|
|
89
|
+
pmiRemovalLtv: pmiRequired ? 78 : undefined,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* PMI rate lookup table (approximate)
|
|
94
|
+
* Format: [LTV range][Credit score range] = annual rate %
|
|
95
|
+
*/
|
|
96
|
+
const PMI_RATES = {
|
|
97
|
+
'95-97': { '760+': 0.55, '740-759': 0.65, '720-739': 0.78, '700-719': 0.95, '680-699': 1.15, '<680': 1.40 },
|
|
98
|
+
'90-95': { '760+': 0.38, '740-759': 0.45, '720-739': 0.55, '700-719': 0.70, '680-699': 0.90, '<680': 1.15 },
|
|
99
|
+
'85-90': { '760+': 0.25, '740-759': 0.30, '720-739': 0.38, '700-719': 0.50, '680-699': 0.65, '<680': 0.85 },
|
|
100
|
+
'80-85': { '760+': 0.15, '740-759': 0.18, '720-739': 0.23, '700-719': 0.30, '680-699': 0.40, '<680': 0.55 },
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Get credit score bracket for PMI lookup
|
|
104
|
+
*/
|
|
105
|
+
function getCreditBracket(score) {
|
|
106
|
+
if (score >= 760)
|
|
107
|
+
return '760+';
|
|
108
|
+
if (score >= 740)
|
|
109
|
+
return '740-759';
|
|
110
|
+
if (score >= 720)
|
|
111
|
+
return '720-739';
|
|
112
|
+
if (score >= 700)
|
|
113
|
+
return '700-719';
|
|
114
|
+
if (score >= 680)
|
|
115
|
+
return '680-699';
|
|
116
|
+
return '<680';
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get LTV bracket for PMI lookup
|
|
120
|
+
*/
|
|
121
|
+
function getLtvBracket(ltv) {
|
|
122
|
+
if (ltv > 95)
|
|
123
|
+
return '95-97';
|
|
124
|
+
if (ltv > 90)
|
|
125
|
+
return '90-95';
|
|
126
|
+
if (ltv > 85)
|
|
127
|
+
return '85-90';
|
|
128
|
+
if (ltv > 80)
|
|
129
|
+
return '80-85';
|
|
130
|
+
return '80-85'; // Below 80 - no PMI normally
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Calculate PMI
|
|
134
|
+
*/
|
|
135
|
+
function calculatePmi(inputs) {
|
|
136
|
+
const { ltv, creditScore, loanAmount, termYears = 30 } = inputs;
|
|
137
|
+
// No PMI below 80% LTV
|
|
138
|
+
if (ltv <= 80) {
|
|
139
|
+
return {
|
|
140
|
+
required: false,
|
|
141
|
+
monthlyAmount: 0,
|
|
142
|
+
annualAmount: 0,
|
|
143
|
+
ratePercent: 0,
|
|
144
|
+
cancellationLtv: 80,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const ltvBracket = getLtvBracket(ltv);
|
|
148
|
+
const creditBracket = getCreditBracket(creditScore);
|
|
149
|
+
const ratePercent = PMI_RATES[ltvBracket]?.[creditBracket] || 0.85;
|
|
150
|
+
const annualAmount = (loanAmount * ratePercent) / 100;
|
|
151
|
+
const monthlyAmount = annualAmount / 12;
|
|
152
|
+
// Estimate months to reach 78% LTV (automatic cancellation)
|
|
153
|
+
// Simplified - assumes 30-year at average rate
|
|
154
|
+
const avgRate = 6.5; // Approximate
|
|
155
|
+
const monthlyPayment = calculateMonthlyPayment(loanAmount, avgRate, termYears);
|
|
156
|
+
// Very rough estimate of months to 78% LTV
|
|
157
|
+
const targetLoanAmount = loanAmount * (78 / ltv);
|
|
158
|
+
const reductionNeeded = loanAmount - targetLoanAmount;
|
|
159
|
+
// Approximate based on early amortization (mostly interest)
|
|
160
|
+
const avgMonthlyPrincipal = monthlyPayment * 0.25; // Rough estimate
|
|
161
|
+
const monthsToCancel = Math.ceil(reductionNeeded / avgMonthlyPrincipal);
|
|
162
|
+
return {
|
|
163
|
+
required: true,
|
|
164
|
+
monthlyAmount: Math.round(monthlyAmount * 100) / 100,
|
|
165
|
+
annualAmount: Math.round(annualAmount * 100) / 100,
|
|
166
|
+
ratePercent,
|
|
167
|
+
cancellationLtv: 78,
|
|
168
|
+
monthsToCancel,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Calculate full payment breakdown
|
|
173
|
+
*/
|
|
174
|
+
function calculatePaymentBreakdown(scenario) {
|
|
175
|
+
const principalAndInterest = calculateMonthlyPayment(scenario.loanAmount, scenario.interestRate, scenario.termYears);
|
|
176
|
+
const propertyTaxes = (scenario.propertyTaxes || scenario.propertyValue * 0.0125) / 12;
|
|
177
|
+
const homeownersInsurance = (scenario.homeownersInsurance || scenario.propertyValue * 0.0035) / 12;
|
|
178
|
+
const hoaDues = scenario.hoaDues || 0;
|
|
179
|
+
// Calculate PMI if needed
|
|
180
|
+
const ltv = (scenario.loanAmount / scenario.propertyValue) * 100;
|
|
181
|
+
const pmiResult = calculatePmi({
|
|
182
|
+
ltv,
|
|
183
|
+
creditScore: scenario.creditScore,
|
|
184
|
+
loanAmount: scenario.loanAmount,
|
|
185
|
+
termYears: scenario.termYears,
|
|
186
|
+
});
|
|
187
|
+
const totalPayment = principalAndInterest + propertyTaxes + homeownersInsurance +
|
|
188
|
+
pmiResult.monthlyAmount + hoaDues;
|
|
189
|
+
return {
|
|
190
|
+
principalAndInterest: Math.round(principalAndInterest * 100) / 100,
|
|
191
|
+
propertyTaxes: Math.round(propertyTaxes * 100) / 100,
|
|
192
|
+
homeownersInsurance: Math.round(homeownersInsurance * 100) / 100,
|
|
193
|
+
mortgageInsurance: pmiResult.monthlyAmount,
|
|
194
|
+
hoaDues,
|
|
195
|
+
totalPayment: Math.round(totalPayment * 100) / 100,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Calculate FHA MIP (Mortgage Insurance Premium)
|
|
200
|
+
*/
|
|
201
|
+
function calculateFhaMip(loanAmount, ltv, termYears) {
|
|
202
|
+
// Upfront MIP: 1.75% of loan amount
|
|
203
|
+
const upfront = loanAmount * 0.0175;
|
|
204
|
+
// Annual MIP rates (as of 2024, may change)
|
|
205
|
+
// For loans > 15 years and LTV > 90%: 0.85%
|
|
206
|
+
// For loans > 15 years and LTV <= 90%: 0.80%
|
|
207
|
+
// For loans <= 15 years: 0.45% to 0.70% depending on LTV
|
|
208
|
+
let annualRate;
|
|
209
|
+
if (termYears > 15) {
|
|
210
|
+
annualRate = ltv > 90 ? 0.85 : 0.80;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
annualRate = ltv > 90 ? 0.70 : 0.45;
|
|
214
|
+
}
|
|
215
|
+
const monthly = (loanAmount * annualRate / 100) / 12;
|
|
216
|
+
return {
|
|
217
|
+
upfront: Math.round(upfront * 100) / 100,
|
|
218
|
+
monthly: Math.round(monthly * 100) / 100,
|
|
219
|
+
annualRate,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Calculate VA Funding Fee
|
|
224
|
+
*/
|
|
225
|
+
function calculateVaFundingFee(loanAmount, downPaymentPercent, firstTimeUse, reservist = false) {
|
|
226
|
+
// VA Funding Fee rates (2024)
|
|
227
|
+
// First use, no down: 2.15% (2.40% for reserves/NG)
|
|
228
|
+
// First use, 5-10% down: 1.50% (1.75% for reserves/NG)
|
|
229
|
+
// First use, 10%+ down: 1.25% (1.50% for reserves/NG)
|
|
230
|
+
// Subsequent use, no down: 3.30%
|
|
231
|
+
// Subsequent use, 5-10% down: 1.50%
|
|
232
|
+
// Subsequent use, 10%+ down: 1.25%
|
|
233
|
+
let rate;
|
|
234
|
+
if (firstTimeUse) {
|
|
235
|
+
if (downPaymentPercent >= 10) {
|
|
236
|
+
rate = reservist ? 1.50 : 1.25;
|
|
237
|
+
}
|
|
238
|
+
else if (downPaymentPercent >= 5) {
|
|
239
|
+
rate = reservist ? 1.75 : 1.50;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
rate = reservist ? 2.40 : 2.15;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
if (downPaymentPercent >= 10) {
|
|
247
|
+
rate = 1.25;
|
|
248
|
+
}
|
|
249
|
+
else if (downPaymentPercent >= 5) {
|
|
250
|
+
rate = 1.50;
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
rate = 3.30;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return Math.round((loanAmount * rate / 100) * 100) / 100;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Calculate USDA Guarantee Fee
|
|
260
|
+
*/
|
|
261
|
+
function calculateUsdaFee(loanAmount) {
|
|
262
|
+
// USDA fees (2024)
|
|
263
|
+
// Upfront: 1.0%
|
|
264
|
+
// Annual: 0.35%
|
|
265
|
+
return {
|
|
266
|
+
upfront: Math.round((loanAmount * 0.01) * 100) / 100,
|
|
267
|
+
annual: Math.round((loanAmount * 0.0035) * 100) / 100,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=calculations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculations.js","sourceRoot":"","sources":["../../src/lib/calculations.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA8CH,gDAgBC;AAKD,0DAiBC;AAKD,oCAmBC;AAuCD,oCA0CC;AAKD,8DA+BC;AAKD,0CA2BC;AAKD,sDAmCC;AAKD,4CASC;AA5SD;;GAEG;AACU,QAAA,gBAAgB,GAAe;IAC1C,QAAQ,EAAE,MAAM,EAAO,4BAA4B;IACnD,QAAQ,EAAE,OAAO,EAAM,4CAA4C;IACnE,QAAQ,EAAE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
3
|
+
*/
|
|
4
|
+
import { LoanScenario, EligibilityResult, LoanProgram } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Check conventional loan eligibility
|
|
7
|
+
*/
|
|
8
|
+
export declare function checkConventionalEligibility(scenario: LoanScenario): EligibilityResult;
|
|
9
|
+
/**
|
|
10
|
+
* Check FHA loan eligibility
|
|
11
|
+
*/
|
|
12
|
+
export declare function checkFhaEligibility(scenario: LoanScenario): EligibilityResult;
|
|
13
|
+
/**
|
|
14
|
+
* Check VA loan eligibility
|
|
15
|
+
*/
|
|
16
|
+
export declare function checkVaEligibility(scenario: LoanScenario): EligibilityResult;
|
|
17
|
+
/**
|
|
18
|
+
* Check USDA loan eligibility
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkUsdaEligibility(scenario: LoanScenario): EligibilityResult;
|
|
21
|
+
/**
|
|
22
|
+
* Check jumbo loan eligibility
|
|
23
|
+
*/
|
|
24
|
+
export declare function checkJumboEligibility(scenario: LoanScenario): EligibilityResult;
|
|
25
|
+
/**
|
|
26
|
+
* Check all program eligibility
|
|
27
|
+
*/
|
|
28
|
+
export declare function checkAllEligibility(scenario: LoanScenario): EligibilityResult[];
|
|
29
|
+
/**
|
|
30
|
+
* Find best recommended program
|
|
31
|
+
*/
|
|
32
|
+
export declare function findBestProgram(eligibility: EligibilityResult[]): LoanProgram | undefined;
|
|
33
|
+
//# sourceMappingURL=eligibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eligibility.d.ts","sourceRoot":"","sources":["../../src/lib/eligibility.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,WAAW,EAEZ,MAAM,UAAU,CAAC;AAGlB;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CAsEtF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CAwD7E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CA+C5E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CA+C9E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CA+C/E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,iBAAiB,EAAE,CAQ/E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,iBAAiB,EAAE,GAC/B,WAAW,GAAG,SAAS,CAoBzB"}
|