We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent acd0ac2 commit 3fbb437Copy full SHA for 3fbb437
src/underbar.js
@@ -263,6 +263,17 @@ var _ = {};
263
// Like extend, but doesn't ever overwrite a key that already
264
// exists in obj
265
_.defaults = function(obj) {
266
+ var args = Array.prototype.slice.call(arguments);
267
+ var newProps=args.slice(1, args.length);
268
+
269
+ _.each(newProps, function(newObj) {
270
+ _.each(newObj, function(val, key) {
271
+ if (!(key in obj)) {
272
+ obj[key]=val;
273
+ }
274
+ });
275
276
+ return obj;
277
};
278
279
0 commit comments