From 21af8f4f2809563414ce69167e447968335d8c42 Mon Sep 17 00:00:00 2001 From: Tobias Speicher Date: Tue, 22 Mar 2022 08:38:46 +0100 Subject: [PATCH] refactor: replace deprecated String.prototype.substr() .substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher --- electron/createWindow.js | 2 +- ui/component/common/form-components/form-field.jsx | 2 +- ui/component/common/transaction-link.jsx | 2 +- ui/component/dateTime/view.jsx | 2 +- ui/component/markdownLink/view.jsx | 2 +- ui/component/publishFile/view.jsx | 2 +- ui/component/tagsSearch/view.jsx | 2 +- ui/redux/actions/wallet.js | 2 +- ui/util/enhanced-layout.js | 2 +- ui/util/formatMediaDuration.js | 4 ++-- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/electron/createWindow.js b/electron/createWindow.js index 2d24199e1..9b442cce7 100644 --- a/electron/createWindow.js +++ b/electron/createWindow.js @@ -95,7 +95,7 @@ export default appState => { // is it a lbry://? pointing to an app page if (deepLinkingURI.includes(lbryProtoQ)) { - let path = deepLinkingURI.substr(lbryProtoQ.length); + let path = deepLinkingURI.slice(lbryProtoQ.length); let page = path.indexOf('?') >= 0 ? path.substring(0, path.indexOf('?')) : path; if (Object.values(PAGES).includes(page)) { deepLinkingURI = deepLinkingURI.replace(lbryProtoQ, '#/$/'); diff --git a/ui/component/common/form-components/form-field.jsx b/ui/component/common/form-components/form-field.jsx index 9dac1df87..ebcf4e718 100644 --- a/ui/component/common/form-components/form-field.jsx +++ b/ui/component/common/form-components/form-field.jsx @@ -157,7 +157,7 @@ export class FormField extends React.PureComponent { delta = instance.getValue().length + delta - textAreaMaxLength; if (delta > 0) { - str = str.substr(0, str.length - delta); + str = str.substring(0, str.length - delta); changes.update(changes.from, changes.to, str.split('\n')); } } diff --git a/ui/component/common/transaction-link.jsx b/ui/component/common/transaction-link.jsx index 214ce595c..fca68ef1b 100644 --- a/ui/component/common/transaction-link.jsx +++ b/ui/component/common/transaction-link.jsx @@ -10,7 +10,7 @@ const TransactionLink = (props: Props) => { const { id } = props; const href = `https://explorer.lbry.com/tx/${id}`; - const label = id.substr(0, 7); + const label = id.slice(0, 7); return