Sha256: e08339b81025589245f96775a88cd2a3e50ba9c9f65035e546cdd231d4706812

Contents?: true

Size: 920 Bytes

Versions: 9

Compression:

Stored size: 920 Bytes

Contents

CanUtils = {

	isCanObject: function(aObject) {
		return aObject instanceof can.Construct;
	},

	attr: function(aObject,aProperty,aValue) {
		if (!aObject)
			return undefined;
		if (this.isCanObject(aObject)) {
			return aObject.attr(aProperty,aValue)
		} else {
			if (arguments.length===3) {  // set
				return aObject[aProperty] = aValue;
			} else {
				return aObject[aProperty]
			}
		}
	},

	copyProperties: function(aDest,aSource,aProperties,aExclude) {
		var p;
		var v;
		if (aProperties) {
			for (var i=0;i<aProperties.length;i++) {
				p = aProperties[i];
				if (aExclude && aExclude.indexOf(p)>=0)
					continue;
				v = this.attr(aSource,p);
				if (v!==undefined)
					this.attr(aDest,p,v);
			}
		} else {
			for (p in aSource) {
				if (aExclude && aExclude.indexOf(p)>=0)
					continue;
				v = this.attr(aSource,p);
				if (v!==undefined)
					this.attr(aDest,p,v);
			}
		}
		return aDest;
	}

};

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kojac-0.17.0 app/assets/javascripts/can_extensions.js
kojac-0.16.0 app/assets/javascripts/can_extensions.js
kojac-0.15.0 app/assets/javascripts/can_extensions.js
kojac-0.13.0 app/assets/javascripts/can_extensions.js
kojac-0.12.0 app/assets/javascripts/can_extensions.js
kojac-0.11.0 app/assets/javascripts/can_extensions.js
kojac-0.9.1 app/assets/javascripts/can_extensions.js
kojac-0.9.0.1 app/assets/javascripts/can_extensions.js
kojac-0.9.0 app/assets/javascripts/can_extensions.js