hidePrice.wxs 562 B

1234567891011121314151617181920212223
  1. function query(price, hide) {
  2. if (!price && price != 0) return;
  3. return hide == "1" ? price.toString().replace(getRegExp('([0-9])', 'g'), '*') : price
  4. };
  5. function verify(text, name, list = []) {
  6. var conceal = !list.some(function (v) {
  7. return v == name
  8. });
  9. return conceal ? text.toString().replace(getRegExp('([0-9])', 'g'), '*') : text
  10. };
  11. function hidePrice(name, list = []) {
  12. return !list.some(function (v) {
  13. return v == name
  14. });
  15. }
  16. module.exports = {
  17. query: query,
  18. verify: verify,
  19. hidePrice: hidePrice
  20. }