1.0.1 • Published 6 years ago

whenexec v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

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.