regrets.js
⏰ Asynchronous control structures in JS
Platform | Build Status |
---|---|
Linux | |
Windows |
What is regrets.js
regrets.js or Regrets allows asynchronous control structures in JS.
Regrets provides asynchronous:
- if-elseif-else
- while-do
- repeat-until
- boolean expressions (and, or, not)
- comparisons (eq, ne, gt, lt, ge, le)
- switch-case-default
- foreach
You can read more here at the documentation site.
Usage
Installation
NPM
npm i regrets-js
CDN
Loading the module
CommonJS
const regrets = ;
Example
Delayed odd or even
Checks asynchronously if the number is an odd or an even number.
The result is resolved after 5 seconds.
const sleep = ; const checkParity =
Sleepy Switch
const sleep = ; const sleepySwitch =
Iterate items at an interval
const sleep = ; const interval = x; ;
Build
Clone the repo first then run in Terminal:
npm install
This installs the dependencies, then run:
npm run build
to build the CommonJS module, the browser module, the minified module, the docs, the coverages and the test suite.