mirror of https://github.com/lidarr/Lidarr
New: Natural Sorting Manual Import Paths
(cherry picked from commit bdd5865876796bc203c8117418a5389afc8b5f11) Closes #2751
This commit is contained in:
parent
789261ba6b
commit
e3bc824dc1
|
@ -5,6 +5,7 @@ import { sortDirections } from 'Helpers/Props';
|
|||
import { createThunk, handleThunks } from 'Store/thunks';
|
||||
import createAjaxRequest from 'Utilities/createAjaxRequest';
|
||||
import updateSectionState from 'Utilities/State/updateSectionState';
|
||||
import naturalExpansion from 'Utilities/String/naturalExpansion';
|
||||
import { set, update, updateItem } from './baseActions';
|
||||
import createFetchHandler from './Creators/createFetchHandler';
|
||||
import createHandleActions from './Creators/createHandleActions';
|
||||
|
@ -40,7 +41,7 @@ export const defaultState = {
|
|||
path: function(item, direction) {
|
||||
const path = item.path;
|
||||
|
||||
return path.toLowerCase();
|
||||
return naturalExpansion(path.toLowerCase());
|
||||
},
|
||||
|
||||
artist: function(item, direction) {
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
const regex = /\d+/g;
|
||||
|
||||
function naturalExpansion(input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return input.replace(regex, (n) => n.padStart(8, '0'));
|
||||
}
|
||||
|
||||
export default naturalExpansion;
|
|
@ -1,9 +1,11 @@
|
|||
const regex = /\b\w+/g;
|
||||
|
||||
function titleCase(input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return input.replace(/\b\w+/g, (match) => {
|
||||
return input.replace(regex, (match) => {
|
||||
return match.charAt(0).toUpperCase() + match.substr(1).toLowerCase();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue