+62
| export interface Installment { | ||
| capital: number; | ||
| interest: number; | ||
| installment: number; | ||
| remain: number; | ||
| interestSum: number; | ||
| } | ||
| export interface LoanInstance { | ||
| installments: Installment[]; | ||
| amount: number; | ||
| interestSum: number; | ||
| capitalSum: number; | ||
| sum: number; | ||
| } | ||
| export type GetNextInstalmentFunction = ( | ||
| amount: number, | ||
| installmentsNumber: number, | ||
| interestRate: number, | ||
| diminishing: boolean, | ||
| capitalSum: number, | ||
| interestSum: number | ||
| ) => Installment; | ||
| export type LoanFunction = ( | ||
| amount: number, | ||
| installmentsNumber: number, | ||
| interestRate: number, | ||
| diminishing = false | ||
| ) => LoanInstance; | ||
| /** | ||
| * Create Loan Instance with all installments and sum of interest | ||
| * | ||
| * @param {number} amount full amount of Loan | ||
| * @param {number} installmentsNumber how many installments will be | ||
| * @param {number} interestRate interest rate in percent (3.5) equal/annuity (false) | ||
| * @param {boolean} diminishing if installments will be diminishing (true) or not | ||
| */ | ||
| export const Loan: LoanFunction | ||
| export interface LoanToHtmlTableParams { | ||
| formatMoney?: (num: number) => string; | ||
| translations?: Record<string, string>; | ||
| } | ||
| export type LoanToHtmlTableFunction = ( | ||
| loan: LoanInstance, | ||
| params: LoanToHtmlTableParams = {} | ||
| ) => string | ||
| /** | ||
| * Create Loan Object with all installments and sum of interest | ||
| * @param {LoanInstance} loan loan instance object | ||
| * @param {LoanToHtmlTableParams} params params | ||
| * | ||
| * @return {string} html string with the table | ||
| */ | ||
| export const loanToHtmlTable: LoanToHtmlTableFunction | ||
+3
-2
| { | ||
| "name": "loanjs", | ||
| "version": "1.0.11", | ||
| "version": "1.0.12", | ||
| "main": "LoanJS.js", | ||
@@ -22,3 +22,4 @@ "description": "Calculate loan in js (browser/node.js) for equal installments, installments decreasing, the sum of interest, etc.", | ||
| "lib", | ||
| "LoanJS.js" | ||
| "LoanJS.js", | ||
| "types.d.ts" | ||
| ], | ||
@@ -25,0 +26,0 @@ "keywords": [ |
27241
6.23%14
7.69%542
10.84%