You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
583 B

4 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var matchValueName = /[$#]?[\w-\.]+/g;
  6. var replaceValueSymbols = function replaceValueSymbols(value, replacements) {
  7. var matches = void 0;
  8. while (matches = matchValueName.exec(value)) {
  9. var replacement = replacements[matches[0]];
  10. if (replacement) {
  11. value = value.slice(0, matches.index) + replacement + value.slice(matchValueName.lastIndex);
  12. matchValueName.lastIndex -= matches[0].length - replacement.length;
  13. }
  14. }
  15. return value;
  16. };
  17. exports.default = replaceValueSymbols;