Javascript Prototype Design Pattern return statement

54 Views Asked by At

Currently have been refactoring an app, partially written in *.js. After consideration have decided to use the Revealing Prototype Design Pattern which lets to encapsulate states as well as reveal states you want to expose.
Let's say my code is:

'use strict';
var Api = function(){ };
Api.prototype = funcion(){
 let 
   getName = function(name) {
      return name;          
 },
  ...
   200 methods more 
  ...

return {
  getName: getName,
  ...
  return 150 methods more
  ...
 }
}();

Code is correct and all works as intended, but the return statement looks a bit sloppy. Can I return all the public methods in a more concise way?

0

There are 0 best solutions below