Great catch (and I love that you wrote tests)!

We have a function called `invariant`, so just require that at the top `var invariant = require('invariant');` and then use it here. It'll throw errors for you.

Then let's just use `typeof` here and put it first thing in the function.
`invariant(typeof listener === 'function', 'error message here %s', registrationName);`