Skip to content

Commit 10a658f

Browse files
committed
fix: Accept null inputs in curried functions
1 parent c279c9e commit 10a658f

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

join.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
var tuple = require('./tuple')
22

33
function join(a, b, c) {
4-
return a != null && b != null && c == null
5-
? joinCurried(a, b)
6-
: joinMain(a, b, c)
4+
return b != null && c == null ? joinCurried(a, b) : joinMain(a, b, c)
75
}
86

97
function joinMain(id, joiner, makerFns) {

tests/fictional.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ tap.test('consistency', t => {
5454
tap.test('curried makers', t => {
5555
for (const [fn, ...args] of curriedMakerDefs) {
5656
t.deepEquals(fn(23, ...args), fn(...args)(23))
57+
t.deepEquals(fn(null, ...args), fn(...args)(null))
5758
}
5859

5960
t.end()

tuple.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var hash = require('./hash')
22

33
function tuple(a, b) {
4-
return a != null && b != null ? tupleMain(a, b) : tupleCurried(a)
4+
return b != null ? tupleMain(a, b) : tupleCurried(a)
55
}
66

77
function tupleMain(input, fns) {

0 commit comments

Comments
 (0)