Skip to content

Commit

Permalink
feat: enhance operations to return frozen object
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-kovalev committed Oct 21, 2019
1 parent cbf5f09 commit 5ae2547
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function mapValues(object, map) {

function enhance(fn) {
return specialCurry(
(...args) => preparePath(fn)(...args),
freezeResult(preparePath(fn)),
fn.length
);
}
Expand All @@ -42,3 +42,7 @@ function specialCurry(fn, arity = fn.length) {
);
};
}

function freezeResult(fn) {
return (...args) => Object.freeze(fn(...args));
}

0 comments on commit 5ae2547

Please sign in to comment.