title: convert javascript plain object into model class instance
body: <p>I need to implement small ODM like feature. I get plain javascript object from database, and I need to convert it into my model class instance. Let's assume model looks like:</p>
  
  <pre><code>    class Model{
         constructor(){
             this.a = '777';
             ---- whole bunch of other things ---
         }
         print(){
             console.log(this.a);
         }
     }
  </code></pre>
  
  <p>So I need convert <code>var a = {b:999, c:666}</code> to instance of model and being able to call <code>a.print()</code> after, and when <code>a.print()</code> executed <code>777</code> should be placed in console. How to do that?</p>