I am trying to sort numeric string using sortbyorder
function of lodash
.
Function should work as normal on string only fields but should sort in numeric order in case of numeral string.
Sample array object is as follows:
[{
"timeInProcessing": "20 min",
"timeInManual": "8 min",
"taskID": "653452",
"reasonType": "Customer Request",
"assignedStatus": "Robinson, Edwin",
"virtualMachine": "[machine name]",
"lastAction": "1st processing fail",
"region": "EU",
"project": "Demo Chue STAGE Media Extracts 04",
"fileName": "Depósito à Prazo BC - BI de Abril a 08 JUN 2016.xlsx",
"index": "1.0",
"fileRoom": "NRP TriPost",
"fileType": "xlsx",
"fileSize": "22.49 MB",
"processedBy": "n/a",
"uploadedBy": "Johnson III, Chadwick",
"node": "SPWD6PDGDS001"
}, {
"timeInProcessing": "15 min",
"timeInManual": "7 min",
"taskID": "765435",
"reasonType": "Multiple Attachments",
"assignedStatus": "Robinson, Edwin",
"virtualMachine": "[machine name]",
"lastAction": "2nd processing fail",
"region": "EU",
"project": "Blue Thunder",
"fileName": "lorem_ipsum_dolor.msg",
"index": "1.1",
"fileRoom": "North America",
"fileType": "msg",
"fileSize": "0.51 MB",
"processedBy": "Chandwik, Eric",
"uploadedBy": "Williamson, Lucinda",
"node": "SPWD6PDGDS002"
}, {
"timeInProcessing": "10 min",
"timeInManual": "n/a",
"taskID": "765436",
"reasonType": "Customer Request",
"assignedStatus": "Unassigned",
"virtualMachine": "n/a",
"lastAction": "[TBD]",
"region": "AP",
"project": "Hercules",
"fileName": "lorem_ipsum_dolor.msg",
"index": "1.1.1",
"fileRoom": "STAGING-Enterprise HR",
"fileType": "msg",
"fileSize": "0.01 MB",
"processedBy": "Holland, Roberta",
"uploadedBy": "Trisko, Dora",
"node": "SPWD6PDGDS005"
}, ]
the field on which I am trying to sort is timeInProcessing
.