Skip to content

Instantly share code, notes, and snippets.

@raine
Last active August 29, 2015 14:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raine/c0266dea6b5991b6a83c to your computer and use it in GitHub Desktop.
Save raine/c0266dea6b5991b6a83c to your computer and use it in GitHub Desktop.
var R = require('ramda');
var obj = {
a: 1,
b: {
c: 2
}
}
var pickPaths = function(paths, obj) {
return R.reduce(function(acc, pStr) {
return R.assoc(pStr, R.path(pStr.split('.'), obj), acc);
}, {}, paths);
};
pickPaths(['a', 'b.c'], obj);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment