New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@u-dev/unison-calculators

Package Overview
Dependencies
Maintainers
11
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@u-dev/unison-calculators

Node.js module for Unison calculators

  • 1.0.12
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
11
Weekly downloads
 
Created
Source

unison-calculators

Utility Calculator

UtilCalculator

The util calculator can be used to do basic math for Unison deals.

For instance, I could run:

let calculator = new UtilCalculator('HomeOwner')
calculator.minHomeValue(3.5) // => 114285
calculator.maxHomeValue(3.5) // => 2857142
calculator.minSharingPercentage(3.5) // => 0.175
calculator.minInvestmentAmount(500000) // => 25000
calculator.maxInvestmentAmount(500000) // => 100000
calculator.sharingPercentage(.2, 3.5) // => .7
calculator.investmentPercentage(500000,100000) // => .2
calculator.unisonShare(100000,.35) // => 35000
calculator.leverage() // => 4
calculator.leverage({qualifiesForNewPricing: true}) // => 3.5

let calculator = new UtilCalculator('HomeBuyer')
calculator.minHomeValue(3.5) // => 114285
calculator.maxHomeValue(3.5) // => 2857142
calculator.minSharingPercentage(3.5) // => 0.175
calculator.minInvestmentAmount(500000) // => 25000
calculator.maxInvestmentAmount(500000) // => 100000
calculator.sharingPercentage(.2, 3.5) // => .7
calculator.investmentPercentage(500000,100000) // => .2
calculator.unisonShare(100000,.35) // => 35000
calculator.leverage() // => 4
calculator.leverage({isNewConstruction: true}) // => 4.5

API documentation:

// .initialize
// @param {string} product - The product we are calculating for
new UtilCalculator('HomeOwner')

// #minHomeValue()
// @param {number} leverage - The leverage in a unison deal
calculator.minHomeValue(3.5)

// #maxHomeValue()
// @param {number} leverage - The leverage in a unison deal
calculator.maxHomeValue(3.5)

// #minSharingPercentage()
// @param {number} leverage - The leverage in a unison deal
calculator.minSharingPercentage(3.5)

// #minInvestmentAmount()
// @param {number} homeValue - The home value
calculator.minInvestmentAmount(500000)

// #maxInvestmentAmount()
// @param {number} homeValue - The home value
calculator.maxInvestmentAmount(500000)

// #sharingPercentage()
// @param {number} investmentPercentage - The amount unison invested in a deal
// @param {number} leverage - The leverage on a deal
calculator.sharingPercentage(.2, 3.5)

// #investmentPercentage()
// @param {number} appreciation - The amount that the asset appreciated
// @param {number} sharingPercentage - The percentage share unison has given a deal
calculator.investmentPercentage(.2, 3.5)

// #unisonShare()
// @param {number} homeValue - The value of the asset
// @param {number} amountInvested - The amount invested in the home
calculator.unisonShare(100000, .35)

// #leverage()
// @param {object} options  
// @param {string} [options.qualifiesForNewPricing] - This acts as a leverage modifier on HomeOwner deals
// @param {string} [options.isNewConstruction] - This acts as a leverage modifier on HomeBuyer deals
calculator.leverage({qualifiesForNewPricing: true})

Scenario Calculators

HomeBuyerScenarioCalculator

The HomeBuyer scenario calculator can be used to calculate the outcome of a homebuyer deal.

To get started initialize a HomeBuyerCalculator instance and run the #calculate function.

#calculate takes four arguments 1) initialHomeValue, 2) unisonInvestment, 3) finalPriceChange, 4) and optional configuration object

For instance, I could run:

let calculator = new HomeBuyerScenarioCalculator()
calculator.calculate(500000,50000,100000,{
  isNewConstruction: false
})

And expect

{
  finalPriceChange: 100000,
  initialHomeValue: 500000,
  unisonInvestment: 50000,
  unisonLeverage: 4,
  unisonSharingPercentage: 0.4,
  unisonInvestmentPercentage: 0.1,
  futureSalePrice: 600000,
  unisonPayment: 90000,
  unisonShareInChange: 40000
}

API documentation:

// .initialize
new HomeBuyerScenarioCalculator()

