Buckets:
| class LoaderUtils { | |
| static decodeText( array ) { | |
| if ( typeof TextDecoder !== 'undefined' ) { | |
| return new TextDecoder().decode( array ); | |
| } | |
| // Avoid the String.fromCharCode.apply(null, array) shortcut, which | |
| // throws a "maximum call stack size exceeded" error for large arrays. | |
| let s = ''; | |
| for ( let i = 0, il = array.length; i < il; i ++ ) { | |
| // Implicitly assumes little-endian. | |
| s += String.fromCharCode( array[ i ] ); | |
| } | |
| try { | |
| // merges multi-byte utf-8 characters. | |
| return decodeURIComponent( escape( s ) ); | |
| } catch ( e ) { // see #16358 | |
| return s; | |
| } | |
| } | |
| static extractUrlBase( url ) { | |
| const index = url.lastIndexOf( '/' ); | |
| if ( index === - 1 ) return './'; | |
| return url.slice( 0, index + 1 ); | |
| } | |
| static resolveURL( url, path ) { | |
| // Invalid URL | |
| if ( typeof url !== 'string' || url === '' ) return ''; | |
| // Host Relative URL | |
| if ( /^https?:\/\//i.test( path ) && /^\//.test( url ) ) { | |
| path = path.replace( /(^https?:\/\/[^\/]+).*/i, '$1' ); | |
| } | |
| // Absolute URL http://,https://,// | |
| if ( /^(https?:)?\/\//i.test( url ) ) return url; | |
| // Data URI | |
| if ( /^data:.*,.*$/i.test( url ) ) return url; | |
| // Blob URL | |
| if ( /^blob:.*$/i.test( url ) ) return url; | |
| // Relative URL | |
| return path + url; | |
| } | |
| } | |
| export { LoaderUtils }; | |
Xet Storage Details
- Size:
- 1.31 kB
- Xet hash:
- 44b0a7c089bdb59eced28454cb4c1c916a311b25b7826c2296c7e50bb336c307
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.