mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-22 15:18:27 -04:00
some tiny fixes in misc.ts (#4640)
This commit is contained in:
committed by
GitHub
parent
4a7faa4237
commit
11e2bf35ae
@@ -97,11 +97,6 @@ export function getContentDispositionHeader<T extends Header>(headers: T[]): T |
|
||||
return matches.length ? matches[0] : null;
|
||||
}
|
||||
|
||||
export function getContentLengthHeader<T extends Header>(headers: T[]): T | null {
|
||||
const matches = filterHeaders(headers, 'content-length');
|
||||
return matches.length ? matches[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate an ID of the format "<MODEL_NAME>_<TIMESTAMP><RANDOM>"
|
||||
* @param prefix
|
||||
@@ -192,14 +187,6 @@ export function describeByteSize(bytes: number, long = false) {
|
||||
return `${rounded} ${unit}`;
|
||||
}
|
||||
|
||||
export function nullFn() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
export function preventDefault(e: Event) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
export function xmlDecode(input: string) {
|
||||
const ESCAPED_CHARACTERS_MAP = {
|
||||
'&': '&',
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { autoBindMethodsForReact } from 'class-autobind-decorator';
|
||||
import classnames from 'classnames';
|
||||
import { HotKeyRegistry } from 'insomnia-common';
|
||||
import { noop } from 'ramda-adjunct';
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
import { AUTOBIND_CFG } from '../../../common/constants';
|
||||
import { hotKeyRefs } from '../../../common/hotkeys';
|
||||
import * as misc from '../../../common/misc';
|
||||
import { RENDER_PURPOSE_NO_RENDER } from '../../../common/render';
|
||||
import type { Environment } from '../../../models/environment';
|
||||
import { GrpcRequest } from '../../../models/grpc-request';
|
||||
@@ -73,7 +73,7 @@ export class RequestActionsDropdown extends PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
_canPin() {
|
||||
return this.props.handleSetRequestPinned !== misc.nullFn;
|
||||
return this.props.handleSetRequestPinned !== noop;
|
||||
}
|
||||
|
||||
_handleSetRequestPinned() {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { autoBindMethodsForReact } from 'class-autobind-decorator';
|
||||
import classnames from 'classnames';
|
||||
import { noop } from 'ramda-adjunct';
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
import { AUTOBIND_CFG, DEBOUNCE_MILLIS } from '../../../common/constants';
|
||||
import { generateId, nullFn } from '../../../common/misc';
|
||||
import { generateId } from '../../../common/misc';
|
||||
import { Dropdown } from '../base/dropdown/dropdown';
|
||||
import { DropdownButton } from '../base/dropdown/dropdown-button';
|
||||
import { DropdownItem } from '../base/dropdown/dropdown-item';
|
||||
@@ -477,8 +478,8 @@ export class KeyValueEditor extends PureComponent<Props, State> {
|
||||
readOnly
|
||||
forceInput
|
||||
index={-1}
|
||||
onChange={nullFn}
|
||||
onDelete={nullFn}
|
||||
onChange={noop}
|
||||
onDelete={noop}
|
||||
renderLeftIcon={() => (
|
||||
<Dropdown>
|
||||
<DropdownButton>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { autoBindMethodsForReact } from 'class-autobind-decorator';
|
||||
import classnames from 'classnames';
|
||||
import { KeyCombination } from 'insomnia-common';
|
||||
import { noop } from 'ramda-adjunct';
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
import { AUTOBIND_CFG } from '../../../common/constants';
|
||||
import { constructKeyCombinationDisplay, isModifierKeyCode } from '../../../common/hotkeys';
|
||||
import { keyboardKeys } from '../../../common/keyboard-keys';
|
||||
import * as misc from '../../../common/misc';
|
||||
import { Modal } from '../base/modal';
|
||||
import { ModalBody } from '../base/modal-body';
|
||||
import { ModalHeader } from '../base/modal-header';
|
||||
@@ -24,8 +24,8 @@ export class AddKeyCombinationModal extends PureComponent<{}, State> {
|
||||
|
||||
state: State = {
|
||||
hotKeyRefId: null,
|
||||
checkKeyCombinationDuplicate: misc.nullFn,
|
||||
onAddKeyCombination: misc.nullFn,
|
||||
checkKeyCombinationDuplicate: noop,
|
||||
onAddKeyCombination: noop,
|
||||
pressedKeyCombination: null,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { autoBindMethodsForReact } from 'class-autobind-decorator';
|
||||
import classnames from 'classnames';
|
||||
import { HotKeyRegistry } from 'insomnia-common';
|
||||
import { noop } from 'ramda-adjunct';
|
||||
import React, { PureComponent } from 'react';
|
||||
import { PropsWithChildren } from 'react';
|
||||
import { createRef } from 'react';
|
||||
@@ -8,7 +9,6 @@ import { DragSource, DragSourceSpec, DropTarget, DropTargetMonitor, DropTargetSp
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import { AUTOBIND_CFG } from '../../../common/constants';
|
||||
import * as misc from '../../../common/misc';
|
||||
import { RequestGroup } from '../../../models/request-group';
|
||||
import { RootState } from '../../redux/modules';
|
||||
import { selectActiveEnvironment, selectActiveRequest } from '../../redux/selectors';
|
||||
@@ -165,11 +165,11 @@ class UnconnectedSidebarRequestGroupRow extends PureComponent<Props, State> {
|
||||
children
|
||||
) : (
|
||||
<SidebarRequestRow
|
||||
handleActivateRequest={misc.nullFn}
|
||||
handleDuplicateRequest={misc.nullFn}
|
||||
handleGenerateCode={misc.nullFn}
|
||||
handleCopyAsCurl={misc.nullFn}
|
||||
handleSetRequestPinned={misc.nullFn}
|
||||
handleActivateRequest={noop}
|
||||
handleDuplicateRequest={noop}
|
||||
handleGenerateCode={noop}
|
||||
handleCopyAsCurl={noop}
|
||||
handleSetRequestPinned={noop}
|
||||
isActive={false}
|
||||
requestGroup={requestGroup}
|
||||
requestCreate={handleCreateRequest}
|
||||
|
||||
Reference in New Issue
Block a user