From 99c442bf279f4c9b8e2a86b15b24a839edfa7bdb Mon Sep 17 00:00:00 2001 From: CommanderRoot Date: Tue, 3 May 2022 10:43:55 +0200 Subject: [PATCH] refactor: replace deprecated String.prototype.substr() (#1335) .substr() is deprecated so we replace it with .slice() or .substring() which work similarily but aren't deprecated Signed-off-by: Tobias Speicher --- .test-todo/test-ssr-composition/src/entry-server.js | 2 +- .test-todo/test-ssr-composition/src/vue-apollo.js | 2 +- .test-todo/test-ssr/src/entry-server.js | 2 +- .test-todo/test-ssr/src/vue-apollo.js | 2 +- packages/vue-apollo-util/src/errorLog.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.test-todo/test-ssr-composition/src/entry-server.js b/.test-todo/test-ssr-composition/src/entry-server.js index 21ef56a..7de71b1 100644 --- a/.test-todo/test-ssr-composition/src/entry-server.js +++ b/.test-todo/test-ssr-composition/src/entry-server.js @@ -5,7 +5,7 @@ import { createApp } from './main' const prepareUrlForRouting = url => { const { BASE_URL } = process.env return url.startsWith(BASE_URL.replace(/\/$/, '')) - ? url.substr(BASE_URL.length) + ? url.slice(BASE_URL.length) : url } diff --git a/.test-todo/test-ssr-composition/src/vue-apollo.js b/.test-todo/test-ssr-composition/src/vue-apollo.js index 884f732..0137d36 100644 --- a/.test-todo/test-ssr-composition/src/vue-apollo.js +++ b/.test-todo/test-ssr-composition/src/vue-apollo.js @@ -7,7 +7,7 @@ const AUTH_TOKEN = 'apollo-token' // Http endpoint const httpEndpoint = process.env.VUE_APP_GRAPHQL_HTTP || 'http://localhost:4042/graphql' // Files URL root -export const filesRoot = process.env.VUE_APP_FILES_ROOT || httpEndpoint.substr(0, httpEndpoint.indexOf('/graphql')) +export const filesRoot = process.env.VUE_APP_FILES_ROOT || httpEndpoint.substring(0, httpEndpoint.indexOf('/graphql')) Vue.prototype.$filesRoot = filesRoot diff --git a/.test-todo/test-ssr/src/entry-server.js b/.test-todo/test-ssr/src/entry-server.js index 2129c26..35e6a49 100644 --- a/.test-todo/test-ssr/src/entry-server.js +++ b/.test-todo/test-ssr/src/entry-server.js @@ -5,7 +5,7 @@ import { createApp } from './main' const prepareUrlForRouting = url => { const { BASE_URL } = process.env return url.startsWith(BASE_URL.replace(/\/$/, '')) - ? url.substr(BASE_URL.length) + ? url.slice(BASE_URL.length) : url } diff --git a/.test-todo/test-ssr/src/vue-apollo.js b/.test-todo/test-ssr/src/vue-apollo.js index 8cd1e2d..cda8adf 100644 --- a/.test-todo/test-ssr/src/vue-apollo.js +++ b/.test-todo/test-ssr/src/vue-apollo.js @@ -13,7 +13,7 @@ const AUTH_TOKEN = 'apollo-token' // Http endpoint const httpEndpoint = process.env.VUE_APP_GRAPHQL_HTTP || 'http://localhost:4042/graphql' // Files URL root -export const filesRoot = process.env.VUE_APP_FILES_ROOT || httpEndpoint.substr(0, httpEndpoint.indexOf('/graphql')) +export const filesRoot = process.env.VUE_APP_FILES_ROOT || httpEndpoint.substring(0, httpEndpoint.indexOf('/graphql')) Vue.prototype.$filesRoot = filesRoot diff --git a/packages/vue-apollo-util/src/errorLog.ts b/packages/vue-apollo-util/src/errorLog.ts index 591c7c1..fb79630 100644 --- a/packages/vue-apollo-util/src/errorLog.ts +++ b/packages/vue-apollo-util/src/errorLog.ts @@ -48,7 +48,7 @@ export function logErrorMessages (error: ApolloError | ErrorResponse, printStack if (stack == null) return const newLineIndex = stack.indexOf('\n') - stack = stack.substr(stack.indexOf('\n', newLineIndex + 1)) + stack = stack.slice(stack.indexOf('\n', newLineIndex + 1)) console.log(`%c${stack}`, 'color:grey;') } }