type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
InterfaceDeclaration
interface Response extends NodeJS.ReadableStream { accepted: boolean; badRequest: boolean; body: any; charset: string; clientError: boolean; error: ResponseError; files: any; forbidden: boolean; get(header: string): string; get(header: 'Se...
8eecf0d2/DefinitelyTyped
types/superagent/index.d.ts
TypeScript
InterfaceDeclaration
interface Request extends Promise<Response> { abort(): void; accept(type: string): this; attach(field: string, file: MultipartValueSingle, options?: string | { filename?: string; contentType?: string }): this; auth(user: string, pass: string, options?: { type: 'basic' | 'auto' }): this;...
8eecf0d2/DefinitelyTyped
types/superagent/index.d.ts
TypeScript
InterfaceDeclaration
interface ProgressEvent { direction: 'download' | 'upload'; loaded: number; percent?: number; total?: number; }
8eecf0d2/DefinitelyTyped
types/superagent/index.d.ts
TypeScript
TypeAliasDeclaration
type CallbackHandler = (err: any, res: request.Response) => void;
8eecf0d2/DefinitelyTyped
types/superagent/index.d.ts
TypeScript
TypeAliasDeclaration
type Serializer = (obj: any) => string;
8eecf0d2/DefinitelyTyped
types/superagent/index.d.ts
TypeScript
TypeAliasDeclaration
type BrowserParser = (str: string) => any;
8eecf0d2/DefinitelyTyped
types/superagent/index.d.ts
TypeScript
TypeAliasDeclaration
type NodeParser = (res: request.Response, callback: (err: Error | null, body: any) => void) => void;
8eecf0d2/DefinitelyTyped
types/superagent/index.d.ts
TypeScript
TypeAliasDeclaration
type Parser = BrowserParser | NodeParser;
8eecf0d2/DefinitelyTyped
types/superagent/index.d.ts
TypeScript
TypeAliasDeclaration
type MultipartValueSingle = Blob | Buffer | fs.ReadStream | string | boolean | number;
8eecf0d2/DefinitelyTyped
types/superagent/index.d.ts
TypeScript
TypeAliasDeclaration
type MultipartValue = MultipartValueSingle | MultipartValueSingle[];
8eecf0d2/DefinitelyTyped
types/superagent/index.d.ts
TypeScript
TypeAliasDeclaration
type Plugin = (req: SuperAgentRequest) => void;
8eecf0d2/DefinitelyTyped
types/superagent/index.d.ts
TypeScript
ClassDeclaration
@Controller() export class MessageController { @Post('youtube/messages/pin') pinMessage(@Body() body, @Response() resp) { this.messageService.pinMessage(body.id); return resp.json({ success: true }); } constructor(private messageService: MessageService) {} }
brandonroberts/streamkit
apps/youtube-server/src/app/message/message.controller.ts
TypeScript
MethodDeclaration
@Post('youtube/messages/pin') pinMessage(@Body() body, @Response() resp) { this.messageService.pinMessage(body.id); return resp.json({ success: true }); }
brandonroberts/streamkit
apps/youtube-server/src/app/message/message.controller.ts
TypeScript
ClassDeclaration
export default class PistonArmCollision extends Solid { public constructor( name = 'minecraft:piston_arm_collision', // It's actually supposed to be "pistonArmCollision", but that's dumb id: BlockIdsType = BlockIdsType.PistonArmCollision ) { super({ name, id, ...
BoredSathvik/JSPrismarine
packages/prismarine/src/block/blocks/PistonArmCollision.ts
TypeScript
FunctionDeclaration
export function isBlank(toTest: String): boolean { if (toTest === null || toTest === undefined) { return true; } else { toTest = toTest.trim(); return toTest === ''; } }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
/** * Random String Generator (simplified version) * * Info: http://stackoverflow.com/a/27872144/383904 * Use: randomString(length); * Default: return a random alpha-numeric string */ export function randomString(len): string { let str = '', i = 0; for (; i++ < len; ) { let rand = Math.fl...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
/** * Helper to assert the React.CSSProperties type for all properties in a tuple, * while maintaining property names. This will fail compilation if input CSS * properties are invalid and will avoid the need for a type assertion on the * output. Also makes the properties readonly. * * This is a workaround to an i...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
export function decamelize(str: string, separator: string) { separator = typeof separator === 'undefined' ? '_' : separator; return str .replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2') .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2') .toLowerCase(); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
export function formatDomainString(domainString: string): string { return domainString === Domain.PHYSICALMEASUREMENTCSS.toString() ? fp.capitalize(Domain.PHYSICALMEASUREMENT.toString()) : domainString === Domain.WHOLEGENOMEVARIANT.toString() ? 'VCF Files' : fp.capitalize(domainString); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
export function formatDomain(domain: Domain): string { return formatDomainString(domain.toString()); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
export function sliceByHalfLength(obj) { return Math.ceil(obj.length / 2); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
export function hasNewValidProps(currProps, prevProps, fieldsToCompare) { for (const fieldGetter of fieldsToCompare) { if (!fieldGetter(currProps)) { return false; } if (fieldGetter(currProps) !== fieldGetter(prevProps)) { return true; } } return false; }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
// Returns a function which will execute `action` at most once every `sensitivityMs` milliseconds // if the returned function has been invoked within the last `sensitivityMs` milliseconds // Example : debouncing user activity events to change rate of invocation from 1000/s to 1/s export function debouncer(action, sensi...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
// Starts a timer which will invoke `f` after `timeoutInSeconds` has passed // Calling the returned function will reset the timer to zero // Example : Call a logout function after 30 seconds of the returned function not being invoked export function resettableTimeout(f, timeoutInSeconds) { let timeout; return { ...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
export function highlightSearchTerm( searchTerm: string, stringToHighlight: string, highlightColor: string ) { if (searchTerm.length < 3) { return stringToHighlight; } try { const words: string[] = []; const matchString = new RegExp( searchTerm.replace(/([^a-zA-z0-9 \-<>=\/]+)/g, () => ''...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
// render a float value as US currency, rounded to cents: 255.372793 -> $255.37 // negative values are rendered as $0 export function formatInitialCreditsUSD(value?: number): string { if (!value || value <= 0.0) { return '$0'; } else { return '$' + value.toFixed(2).toString(); } }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
// Takes a search string and validates for the most common MySQL use cases. // Checks for unclosed "", trailing + or -, and breaking special characters. export function validateInputForMySQL(searchString: string): Array<string> { const inputErrors = new Set<string>(); // use Set to prevent duplicate messages let un...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(value, ...pairs) => { const match = fp.find( ([v]) => fp.isEqual(v, value) || fp.isEqual(v, DEFAULT), pairs ); return match?.[1](); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
([v]) => fp.isEqual(v, value) || fp.isEqual(v, DEFAULT)
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(fn) => { let running = false; return (...args) => { if (!running) { running = true; window.requestAnimationFrame(() => { running = false; fn(...args); }); } }; }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(...args) => { if (!running) { running = true; window.requestAnimationFrame(() => { running = false; fn(...args); }); } }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { running = false; fn(...args); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { window.dispatchEvent(new CustomEvent('resizeAnimation')); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(): WindowSize => { return { height: window.innerHeight, width: window.innerWidth }; }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => (WrappedComponent) => { class Wrapper extends React.Component<any, { windowSize: WindowSize }> { constructor(props) { super(props); this.state = { windowSize: getWindowSize() }; } static displayName = 'withWindowSize()'; resize = () => { const { windowSize } = this.state; ...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(WrappedComponent) => { class Wrapper extends React.Component<any, { windowSize: WindowSize }> { constructor(props) { super(props); this.state = { windowSize: getWindowSize() }; } static displayName = 'withWindowSize()'; resize = () => { const { windowSize } = this.state; co...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { const { windowSize } = this.state; const newSize = getWindowSize(); if (!fp.isEqual(windowSize, newSize)) { this.setState({ windowSize: newSize }); } }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
({ field, direction }, newField) => { return newField === field ? { field, direction: direction === 'asc' ? 'desc' : 'asc' } : { field: newField, direction: 'asc' }; }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(styleObj) => (WrappedComponent) => { const Wrapper = React.forwardRef(({ style = {}, ...props }: any, ref) => { return ( <WrappedComponent ref={ref} style={{ ...styleObj, ...style }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(WrappedComponent) => { const Wrapper = React.forwardRef(({ style = {}, ...props }: any, ref) => { return ( <WrappedComponent ref={ref} style={{ ...styleObj, ...style }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
({ style = {}, ...props }: any, ref) => { return ( <WrappedComponent ref={ref} style={{
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(errors) => { const errorList = fp.cond([ [fp.isPlainObject, fp.flatMap(fp.values)], [fp.isArray, fp.identity], [() => true, () => []], ])(errors); if (errorList.length) { return errorList.map((v, i) => { return ( <div key={i} style={{ marginTop: i !== 0 ? '0.25rem' : undefined }}> ...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(v, i) => { return ( <div key={i} style={{ marginTop: i !== 0 ? '0.25rem' : undefined }}
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
<T extends {}>( subject: BehaviorSubject<T>, name: string, preventRenderUntilDataIsPresent: boolean = false ) => { return (WrappedComponent) => { class Wrapper extends React.Component<any, { value: T }> { static displayName = 'connectBehaviorSubject()'; private subscription; constructor(...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(WrappedComponent) => { class Wrapper extends React.Component<any, { value: T }> { static displayName = 'connectBehaviorSubject()'; private subscription; constructor(props) { super(props); this.state = { value: subject.getValue() }; } componentDidMount() { th...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(v) => { this.setState({ value: v }); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
<T extends {}>( subject: ReplaySubject<T>, name: string ) => { return (WrappedComponent) => { class Wrapper extends React.Component<any, { value: T }> { static displayName = 'connectReplaySubject()'; private subscription; constructor(props) { super(props); this.state = { va...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(WrappedComponent) => { class Wrapper extends React.Component<any, { value: T }> { static displayName = 'connectReplaySubject()'; private subscription; constructor(props) { super(props); this.state = { value: null }; } componentDidMount() { this.subscription ...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(v) => this.setState({ value: v })
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { return connectBehaviorSubject(currentWorkspaceStore, 'workspace'); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { return connectBehaviorSubject(currentCohortStore, 'cohort'); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { return connectBehaviorSubject(currentCohortReviewStore, 'cohortReview'); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { return connectBehaviorSubject(currentCohortCriteriaStore, 'criteria'); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { return connectBehaviorSubject(currentConceptStore, 'concept'); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { return connectBehaviorSubject( currentCohortSearchContextStore, 'cohortContext' ); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { return connectBehaviorSubject(currentConceptSetStore, 'conceptSet'); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { return connectBehaviorSubject(globalErrorStore, 'globalError'); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { return withStore(profileStore, 'profileState'); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { return withStore(cdrVersionStore, 'cdrVersionTiersResponse'); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(value, arr) => fp.concat(arr, [value])
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
<T extends {}>(value: T, arr: Array<T>) => { return fp.includes(value, arr) ? fp.pull(value, arr) : append(value, arr); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { if (Date.now() - t < sensitivityMs) { action(); } }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { t = Date.now(); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => timer
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { clearTimeout(timeout); timeout = setTimeout(f, timeoutInSeconds); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => timeout
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(word, w) => ( <span key={w}
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(fn: Function, updateList = [], ms = 250) => { useEffect(() => { const timeoutId = setTimeout(fn, ms); return () => clearTimeout(timeoutId); }, updateList); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { const timeoutId = setTimeout(fn, ms); return () => clearTimeout(timeoutId); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => clearTimeout(timeoutId)
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(): [boolean, Function] => { const [state, setState] = useState(false); useEffect(() => { if (state) { setState(false); } }, [state]); return [state, setState]; }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { if (state) { setState(false); } }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
( handler: (error: Error) => void, fnToTry: (...args: any[]) => Promise<any> ) => async (...args) => { try { return await fnToTry(...args); } catch (error) { handler(error); } }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
async (...args) => { try { return await fnToTry(...args); } catch (error) { handler(error); } }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(setters: string[], getters: string[], obj: object): object => { return fp.flow( fp.zip(getters), fp.map<[string, string], [string, object]>(([fromProp, toProp]) => [ toProp, obj[fromProp], ]), fp.fromPairs )(setters); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
([fromProp, toProp]) => [ toProp, obj[fromProp], ]
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => { const [id] = useState(() => fp.uniqueId('element-')); return id; }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
() => fp.uniqueId('element-')
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(fn, value) => value !== nothing && value ? fn(value) : nothing
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
<T extends unknown>( ...args: ([boolean, () => T] | (() => T))[] ) => { for (const arg of args) { // If the arg is an array, conditionally execute (maybe). If not an array, then this is the default case. const result = Array.isArray(arg) ? maybe(...fp.reverse(arg)) : arg(); if (result !== nothing) { ...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(username: string) => { if (!username) { return ''; } const atIdx = username.indexOf('@'); return atIdx === -1 ? username : username.substring(0, atIdx); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ArrowFunction
(value: string, maxLength: number) => value?.length > maxLength ? value.slice(0, maxLength) + '...' : value
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ClassDeclaration
class Wrapper extends React.Component<any, { windowSize: WindowSize }> { constructor(props) { super(props); this.state = { windowSize: getWindowSize() }; } static displayName = 'withWindowSize()'; resize = () => { const { windowSize } = this.state; const newSize = getWindowSiz...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ClassDeclaration
class Wrapper extends React.Component<any, { value: T }> { static displayName = 'connectBehaviorSubject()'; private subscription; constructor(props) { super(props); this.state = { value: subject.getValue() }; } componentDidMount() { this.subscription = subject.su...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
ClassDeclaration
class Wrapper extends React.Component<any, { value: T }> { static displayName = 'connectReplaySubject()'; private subscription; constructor(props) { super(props); this.state = { value: null }; } componentDidMount() { this.subscription = subject.subscribe((v) => ...
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
InterfaceDeclaration
export interface WindowSize { height: number; width: number; }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
InterfaceDeclaration
// Components using withWindowSize can use this props interface to ensure they are including the // correctly-named props, e.g. "interface MyClassProps extends WindowSizeProps". export interface WindowSizeProps { windowSize: WindowSize; }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
TypeAliasDeclaration
type ReactStyles<T> = { readonly [P in keyof T]: React.CSSProperties; };
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
MethodDeclaration
componentDidMount() { window.addEventListener('resizeAnimation', this.resize); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
MethodDeclaration
componentWillUnmount() { window.removeEventListener('resizeAnimation', this.resize); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
MethodDeclaration
render() { const { windowSize } = this.state; return <WrappedComponent windowSize={windowSize} {...this.props} />; }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
MethodDeclaration
componentDidMount() { this.subscription = subject.subscribe((v) => { this.setState({ value: v }); }); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
MethodDeclaration
componentWillUnmount() { this.subscription.unsubscribe(); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
MethodDeclaration
render() { const { value } = this.state; // We allow overriding of the currentValue, for reuse of the same // logic outside of the scope of a current workspace. if (preventRenderUntilDataIsPresent && value == null) { return null; } return <WrappedComponent {......
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
MethodDeclaration
componentDidMount() { this.subscription = subject.subscribe((v) => this.setState({ value: v }) ); }
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
MethodDeclaration
render() { const { value } = this.state; // Since ReplaySubject may not have an initial value, only render the // connected value once the value is available. return ( value && <WrappedComponent {...{ [name]: value }} {...this.props} />
all-of-us/research
ui/src/app/utils/index.tsx
TypeScript
FunctionDeclaration
function ignore(): ignore.Ignore;
jeremyrajan/vscode-gitlens
src/@types/ignore/index.d.ts
TypeScript
InterfaceDeclaration
interface Ignore { add(patterns: string | Array<string> | Ignore): Ignore; filter(paths: Array<string>): Array<string>; }
jeremyrajan/vscode-gitlens
src/@types/ignore/index.d.ts
TypeScript
TypeAliasDeclaration
export type SimpleBinaryKernelImplCPU = SimpleBinaryKernelImpl;
BadMachine/tfjs
tfjs-backend-webgpu/src/kernel_utils/shared.ts
TypeScript
TypeAliasDeclaration
export type SimpleUnaryKernelImplCPU = SimpleUnaryImpl;
BadMachine/tfjs
tfjs-backend-webgpu/src/kernel_utils/shared.ts
TypeScript