Skip to content

Alvezin/operator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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



sum

    operatejs.sum([ 2,2,5,4 ])

The method Accepts an array of numbers, returning a sum of these numbers



subtract

    operatejs.subtract([ 2,2,5,4 ])

The method Accepts an array of numbers, returning a subtract of these numbers



multiply

    operatejs.multiply([ 2,2,5,4 ])

The method Accepts an array of numbers, returning a multiply of these numbers



divide

    operatejs.divide([ 2,2,5,4 ])

The method Accepts an array of numbers, returning a divide of these numbers



getPercentOf

    operatejs.getPercentOf(percentage/*% */, totalValue/* 100% */)

The method Accepts a percent parameter, used to return the fraction of the total value parameter



XIsHowPercentOf

    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"



getFactorial

    operatejs.getFactorial(number)
    // return : X

The method Accepts a number, that will return your factorial



getPotentiation

    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



currencySum

    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



currencySubtract

    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



currencyMultiply

    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



currencyDivide

    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



numberToCurrency

    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



currencyToNumber

    operatejs.currencyToNumber([n1, n2, n3, ...])
    // return an array of numbers



getSimpleInterest

    operatejs.getSimpleInterest(capital:Number, interestRate:Number, time:Number, options:{
        countryCurrency: String,
        currency: String
    })
    // return the simple interest, without the capital



getCompundInterest

    operatejs.getCompundInterest(capital:Number, interestRate:Number, time:Number, options:{
        countryCurrency: String,
        currency: String
    })
    // return the compound interest, without the capital

About

Criando classe com diversos tipos de operações

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published