diff options
Diffstat (limited to 'node_modules/split-string')
-rw-r--r-- | node_modules/split-string/node_modules/extend-shallow/index.js | 26 | ||||
-rw-r--r-- | node_modules/split-string/node_modules/extend-shallow/package.json | 3 |
2 files changed, 27 insertions, 2 deletions
diff --git a/node_modules/split-string/node_modules/extend-shallow/index.js b/node_modules/split-string/node_modules/extend-shallow/index.js index 4326d274b..c9582f8f9 100644 --- a/node_modules/split-string/node_modules/extend-shallow/index.js +++ b/node_modules/split-string/node_modules/extend-shallow/index.js @@ -1,15 +1,23 @@ '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('expected an object'); + 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; @@ -23,6 +31,18 @@ function assign(a, b) { } } +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); } @@ -34,3 +54,7 @@ function isObject(val) { function hasOwn(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } + +function isEnum(obj, key) { + return Object.prototype.propertyIsEnumerable.call(obj, key); +} diff --git a/node_modules/split-string/node_modules/extend-shallow/package.json b/node_modules/split-string/node_modules/extend-shallow/package.json index 73648776c..e5e910531 100644 --- a/node_modules/split-string/node_modules/extend-shallow/package.json +++ b/node_modules/split-string/node_modules/extend-shallow/package.json @@ -1,7 +1,7 @@ { "name": "extend-shallow", "description": "Extend an object with the properties of additional objects. node.js/javascript util.", - "version": "3.0.1", + "version": "3.0.2", "homepage": "https://github.com/jonschlinkert/extend-shallow", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", "contributors": [ @@ -24,6 +24,7 @@ "test": "mocha" }, "dependencies": { + "assign-symbols": "^1.0.0", "is-extendable": "^1.0.1" }, "devDependencies": { |