I was looking to incorporate a simple debugging method into immutable js for easier debugging purposes...
log(msg) {
console.log(msg, this.toJS());
return this;
}
This way, I could simplify the process of debugging chained expressions like:
someImmutableMap
.toList()
.slice(index, index + ITEMS_PER_PAGE)
.filter(index => !!index)
.log('Filter: ')
.map(griddleMapper)
.toJS()
Is there already something similar available? If not, how can I implement it into the Map
class in order to submit a pull request?
I attempted to add it to src/Map.js
within the Map
class definition and created a basic test for it, but the test failed with
Property 'log' does not exist on type 'Map<string, number>'.
I believe that's because I may need to define the type in type-definitions
, but as I am unfamiliar with typescript/flow, I'm feeling quite lost.
Here is my forked repository with the changes I've outlined above..
Any assistance would be greatly appreciated.