export const postLinkToIds = ( postLink ) => { const match = postLink . match ( /\/questions\/(\d+)\/[^\/]+(?:\/(\d+))?/ ) ! ; const [ , questionId , answerId ] = match ; return { questionId : Number ( questionId ) , answerId : answerId ? Number ( answerId ) : undefined } ; } ;