src/manifest.js
function(files) {
    var collection = {};
    files.forEach(function(file) {
        var filename = file.name;
        if (!collection.hasOwnProperty(filename) || collection[filename].version < file.version) {
            collection[filename] = file;
        }
    });
    return Object.keys(collection).map(function(name) {
        return collection[name];
    });
}
function(files) {
    var collection = {};
    files.forEach(function(file) {
        var filename = file.name;
        if (!collection.hasOwnProperty(filename) || collection[filename].version < file.version) {
            collection[filename] = file;
        }
    });
    return Object.keys(collection).map(function(name) {
        return collection[name];
    });
}
function ( files ) { var collection = { } ; files . forEach ( function ( file ) { var filename = file . name ; if ( ! collection . hasOwnProperty ( filename ) || collection [ filename ] . version < file . version ) { collection [ filename ] = file ; } } ) ; return Object . keys ( collection ) . map ( function ( name ) { return collection [ name ] ; } ) ; }
Deduplicate the list of files.

Only keep the most recent file versions.

@param array files
@return array
Deduplicate the list of files .