Nelze vybrat více než 25 témat
Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
Tento repozitář je archivovaný. Můžete prohlížet soubory, klonovat, ale nemůžete nahrávat a vytvářet nové úkoly a požadavky na natažení.
|
- /**
- * @fileoverview Interpolate keys from an object into a string with {{ }} markers.
- * @author Jed Fox
- */
-
- "use strict";
-
- //------------------------------------------------------------------------------
- // Public Interface
- //------------------------------------------------------------------------------
-
- module.exports = (text, data) => {
- if (!data) {
- return text;
- }
-
- // Substitution content for any {{ }} markers.
- return text.replace(/\{\{([^{}]+?)\}\}/g, (fullMatch, termWithWhitespace) => {
- const term = termWithWhitespace.trim();
-
- if (term in data) {
- return data[term];
- }
-
- // Preserve old behavior: If parameter name not provided, don't replace it.
- return fullMatch;
- });
- };
|