npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nv-facutil-notandor

v1.0.5

Published

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

Downloads

43

Readme

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