1.0.1 • Published 2 years ago

nv-facutil-func-oper v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

nv-facutil-func-oper

  • simple util to avoid using operators

install

  • npm install nv-facutil-func-oper

usage

example

const fop = require("nv-facutil-func-oper")

#value

> fop.value.ternary(true,false,true,'d','e')
false
> true?false:true?'d':'e'
false
>

> fop.value.power(2,3,2)
512
> 2**3**2
512

> fop.value.add(2,3,2)
7
> 2+3+2
7


> fop.value.quo(17,2,3)
2
> (17 -17%2)
16
> 16/2
8
> 8 - 8%3
6
> 6/3
2
>

sync

var funcs = [()=>true,()=>false,()=>true,()=>'d',()=>'e']
> fop.sync.ternary(funcs)
false
>
> true?false:true?'d':'e'
false
>

var funcs = [()=>2,()=>3,()=>2]
> fop.sync.power(funcs)
512
>

var funcs = [()=>17,()=>2,()=>3]
> fop.sync.quo(funcs)
2
>

async

var funcs = [async ()=>true,async()=>false,async()=>true,async()=>'d',async()=>'e']
> await fop.async.ternary(funcs)
false
>
> true?false:true?'d':'e'
false
>

var funcs = [async ()=>2,async ()=>3,async ()=>2]
> await fop.async.power(funcs)
512
>

var funcs = [async ()=>17,async ()=>2,async ()=>3]
> await fop.async.quo(funcs)
2
>

APIS

        {
          UOP: {
            _lnot: [Function: _lnot],
            _bnot: [Function: _bnot],
            _pos: [Function: _pos],
            _neg: [Function: _neg],
            _void: [Function: _void]
          },
          _uop: [AsyncFunction (anonymous)],
          lnot: [AsyncFunction (anonymous)],
          bnot: [AsyncFunction (anonymous)],
          pos: [AsyncFunction (anonymous)],
          neg: [AsyncFunction (anonymous)],
          void: [AsyncFunction (anonymous)],
          LEFT_ASSO_BOP: {
            _add: [Function: _add],
            _sub: [Function: _sub],
            _mul: [Function: _mul],
            _div: [Function: _div],
            _rem: [Function: _rem],
            _quo: [Function: _quo],
            _band: [Function: _band],
            _bor: [Function: _bor],
            _bxor: [Function: _bxor],
            _land: [Function: _land],
            _lor: [Function: _lor],
            _lshift: [Function: _lshift],
            _rshift: [Function: _rshift],
            _urshift: [Function: _urshift]
          },
          _left_asso_binop: [AsyncFunction: _left_asso_binop],
          add: [AsyncFunction (anonymous)],
          sub: [AsyncFunction (anonymous)],
          mul: [AsyncFunction (anonymous)],
          div: [AsyncFunction (anonymous)],
          rem: [AsyncFunction (anonymous)],
          quo: [AsyncFunction (anonymous)],
          band: [AsyncFunction (anonymous)],
          bor: [AsyncFunction (anonymous)],
          bxor: [AsyncFunction (anonymous)],
          land: [AsyncFunction (anonymous)],
          lor: [AsyncFunction (anonymous)],
          lshift: [AsyncFunction (anonymous)],
          rshift: [AsyncFunction (anonymous)],
          urshift: [AsyncFunction (anonymous)],
          RIGHT_ASSO_BOP: { _power: [Function: _power], _typeof: [Function: _typeof] },
          _right_asso_bop: [AsyncFunction: _right_asso_bop],
          power: [AsyncFunction (anonymous)],
          typeof: [AsyncFunction (anonymous)],
          ORDER_OP: {
            _deq: [Function: _deq],
            _teq: [Function: _teq],
            _gt: [Function: _gt],
            _ge: [Function: _ge],
            _lt: [Function: _lt],
            _le: [Function: _le],
            _in: [Function: _in],
            _instof: [Function: _instof]
          },
          _order: [AsyncFunction: _order],
          deq: [AsyncFunction (anonymous)],
          teq: [AsyncFunction (anonymous)],
          gt: [AsyncFunction (anonymous)],
          ge: [AsyncFunction (anonymous)],
          lt: [AsyncFunction (anonymous)],
          le: [AsyncFunction (anonymous)],
          in: [AsyncFunction (anonymous)],
          instof: [AsyncFunction (anonymous)],
          NEQ_OP: { _dneq: [Function: _dneq], _tneq: [Function: _tneq] },
          _all_neq: [AsyncFunction: _all_neq],
          all_dneq: [AsyncFunction (anonymous)],
          all_tneq: [AsyncFunction (anonymous)],
          _any_neq: [AsyncFunction: _any_neq],
          any_dneq: [AsyncFunction (anonymous)],
          any_tneq: [AsyncFunction (anonymous)],
          _comma: [Function: _comma],
          comma: [AsyncFunction (anonymous)],
          _ternary: [Function: _ternary],
          ternary: [AsyncFunction (anonymous)],
          _nc: [Function: _nc],
          nc: [AsyncFunction (anonymous)],
          _oc: [Function: _oc],
          oc: [AsyncFunction (anonymous)],
          _call: [AsyncFunction: _call],
          call: [AsyncFunction (anonymous)]
        }

LICENSE

  • ISC