From aa5aca1697d6d88a2409d84cf39c77a1b3dc7f8d Mon Sep 17 00:00:00 2001 From: 刘汉宸 Date: Tue, 16 Jun 2020 19:52:25 +0800 Subject: [PATCH] fix: 修复工具方法正则表达式及ESLint提示 --- packages/form/util.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/form/util.js b/packages/form/util.js index 70a069b..710ebe1 100644 --- a/packages/form/util.js +++ b/packages/form/util.js @@ -50,7 +50,8 @@ export const cloneDeep = obj => { export const get = (obj, dotSeparatedKeys) => { if (dotSeparatedKeys !== undefined && typeof dotSeparatedKeys !== 'string') return undefined; if (typeof obj !== 'undefined' && typeof dotSeparatedKeys === 'string') { - const splitRegex = /[.[]'"]/g; + // eslint-disable-next-line no-useless-escape + const splitRegex = /[.\[\]'"]/g; const pathArr = dotSeparatedKeys.split(splitRegex).filter(k => k !== ''); obj = pathArr.reduce((o, key) => (o && o[key] !== undefined ? o[key] : undefined), obj); } @@ -66,7 +67,8 @@ export const get = (obj, dotSeparatedKeys) => { * @example set(obj, 'a.b.c', 'd') */ export const set = (obj, dotSeparatedKeys, value) => { - const splitRegex = /[.[]'"]/g; + // eslint-disable-next-line no-useless-escape + const splitRegex = /[.\[\]'"]/g; const pathArr = dotSeparatedKeys.split(splitRegex).filter(k => k !== ''); const key = pathArr.pop(); pathArr.reduce((o, k) => { -- libgit2 0.21.0