// #calculate()
// @param {number} initialHomeValue - The initial home value
// @param {number} unisonInvestment - The amount unison has invested
// @param {number} finalPriceChange - The change in value you want to calculate for
// @param {object} [options={}] - optional modifiers for calculations
// @param {boolean} [options.isNewConstruction=false] - toggles pricing (non-new construction homes have better pricing)
calculator.calculate(500000, 50000, 100000, {
  isNewConstruction: false
})

HomeOwnerScenarioCalculator

The HomeOwner scenario calculator can be used to calculate the outcome of a homebuyer deal.

To get started initialize a HomeBuyerCalculator instance and run the #calculate function.

#calculate takes four arguments 1) initialHomeValue, 2) unisonInvestment, 3) finalPriceChange, 4) and optional configuration object

For instance, I could run:

let calculator = new HomeOwnerScenarioCalculator()
calculator.calculate(500000, 50000, 100000, {
  qualifiesForNewPricing: false
})

And expect

{
  finalPriceChange: 100000,
  initialHomeValue: 500000,
  unisonInvestment: 50000,
  unisonLeverage: 4,
  unisonSharingPercentage: 0.4,
  unisonInvestmentPercentage: 0.1,
  futureSalePrice: 600000,
  unisonPayment: 90000,
  unisonShareInChange: 40000
}

API documentation:

// .initialize
new HomeOwnerScenarioCalculator()

// #calculate()
// @param {number} initialHomeValue - The initial home value
// @param {number} unisonInvestment - The amount unison has invested
// @param {number} finalPriceChange - The change in value you want to calculate for
// @param {object} [options={}] - optional modifiers for calculations
// @param {boolean} [options.qualifiesForNewPricing=false] - toggles pricing (this is new pricing A.K.A. purchased in last year, which has better pricing)
calculator.calculate(500000, 50000, 100000, {
  qualifiesForNewPricing: false
})

Mortgage Calculators

HomeBuyerMortgageCalculator

The homebuyer mortgage calculator can be used to calculate mortgage payments with and without Unison.

To get started, initialize a new calculator with (optionally) an object containing any assumptions you want to overwrite.

You can then use the #calculate function to see payment outcomes for various combinations.

#calculate takes three arguments 1) homePrice, 2) clientDownPaymentPercentage, and 3) unisonDownPaymentPercentage

For instance, I could run:

var calculator = new HomeBuyerMortgageCalculator({assumptions: {mortgageYears: 30}})
calculator.calculate(500000,.1,.1)

And expect:

{
  assumptions: {
    mortgageYears: 30,
    annualMortgageInsurancePremium: 0.0074,
    annualMortgageInterestRate: 0.04,
    annualPropertyInsuranceRate: 0.003,
    annualPropertyTaxRate: 0.0125,
  },
  monthlyMortgagePayment: -1910,
  monthlyPMIPayment: 0,
  monthlyPropertyTaxPayment: -521,
  monthlyPropertyInsurancePayment: -125,
  totalMonthlyPayments: -2556,
  clientDownPaymentAmount: 50000,
  unisonDownPaymentAmount: 50000,
  downPaymentAmount: 100000,
  hasPMI: false,
}

Here are the default assumptions for any new calculator:

const DEFAULT_ASSUMPTIONS = {
  mortgageYears: 30,
  annualMortgageInterestRate: .04,
  annualPropertyTaxRate: .0125,
  annualPropertyInsuranceRate: .003,
  annualMortgageInsurancePremium: .0074,
}

API documentation:

// .initialize
// @param {object} [options={assumptions={}}] - The default set of options
// @param {number} [options.assumptions.mortgageYears] - Length of mortgage in years
// @param {number} [options.assumptions.annualMortgageInterestRate] - Annual loan interest rate
// @param {number} [options.assumptions.annualPropertyTaxRate] - Annual property tax rate
// @param {number} [options.assumptions.annualPropertyInsuranceRate] - Annual property insurance rate
// @param {number} [options.assumptions.annualMortgageInsurancePremium] - PMI rate
new HomeBuyerMortgageCalculator(options)

// #calculate()
// @param {number} homePrice - The initial home value
// @param {number} clientDownPaymentPercentage - The percent of the loan, expressed as a decimal, that the client paid down
// @param {number} unisonDownPaymentPercentage - The percent of the loan, expressed as a decimal, that unison paid down
calculator.calculate(500000,.1,.1)

FAQs

Package last updated on 13 Feb 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc