UNPKG

xe-utils

Version:

JavaScript 函数库、工具类

11 lines (9 loc) • 451 B
import helperStringReplace from './helperStringReplace.js';import toValueString from './toValueString.js';import keys from './keys.js';function helperFormatEscaper (dataMap) { var replaceRegexp = new RegExp('(?:' + keys(dataMap).join('|') + ')', 'g') return function (str) { return helperStringReplace(toValueString(str), replaceRegexp, function (match) { return dataMap[match] }) } } export default helperFormatEscaper