Awesome tool for FP JS. Logging of the input and output arguments of the function on each call.
for example, debugging sort products code:
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
npm install function-logger --save-dev
You can set globally, to be used in all their projects without having to install each.
Wrap the function for which you want to watch. And yet! 🏁
import functionLogger from 'function-logger';
// foo('bar')
functionLogger(foo)('bar')
in html area
<script src="https://unpkg.com/function-logger@latest/build/umd/index.js"></script>
in js area use functionLogger
from global scope
Got ideas on how to make this better? Open an issue!
MIT