0.0.3 • Published 3 years ago

nv-bool-basic v0.0.3

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

nv-bool-basic

  • nv-bool-basic
  • simple util of some bool operation, translate them to a sentence (function name)
  • normally its USELESS
  • to avoid use ternary in another project

install

  • npm install nv-bool-basic

usage

example

const {sbool,abool} = require("nv-bool-basic");




    const tmoutp = require('timers/promises').setTimeout;

    var handler = {
        ident:async(r)=>tmoutp(3000,r),
        condf:async(r)=>tmoutp(3000,r),
        not  :async(r)=>tmoutp(3000,!r)
    }

    var p = 100;
    var q = true;

    var r = abool.if_notq_then_notp_else_p(p,q,handler)

    /*
    >
    > r
    Promise { <pending> }
    > r
    Promise { <pending> }
    > r
    Promise { <pending> }
    > r
    Promise { <pending> }
    > r
    Promise { 100 }
    >
    >
    */

API

async

        > abool
        {
          DFLT_HANDLER: {
            condf: [AsyncFunction: condf],
            ident: [AsyncFunction: ident],
            not: [AsyncFunction: not]
          },
          if_p_then_p_else_p: [AsyncFunction: _f],
          if_p_then_p_else_q: [AsyncFunction: _f],
          if_p_then_p_else_notp: [AsyncFunction: _f],
          if_p_then_p_else_notq: [AsyncFunction: _f],
          if_p_then_q_else_p: [AsyncFunction: _f],
          if_p_then_q_else_q: [AsyncFunction: _f],
          if_p_then_q_else_notp: [AsyncFunction: _f],
          if_p_then_q_else_notq: [AsyncFunction: _f],
          if_p_then_notp_else_p: [AsyncFunction: _f],
          if_p_then_notp_else_q: [AsyncFunction: _f],
          if_p_then_notp_else_notp: [AsyncFunction: _f],
          if_p_then_notp_else_notq: [AsyncFunction: _f],
          if_p_then_notq_else_p: [AsyncFunction: _f],
          if_p_then_notq_else_q: [AsyncFunction: _f],
          if_p_then_notq_else_notp: [AsyncFunction: _f],
          if_p_then_notq_else_notq: [AsyncFunction: _f],
          if_p_then_tru_else_p: [AsyncFunction: _f],
          if_p_then_tru_else_q: [AsyncFunction: _f],
          if_p_then_tru_else_notp: [AsyncFunction: _f],
          if_p_then_tru_else_notq: [AsyncFunction: _f],
          if_p_then_fls_else_p: [AsyncFunction: _f],
          if_p_then_fls_else_q: [AsyncFunction: _f],
          if_p_then_fls_else_notp: [AsyncFunction: _f],
          if_p_then_fls_else_notq: [AsyncFunction: _f],
          if_q_then_p_else_p: [AsyncFunction: _f],
          if_q_then_p_else_q: [AsyncFunction: _f],
          if_q_then_p_else_notp: [AsyncFunction: _f],
          if_q_then_p_else_notq: [AsyncFunction: _f],
          if_q_then_q_else_p: [AsyncFunction: _f],
          if_q_then_q_else_q: [AsyncFunction: _f],
          if_q_then_q_else_notp: [AsyncFunction: _f],
          if_q_then_q_else_notq: [AsyncFunction: _f],
          if_q_then_notp_else_p: [AsyncFunction: _f],
          if_q_then_notp_else_q: [AsyncFunction: _f],
          if_q_then_notp_else_notp: [AsyncFunction: _f],
          if_q_then_notp_else_notq: [AsyncFunction: _f],
          if_q_then_notq_else_p: [AsyncFunction: _f],
          if_q_then_notq_else_q: [AsyncFunction: _f],
          if_q_then_notq_else_notp: [AsyncFunction: _f],
          if_q_then_notq_else_notq: [AsyncFunction: _f],
          if_q_then_tru_else_p: [AsyncFunction: _f],
          if_q_then_tru_else_q: [AsyncFunction: _f],
          if_q_then_tru_else_notp: [AsyncFunction: _f],
          if_q_then_tru_else_notq: [AsyncFunction: _f],
          if_q_then_fls_else_p: [AsyncFunction: _f],
          if_q_then_fls_else_q: [AsyncFunction: _f],
          if_q_then_fls_else_notp: [AsyncFunction: _f],
          if_q_then_fls_else_notq: [AsyncFunction: _f],
          if_notp_then_p_else_p: [AsyncFunction: _f],
          if_notp_then_p_else_q: [AsyncFunction: _f],
          if_notp_then_p_else_notp: [AsyncFunction: _f],
          if_notp_then_p_else_notq: [AsyncFunction: _f],
          if_notp_then_q_else_p: [AsyncFunction: _f],
          if_notp_then_q_else_q: [AsyncFunction: _f],
          if_notp_then_q_else_notp: [AsyncFunction: _f],
          if_notp_then_q_else_notq: [AsyncFunction: _f],
          if_notp_then_notp_else_p: [AsyncFunction: _f],
          if_notp_then_notp_else_q: [AsyncFunction: _f],
          if_notp_then_notp_else_notp: [AsyncFunction: _f],
          if_notp_then_notp_else_notq: [AsyncFunction: _f],
          if_notp_then_notq_else_p: [AsyncFunction: _f],
          if_notp_then_notq_else_q: [AsyncFunction: _f],
          if_notp_then_notq_else_notp: [AsyncFunction: _f],
          if_notp_then_notq_else_notq: [AsyncFunction: _f],
          if_notp_then_tru_else_p: [AsyncFunction: _f],
          if_notp_then_tru_else_q: [AsyncFunction: _f],
          if_notp_then_tru_else_notp: [AsyncFunction: _f],
          if_notp_then_tru_else_notq: [AsyncFunction: _f],
          if_notp_then_fls_else_p: [AsyncFunction: _f],
          if_notp_then_fls_else_q: [AsyncFunction: _f],
          if_notp_then_fls_else_notp: [AsyncFunction: _f],
          if_notp_then_fls_else_notq: [AsyncFunction: _f],
          if_notq_then_p_else_p: [AsyncFunction: _f],
          if_notq_then_p_else_q: [AsyncFunction: _f],
          if_notq_then_p_else_notp: [AsyncFunction: _f],
          if_notq_then_p_else_notq: [AsyncFunction: _f],
          if_notq_then_q_else_p: [AsyncFunction: _f],
          if_notq_then_q_else_q: [AsyncFunction: _f],
          if_notq_then_q_else_notp: [AsyncFunction: _f],
          if_notq_then_q_else_notq: [AsyncFunction: _f],
          if_notq_then_notp_else_p: [AsyncFunction: _f],
          if_notq_then_notp_else_q: [AsyncFunction: _f],
          if_notq_then_notp_else_notp: [AsyncFunction: _f],
          if_notq_then_notp_else_notq: [AsyncFunction: _f],
          if_notq_then_notq_else_p: [AsyncFunction: _f],
          if_notq_then_notq_else_q: [AsyncFunction: _f],
          if_notq_then_notq_else_notp: [AsyncFunction: _f],
          if_notq_then_notq_else_notq: [AsyncFunction: _f],
          if_notq_then_tru_else_p: [AsyncFunction: _f],
          if_notq_then_tru_else_q: [AsyncFunction: _f],
          if_notq_then_tru_else_notp: [AsyncFunction: _f],
          if_notq_then_tru_else_notq: [AsyncFunction: _f],
          if_notq_then_fls_else_p: [AsyncFunction: _f],
          if_notq_then_fls_else_q: [AsyncFunction: _f],
          if_notq_then_fls_else_notp: [AsyncFunction: _f],
          if_notq_then_fls_else_notq: [AsyncFunction: _f]
        }

sync

  • same as async

LICENSE

  • ISC