lib/index.js
function setPath(obj, path, value) {
	var cur = obj;
	var parts = path.split('.');
	var i;
	for (i = 0; i < parts.length; i++) {
		if (i === parts.length - 1) {
			cur[parts[i]] = value;
		} else {
			if (isScalar(cur[parts[i]])) cur[parts[i]] = {};
			cur = cur[parts[i]];
		}
	}
	return obj;
}
function setPath(obj, path, value) {
	var cur = obj;
	var parts = path.split('.');
	var i;
	for (i = 0; i < parts.length; i++) {
		if (i === parts.length - 1) {
			cur[parts[i]] = value;
		} else {
			if (isScalar(cur[parts[i]])) cur[parts[i]] = {};
			cur = cur[parts[i]];
		}
	}
	return obj;
}
function setPath ( obj , path , value ) { var cur = obj ; var parts = path . split ( '.' ) ; var i ; for ( i = 0 ; i < parts . length ; i ++ ) { if ( i === parts . length - 1 ) { cur [ parts [ i ] ] = value ; } else { if ( isScalar ( cur [ parts [ i ] ] ) ) cur [ parts [ i ] ] = { } ; cur = cur [ parts [ i ] ] ; } } return obj ; }
Sets the value at a given path in an object.

@method setPath
@static
@param {Object} obj - The object
@param {String} path - The path, dot-separated
@param {Mixed} value - Value to set
@return {Object} - The same object
Sets the value at a given path in an object .