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: { NumRange: {
min: (parent: string) => { min: (parent: string) => {
return parent.split(',')[0].replace('[', ''); return parent.replace(/^\[(.*),.*]$/, '$1');
}, },
max: (parent: string) => { max: (parent: string) => {
return parent.split(',')[1].replace(']', ''); return parent.replace(/^\[.*,(.*)]$/, '$1');
} }
}, },
Equipment: { Equipment: {

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

Loading…
Cancel
Save