src/resolvers/*: use reg ex

pull/23/head
leonnicolas 4 years ago
parent 4a89b758de
commit 8dfa429e22
No known key found for this signature in database
GPG Key ID: 088D0743E2B65C07

@ -163,10 +163,10 @@ export default {
},
NumRange: {
min: (parent: string) => {
return parent.split(',')[0].replace('[', '');
return parent.replace(/^\[(.*),.*]$/, '$1');
},
max: (parent: string) => {
return parent.split(',')[1].replace(']', '');
return parent.replace(/^\[.*,(.*)]$/, '$1');
}
},
Equipment: {

@ -106,11 +106,10 @@ export default {
},
DateRange: {
from (parent: string) {
return parent.split(',')[0].replace('[', '');
return parent.replace(/^\[(.*),.*\)$/, '$1');
},
to (parent: string) {
const str = parent.split(',')[1].replace(')', '');
return (str.length > 0) ? str : null;
return parent.replace(/^\[.*,(.*)\)$/, '$1');
}
},
TimeFrame: {

Loading…
Cancel
Save