Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/slurmulon/flap
:rooster: Guard clauses for JS
https://github.com/slurmulon/flap
clause functional-programming guard guard-clauses pattern-matching
Last synced: 18 days ago
JSON representation
:rooster: Guard clauses for JS
- Host: GitHub
- URL: https://github.com/slurmulon/flap
- Owner: slurmulon
- License: mit
- Created: 2016-01-07T05:29:54.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-11-01T19:58:48.000Z (about 5 years ago)
- Last Synced: 2024-10-11T07:50:04.768Z (about 1 month ago)
- Topics: clause, functional-programming, guard, guard-clauses, pattern-matching
- Language: JavaScript
- Homepage: https://flap.js.org
- Size: 44.9 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flap
> :rooster: Guard clauses for JS
-----
## Summary
`flap` allows you to cleanly enforce integrity conditions and modifications to the inputs and outputs of functions.
You can also think of it as a generic datal-flow wrapper for functions, with a dash of pattern-matching awesomeness.
## Features
* Wraps JS functions and their arguments with [guard clauses](https://sourcemaking.com/refactoring/replace-nested-conditional-with-guard-clauses) found in languages such as Elixir and Haskell
* Elegantly modifies and reacts to arguments based on expressions
* Pattern matching against object arguments
* Improves readability of complex conditions by chaining discrete units of logic
* Helps prevent deep nesting and callback hell
* Optionally bind to `Function.prototype` for maximum sugar## Installation
```sh
npm i flap
```## Documentation
You can find detailed documentation and examples at [https://flap.js.org](https://flap.js.org).
## Contributing
Contributions are always welcome! Simply open a PR with completely covered tests.
```sh
npm run coverage
```## License
MIT