Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make register option works with parameters other than object types #101

Open
acrodrig opened this issue Oct 27, 2016 · 0 comments
Open

Make register option works with parameters other than object types #101

acrodrig opened this issue Oct 27, 2016 · 0 comments

Comments

@acrodrig
Copy link

Hi, I am using Loopback and I am trying to incorporate this module to my server. I was trying to use the register option to attach i18n functions to the application object (normally called app).

It did not work. Looking at the source code I found the following lines in the code:

// you may register helpers in global scope, up to you
if (typeof this.register === "object") {
    i18n.resMethods.forEach(function (method) {
        self.register[method] = self[method].bind(self);
    });
}

The I printed out typeof(app) and it turns out it's a function. Couple of comments/questions:

  1. Why should the module care that the this.register is an object?
  2. The code should not fail silently, it should give a warning so that we know what's going on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant