feat: minor code refactor

This commit is contained in:
jamesgeorge007 2019-10-10 10:53:42 +05:30 committed by Sean Yesmunt
parent 6471aa2140
commit 6e7de72686
5 changed files with 6 additions and 6 deletions

View file

@ -133,7 +133,7 @@ if (!gotSingleInstanceLock) {
// HACK: patch webrequest to fix devtools incompatibility with electron 2.x.
// See https://github.com/electron/electron/issues/13008#issuecomment-400261941
session.defaultSession.webRequest.onBeforeRequest({}, (details, callback) => {
if (details.url.indexOf('7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33') !== -1) {
if (details.url.includes('7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33')) {
callback({
redirectURL: details.url.replace(
'7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33',

View file

@ -43,7 +43,7 @@ export default function FileViewer(props: Props) {
costInfo,
} = props;
const cost = costInfo && costInfo.cost;
const isPlayable = ['audio', 'video'].indexOf(mediaType) !== -1;
const isPlayable = ['audio', 'video'].includes(mediaType);
const fileStatus = fileInfo && fileInfo.status;
const supported = (IS_WEB && isStreamable) || !IS_WEB;

View file

@ -371,10 +371,10 @@ export default class Autocomplete extends React.Component {
if (value !== '' && matchedItem) {
const itemValue = getItemValue(matchedItem);
const itemValueDoesMatch =
itemValue.toLowerCase().indexOf(
itemValue.toLowerCase().includes(
value.toLowerCase()
// below line is the the only thing that is changed from the real component
) !== -1;
);
if (itemValueDoesMatch) {
return { highlightedIndex: index };
}

View file

@ -41,7 +41,7 @@ export function doDeleteFile(outpoint, deleteFromComputer, abandonClaim) {
// If the file is for a claim we published then also abandon the claim
const myClaimsOutpoints = selectMyClaimsOutpoints(state);
if (abandonClaim && myClaimsOutpoints.indexOf(outpoint) !== -1) {
if (abandonClaim && myClaimsOutpoints.includes(outpoint)) {
const [txid, nout] = outpoint.split(':');
dispatch(doAbandonClaim(txid, Number(nout)));

View file

@ -30,7 +30,7 @@ export function toQueryString(params) {
// https://stackoverflow.com/questions/5999118/how-can-i-add-or-update-a-query-string-parameter
export function updateQueryParam(uri, key, value) {
const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
const separator = uri.indexOf('?') !== -1 ? '&' : '?';
const separator = uri.includes('?') ? '&' : '?';
if (uri.match(re)) {
return uri.replace(re, '$1' + key + '=' + value + '$2');
} else {