Skip to content

Commit

Permalink
fix: ignore function types
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Apr 6, 2019
1 parent ead41a3 commit 4aff569
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function toVal(mix) {
str += y;
}
}
} else if (typeof mix !== 'boolean') {
} else if (typeof mix !== 'boolean' && !mix.call) {
str && (str += ' ');
str += mix;
}
Expand Down
8 changes: 8 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,11 @@ test('arrays (variadic)', t => {
t.is(fn(['foo'], null, ['baz', ''], true, '', []), 'foo baz');
t.end();
});

test('functions', t => {
const foo = () => {};
t.is(fn(foo, 'hello'), 'hello');
t.is(fn(foo, 'hello', fn), 'hello');
t.is(fn(foo, 'hello', [[fn], 'world']), 'hello world');
t.end();
});

0 comments on commit 4aff569

Please sign in to comment.