Sha256: 479943423c67f1a8fdec366c00db399e866b50cdbb12b802755bda7cacae6dfd

Contents?: true

Size: 1.18 KB

Versions: 191

Compression:

Stored size: 1.18 KB

Contents

'use strict';

var isExtendable = require('is-extendable');
var assignSymbols = require('assign-symbols');

module.exports = Object.assign || function(obj/*, objects*/) {
  if (obj === null || typeof obj === 'undefined') {
    throw new TypeError('Cannot convert undefined or null to object');
  }
  if (!isObject(obj)) {
    obj = {};
  }
  for (var i = 1; i < arguments.length; i++) {
    var val = arguments[i];
    if (isString(val)) {
      val = toObject(val);
    }
    if (isObject(val)) {
      assign(obj, val);
      assignSymbols(obj, val);
    }
  }
  return obj;
};

function assign(a, b) {
  for (var key in b) {
    if (hasOwn(b, key)) {
      a[key] = b[key];
    }
  }
}

function isString(val) {
  return (val && typeof val === 'string');
}

function toObject(str) {
  var obj = {};
  for (var i in str) {
    obj[i] = str[i];
  }
  return obj;
}

function isObject(val) {
  return (val && typeof val === 'object') || isExtendable(val);
}

/**
 * Returns true if the given `key` is an own property of `obj`.
 */

function hasOwn(obj, key) {
  return Object.prototype.hasOwnProperty.call(obj, key);
}

function isEnum(obj, key) {
  return Object.prototype.propertyIsEnumerable.call(obj, key);
}

Version data entries

191 entries across 38 versions & 12 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/micromatch/node_modules/extend-shallow/index.js
optimacms-0.1.61 spec/dummy/node_modules/regex-not/node_modules/extend-shallow/index.js
optimacms-0.1.61 spec/dummy/node_modules/to-regex/node_modules/extend-shallow/index.js
optimacms-0.1.61 spec/dummy/node_modules/split-string/node_modules/extend-shallow/index.js
optimacms-0.1.61 spec/dummy/node_modules/nanomatch/node_modules/extend-shallow/index.js
disco_app-0.18.0 test/dummy/node_modules/split-string/node_modules/extend-shallow/index.js
disco_app-0.18.0 test/dummy/node_modules/regex-not/node_modules/extend-shallow/index.js
disco_app-0.18.0 test/dummy/node_modules/micromatch/node_modules/extend-shallow/index.js
disco_app-0.18.0 test/dummy/node_modules/to-regex/node_modules/extend-shallow/index.js
disco_app-0.18.0 test/dummy/node_modules/nanomatch/node_modules/extend-shallow/index.js
disco_app-0.18.2 test/dummy/node_modules/regex-not/node_modules/extend-shallow/index.js
disco_app-0.18.2 test/dummy/node_modules/split-string/node_modules/extend-shallow/index.js
disco_app-0.18.2 test/dummy/node_modules/micromatch/node_modules/extend-shallow/index.js
disco_app-0.18.2 test/dummy/node_modules/nanomatch/node_modules/extend-shallow/index.js
disco_app-0.18.2 test/dummy/node_modules/to-regex/node_modules/extend-shallow/index.js
disco_app-0.16.1 test/dummy/node_modules/split-string/node_modules/extend-shallow/index.js
disco_app-0.16.1 test/dummy/node_modules/to-regex/node_modules/extend-shallow/index.js
disco_app-0.16.1 test/dummy/node_modules/nanomatch/node_modules/extend-shallow/index.js
disco_app-0.16.1 test/dummy/node_modules/regex-not/node_modules/extend-shallow/index.js
disco_app-0.16.1 test/dummy/node_modules/micromatch/node_modules/extend-shallow/index.js