Chalarangelo/30-seconds-of-code

View on GitHub
src/blocks/utilities/tagFormatter.js

Summary

Maintainability
A
0 mins
Test Coverage
import tagDictionary from '#settings/tags';
import { capitalize } from '#utils';

/**
 * Formats a tag for display.
 */
export class TagFormatter {
  static format = tag => {
    if (!tag.length) return '';
    if (tagDictionary[tag]) return tagDictionary[tag];
    return capitalize(tag);
  };
}