
Research
/Security News
GlassWASM: WebAssembly Malware Found in Trojanized Open VSX Extensions
The trojanized extensions use TinyGo-compiled WebAssembly and Solana transaction memos to resolve command-and-control infrastructure.
Calculate loan in js (browser/node.js) for equal installments, installments decreasing, the sum of interest, etc.
Super small (~500B) and fast module to calculate loan in js (browser/node.js) for equal/decreasing/annuity/annuityDue installments, the sum of interest, etc, with TypeScript support
Install with:
npm install loanjs
import { Loan } from 'loanjs';
// or
const { Loan } = require('loanjs');
const loan = new Loan(
1000, // amount
12, // installments number
5, // interest rate
'annuity' // loanType: 'annuity' | 'annuityDue' | 'diminishing' | GetNextInstalmentPartFunction
);
/** returns
{
installments : [
{
capital : number,
interest : number,
installment : number,
remain : number
},
//...
],
amount : number,
interestSum : number,
capitalSum : number,
sum : number
}
*/
LoanJS.Loan(amount, installmentsNumber, interestRate, loanType)
| Argument | type | default | Description |
|---|---|---|---|
| amount | number | *required | full amount of Loan |
| installmentsNumber | number | *required | how many installments will be (in months) |
| interestRate | number | *required | interest rate in percent (ex. 3.5) |
| loanType | string or fn | annuity | annuity | annuityDue | diminishing | GetNextInstalmentPartFunction |
interface InstallmentPart {
capital: number;
interest: number;
installment: number;
}
type GetNextInstalmentPartFunction = (
amount: number,
installmentsNumber: number,
interestRateMonth: number,
capitalSum: number
) => InstallmentPart;
{
installments : [
{
capital : number,
interest : number,
installment : number,
remain : number
}
],
amount : number,
interestSum : number,
capitalSum : number,
sum : number
}
import { Loan } from 'loanjs';
const annuityLoan = new Loan(1000, 12, 5, 'annuity');
const annuityDueLoan = new Loan(1000, 12, 5, 'annuityDue');
const diminishingLoan = new Loan(1000, 12, 5, 'diminishing');
const customInstalmentLoan = new Loan(1000, 12, 5, getNext10Instalment);
function getNext10Instalment (amount: number, installmentsNumber: number, capitalSum: number, interestRateMonth: number) {
const capital = rnd(amount / installmentsNumber);
const interest = 10;
const installment = capital + interest;
return { capital, interest, installment };
}
import { Loan } from 'loanjs';
// or
const { Loan } = require('loanjs');
const loan_1 = new Loan(1000, 12, 5, 'diminishing');
// loan on 1 000($) in 12 loanType installments (ex. months) with 5% interest rate
const loan_2 = new Loan(500000, 360, 3.5, 'annuity');
// loan on 500 000($) in 360 equal installments (30 years) with 3.5% interest rate
You can also render loan as html table
<script src="../../dist/loan.js"></script>
<script src="../../dist/loanToHtmlTable.js"></script>
<script>
const loan = new LoanJS.Loan(1000, 12, 5, 'annuity');
const div = document.createElement("div");
div.innerHTML = LoanJS.loanToHtmlTable(loan); // loan rendering as html table string
document.body.appendChild(div);
</script>
more examples here
Im open for contributors :).
annuityDue interest rate loan typediminishing to loanType (annuity | diminishing | annuityDue), with backward compatibility (false == 'annuity', true == 'diminishing')Copyright (c) 2023 Grzegorz Klimek Licensed under the MIT license.
FAQs
Calculate loan in js (browser/node.js) for equal installments, installments decreasing, the sum of interest, etc.
The npm package loanjs receives a total of 420 weekly downloads. As such, loanjs popularity was classified as not popular.
We found that loanjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
The trojanized extensions use TinyGo-compiled WebAssembly and Solana transaction memos to resolve command-and-control infrastructure.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.