Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sortChunks (chunks) {
// Custom function
if (typeof this.options.chunksSortMode === 'function') {
return chunks.sort(this.options.chunksSortMode)
}
// Disabled sorting:
if (this.options.chunksSortMode === 'none') {
return chunkSorter.none(chunks)
}
// Check if the given sort mode is a valid chunkSorter sort mode
if (typeof chunkSorter[this.options.chunksSortMode] !== 'undefined') {
return chunkSorter[this.options.chunksSortMode](chunks)
}
throw new Error('"' + this.options.chunksSortMode + '" is not a valid chunk sort mode')
}