Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itwillwork/function-logger
Awesome tool for FP JS. Logging of the input and output arguments of the function on each call.
https://github.com/itwillwork/function-logger
debugging-tool frontend functional-programming javascript
Last synced: 6 days ago
JSON representation
Awesome tool for FP JS. Logging of the input and output arguments of the function on each call.
- Host: GitHub
- URL: https://github.com/itwillwork/function-logger
- Owner: itwillwork
- Created: 2017-11-06T09:55:06.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-27T08:38:19.000Z (over 5 years ago)
- Last Synced: 2024-10-30T15:23:20.559Z (13 days ago)
- Topics: debugging-tool, frontend, functional-programming, javascript
- Language: JavaScript
- Homepage:
- Size: 4.13 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# function-logger
Awesome tool for [FP JS](https://github.com/stoeffel/awesome-fp-js). Logging of the input and output arguments of the function on each call.[JSBin demo](https://jsbin.com/sayujal/1/edit?js)
## Motivation
for example, debugging sort products code:
```javascript
const byPrice = order => (a, b) => order(a.price, b.price);const asc = (a, b) => a - b;
const desc = (a, b) => b - a;const products = [{price: 100}, {price: 50}, {price: 300}];
// products.sort(byPrice(desc));
// use functionLogger for fast logging
products.sort(functionLogger(byPrice(desc)));
```
browser console output### Installation
```
npm install function-logger --save-dev
```You can set globally, to be used in all their projects without having to install each.
## Usage
Wrap the function for which you want to watch. And yet! :checkered_flag:
```javascript
import functionLogger from 'function-logger';// foo('bar')
functionLogger(foo)('bar')
```## Usage for CodePen and JSBin as UMD module
in html area
```javascript```
in js area use ```functionLogger``` from global scope[JSBin demo](https://jsbin.com/sayujal/1/edit?js)
## Contributing
Got ideas on how to make this better? Open an issue!## License
MIT