barbiturat
6/3/2017 - 2:20 PM

Derivative of R.props for deep fields

Derivative of R.props for deep fields

const obj1 = {
  a: { b: { c: 1 } },
  x: 2
};

const dotPath = compose(path, split('.'));
const dotPaths = map(dotPath);

const propsDotPath = (paths, obj) => 
  ap(dotPaths(paths), [obj])

propsDotPath(['a.b.c', 'x'], obj1) // => [1, 2]