diff --git a/packages/devextreme/js/__internal/core/utils/m_data.ts b/packages/devextreme/js/__internal/core/utils/m_data.ts index fd2626f52fd5..c2be20be8331 100644 --- a/packages/devextreme/js/__internal/core/utils/m_data.ts +++ b/packages/devextreme/js/__internal/core/utils/m_data.ts @@ -13,12 +13,12 @@ const { assign } = variableWrapper; const bracketsToDots = function (expr) { return expr - .replace(/\[/g, '@js/core/utils') + .replace(/\[/g, '.') .replace(/\]/g, ''); }; export const getPathParts = function (name) { - return bracketsToDots(name).split('@js/core/utils'); + return bracketsToDots(name).split('.'); }; const readPropValue = function (obj, propName, options) { @@ -125,7 +125,7 @@ function combineGetters(getters) { } let current = result || (result = {}); - const path = name.split('@js/core/utils'); + const path = name.split('.'); const last = path.length - 1; for (let i = 0; i < last; i++) { diff --git a/packages/devextreme/js/__internal/core/utils/m_extend.ts b/packages/devextreme/js/__internal/core/utils/m_extend.ts index 55f68d6277ba..09c454ddc6a8 100644 --- a/packages/devextreme/js/__internal/core/utils/m_extend.ts +++ b/packages/devextreme/js/__internal/core/utils/m_extend.ts @@ -2,26 +2,27 @@ import { isPlainObject } from '@js/core/utils/type'; export const extendFromObject = function (target, source, overrideExistingValues) { target = target || {}; - Object.keys(source).forEach((prop) => { + // eslint-disable-next-line no-restricted-syntax + for (const prop in source) { if (Object.prototype.hasOwnProperty.call(source, prop)) { const value = source[prop]; if (!(prop in target) || overrideExistingValues) { target[prop] = value; } } - }); + } return target; }; -export const extend = function (target, ...args: any[]) { - target = target || {}; +export const extend = function (...args) { + let target = args[0] || {}; - let i = 0; + let i = 1; let deep = false; if (typeof target === 'boolean') { deep = target; - target = args[0] || {}; + target = args[1] || {}; i++; } @@ -31,19 +32,20 @@ export const extend = function (target, ...args: any[]) { continue; } - Object.keys(source).forEach((key) => { + // eslint-disable-next-line no-restricted-syntax, guard-for-in + for (const key in source) { const targetValue = target[key]; const sourceValue = source[key]; let sourceValueIsArray = false; let clone; if (key === '__proto__' || key === 'constructor' || target === sourceValue) { - return; + continue; } if (deep && sourceValue && (isPlainObject(sourceValue) - // eslint-disable-next-line no-cond-assign - || (sourceValueIsArray = Array.isArray(sourceValue)))) { + // eslint-disable-next-line no-cond-assign + || (sourceValueIsArray = Array.isArray(sourceValue)))) { if (sourceValueIsArray) { clone = targetValue && Array.isArray(targetValue) ? targetValue : []; } else { @@ -54,7 +56,7 @@ export const extend = function (target, ...args: any[]) { } else if (sourceValue !== undefined) { target[key] = sourceValue; } - }); + } } return target;