UNPKG
apart
Version:
latest (2.0.1)
2.0.1
2.0.0
1.0.1
1.0.0
partial function application
github.com/coderaiser/apart
coderaiser/apart
apart
/
lib
/
apart.js
20 lines
(15 loc)
•
313 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'use strict'
;
module
.
exports
=
(
fn, ...a
) =>
{
check
(fn);
return
(
...b
) =>
{
const
args = [ ...a, ...b, ];
return
fn
(...args); }; };
function
check
(
fn
) {
if
(
typeof
fn !==
'function'
)
throw
Error
(
'fn should be function!'
); }