whenexec

1.0.1 • Public • Published

whenexec

a tiny helper for checking a series of conditions and executing a function if all of them are true

why?

Because i've noticed certain patterns in my workflows that pushed me towards creating chainable and declarative solution for logical operations.

import when from "whenexec";

const workInThePark = () => ...; // should we work outside today ?

const weatherIsFine = true; // if the weather is fine
const enoughBatteryPower = true; // and we have enough battery power


// You can rely on weather only
when(weatherIsFine)
    .do(workInThePark)

// Or add some more conditions to make your decision
when(weatherIsFine)
    .and(enoughBatteryPower)
    .do(workInThePark)

Contact

@dzm_char

License

whenexec source code is available under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i whenexec

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

6.02 kB

Total Files

5

Last publish

Collaborators

  • n3u3w3lt