@xyezir/vux-loader
Version:
extended loader for vux
18 lines (14 loc) • 313 B
JavaScript
const matchI18nReg = /this.\$t\('?(.*?)'?\)/g
function replace (code, map = {}, options = {}) {
if (!code) {
return
}
code = code.replace(matchI18nReg, function (a, b) {
return addQuotes(map[b] || b)
})
return code
}
exports.replace = replace
function addQuotes (str) {
return `'${str}'`
}