Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

combine

oatkiller edited this page Sep 13, 2010 · 2 revisions

copy all the instance properties of an object onto another object

(function () {

var obj1 = {}; // an empty object
var obj2 = {
	width: 1,
	height: 1	
};

o.combine(obj1,obj2); // returns obj1

// obj1 has gained all the properties of obj2;
obj1; // {width: 1, height: 1}
	
})();

this does not copy properties from object’s prototypes. to do that, use super_combine!

Clone this wiki locally