From 67e24e824b59e00dffd7e9108758f70d50d51f2f Mon Sep 17 00:00:00 2001 From: Tobias Speicher Date: Fri, 18 Mar 2022 05:10:37 +0100 Subject: [PATCH] Replace deprecated String.prototype.substr() String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with similar functions which aren't deprecated. Signed-off-by: Tobias Speicher --- src/helpers/helpers.core.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/helpers.core.js b/src/helpers/helpers.core.js index 2663c8b834b..00c143aa325 100644 --- a/src/helpers/helpers.core.js +++ b/src/helpers/helpers.core.js @@ -39,7 +39,7 @@ export function isArray(value) { return true; } const type = Object.prototype.toString.call(value); - if (type.substr(0, 7) === '[object' && type.substr(-6) === 'Array]') { + if (type.slice(0, 7) === '[object' && type.slice(-6) === 'Array]') { return true; } return false; @@ -307,7 +307,7 @@ export function resolveObjectKey(obj, key) { let pos = 0; let idx = indexOfDotOrLength(key, pos); while (obj && idx > pos) { - obj = obj[key.substr(pos, idx - pos)]; + obj = obj[key.slice(pos, idx)]; pos = idx + 1; idx = indexOfDotOrLength(key, pos); }