Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

well, it's not good. can be improved with lodash #1430

Open
github-actions bot opened this issue Jul 29, 2022 · 0 comments
Open

well, it's not good. can be improved with lodash #1430

github-actions bot opened this issue Jul 29, 2022 · 0 comments
Labels

Comments

@github-actions
Copy link

I REALLY HATE THIS LINE

// TODO well, it's not good. can be improved with lodash

  const config = {
    params,
    name: 'paragraph',
    // debug: true,
  };

  // console.log(config);
  const replaced = commonReplaceReact(config);
  const result = newLine + replaced + newLine;

  return result;
}
/// !end function is not working as planned

function _image(text, alt, srcWithTooltip) {
  const src = srcWithTooltip.trim().replace(/\"image_tooltip\"/, '');

  const params = {
    src: src.trim(),
    altText: alt,
  };

  const config = {
    params,
    name: 'image',
    debug: true,
  };

  this.warnings.images += 1;

  const replaced = commonReplaceReact(config);

  return replaced;
}

function _br(text, newLines) {
  const arrNewLines = newLines.match(new RegExp(newLine, 'g'));

  // TODO well, it's not good. can be improved with lodash
  // I REALLY HATE THIS LINE
  const result = arrNewLines.reduce(
    (acc, current, index) => (index > 0 ? `${acc}<br/>${current}` : current),
    '',
@github-actions github-actions bot added the todo label Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants