Skip to content

Commit 4aff569

Browse files
committed
fix: ignore function types
1 parent ead41a3 commit 4aff569

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function toVal(mix) {
88
str += y;
99
}
1010
}
11-
} else if (typeof mix !== 'boolean') {
11+
} else if (typeof mix !== 'boolean' && !mix.call) {
1212
str && (str += ' ');
1313
str += mix;
1414
}

test/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,11 @@ test('arrays (variadic)', t => {
6363
t.is(fn(['foo'], null, ['baz', ''], true, '', []), 'foo baz');
6464
t.end();
6565
});
66+
67+
test('functions', t => {
68+
const foo = () => {};
69+
t.is(fn(foo, 'hello'), 'hello');
70+
t.is(fn(foo, 'hello', fn), 'hello');
71+
t.is(fn(foo, 'hello', [[fn], 'world']), 'hello world');
72+
t.end();
73+
});

0 commit comments

Comments
 (0)