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.
@@ -1276,6 +1276,19 @@ function extractSlotsWithoutPrefix(slots, prefix) {
1276
1276
  function easyCopy(data) {
1277
1277
  return JSON.parse(JSON.stringify(data));
1278
1278
  }
1279
+ function valueFillter(val, keys, data) {
1280
+ if (!val) return val;
1281
+ return val.replace(/(?:\${([^}]*)})|(?:\$([^&?\b]*))/g, ($1, $2, $3) => {
1282
+ let result = "";
1283
+ const rule = new RegExp(keys);
1284
+ if (rule.test($2) || rule.test($3)) {
1285
+ result = data[$2 || $3] || "";
1286
+ } else {
1287
+ result = $1;
1288
+ }
1289
+ return `${result}`;
1290
+ });
1291
+ }
1279
1292
  function toMoney(money, precision = 2, multiple) {
1280
1293
  if (isEmpty(money)) return "";
1281
1294
  if (multiple) money = Number(money) * multiple;
@@ -12405,5 +12418,6 @@ exports.useServicePagination = useServicePagination;
12405
12418
  exports.useTimer = useTimer;
12406
12419
  exports.validator = validator;
12407
12420
  exports.validatorRegs = validatorRegs;
12421
+ exports.valueFillter = valueFillter;
12408
12422
  exports.waitTime = waitTime;
12409
12423
  //# sourceMappingURL=qidian-shared.cjs.js.map