Skip to content
Permalink
bef0a3ebad
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
11 lines (10 sloc) 435 Bytes
export function get (object, path, def) {
return (object = (path.split ? path.split('.') : path).reduce(function (obj, p) {
return obj && obj[p]
}, object)) === undefined ? def : object;
};
export function set (object, path, val, obj) {
return ((path = path.split ? path.split('.') : path.slice(0)).slice(0, -1).reduce(function (obj, p) {
return obj[p] = obj[p] || {};
}, obj = object)[path.pop()] = val), object;
};