2.0.1 • Published 7 years ago
composition-trace v2.0.1
Problem
var dasherize = compose(join('-'), toLower, split(' '), replace(/\s{2,}/ig, ' '));
dasherize('The world is a vampire');
// TypeError: Cannot read property 'apply' of undefined
What arguments is toLower
called with?
What does split(' ')
return?
Let's trace
const trace = require('composition-trace');
var dasherize = compose(join('-'), toLower, trace('after split'), split(' '), replace(/\s{2,}/ig, ' '));
// after split [ 'The', 'world', 'is', 'a', 'vampire' ]
dasherize('The world is a vampire');
For more details, please see https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch5.html#debugging