https://github.com/sorodrigo/simplif
Simplify verbose if statements
https://github.com/sorodrigo/simplif
collections conditionals es6 if javascript tool
Last synced: 8 months ago
JSON representation
Simplify verbose if statements
- Host: GitHub
- URL: https://github.com/sorodrigo/simplif
- Owner: sorodrigo
- License: mit
- Created: 2017-05-17T22:26:02.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-28T15:45:19.000Z (about 8 years ago)
- Last Synced: 2025-03-10T21:47:09.150Z (over 1 year ago)
- Topics: collections, conditionals, es6, if, javascript, tool
- Language: JavaScript
- Homepage:
- Size: 5.86 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# simplif
> Clean, debuggable solution to verbose if statements
## Installation
In a browser:
```
```
Using npm:
```
$ npm i -S simplif
```
## Usage
```
import { simplif as sif } from 'simplif';
// Arrays
sif([pouredSalt, waterBoiling, pouredPasta, timeInWater > 8], () => {
/* takes out spaghetti */
/* serves plate */
/* pours bolognesa */
});
// Objects
const spaghetti = {
pouredSalt: true,
waterBoiling: true,
pouredPasta: true,
timeInWater: totalTime > 8
};
sif(spaghetti, () => {
/* takes out spaghetti */
/* serves plate */
/* pours bolognesa */
});
```