项目原始demo,不改动
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
Repozitorijs ir arhivēts. Tam var aplūkot failus un to var klonēt, bet nevar iesūtīt jaunas izmaiņas, kā arī atvērt jaunas problēmas/izmaiņu pieprasījumus.

12345678910111213141516171819202122232425262728
  1. /**
  2. * @fileoverview Interpolate keys from an object into a string with {{ }} markers.
  3. * @author Jed Fox
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Public Interface
  8. //------------------------------------------------------------------------------
  9. module.exports = (text, data) => {
  10. if (!data) {
  11. return text;
  12. }
  13. // Substitution content for any {{ }} markers.
  14. return text.replace(/\{\{([^{}]+?)\}\}/g, (fullMatch, termWithWhitespace) => {
  15. const term = termWithWhitespace.trim();
  16. if (term in data) {
  17. return data[term];
  18. }
  19. // Preserve old behavior: If parameter name not provided, don't replace it.
  20. return fullMatch;
  21. });
  22. };