text: // forked from
  // https://github.com/vmattos/js-extend/blob/7023fd69a9e9552688086b8b8006b1fcf916a306/extend.js
  // TODO: I don't know why we have two different extend() functions in PouchDB
  
  var slice = Array.prototype.slice;
  var each = Array.prototype.forEach;
  
  function extend(obj) {
    if (typeof obj !== 'object') {
      throw obj + ' is not an object' ;
    }
  
    var sources = slice.call(arguments, 1);
  
    each.call(sources, function (source) {
      if (source) {
        for (var prop in source) {
          if (typeof source[prop] === 'object' && obj[prop]) {
            extend.call(obj, obj[prop], source[prop]);
          } else {
            obj[prop] = source[prop];
          }
        }
      }
    });
  
    return obj;
  }
  
  export default extend;