Socket
Socket
Sign inDemoInstall

nv-facutil-notandor

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nv-facutil-notandor

simple and,or,not to void too many || and &&


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

nv-facutil-notandor

  • nv-facutil-notandor is a very simple tool to avoid use too many || && !
  • make your code readable

install

  • npm install nv-facutil-notandor

usage

const {and,or,at_least_some} = require("nv-facutil-notandor")

function wrap(x,y,z,u) {
    let rslt = and(
        x+y >0,
        and(
            x%z>-300,
            or(y>8,u<100),
            at_least_some(2,y%7!==3,y%7!==5,y%7!==1)
        ),
        or(x*y < 9800,x>-100)
    )
    return(rslt)
}

> wrap(-100,999,7,50)
true
> 

APIS

not

not(100) === false
not(false) === true

and,all

# all are true
and(true,false,true) === false
all(true,false,true) === false

all_not

# all are false
all_not(true,false,false) === false
all_not(false,false,false) === true

or,any

# any is true
or(false,true,false) === true
any(false,true,false) === true
any(false,false,false) === false

any_not

# any is false
any_not(false,true,true) === true
any_not(true,true,true) === false

at_least_some

# at least n are true
at_least_some(2,false,true,true,true,false) === true
at_least_some(2,false,true,false,false,false) === false

at_least_some_not

# at least n are false
at_least_some_not(2,false,true,false,true,false) === true
at_least_some_not(2,true,true,false,true,true) === false

must_some

# only n are true,others are false
must_some(2,false,true,false,true,false) === true
must_some(2,false,true,true,true,false) === false

must_some_not

# only n are false,others are true
must_some_not(2,false,true,false,true,false) === false
must_some_not(2,true,false,false,true,true) === true

one

# only 1 are true,others are false
one(true,true,false) === false
one(false,true,false) === true

one_not

# only 1 are false,others are true
one_not(true,true,false) === true
one_not(false,true,false) === false

at_least_certain

# at least the-inputed-indexes are true
at_least_certain([1,3],false,true,false,true,false,false) === true
at_least_certain([1,3],false,false,false,true,false,false) === false

at_least_certain_not

# at least the-inputed-indexes are false
at_least_certain_not([1,3],false,true,false,true,false,false) === false
at_least_certain_not([1,3],false,false,true,false,true,true) === true

must_certain

# only the-inputed-indexes are true,others are false
must_certain([1,3],true,true,false,true,false,false) === false
must_certain([1,3],false,true,false,true,false,false) === true

must_certain_not

# only the-inputed-indexes are false,others are true
must_certain_not([1,3],true,false,false,false,true,true) === false
must_certain_not([1,3],true,false,true,false,true,true) === true

at_most_some:

      (max_count,...params)=>Boolean

at_most_some_not:

      (max_count,...params)=>Boolean

some_between

      (ge,lt,...params)     => Boolean

some_not_between

     (ge,lt,...params) => Boolean

at_most_certain:

    #only the-inputed-indexes maybe-true,others are false
    (whiches,...params)=>Boolean,

at_most_certain_not:

     #only the-inputed-indexes maybe-false,others are true
     (whiches,...params)=>Boolean,

LICENSE

  • ISC

Keywords

FAQs

Package last updated on 29 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc