Fix TypeError regarding matchAll (#579)
Co-authored-by: ekzyis <ek@stacker.news>
This commit is contained in:
parent
3160a3f66f
commit
d641c305b5
|
@ -14,7 +14,8 @@ export const isJob = item => typeof item.maxBid !== 'undefined'
|
|||
|
||||
const deletePattern = /\B@delete\s+in\s+(\d+)\s+(second|minute|hour|day|week|month|year)s?/gi
|
||||
|
||||
export const getDeleteCommand = (text = '') => {
|
||||
export const getDeleteCommand = (text) => {
|
||||
if (!text) return false
|
||||
const matches = [...text.matchAll(deletePattern)]
|
||||
const commands = matches?.map(match => ({ number: match[1], unit: match[2] }))
|
||||
return commands.length ? commands[commands.length - 1] : undefined
|
||||
|
|
Loading…
Reference in New Issue