Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/core/curry.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ function curry(fn) {
value: true
})

Object.defineProperty(curried, 'length', {
enumerable: false,
writable: false,
value: fn.length
})

return curried
}

Expand Down
8 changes: 8 additions & 0 deletions src/core/curry.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,11 @@ test('curry on a curried function', t => {

t.end()
})

test('curried function with arity exposed', t => {
const fn = (a, b) => a + b
const curried = curry(fn)
t.equal(curried.length, fn.length, 'returns the same arity as its uncurried counterpart')

t.end()
})