Skip to content

Commit

Permalink
Replace deprecated String.prototype.substr() (#10243)
Browse files Browse the repository at this point in the history
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 <rootcommander@gmail.com>
  • Loading branch information
CommanderRoot committed Mar 18, 2022
1 parent 285d845 commit acc7d9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/helpers/helpers.core.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit acc7d9e

Please sign in to comment.