1+ // function.name (all IE)
2+ /*! @source http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie*/
3+ if ( ! Object . hasOwnProperty ( 'name' ) ) {
4+ Object . defineProperty ( Function . prototype , 'name' , {
5+ get : function ( ) {
6+ var name = this . toString ( ) . match ( / ^ \s * f u n c t i o n \s * ( \S * ) \s * \( / ) [ 1 ] ;
7+ // For better performance only parse once, and then cache the
8+ // result through a new accessor for repeated access.
9+ Object . defineProperty ( this , 'name' , { value : name } ) ;
10+ return name ;
11+ }
12+ } ) ;
13+ }
14+
15+ // URL polyfill for SystemJS (all IE)
16+ /*! @source https://github.com/ModuleLoader/es6-module-loader/blob/master/src/url-polyfill.js*/
17+ // from https://gist.github.com/Yaffle/1088850
18+ ( function ( global ) {
19+ function URLPolyfill ( url , baseURL ) {
20+ if ( typeof url != 'string' ) {
21+ throw new TypeError ( 'URL must be a string' ) ;
22+ }
23+ var m = String ( url ) . replace ( / ^ \s + | \s + $ / g, "" ) . match ( / ^ ( [ ^ : \/ ? # ] + : ) ? (?: \/ \/ (?: ( [ ^ : @ \/ ? # ] * ) (?: : ( [ ^ : @ \/ ? # ] * ) ) ? @ ) ? ( ( [ ^ : \/ ? # ] * ) (?: : ( \d * ) ) ? ) ) ? ( [ ^ ? # ] * ) ( \? [ ^ # ] * ) ? ( # [ \s \S ] * ) ? / ) ;
24+ if ( ! m ) {
25+ throw new RangeError ( ) ;
26+ }
27+ var protocol = m [ 1 ] || "" ;
28+ var username = m [ 2 ] || "" ;
29+ var password = m [ 3 ] || "" ;
30+ var host = m [ 4 ] || "" ;
31+ var hostname = m [ 5 ] || "" ;
32+ var port = m [ 6 ] || "" ;
33+ var pathname = m [ 7 ] || "" ;
34+ var search = m [ 8 ] || "" ;
35+ var hash = m [ 9 ] || "" ;
36+ if ( baseURL !== undefined ) {
37+ var base = baseURL instanceof URLPolyfill ? baseURL : new URLPolyfill ( baseURL ) ;
38+ var flag = protocol === "" && host === "" && username === "" ;
39+ if ( flag && pathname === "" && search === "" ) {
40+ search = base . search ;
41+ }
42+ if ( flag && pathname . charAt ( 0 ) !== "/" ) {
43+ pathname = ( pathname !== "" ? ( ( ( base . host !== "" || base . username !== "" ) && base . pathname === "" ? "/" : "" ) + base . pathname . slice ( 0 , base . pathname . lastIndexOf ( "/" ) + 1 ) + pathname ) : base . pathname ) ;
44+ }
45+ // dot segments removal
46+ var output = [ ] ;
47+ pathname . replace ( / ^ ( \. \. ? ( \/ | $ ) ) + / , "" )
48+ . replace ( / \/ ( \. ( \/ | $ ) ) + / g, "/" )
49+ . replace ( / \/ \. \. $ / , "/../" )
50+ . replace ( / \/ ? [ ^ \/ ] * / g, function ( p ) {
51+ if ( p === "/.." ) {
52+ output . pop ( ) ;
53+ } else {
54+ output . push ( p ) ;
55+ }
56+ } ) ;
57+ pathname = output . join ( "" ) . replace ( / ^ \/ / , pathname . charAt ( 0 ) === "/" ? "/" : "" ) ;
58+ if ( flag ) {
59+ port = base . port ;
60+ hostname = base . hostname ;
61+ host = base . host ;
62+ password = base . password ;
63+ username = base . username ;
64+ }
65+ if ( protocol === "" ) {
66+ protocol = base . protocol ;
67+ }
68+ }
69+
70+ // convert windows file URLs to use /
71+ if ( protocol == 'file:' )
72+ pathname = pathname . replace ( / \\ / g, '/' ) ;
73+
74+ this . origin = protocol + ( protocol !== "" || host !== "" ? "//" : "" ) + host ;
75+ this . href = protocol + ( protocol !== "" || host !== "" ? "//" : "" ) + ( username !== "" ? username + ( password !== "" ? ":" + password : "" ) + "@" : "" ) + host + pathname + search + hash ;
76+ this . protocol = protocol ;
77+ this . username = username ;
78+ this . password = password ;
79+ this . host = host ;
80+ this . hostname = hostname ;
81+ this . port = port ;
82+ this . pathname = pathname ;
83+ this . search = search ;
84+ this . hash = hash ;
85+ }
86+ global . URLPolyfill = URLPolyfill ;
87+ } ) ( typeof self != 'undefined' ? self : global ) ;
0 commit comments