Skip to content

Commit

Permalink
Handle undefined input into _.defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaeleidus committed Aug 21, 2012
1 parent 7f098f4 commit a84dd90
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@

// Fill in a given object with default properties.
_.defaults = function(obj) {
if(_.isUndefined(obj)) obj = {};
each(slice.call(arguments, 1), function(source) {
for (var prop in source) {
if (obj[prop] == null) obj[prop] = source[prop];
Expand Down

0 comments on commit a84dd90

Please sign in to comment.