hasTplInterpolation.mjs 343 B

1234567891011
  1. const HAS_TPL_INTERPOLATION = /\{.+?\}/s;
  2. /**
  3. * Check whether a string has JS template literal interpolation or HTML-like template
  4. *
  5. * @param {string} string
  6. * @returns {boolean} If `true`, a string has template literal interpolation
  7. */
  8. export default function hasTplInterpolation(string) {
  9. return HAS_TPL_INTERPOLATION.test(string);
  10. }