Function nper

  • Compute the number of periodic payments.

    Parameters

    • rate: number

      Rate of interest (per period)

    • pmt: number

      Payment

    • pv: number

      Present value

    • fv: number = 0

      Future value

    • when: PaymentDueTime = PaymentDueTime.End

      When payments are due

    Returns number

    The number of periodic payments

    Since

    v0.0.12

    Examples

    If you only had $150/month to pay towards the loan, how long would it take to pay-off a loan of $8,000 at 7% annual interest?

    import { nper } from 'financial'

    Math.round(nper(0.07/12, -150, 8000), 5) // 64.07335

    So, over 64 months would be required to pay off the loan.

    Notes

    The number of periods nper is computed by solving the equation:

    fv + pv * (1+rate) ** nper + pmt * (1+rate * when) / rate * ((1+rate) ** nper-1) = 0
    

    but if rate = 0 then:

    fv + pv + pmt * nper = 0
    

Generated using TypeDoc