import { LineBreaker } from "css-line-break";

export const getWordsCount = (str: string) => {
  try {
    const breaker = LineBreaker(str);
    let wordsCount = 0;
    while (!breaker.next().done) {
      wordsCount += 1;
    }
    return wordsCount;
    /* eslint-disable alidocs/catch-call-function */
  } catch (e) {
    console.log(e);
    return 0;
  }
};
