Opened 14 years ago

Closed 14 years ago

#398 closed defect (invalid)

dojo.lang.shallowCopy has an unnessary if statement

Reported by: rfa@… Owned by: anonymous
Priority: lowest Milestone:
Component: General Version: 0.2
Keywords: Cc:
Blocked By: Blocking:

Description

Remove if(dojo.lang.isUndefined(ret[key]))

dojo.lang.shallowCopy = function(obj) {
	var ret = {}, key;
	for(key in obj) {ret[key] = obj[key];}
	return ret;
}
 REPLACES:
dojo.lang.shallowCopy = function(obj) {
	var ret = {}, key;
	for(key in obj) {
		if(dojo.lang.isUndefined(ret[key])) {
			ret[key] = obj[key];
		}
	}
	return ret;
}

Change History (1)

comment:1 Changed 14 years ago by Tom Trenka

Resolution: invalid
Status: newclosed

There are a few situations (rare but there) where the isUndefined is actually necessary. Thanks for the thought though.

Note: See TracTickets for help on using tickets.