@cuties/if-else

1.1.2 • Public • Published

cutie-if-else

NPM Version Build Status codecov

Cutie extension for work with if-else statements. It's based on the Async Tree Pattern.

Examples

You can find examples of using this library in the test directory.

Install

npm install @cuties/if-else

Run test

npm test

Run build

npm run build

Usage

const {
  If, ElseIf, Else
} = require('@cuties/if-else');

new If(
 asyncTreeThatRepresentsBooleanStatement, asyncTreeThatIsBeingInvokedIfFirstArgumentIsTrue,   
 new ElseIf(
   anotherAsyncTreeThatRepresentsBooleanStatement, 
   anotherAsyncTreeThatIsBeingInvokedIfFirstArgumentIsTrue,
   new ElseIf(..., 
    new Else(otherwiseThisAsyncTreeIsBeingInvoked)
   )
 )
).call();
Async Object Parameters(description) Representation result
If statement, action, next(ElseIf or Else) boolean value of statement
IfNot statement, action, next(ElseIf or Else) boolean value of !statement
ElseIf statement, action, next(ElseIf or Else) boolean value of statement
Else action true
And ...statements statements.every(s => s)
Or ...statements statements.some(s => s)
Not ...statements statements.map(s => !s)

/@cuties/if-else/

    Package Sidebar

    Install

    npm i @cuties/if-else

    Weekly Downloads

    14

    Version

    1.1.2

    License

    MIT

    Unpacked Size

    14.1 kB

    Total Files

    18

    Last publish

    Collaborators

    • guseyn