title: how could I share one config object to multi data
body: <p>I have one config data structure  like below.</p>
  
  <pre><code>const config = {
    foo: 'bar',
    king: [ { val: [], name: 'saber'}, { val: [], name: 'archer'} ],
  };
  </code></pre>
  
  <p>and I want to share above one to multi data object which like below.</p>
  
  <pre><code>var data = {
    group1: [ [1, 2, 3], ['a', 'b', 'c'] ],
    group2: [ [4, 5, 6], ['d', 'e', 'f'] ],
  };
  </code></pre>
  
  <p>I afraid that I can't express clearly, for example, I want to get final result like this.</p>
  
  <pre><code>{
    group1: {
      foo: 'bar',
      king: [ {val: [1,2,3], name:'saber'}, {val: ['a','b','c'], name:'archer'} ],
    },
    group2: {
      foo: 'bar',
      king: [ {val: [4,5,6], name:'saber'}, {val: ['d','e','f'], name:'archer'} ],
    },
  }
  </code></pre>
  
  <p>I try use <code>assign()</code> share one config to each data,</p>
  
  <p>I write the method <code>compose</code> below but eventually I notice that <code>config</code> will be changed even if I use <code>Object.freeze()</code>, I have no idea to protect <code>config</code> variable, will you give me any suggestion?</p>
  
  <pre><code>var compose = function(data) {
    let mix = {};
  
    Object.keys(data).map(function(key) {
      mix[key] = Object.assign({},
        config
      );
      mix[key].king.map(function(val, index) {
        mix[key].king[index].val = data[key][index];  // config will be changed here :(
      });
    });
  
    return mix;
  };
  </code></pre>
  
  <p>regards.</p>