I'd probably split this up and add a sanity check:

```c++
Local<Value> exports = String::New("exports");
assert(exports.IsObject());
mod->register_func(exports.As<Object>());
```