Is it a good practice to put functions inside of class objects?

I am currently making a class called MainRESTHandler and it's going to have many functions, so I wanted to categorise the many functions in various objects. For example

export class MainRESTHandler {
  constructor() {
    this.auth.register = this.auth.register.bind(this);
    this.restaurants.location = this.restaurants.location.bind(this);
  }

  auth = {
    register() {
      // ...
    }
  }

  restaurants = {
    location() {
      // ...
    }
  }
}
Was this page helpful?