1
- ( function ( global , factory ) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module . exports = factory ( ) :
3
- typeof define === 'function' && define . amd ? define ( 'composableNormalize' , factory ) :
4
- ( global . composableNormalize = factory ( ) ) ;
5
- } ( this , function ( ) {
6
- 'use strict' ;
7
-
8
- // decode :: String -> String
9
- var decode = decodeURIComponent ;
10
-
11
- // _compose :: (b -> c) -> (a -> b) -> (a -> c)
12
- var _compose = function ( f , g ) {
13
- return function ( ) {
14
- var args = [ ] ,
15
- len = arguments . length ;
16
- while ( len -- ) args [ len ] = arguments [ len ] ;
17
-
18
- return f ( g . apply ( void 0 , args ) ) ; ;
19
- }
20
- } ;
21
-
22
- // compose :: [(d -> e) -> (c -> d) -> (b -> c) -> (a -> b)] -> (a -> e)
23
- var compose = function ( fns ) {
24
- return fns . reduce ( _compose ) ;
25
- } ;
26
-
27
- // replace :: Regex -> String -> String -> String
28
- var replace = function ( pattern , substr ) {
29
- return function ( str ) {
30
- return str . replace ( pattern , substr ) ;
31
- } ;
32
- } ;
33
-
34
- // toLower :: String -> String
35
- var toLower = function ( str ) {
36
- return str . toLowerCase ( ) ;
37
- } ;
38
-
39
- // append :: String -> String -> String
40
- var append = function ( a ) {
41
- return function ( b ) {
42
- return b . concat ( a ) ;
43
- } ;
44
- } ;
45
-
46
- var dedupeSlashes = / ( [ ^ : ] \/ ) \/ + / g;
47
- var dedupeDots = / \/ \. + / g;
48
- var defaultPorts = / ( \: 8 0 | \: 4 4 3 ) / ;
49
-
50
- var main = compose ( [
51
- replace ( dedupeSlashes , '$1' ) ,
52
- replace ( dedupeDots , '/' ) ,
53
- replace ( defaultPorts , '' ) ,
54
- toLower ,
55
- append ( '/' ) ,
56
- decode
57
- ] ) ;
58
-
59
- return main ;
60
-
61
- } ) ) ;
1
+ ( function ( global , factory ) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module . exports = factory ( ) :
3
+ typeof define === 'function' && define . amd ? define ( factory ) :
4
+ ( global . pullDomEvents = factory ( ) ) ;
5
+ } ( this , function ( ) { 'use strict' ;
6
+
7
+ // decode :: String -> String
8
+ var decode = decodeURIComponent ;
9
+
10
+ // _compose :: (b -> c) -> (a -> b) -> (a -> c)
11
+ var _compose = function ( f , g ) { return function ( ) {
12
+ var args = [ ] , len = arguments . length ;
13
+ while ( len -- ) args [ len ] = arguments [ len ] ;
14
+
15
+ return f ( g . apply ( void 0 , args ) ) ;
16
+ ; } } ;
17
+
18
+ // compose :: (a -> c) -> [(a -> a)] -> (a -> c)
19
+ var compose = function ( fns ) { return fns . reduce ( _compose ) ; } ;
20
+
21
+ // replace :: Regex -> String -> String -> String
22
+ var replace = function ( pattern , substr ) { return function ( str ) { return str . replace ( pattern , substr ) ; } ; } ;
23
+
24
+ // toLower :: String -> String
25
+ var toLower = function ( str ) { return str . toLowerCase ( ) ; } ;
26
+
27
+ // append :: String -> String -> String
28
+ var append = function ( a ) { return function ( b ) { return b . concat ( a ) ; } ; } ;
29
+
30
+ var dedupeSlashes = / ( [ ^ : ] \/ ) \/ + / g;
31
+ var dedupeDots = / \/ \. + / g;
32
+ var defaultPorts = / ( \: 8 0 | \: 4 4 3 ) / ;
33
+
34
+ var index = compose ( [
35
+ replace ( dedupeSlashes , '$1' ) ,
36
+ replace ( dedupeDots , '/' ) ,
37
+ replace ( defaultPorts , '' ) ,
38
+ toLower ,
39
+ append ( '/' ) ,
40
+ decode
41
+ ] ) ;
42
+
43
+ return index ;
44
+
45
+ } ) ) ;
0 commit comments