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.
@@ -1277,6 +1277,19 @@
1277
1277
  function easyCopy(data) {
1278
1278
  return JSON.parse(JSON.stringify(data));
1279
1279
  }
1280
+ function valueFillter(val, keys, data) {
1281
+ if (!val) return val;
1282
+ return val.replace(/(?:\${([^}]*)})|(?:\$([^&?\b]*))/g, ($1, $2, $3) => {
1283
+ let result = "";
1284
+ const rule = new RegExp(keys);
1285
+ if (rule.test($2) || rule.test($3)) {
1286
+ result = data[$2 || $3] || "";
1287
+ } else {
1288
+ result = $1;
1289
+ }
1290
+ return `${result}`;
1291
+ });
1292
+ }
1280
1293
  function toMoney(money, precision = 2, multiple) {
1281
1294
  if (isEmpty(money)) return "";
1282
1295
  if (multiple) money = Number(money) * multiple;
@@ -12406,6 +12419,7 @@
12406
12419
  exports2.useTimer = useTimer;
12407
12420
  exports2.validator = validator;
12408
12421
  exports2.validatorRegs = validatorRegs;
12422
+ exports2.valueFillter = valueFillter;
12409
12423
  exports2.waitTime = waitTime;
12410
12424
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
12411
12425
  }));