composition-trace

2.0.1 • Public • Published

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

Alternatives

Package Sidebar

Install

npm i composition-trace

Weekly Downloads

2

Version

2.0.1

License

MIT

Last publish

Collaborators

  • stevemao