Skip to content

Commit

Permalink
fix: modified path conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-kovalev committed Nov 4, 2019
1 parent d62d5ae commit 38e8116
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,23 @@ function enhance(fn) {
function preparePath(fn) {
return (object, path, ...rest) => fn(
object,
Array.isArray(path) ? path : path.split('.'),
parsePath(path),
...rest
);
}

function parsePath(path) {
if (!path) {
return [];
}

if (Array.isArray(path)) {
return path;
}

return path.toString().split('.');
}

function specialCurry(fn, arity = fn.length) {
return (...args) => {
if (args.length >= arity) {
Expand Down

0 comments on commit 38e8116

Please sign in to comment.