UNPKG
hurt
Version:
latest (0.1.0-alpha.1)
0.1.0-alpha.1
HTTP and SPA routing using RFC 6570 URI templates
github.com/jpommerening/hurt
jpommerening/hurt
hurt
/
src
/
conditional.js
12 lines
(10 loc)
•
217 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
export
default
function
conditional
(
test, handle
)
{
return
function (...
args
) {
const
next =
args
.pop();
if
(test(...
args
)) { handle.call(
this
, ...
args
, next); }
else
{ next(); } }; }