From 491bcb86ed9c00909386d0cbf65aa6d504f58dfa Mon Sep 17 00:00:00 2001 From: Tobias Speicher Date: Sun, 20 Feb 2022 15:28:39 +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 slice() which works similarily but isn't deprecated. Signed-off-by: Tobias Speicher --- packages/bbui/src/Stores/notifications.js | 2 +- packages/bbui/src/Tabs/Tabs.svelte | 2 +- .../portal/manage/users/_components/BasicOnboardingModal.svelte | 2 +- .../manage/users/_components/ForceResetPasswordModal.svelte | 2 +- packages/server/scripts/docs/toSwagger.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/bbui/src/Stores/notifications.js b/packages/bbui/src/Stores/notifications.js index 640f8218c4..74eed8628a 100644 --- a/packages/bbui/src/Stores/notifications.js +++ b/packages/bbui/src/Stores/notifications.js @@ -60,7 +60,7 @@ export const createNotificationStore = () => { } function id() { - return "_" + Math.random().toString(36).substr(2, 9) + return "_" + Math.random().toString(36).slice(2, 9) } export const notifications = createNotificationStore() diff --git a/packages/bbui/src/Tabs/Tabs.svelte b/packages/bbui/src/Tabs/Tabs.svelte index 40e02058c1..6930a6cdb5 100644 --- a/packages/bbui/src/Tabs/Tabs.svelte +++ b/packages/bbui/src/Tabs/Tabs.svelte @@ -68,7 +68,7 @@ }) function id() { - return "_" + Math.random().toString(36).substr(2, 9) + return "_" + Math.random().toString(36).slice(2, 9) } diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/BasicOnboardingModal.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/BasicOnboardingModal.svelte index 29e2d56ed0..8f01349765 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/_components/BasicOnboardingModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/BasicOnboardingModal.svelte @@ -11,7 +11,7 @@ import { users } from "stores/portal" const [email, error, touched] = createValidationStore("", emailValidator) - const password = Math.random().toString(36).substr(2, 20) + const password = Math.random().toString(36).slice(2, 20) let builder = false, admin = false diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/ForceResetPasswordModal.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/ForceResetPasswordModal.svelte index a380f0aa65..8a7a3940bf 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/_components/ForceResetPasswordModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/ForceResetPasswordModal.svelte @@ -7,7 +7,7 @@ export let user - const password = Math.random().toString(36).substr(2, 20) + const password = Math.random().toString(36).slice(2, 20) async function resetPassword() { try { diff --git a/packages/server/scripts/docs/toSwagger.js b/packages/server/scripts/docs/toSwagger.js index c9680143fc..1532e25fa6 100644 --- a/packages/server/scripts/docs/toSwagger.js +++ b/packages/server/scripts/docs/toSwagger.js @@ -51,7 +51,7 @@ function extractPaths(apidocJson) { // Surrounds URL parameters with curly brackets -> :email with {email} let pathKeys = [] for (let j = 1; j < matches.length; j++) { - let key = matches[j].substr(1) + let key = matches[j].slice(1) url = url.replace(matches[j], "{" + key + "}") pathKeys.push(key) }