extend-shallow
Advanced tools
Comparing version 3.0.1 to 3.0.2
26
index.js
'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); | ||
} | ||
@@ -26,2 +34,14 @@ } | ||
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) { | ||
@@ -38,1 +58,5 @@ return (val && typeof val === 'object') || isExtendable(val); | ||
} | ||
function isEnum(obj, key) { | ||
return Object.prototype.propertyIsEnumerable.call(obj, key); | ||
} |
{ | ||
"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", | ||
@@ -27,2 +27,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"dependencies": { | ||
"assign-symbols": "^1.0.0", | ||
"is-extendable": "^1.0.1" | ||
@@ -29,0 +30,0 @@ }, |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
8612
51
2
1
+ Addedassign-symbols@^1.0.0
+ Addedassign-symbols@1.0.0(transitive)