File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- const compose = ( f , g ) => x => f ( g ( x ) )
3
+ const _compose = function _compose ( f , g ) {
4
+ return function ( ) {
5
+ return f ( g . apply ( null , arguments ) ) ;
6
+ } ;
7
+ } ;
8
+
9
+ const compose = fns => fns . reduce ( _compose )
4
10
5
11
const uniq = xs => xs . reduce ( ( list , x ) => list . indexOf ( x ) === - 1 ? list . concat ( x ) : list , [ ] )
6
12
7
13
const identity = x => x
8
14
9
- const flatten = xs => [ ] . concat . apply ( [ ] , xs . map ( identity ) ) ;
15
+ const concat = ( xs , list ) => xs . concat ( list )
16
+
17
+ const union = compose ( [ uniq , identity ] )
18
+
19
+ const join = separator => xs => xs . join ( separator )
20
+
21
+ const split = separator => str => str . split ( separator )
22
+
23
+ const pathUnion = compose ( [ join ( '/' ) , union , split ( '/' ) , concat ] )
10
24
11
- exports . union = compose ( uniq , flatten )
25
+ exports . pathUnion = pathUnion
You can’t perform that action at this time.
0 commit comments