"use strict";

/**
 * Dependencies
 */

var fs = require("fs");


/**
 * Utilities
 */


/**
 * Object.assign polyfill
 *
 * @param {Object} dest
 * @param {Object} src
 * @returns {Object}
 * @api public
 */

if (!Object.assign) {
  Object.assign = function (dest, src) {
    Object.keys(src).forEach(function (key) {
      return dest[key] = src[key];
    });
  };
}

"use strict";

/**
 * Dependencies
 */

var fs = require("fs");


/**
 * Utilities
 */


/**
 * Object.assign polyfill
 *
 * @param {Object} dest
 * @param {Object} src
 * @returns {Object}
 * @api public
 */

if (!Object.assign) {
  Object.defineProperty(Object, 'assign', {
    enumerable: false,
    configurable: true,
    writable: true,
    value: function(target) {
      'use strict';
      if (target === undefined || target === null) {
        throw new TypeError('Cannot convert first argument to object');
      }

      var to = Object(target);
      for (var i = 1; i < arguments.length; i++) {
        var nextSource = arguments[i];
        if (nextSource === undefined || nextSource === null) {
          continue;
        }
        nextSource = Object(nextSource);

        var keysArray = Object.keys(Object(nextSource));
        for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
          var nextKey = keysArray[nextIndex];
          var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
          if (desc !== undefined && desc.enumerable) {
            to[nextKey] = nextSource[nextKey];
          }
        }
      }
      return to;
    }
  });
}

Update Object.assign polyfill from mdn site.
Update Object.assign polyfill from mdn site.

This is a more complete polyfill. The main problem with the existing implementation is that
it doesn't return anything.

This also fixes compatibility with 'object-assign' library.

Fixes #19
