🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@marcusthelin/pmt

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marcusthelin/pmt

Simple PMT function with options

latest
Source
npmnpm
Version
1.1.4
Version published
Maintainers
1
Created
Source

PMT

Simple PMT function. Credit to Tobias Lanz @StackOverflow

Parameters

/**
 * @param {number} rate - Monthly interest rate
 * @param {number} nperiod - Number of periods (months)
 * @param {number} pv - Present value
 * @param {number} fv - Future value
 * @param {number} type - 0 = end of period, 1 = beginning of period
 * @param {object} options - Options. See defaultOptions for available options
 */

Options

const defaultOptions = {
    round: false, // If the result should be rounded
    positive: false // If the result should be a positive number
}

Example usage

Require the module

const pmt = require('@marcusthelin/pmt')

Usage

const interestRate = 0.475 / 12

const periods = 36

const presentValue = 99330

const futureValue = 56760

const type = 1

const pmtVal = pmt(interestRate, months, presentVal, futureVal, type, {
    round: true,
    positive: true
}) // 1490

Keywords

pmt

FAQs

Package last updated on 19 Apr 2019

Did you know?

Socket

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.

Install

Related posts