src/aria/core/DownloadMgr.js
function (urls) {

            if (this._typeUtils.isString(urls)) {
                urls = [urls];
            }

            var _getPackages = function (urls, urlMap, packages) {
                if (urls.length === 0) {
                    // everything has been found, leave back the recursive loop
                    return;
                }
                for (var key in urlMap) {
                    var value = urlMap[key];
                    if (typeof(value) == 'string') {
                        value = "/" + value;
                        // Check if something match
                        for (var i = 0, ii = urls.length; i < ii; i++) {
                            var file = urls[i];
                            if (value.substr(0, file.length) == file) {
                                packages[value] = true;
                                // remove found item from the url list, for performance reason
                                urls.slice(i, i);
                                break;
                            }
                        }
                    } else {
                        _getPackages(urls, urlMap[key], packages);
                    }
                }
            };

            // Clone urls array
            var urlClone = [];
            for (var i = 0, ii = urls.length; i < ii; i++) {
                urlClone.push(urls[i]);
            }

            var packages = {};
            _getPackages(urls, this._urlMap, packages);

            // return the keys only
            var keys = [];
            for (var key in packages) {
                keys.push(key);
            }
            return keys;
        }
function (urls) {

            if (this._typeUtils.isString(urls)) {
                urls = [urls];
            }

            var _getPackages = function (urls, urlMap, packages) {
                if (urls.length === 0) {
                    // everything has been found, leave back the recursive loop
                    return;
                }
                for (var key in urlMap) {
                    var value = urlMap[key];
                    if (typeof(value) == 'string') {
                        value = "/" + value;
                        // Check if something match
                        for (var i = 0, ii = urls.length; i < ii; i++) {
                            var file = urls[i];
                            if (value.substr(0, file.length) == file) {
                                packages[value] = true;
                                // remove found item from the url list, for performance reason
                                urls.slice(i, i);
                                break;
                            }
                        }
                    } else {
                        _getPackages(urls, urlMap[key], packages);
                    }
                }
            };

            // Clone urls array
            var urlClone = [];
            for (var i = 0, ii = urls.length; i < ii; i++) {
                urlClone.push(urls[i]);
            }

            var packages = {};
            _getPackages(urls, this._urlMap, packages);

            // return the keys only
            var keys = [];
            for (var key in packages) {
                keys.push(key);
            }
            return keys;
        }
function ( urls ) { if ( this . _typeUtils . isString ( urls ) ) { urls = [ urls ] ; } var _getPackages = function ( urls , urlMap , packages ) { if ( urls . length === 0 ) { // everything has been found, leave back the recursive loop return ; } for ( var key in urlMap ) { var value = urlMap [ key ] ; if ( typeof ( value ) == 'string' ) { value = "/" + value ; // Check if something match for ( var i = 0 , ii = urls . length ; i < ii ; i ++ ) { var file = urls [ i ] ; if ( value . substr ( 0 , file . length ) == file ) { packages [ value ] = true ; // remove found item from the url list, for performance reason urls . slice ( i , i ) ; break ; } } } else { _getPackages ( urls , urlMap [ key ] , packages ) ; } } } ; // Clone urls array var urlClone = [ ] ; for ( var i = 0 , ii = urls . length ; i < ii ; i ++ ) { urlClone . push ( urls [ i ] ) ; } var packages = { } ; _getPackages ( urls , this . _urlMap , packages ) ; // return the keys only var keys = [ ] ; for ( var key in packages ) { keys . push ( key ) ; } return keys ; }
Return an url list from an array containing the starting url, this function is usefull to retrieve package
name with md5 from the name without it
@param {String|Array} urls starting url string
@return {Array} array of full url
Return an url list from an array containing the starting url this function is usefull to retrieve package name with md5 from the name without it