Remove unnecessary natsort dep
This commit is contained in:
5
package-lock.json
generated
5
package-lock.json
generated
@@ -6540,11 +6540,6 @@
|
||||
"integrity": "sha512-dndRmy03JQEN+Nh6WjQl7/OstIozeEmrtWe4TE7mEqJ8W8oMD8m2tHjsLPWt//e3hLAeRSbs4pxMyc5pk/nCkQ==",
|
||||
"optional": true
|
||||
},
|
||||
"natsort": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/natsort/-/natsort-1.0.6.tgz",
|
||||
"integrity": "sha1-/U9GMfrH9Yhap39x/VWidC2U6zI="
|
||||
},
|
||||
"natural-compare": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
"material-ui": "^0.20.2",
|
||||
"mkdirp": "^0.5.1",
|
||||
"music-metadata": "^3.6.1",
|
||||
"natsort": "^1.0.6",
|
||||
"network-address": "^1.1.0",
|
||||
"parse-torrent": "^6.0.1",
|
||||
"prettier-bytes": "^1.0.1",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const React = require('react')
|
||||
const prettyBytes = require('prettier-bytes')
|
||||
const natsort = require('natsort')
|
||||
|
||||
const Checkbox = require('material-ui/Checkbox').default
|
||||
const LinearProgress = require('material-ui/LinearProgress').default
|
||||
@@ -280,13 +279,13 @@ module.exports = class TorrentList extends React.Component {
|
||||
} else {
|
||||
// We do know the files. List them and show download stats for each one
|
||||
const sortByName = this.props.state.saved.prefs.sortByName
|
||||
const sorter = natsort()
|
||||
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' })
|
||||
let fileRows = torrentSummary.files
|
||||
.filter((file) => !file.path.includes('/.____padding_file/'))
|
||||
.map((file, index) => ({ file, index }))
|
||||
|
||||
if (sortByName) {
|
||||
fileRows = fileRows.sort((a, b) => sorter(a.file.name, b.file.name))
|
||||
fileRows = fileRows.sort((a, b) => collator.compare(a.file.name, b.file.name))
|
||||
}
|
||||
|
||||
fileRows = fileRows.map((obj) => this.renderFileRow(torrentSummary, obj.file, obj.index))
|
||||
|
||||
Reference in New Issue
Block a user