title: Javascript function acting like object and function
body: <p>By API design I need something like this:</p>
  
  <pre><code>Store = function(fn, args) {
       return this[fn](args); 
  }
  Store.getOptions() { return this.options}
  Store.setLog(args) { this.options.log = args}
  </code></pre>
  
  <p>Create objects instances from Store with separate options, Ex:</p>
  
  <pre><code>option1 = {save:false, log: true}
  Store1 = new --&gt;  Store(option1)  //pseudo code object creation
  
  let opt1 = Store1('getOptions');   //Store acting like a function
  
  Store1('setLogs', false);          //same call
  Store1.setLogs(false);
  </code></pre>
  
  <p>Store act like a object(create new objects) and can be called.</p>
  
  <p>I was trying with Store.bind(options) but defined properties <code>getOptions</code> and <code>setLog</code> get lost it.</p>