qidian-shared 1.0.13 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1274,6 +1274,19 @@ function extractSlotsWithoutPrefix(slots, prefix) {
1274
1274
  function easyCopy(data) {
1275
1275
  return JSON.parse(JSON.stringify(data));
1276
1276
  }
1277
+ function valueFillter(val, keys, data) {
1278
+ if (!val) return val;
1279
+ return val.replace(/(?:\${([^}]*)})|(?:\$([^&?\b]*))/g, ($1, $2, $3) => {
1280
+ let result = "";
1281
+ const rule = new RegExp(keys);
1282
+ if (rule.test($2) || rule.test($3)) {
1283
+ result = data[$2 || $3] || "";
1284
+ } else {
1285
+ result = $1;
1286
+ }
1287
+ return `${result}`;
1288
+ });
1289
+ }
1277
1290
  function toMoney(money, precision = 2, multiple) {
1278
1291
  if (isEmpty(money)) return "";
1279
1292
  if (multiple) money = Number(money) * multiple;
@@ -12404,6 +12417,7 @@ export {
12404
12417
  useTimer,
12405
12418
  validator,
12406
12419
  validatorRegs,
12420
+ valueFillter,
12407
12421
  waitTime
12408
12422
  };
12409
12423
  //# sourceMappingURL=qidian-shared.es.js.map