diff --git a/src/components/error_boundary/error_boundary.tsx b/src/components/error_boundary/error_boundary.tsx index 19ee1739870..cb0b3e064b0 100644 --- a/src/components/error_boundary/error_boundary.tsx +++ b/src/components/error_boundary/error_boundary.tsx @@ -61,7 +61,8 @@ export class EuiErrorBoundary extends Component< // For consistency, rebuild the full error text from the Error subparts. const { message, stack } = error; const idx = stack?.indexOf(message) || -1; - const stackStr = idx > -1 ? stack?.substr(idx + message.length + 1) : stack; + const stackStr = + idx > -1 ? stack?.substring(idx + message.length + 1) : stack; const errorMessage = `Error: ${message} ${stackStr}`; this.setState({ diff --git a/src/components/highlight/highlight.tsx b/src/components/highlight/highlight.tsx index 0914ea78e7b..2870b83d1c1 100644 --- a/src/components/highlight/highlight.tsx +++ b/src/components/highlight/highlight.tsx @@ -72,7 +72,7 @@ const highlight = ( {chunks.map((chunk) => { const { end, highlight, start } = chunk; - const value = searchSubject.substr(start, end - start); + const value = searchSubject.substring(start, end); if (highlight) { return ( { - const leading = value.substr(0, position.start.offset); - const trailing = value.substr(position.end.offset); + const leading = value.substring(0, position.start.offset); + const trailing = value.substring(position.end.offset); onChange(`${leading}${next}${trailing}`); }, [value, onChange] diff --git a/upcoming_changelogs/6954.md b/upcoming_changelogs/6954.md new file mode 100644 index 00000000000..17270a68927 --- /dev/null +++ b/upcoming_changelogs/6954.md @@ -0,0 +1,2 @@ +- Updated deprecated `.substr()` usages to `.substring()` +