import getSymbolsInPatternWithPosition from '../getSymbolsInPatternWithPosition';

const getCountOfSymbolsInSelection = (
  selectionStart: number,
  selectionEnd: number,
  pattern: string,
) =>
  getSymbolsInPatternWithPosition(pattern).filter(
    (symbol) => symbol.index >= selectionStart && symbol.index < selectionEnd,
  ).length;

export default getCountOfSymbolsInSelection;
