Commit aa5aca1697d6d88a2409d84cf39c77a1b3dc7f8d

Authored by 刘汉宸
1 parent 9af92dbb

fix: 修复工具方法正则表达式及ESLint提示

Showing 1 changed file with 4 additions and 2 deletions   Show diff stats
packages/form/util.js
... ... @@ -50,7 +50,8 @@ export const cloneDeep = obj => {
50 50 export const get = (obj, dotSeparatedKeys) => {
51 51 if (dotSeparatedKeys !== undefined && typeof dotSeparatedKeys !== 'string') return undefined;
52 52 if (typeof obj !== 'undefined' && typeof dotSeparatedKeys === 'string') {
53   - const splitRegex = /[.[]'"]/g;
  53 + // eslint-disable-next-line no-useless-escape
  54 + const splitRegex = /[.\[\]'"]/g;
54 55 const pathArr = dotSeparatedKeys.split(splitRegex).filter(k => k !== '');
55 56 obj = pathArr.reduce((o, key) => (o && o[key] !== undefined ? o[key] : undefined), obj);
56 57 }
... ... @@ -66,7 +67,8 @@ export const get = (obj, dotSeparatedKeys) => {
66 67 * @example set(obj, 'a.b.c', 'd')
67 68 */
68 69 export const set = (obj, dotSeparatedKeys, value) => {
69   - const splitRegex = /[.[]'"]/g;
  70 + // eslint-disable-next-line no-useless-escape
  71 + const splitRegex = /[.\[\]'"]/g;
70 72 const pathArr = dotSeparatedKeys.split(splitRegex).filter(k => k !== '');
71 73 const key = pathArr.pop();
72 74 pathArr.reduce((o, k) => {
... ...