visible/visible

View on GitHub
packages/@visi/plugin-wcag/src/utils/truncate.ts

Summary

Maintainability
A
0 mins
Test Coverage
export const truncate = (text: string, threshold = 20): string => {
  const flag = text.length > threshold;
  let short = text.substr(0, threshold);
  if (flag) short += '...';
  return short;
};