2.0.1 • Published 2 years ago
operate.js v2.0.1
��
Operate.js
Quick Start
first of all, install the package in your project:
npm install operate.js
Now you just need to import the package into the files:
const operateJs = require('operatejs')
Functions
operatejs.sum([ 2,2,5,4 ])
The method Accepts an array of numbers, returning a sum of these numbers
operatejs.subtract([ 2,2,5,4 ])
The method Accepts an array of numbers, returning a subtract of these numbers
operatejs.multiply([ 2,2,5,4 ])
The method Accepts an array of numbers, returning a multiply of these numbers
operatejs.divide([ 2,2,5,4 ])
The method Accepts an array of numbers, returning a divide of these numbers
operatejs.getPercentOf(percentage/*% */, totalValue/* 100% */)
The method Accepts a percent parameter, used to return the fraction of the total value parameter
operatejs.XIsHowPercentOf(fractionOfvalue, totalValue, options:{
allowPercentSymbol?: boolean
})
// return : X%
The method Accepts a fraction of total Value parameter, used to return the percentage of the total value parameter,
options is an optional object, that accepts a boolean for "allowPercentSymbol"
operatejs.getFactorial(number)
// return : X
The method Accepts a number, that will return your factorial
operatejs.getPotentiation(number, power)
// return : X
The method Accepts a number and the power, returnin thw value of "number ^ power"
Monetary functions
All these methods accepts arrays with numbers and strings
operatejs.currencySum([n1, n2, n3, ...], options:{
countryCurrency:string,
currency:string,
// In case of doubt, the options are for the toLocaleString method, native of JS
})
// return : X
operatejs.currencySubtract([n1, n2, n3, ...], options:{
countryCurrency:string,
currency:string,
// In case of doubt, the options are for the toLocaleString method, native of JS
})
// return : X
operatejs.currencyMultiply([n1, n2, n3, ...], options:{
countryCurrency:string,
currency:string,
// In case of doubt, the options are for the toLocaleString method, native of JS
})
// return : X
operatejs.currencyDivide([n1, n2, n3, ...], options:{
countryCurrency:string,
currency:string,
// In case of doubt, the options are for the toLocaleString method, native of JS
})
// return : X
operatejs.numberToCurrency([n1, n2, n3, ...], options:{
countryCurrency:string,
currency:string,
// In case of doubt, the options are for the toLocaleString method, native of JS
})
// return an array of strings with the monetary representation
operatejs.currencyToNumber([n1, n2, n3, ...])
// return an array of numbers
operatejs.getSimpleInterest(capital:Number, interestRate:Number, time:Number, options:{
countryCurrency: String,
currency: String
})
// return the simple interest, without the capital
operatejs.getCompundInterest(capital:Number, interestRate:Number, time:Number, options:{
countryCurrency: String,
currency: String
})
// return the compound interest, without the capital