diff --git a/app/soapbox/base_polyfills.ts b/app/soapbox/base_polyfills.ts
index 53146d222..a6e92bb3c 100644
--- a/app/soapbox/base_polyfills.ts
+++ b/app/soapbox/base_polyfills.ts
@@ -37,7 +37,7 @@ if (!HTMLCanvasElement.prototype.toBlob) {
const dataURL = this.toDataURL(type, quality);
let data;
- if (dataURL.indexOf(BASE64_MARKER) >= 0) {
+ if (dataURL.includes(BASE64_MARKER)) {
const [, base64] = dataURL.split(BASE64_MARKER);
data = decodeBase64(base64);
} else {
diff --git a/app/soapbox/components/autosuggest_input.tsx b/app/soapbox/components/autosuggest_input.tsx
index e6a4af6d6..54f126a23 100644
--- a/app/soapbox/components/autosuggest_input.tsx
+++ b/app/soapbox/components/autosuggest_input.tsx
@@ -30,7 +30,7 @@ const textAtCursorMatchesToken = (str: string, caretPosition: number, searchToke
word = str.slice(left, right + caretPosition);
}
- if (!word || word.trim().length < 3 || searchTokens.indexOf(word[0]) === -1) {
+ if (!word || word.trim().length < 3 || !searchTokens.includes(word[0])) {
return [null, null];
}
diff --git a/app/soapbox/components/autosuggest_textarea.tsx b/app/soapbox/components/autosuggest_textarea.tsx
index b5d54b670..a475e5ce2 100644
--- a/app/soapbox/components/autosuggest_textarea.tsx
+++ b/app/soapbox/components/autosuggest_textarea.tsx
@@ -23,7 +23,7 @@ const textAtCursorMatchesToken = (str: string, caretPosition: number) => {
word = str.slice(left, right + caretPosition);
}
- if (!word || word.trim().length < 3 || ['@', ':', '#'].indexOf(word[0]) === -1) {
+ if (!word || word.trim().length < 3 || !['@', ':', '#'].includes(word[0])) {
return [null, null];
}
diff --git a/app/soapbox/features/account_gallery/components/media_item.js b/app/soapbox/features/account_gallery/components/media_item.js
index fe8c6cc85..aa15e39e2 100644
--- a/app/soapbox/features/account_gallery/components/media_item.js
+++ b/app/soapbox/features/account_gallery/components/media_item.js
@@ -51,7 +51,7 @@ class MediaItem extends ImmutablePureComponent {
hoverToPlay = () => {
const { autoPlayGif } = this.props;
- return !autoPlayGif && ['gifv', 'video'].indexOf(this.props.attachment.get('type')) !== -1;
+ return !autoPlayGif && ['gifv', 'video'].includes(this.props.attachment.get('type'));
}
handleClick = e => {
@@ -93,7 +93,7 @@ class MediaItem extends ImmutablePureComponent {
style={{ objectPosition: `${x}% ${y}%` }}
/>
);
- } else if (['gifv', 'video'].indexOf(attachment.get('type')) !== -1) {
+ } else if (['gifv', 'video'].includes(attachment.get('type'))) {
const conditionalAttributes = {};
if (isIOS()) {
conditionalAttributes.playsInline = '1';
diff --git a/app/soapbox/features/emoji/emoji_mart_search_light.js b/app/soapbox/features/emoji/emoji_mart_search_light.js
index 89e25785f..f16918ada 100644
--- a/app/soapbox/features/emoji/emoji_mart_search_light.js
+++ b/app/soapbox/features/emoji/emoji_mart_search_light.js
@@ -85,8 +85,8 @@ export function search(value, { emojisToShowFilter, maxResults, include, exclude
pool = {};
data.categories.forEach(category => {
- const isIncluded = include && include.length ? include.indexOf(category.name.toLowerCase()) > -1 : true;
- const isExcluded = exclude && exclude.length ? exclude.indexOf(category.name.toLowerCase()) > -1 : false;
+ const isIncluded = include && include.length ? include.includes(category.name.toLowerCase()) : true;
+ const isExcluded = exclude && exclude.length ? exclude.includes(category.name.toLowerCase()) : false;
if (!isIncluded || isExcluded) {
return;
}
@@ -95,8 +95,8 @@ export function search(value, { emojisToShowFilter, maxResults, include, exclude
});
if (custom.length) {
- const customIsIncluded = include && include.length ? include.indexOf('custom') > -1 : true;
- const customIsExcluded = exclude && exclude.length ? exclude.indexOf('custom') > -1 : false;
+ const customIsIncluded = include && include.length ? include.includes('custom') : true;
+ const customIsExcluded = exclude && exclude.length ? exclude.includes('custom') : false;
if (customIsIncluded && !customIsExcluded) {
addCustomToPool(custom, pool);
}
diff --git a/app/soapbox/features/emoji/emoji_utils.js b/app/soapbox/features/emoji/emoji_utils.js
index 1f4629edf..ad0319598 100644
--- a/app/soapbox/features/emoji/emoji_utils.js
+++ b/app/soapbox/features/emoji/emoji_utils.js
@@ -15,7 +15,7 @@ const buildSearch = (data) => {
(split ? string.split(/[-|_|\s]+/) : [string]).forEach((s) => {
s = s.toLowerCase();
- if (search.indexOf(s) === -1) {
+ if (!search.includes(s)) {
search.push(s);
}
});
@@ -190,7 +190,7 @@ function getData(emoji, skin, set) {
function uniq(arr) {
return arr.reduce((acc, item) => {
- if (acc.indexOf(item) === -1) {
+ if (!acc.includes(item)) {
acc.push(item);
}
return acc;
@@ -201,7 +201,7 @@ function intersect(a, b) {
const uniqA = uniq(a);
const uniqB = uniq(b);
- return uniqA.filter(item => uniqB.indexOf(item) >= 0);
+ return uniqA.filter(item => uniqB.includes(item));
}
function deepMerge(a, b) {
diff --git a/app/soapbox/features/status/components/card.tsx b/app/soapbox/features/status/components/card.tsx
index fbbe0648d..d15eaadf3 100644
--- a/app/soapbox/features/status/components/card.tsx
+++ b/app/soapbox/features/status/components/card.tsx
@@ -26,7 +26,7 @@ const addAutoPlay = (html: string): string => {
const iframe = document.querySelector('iframe');
if (iframe) {
- if (iframe.src.indexOf('?') !== -1) {
+ if (iframe.src.includes('?')) {
iframe.src += '&';
} else {
iframe.src += '?';
diff --git a/app/soapbox/features/ui/components/modal_root.js b/app/soapbox/features/ui/components/modal_root.js
index 62f9fa50f..f7b9b007c 100644
--- a/app/soapbox/features/ui/components/modal_root.js
+++ b/app/soapbox/features/ui/components/modal_root.js
@@ -92,7 +92,7 @@ export default class ModalRoot extends React.PureComponent {
}
renderLoading = modalId => () => {
- return ['MEDIA', 'VIDEO', 'BOOST', 'CONFIRM', 'ACTIONS'].indexOf(modalId) === -1 ? : null;
+ return !['MEDIA', 'VIDEO', 'BOOST', 'CONFIRM', 'ACTIONS'].includes(modalId) ? : null;
}
renderError = (props) => {
diff --git a/app/soapbox/features/ui/components/user_panel.tsx b/app/soapbox/features/ui/components/user_panel.tsx
index 6bf77b659..3c801fd25 100644
--- a/app/soapbox/features/ui/components/user_panel.tsx
+++ b/app/soapbox/features/ui/components/user_panel.tsx
@@ -28,7 +28,7 @@ const UserPanel: React.FC = ({ accountId, action, badges, domain })
if (!account) return null;
const displayNameHtml = { __html: account.get('display_name_html') };
- const acct = account.get('acct').indexOf('@') === -1 && domain ? `${account.get('acct')}@${domain}` : account.get('acct');
+ const acct = !account.get('acct').includes('@') && domain ? `${account.get('acct')}@${domain}` : account.get('acct');
const header = account.get('header');
const verified = account.get('verified');
diff --git a/app/soapbox/features/ui/index.tsx b/app/soapbox/features/ui/index.tsx
index b9fdab67d..e7c0f74e2 100644
--- a/app/soapbox/features/ui/index.tsx
+++ b/app/soapbox/features/ui/index.tsx
@@ -352,7 +352,7 @@ const UI: React.FC = ({ children }) => {
const handleDragEnter = (e: DragEvent) => {
e.preventDefault();
- if (e.target && dragTargets.current.indexOf(e.target) === -1) {
+ if (e.target && !dragTargets.current.includes(e.target)) {
dragTargets.current.push(e.target);
}
diff --git a/app/soapbox/selectors/index.ts b/app/soapbox/selectors/index.ts
index c1ab55532..2a026afe1 100644
--- a/app/soapbox/selectors/index.ts
+++ b/app/soapbox/selectors/index.ts
@@ -93,7 +93,7 @@ const toServerSideType = (columnType: string): string => {
case 'thread':
return columnType;
default:
- if (columnType.indexOf('list:') > -1) {
+ if (columnType.includes('list:')) {
return 'home';
} else {
return 'public'; // community, account, hashtag