'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

/* istanbul ignore _typeof */

var introduce = require('./introduce');
var refine = require('./refine');
var CompositionError = require('./CompositionError');

/**
 * @function composePair
 * @description Compose two objects.
 * @param {Object} obj - Object which will be composed on base.
 * @param {Object} base - Object that will be changed.
 * @returns {Object} Composed object.
 */
module.exports = function composePair(obj, base) {
  var name = void 0;
  Object.keys(obj).forEach(function (key) {
    if (key.startsWith('introduce_')) {
      name = key.substr(10);
      base = introduce(base, name, obj[key]);
    } else if (key.startsWith('refine_')) {
      name = key.substr(7);
      base = refine(base, name, obj[key]);
    } else {
      /* istanbul ignore else  */
      if (key.startsWith('child_')) {
        name = key.substr(6);
        if (base[name] == null || typeof base[name] !== 'function' && _typeof(base[name]) !== 'object') {
          throw new CompositionError('Cannot compose, ' + name + ' is primitive.');
        } else {
          base[name] = composePair(obj[key], base[name]);
        }
      }
    }
  });
  return base;
};
@@ -255,39 +255,8 @@
 %7D;%0A%0A
-/* istanbul ignore _typeof */%0A%0A
 var 
@@ -968,50 +968,8 @@
 lse 
-%7B%0A      /* istanbul ignore else  */%0A      
 if (
@@ -998,26 +998,24 @@
 ')) %7B%0A      
-  
 name = key.s
@@ -1024,18 +1024,16 @@
 str(6);%0A
-  
       if
@@ -1136,18 +1136,16 @@
         
- 
- 
 throw ne
@@ -1216,18 +1216,16 @@
 ;%0A      
-  
 %7D else %7B
@@ -1225,18 +1225,16 @@
  else %7B%0A
-  
         
@@ -1285,18 +1285,8 @@
 %5D);%0A
-        %7D%0A
     

remove silly istanbul code coverage stuff..