Comparing version
@@ -1,11 +0,2 @@ | ||
exports.get = function (object, path, def) { | ||
return (object = (path.split ? path.split('.') : path).reduce(function (obj, p) { | ||
return obj && obj[p]; | ||
}, object)) === undefined ? def : object; | ||
}; | ||
exports.set = function (object, path, val, obj) { | ||
return (path = path.split ? path.split('.') : path).slice(0, -1).reduce(function (obj, p) { | ||
return obj[p] = obj[p] || {}; | ||
}, obj = object)[path.pop()] = val, object; | ||
}; | ||
exports.get=function(t,e,n){return void 0===(t=(e.split?e.split("."):e).reduce(function(t,e){return t&&t[e]},t))?n:t},exports.set=function(t,e,n,r){return(e=e.split?e.split("."):e).slice(0,-1).reduce(function(t,e){return t[e]=t[e]||{}},t)[e.pop()]=n,t}; | ||
//# sourceMappingURL=shvl.es.js.map |
{ | ||
"name": "shvl", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Get and set dot-notated properties within an object", | ||
@@ -42,8 +42,8 @@ "license": "MIT", | ||
"devDependencies": { | ||
"bundlesize": "^0.15.3", | ||
"jest": "^20.0.1", | ||
"bundlesize": "^0.16.0", | ||
"jest": "^22.4.2", | ||
"jest-in-case": "^1.0.2", | ||
"microbundle": "^0.2.4", | ||
"npm-run-all": "^4.1.1" | ||
"microbundle": "^0.4.4", | ||
"npm-run-all": "^4.1.2" | ||
} | ||
} |
# shvl | ||
Get and set dot-notated properties within an object in only __157b__. | ||
Get and set dot-notated properties within an object. | ||
<img src="https://media.giphy.com/media/3o85xLDQLoZD1rk07u/giphy-downsized.gif" width="350" /> | ||
[](https://www.npmjs.com/package/shvl) | ||
@@ -6,0 +8,0 @@ [](https://travis-ci.org/robinvdvleuten/shvl) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7474
53.06%45
4.65%17
-34.62%