{"id":32226774,"url":"https://github.com/davidbooth/amortizejs","last_synced_at":"2025-10-22T09:56:39.776Z","repository":{"id":58236591,"uuid":"112935021","full_name":"davidbooth/AmortizeJS","owner":"davidbooth","description":"Loan calculation and amortization schedule utility with support for custom amortization methods, available for node and browser.","archived":false,"fork":false,"pushed_at":"2022-01-17T16:29:14.000Z","size":4050,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T09:56:39.193Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidbooth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-03T14:32:30.000Z","updated_at":"2022-01-17T16:29:17.000Z","dependencies_parsed_at":"2022-08-31T16:44:07.146Z","dependency_job_id":null,"html_url":"https://github.com/davidbooth/AmortizeJS","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/davidbooth/AmortizeJS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidbooth%2FAmortizeJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidbooth%2FAmortizeJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidbooth%2FAmortizeJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidbooth%2FAmortizeJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidbooth","download_url":"https://codeload.github.com/davidbooth/AmortizeJS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidbooth%2FAmortizeJS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280416598,"owners_count":26327044,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-22T09:56:38.680Z","updated_at":"2025-10-22T09:56:39.764Z","avatar_url":"https://github.com/davidbooth.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AmortizeJS\n\n[![Version][version-img]][npm-url]\n[![npm][npm-img]][npm-url]\n[![license][license-img]]()\n\nLoan calculation and amortization schedule utility with support for custom amortization methods, available for node and browser.\n\n```js\nAmortizeJS.calculate({\n    method: 'mortgage',\n    apr: 3.5,\n    balance: 280350,\n    loanTerm: 60,\n    startDate: new Date('December 24 2017'),\n});\n```\n\n## Example Usage\n\n\u003cimg src=\"preview.gif\"\u003e\n\n## Table of Contents\n\n- [AmortizeJS](#amortizejs)\n  - [Example Usage](#example-usage)\n  - [Table of Contents](#table-of-contents)\n  - [Features](#features)\n    - [Supported amortization methods](#supported-amortization-methods)\n  - [Installation](#installation)\n  - [Usage](#usage)\n  - [Quickstart](#quickstart)\n  - [API Docs](#api-docs)\n    - [AmortizeJS](#amortizejs-1)\n    - [CalculatorConfig](#calculatorconfig)\n    - [AmortizationMethod](#amortizationmethod)\n    - [Payment](#payment)\n  - [Formatting of results in examples](#formatting-of-results-in-examples)\n  - [Contributing](#contributing)\n    - [Using a custom method](#using-a-custom-method)\n    - [Using a custom class](#using-a-custom-class)\n\n## Features\n\n-   Periodic payment calculation\n-   Total interest calculation\n-   Total payment calculation\n-   Calculate a payment's interest amount, principal amount and remaining balance\n-   Amortization schedule creation with optional payment date support\n-   Easily customize and create new amortization methods\n\n### Supported amortization methods\n\n-   Mortgage-Style/Constant-Payment method\n\n## Installation\n\nUsing Bower:\n\n```html\n$ bower install amortizejs\n\n\u003cscript src=\"./bower_components/AmortizeJS/dist/web/bundle.js\"\u003e\u003c/script\u003e\n```\n\nUsing npm:\n\n```bash\n$ npm install amortizejs\n```\n\n## Usage\n\nIn Browser: `AmortizeJS` class is available on the window object.\n\nIn Node.js\n\n```js\nvar AmortizeJS = require('amortizejs').Calculator;\n```\n\n## Quickstart\n\nTo calculate a mortgage amortization schedule including payment dates:\n\n```js\nvar mortgage = AmortizeJS.calculate({\n    method: 'mortgage',\n    apr: 3.5,\n    balance: 280350,\n    loanTerm: 60,\n    startDate: new Date('December 24 2017'),\n});\n\nconsole.log(mortgage.periodicPayment); // 5100.06\nconsole.log(mortgage.periodicInterest); // 0.00292\nconsole.log(mortgage.totalInterest); // 25653.34\nconsole.log(mortgage.totalPayment); // 306003.34\nconsole.log(mortgage.endDate); // Sat Dec 24 2022 00:00:00 GMT-0500 (EST)\nconsole.log(mortgage.schedule); // [{\"interest\": 817.69, \"principal\": 4282.37, \"remainingBalance\": 276067.63, \"date\":\"2017-12-24T05:00:00.000Z\"} ...]\n```\n\nTo retrieve list of available amortization methods:\n\n```js\nAmortizeJS.availableMethods(); // ['mortgage']\n```\n\n## API Docs\n\n### AmortizeJS\n\n| Command              | Params                                | Return                                    | Description                                          |\n| -------------------- | ------------------------------------- | ----------------------------------------- | ---------------------------------------------------- |\n| `calculate(config)`  | [calculatorConfig](#calculatorconfig) | [AmortizationMethod](#amortizationmethod) | Calculates amortization details and schedule.        |\n| `availableMethods()` | none                                  | string[]                                  | Returns the amortization methods that are available. |\n\n### CalculatorConfig\n\nAn object conforming to the CalculatorConfig Interface is required when calling `AmortizeJS.calculate(config)`, the following options are available:\n\n| Attribute | Type               | Description                                                                             |\n| --------- | ------------------ | --------------------------------------------------------------------------------------- |\n| method    | string \\| function | A string identifying the amortization method to use, or a custom amortization function. |\n| balance   | number             | The loan amount.                                                                        |\n| loanTerm  | number             | Loan term in month.                                                                     |\n| apr       | number             | The Anual Percentage Rate (ex: 3.5%)                                                    |\n| startDate | Date (Optional)    | Optional start date, will cause monthly payments to have dates attached to them.        |\n\n### AmortizationMethod\n\nAn object conforming to the AmortizationMethod Interface is returned when calling `AmortizeJS.calculate(config)`, the following attributes are available on it:\n\n| Attribute        | Type                  | Description                                                                                                              |\n| ---------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------ |\n| balance          | number                | The loan amount.                                                                                                         |\n| periods          | number                | The total number of periods.                                                                                             |\n| periodicInterest | number                | The interest payed per period, if the period is month then the APR will be divided by 12 (ex: APR = 3.5%, i = 0.035/12). |\n| periodicPayment  | number                | The total payment that needs to be made per period.                                                                      |\n| schedule         | [Payment[]](#payment) | Array of payments required to pay off the balance.                                                                       |\n| totalPayment     | number                | The total amount of all payments over the term.                                                                          |\n| totalInterest    | number                | The total amount of interest spend over the term.                                                                        |\n| startDate        | Date (Optional)       | The start date of the loan.                                                                                              |\n| endDate          | Date (Optional)       | The pay off date (Will only be calculated if startDate was given).                                                       |\n\n### Payment\n\nA payment for the loan, will include the following:\n\n| Attribute        | Type   | Description                                    |\n| ---------------- | ------ | ---------------------------------------------- |\n| interest         | number | Portion of the payment that goes to interest.  |\n| principal        | number | Portion of the payment that goes to principal. |\n| remainingBalance | number | Remaining balance after this payment.          |\n| date             | Date   | The date of the payment.                       |\n\n## Formatting of results in examples\n\nResults are not truncated or formatted in any way, the results in the examples are truncated for clarity.\n\n## Contributing\n\nIt is easy to extend AmortizeJS with custom amortization methods, all you need to do is create a javascript class or function that can be initiated via the `new` operator. This constructor will be supplied the following arguments in order:\n\n| Argument         | Type            | Description                    |\n| ---------------- | --------------- | ------------------------------ |\n| balance          | number          | The loan amount.               |\n| periodicInterest | number          | The interest payed per period. |\n| periods          | number          | The total number of periods.   |\n| startDate        | Date (Optional) | The start date of the loan.    |\n\nThe constructor should return an object that conforms to the [AmortizationMethod](#amortizationmethod) interface.\n\n### Using a custom method\n\n```js\nfunction customFunction(balance, periodicInterest, loanTerm, startDate) {\n    //Your custom amortization algorithm here\n    return arguments;\n}\n\nvar mortgage = Calculator.calculate({\n    method: customFunction,\n    apr: 3.5,\n    balance: 280350,\n    loanTerm: 60,\n    startDate: new Date('December 24 2017'),\n});\n\nconsole.log(mortgage); //{\"0\": 280350, \"1\": 0.00292, \"2\": 60, \"3\": \"2017-12-24T05:00:00.000Z\"}\n```\n\n### Using a custom class\n\n```js\nclass CustomMethod {\n    constructor(balance, periodicInterest, loanTerm, startDate) {\n        //Your custom amortization algorithm here\n        return arguments;\n    }\n}\n\nvar mortgage = Calculator.calculate({\n    method: CustomMethod,\n    apr: 3.5,\n    balance: 280350,\n    loanTerm: 60,\n    startDate: new Date('December 24 2017'),\n});\n\nconsole.log(mortgage); //{\"0\": 280350, \"1\": 0.00292, \"2\": 60, \"3\": \"2017-12-24T05:00:00.000Z\"}\n```\n\n[npm-url]: https://www.npmjs.com/package/amortizejs\n[npm-img]: https://img.shields.io/npm/dt/amortizejs.svg\n[web-img]: https://img.shields.io/website-up-down-green-red/http/amortize.me.svg?label=amortize.me\n[web-url]: http://amortize.me\n[version-img]: https://img.shields.io/npm/v/amortizejs.svg\n[bower-img]: https://img.shields.io/bower/v/amortizejs.svg\n[license-img]: https://img.shields.io/github/license/davidbooth/amortizejs.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidbooth%2Famortizejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidbooth%2Famortizejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidbooth%2Famortizejs/lists"}