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')
operatejs.sum([ 2,2,5,4 ])
operatejs.subtract([ 2,2,5,4 ])
operatejs.multiply([ 2,2,5,4 ])
operatejs.divide([ 2,2,5,4 ])
operatejs.getPercentOf(percentage/*% */, totalValue/* 100% */)
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"
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
operatejs.getPotentiation(number, power)
// return : X
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