export type OpeningTag = '(' | '[' | '{' | '<' ; export type ClosingTag = ')' | ']' | '}' | '>' ; export const closingTagMap = { '(' : ')' , '[' : ']' , '{' : '}' , '<' : '>' } ; export const openingTags = Object . keys ( closingTagMap ) ; export const closingTags = Object . values ( closingTagMap ) ; export const isOpeningTag = ( char ) : char is OpeningTag => { return openingTags . some ( ( closingTag ) => closingTag === char ) ; } ; export const isClosingTag = ( char ) : char is OpeningTag => { return closingTags . some ( ( closingTag ) => closingTag === char ) ; } ;