// jsbuilder/index/index.js index = { host: { ctxPath: $('#CONFURL').val(), }, // 删除对象value为空的key removeEmptyKey: function (obj) { for (prop in obj) { if (obj[prop] === '') { delete obj[prop]; } } return obj; }, maskPhone: function (phone) { // 移除所有非数字字符 const cleaned = phone.replace(/\D/g, ''); // 检查是否为11位手机号 if (cleaned.length !== 11) { return phone; // 或根据需求抛出错误 } // 替换中间4位为* return cleaned.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'); } };