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