type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
InterfaceDeclaration
interface Output { foo: number, bar: number, }
Paqmind/rambda
source/renameProps-spec.ts
TypeScript
ArrowFunction
() => { this.setState({ on: !this.state.on }); }
tplvcontrol/tpleng-site-2020
src/ToggleRPC.tsx
TypeScript
ClassDeclaration
export default class Toggle extends Component { state = { on: false }; toggle = () => { this.setState({ on: !this.state.on }); }; render() { const { children } = this.props; return children({ on: this.state.on, toggle: this.toggle }); } }
tplvcontrol/tpleng-site-2020
src/ToggleRPC.tsx
TypeScript
MethodDeclaration
render() { const { children } = this.props; return children({ on: this.state.on, toggle: this.toggle }); }
tplvcontrol/tpleng-site-2020
src/ToggleRPC.tsx
TypeScript
ClassDeclaration
/** * CodePipeline invoke Action that is provided by an AWS Lambda function. * * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html */ export class LambdaInvokeAction extends Action { private readonly props: LambdaInvokeActionProps; constructor(props: LambdaInvokeActionProps) { super({ ...props, resource: props.lambda, category: codepipeline.ActionCategory.INVOKE, provider: 'Lambda', artifactBounds: { minInputs: 0, maxInputs: 5, minOutputs: 0, maxOutputs: 5, }, }); this.props = props; if (props.userParameters && props.userParametersString) { throw new Error('Only one of userParameters or userParametersString can be specified'); } } /** * Reference a CodePipeline variable defined by the Lambda function this action points to. * Variables in Lambda invoke actions are defined by calling the PutJobSuccessResult CodePipeline API call * with the 'outputVariables' property filled. * * @param variableName the name of the variable to reference. * A variable by this name must be present in the 'outputVariables' section of the PutJobSuccessResult * request that the Lambda function calls when the action is invoked * * @see https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_PutJobSuccessResult.html */ public variable(variableName: string): string { return this.variableExpression(variableName); } protected bound(scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): codepipeline.ActionConfig { // allow pipeline to list functions options.role.addToPolicy(new iam.PolicyStatement({ actions: ['lambda:ListFunctions'], resources: ['*'], })); // allow pipeline to invoke this lambda functionn this.props.lambda.grantInvoke(options.role); // allow the Role access to the Bucket, if there are any inputs/outputs if ((this.actionProperties.inputs || []).length > 0) { options.bucket.grantRead(options.role); } if ((this.actionProperties.outputs || []).length > 0) { options.bucket.grantWrite(options.role); } // allow lambda to put job results for this pipeline // CodePipeline requires this to be granted to '*' // (the Pipeline ARN will not be enough) this.props.lambda.addToRolePolicy(new iam.PolicyStatement({ resources: ['*'], actions: ['codepipeline:PutJobSuccessResult', 'codepipeline:PutJobFailureResult'], })); return { configuration: { FunctionName: this.props.lambda.functionName, UserParameters: this.props.userParametersString ?? Stack.of(scope).toJsonString(this.props.userParameters), }, }; } }
CarlosDomingues/aws-cdk
packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts
TypeScript
InterfaceDeclaration
/** * Construction properties of the {@link LambdaInvokeAction Lambda invoke CodePipeline Action}. */ export interface LambdaInvokeActionProps extends codepipeline.CommonAwsActionProps { /** * The optional input Artifacts of the Action. * A Lambda Action can have up to 5 inputs. * The inputs will appear in the event passed to the Lambda, * under the `'CodePipeline.job'.data.inputArtifacts` path. * * @default the Action will not have any inputs * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html#actions-invoke-lambda-function-json-event-example */ readonly inputs?: codepipeline.Artifact[]; /** * The optional names of the output Artifacts of the Action. * A Lambda Action can have up to 5 outputs. * The outputs will appear in the event passed to the Lambda, * under the `'CodePipeline.job'.data.outputArtifacts` path. * It is the responsibility of the Lambda to upload ZIP files with the Artifact contents to the provided locations. * * @default the Action will not have any outputs */ readonly outputs?: codepipeline.Artifact[]; /** * A set of key-value pairs that will be accessible to the invoked Lambda * inside the event that the Pipeline will call it with. * * Only one of `userParameters` or `userParametersString` can be specified. * * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-invoke-lambda-function.html#actions-invoke-lambda-function-json-event-example * @default - no user parameters will be passed */ readonly userParameters?: { [key: string]: any }; /** * The string representation of the user parameters that will be * accessible to the invoked Lambda inside the event * that the Pipeline will call it with. * * Only one of `userParametersString` or `userParameters` can be specified. * * @default - no user parameters will be passed */ readonly userParametersString?: string; /** * The lambda function to invoke. */ readonly lambda: lambda.IFunction; }
CarlosDomingues/aws-cdk
packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts
TypeScript
MethodDeclaration
/** * Reference a CodePipeline variable defined by the Lambda function this action points to. * Variables in Lambda invoke actions are defined by calling the PutJobSuccessResult CodePipeline API call * with the 'outputVariables' property filled. * * @param variableName the name of the variable to reference. * A variable by this name must be present in the 'outputVariables' section of the PutJobSuccessResult * request that the Lambda function calls when the action is invoked * * @see https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_PutJobSuccessResult.html */ public variable(variableName: string): string { return this.variableExpression(variableName); }
CarlosDomingues/aws-cdk
packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts
TypeScript
MethodDeclaration
protected bound(scope: Construct, _stage: codepipeline.IStage, options: codepipeline.ActionBindOptions): codepipeline.ActionConfig { // allow pipeline to list functions options.role.addToPolicy(new iam.PolicyStatement({ actions: ['lambda:ListFunctions'], resources: ['*'], })); // allow pipeline to invoke this lambda functionn this.props.lambda.grantInvoke(options.role); // allow the Role access to the Bucket, if there are any inputs/outputs if ((this.actionProperties.inputs || []).length > 0) { options.bucket.grantRead(options.role); } if ((this.actionProperties.outputs || []).length > 0) { options.bucket.grantWrite(options.role); } // allow lambda to put job results for this pipeline // CodePipeline requires this to be granted to '*' // (the Pipeline ARN will not be enough) this.props.lambda.addToRolePolicy(new iam.PolicyStatement({ resources: ['*'], actions: ['codepipeline:PutJobSuccessResult', 'codepipeline:PutJobFailureResult'], })); return { configuration: { FunctionName: this.props.lambda.functionName, UserParameters: this.props.userParametersString ?? Stack.of(scope).toJsonString(this.props.userParameters), }, }; }
CarlosDomingues/aws-cdk
packages/@aws-cdk/aws-codepipeline-actions/lib/lambda/invoke-action.ts
TypeScript
ArrowFunction
() => import(/* webpackChunkName: "playersList" */ '@/views/player/list.vue')
leonway/honor-admin
src/router/modules/players.ts
TypeScript
ArrowFunction
() => import('@/views/player/create.vue')
leonway/honor-admin
src/router/modules/players.ts
TypeScript
ArrowFunction
() => import('@/views/player/edit.vue')
leonway/honor-admin
src/router/modules/players.ts
TypeScript
ClassDeclaration
export class DisassociateServerVirtualIpRequest { private 'nic_id': string | undefined; public body?: DisassociateServerVirtualIpRequestBody; public constructor(nicId?: any) { this['nic_id'] = nicId; } public withNicId(nicId: string): DisassociateServerVirtualIpRequest { this['nic_id'] = nicId; return this; } public set nicId(nicId: string | undefined) { this['nic_id'] = nicId; } public get nicId() { return this['nic_id']; } public withBody(body: DisassociateServerVirtualIpRequestBody): DisassociateServerVirtualIpRequest { this['body'] = body; return this; } }
huaweicloud/huaweicloud-sdk-nodejs-v3
services/ecs/v2/model/DisassociateServerVirtualIpRequest.ts
TypeScript
MethodDeclaration
public withNicId(nicId: string): DisassociateServerVirtualIpRequest { this['nic_id'] = nicId; return this; }
huaweicloud/huaweicloud-sdk-nodejs-v3
services/ecs/v2/model/DisassociateServerVirtualIpRequest.ts
TypeScript
MethodDeclaration
public withBody(body: DisassociateServerVirtualIpRequestBody): DisassociateServerVirtualIpRequest { this['body'] = body; return this; }
huaweicloud/huaweicloud-sdk-nodejs-v3
services/ecs/v2/model/DisassociateServerVirtualIpRequest.ts
TypeScript
ArrowFunction
i => contextTypeOf(ctx).includes(i)
t532-old/ionjs
src/transform/origin.ts
TypeScript
ClassDeclaration
/** Transformations related to the origin user */ export class OriginTransform extends BaseTransform { protected _manager = new MiddlewareManager<IExtensibleMessage>() private readonly _operators: number[] /** * @param operators users with OriginPermission.OPERATOR permission level */ public constructor(operators: number[] = []) { super() this._operators = operators } /** Deep-copy a Transform object */ public static from(last: OriginTransform) { const next = new OriginTransform(last._operators) next._manager = MiddlewareManager.from(last._manager) return next } /** Require the message to be from specific group(s) */ public isFromGroup(...id: number[]) { return this._derive(async function (ctx, next) { if (id.includes(ctx.group_id)) await next() }) } /** Require the message to be from specific discuss group(s) */ public isFromDiscuss(...id: number[]) { return this._derive(async function (ctx, next) { if (id.includes(ctx.discuss_id)) await next() }) } /** Require the message to be from specific user(s) */ public isFromUser(...id: number[]) { return this._derive(async function (ctx, next) { if (id.includes(ctx.user_id)) await next() }) } /** Require the message to be specific type(s) */ public isType(...types: string[]) { return this._derive(async function (ctx, next) { if (types.some(i => contextTypeOf(ctx).includes(i))) await next() }) } /** Require the message's sender to have a specific level of permission */ public hasPermission(level: OriginPermission) { return this._derive(async function (ctx, next) { switch (level) { case OriginPermission.EVERYONE: await next() break case OriginPermission.OPERATOR: if (this._operators.includes(ctx.user_id)) await next() break case OriginPermission.ADMIN: if (!ctx.sender.role || ctx.sender.role === 'admin' || ctx.sender.role === 'owner') await next() break case OriginPermission.OWNER: if (!ctx.sender.role || ctx.sender.role === 'owner') await next() break } }) } private _derive(mw: IMiddleware<IExtensibleMessage>) { const next = OriginTransform.from(this) next._manager = this._manager.use(mw) return next } }
t532-old/ionjs
src/transform/origin.ts
TypeScript
EnumDeclaration
/** Permission levels of OriginTransform.hasPermission() */ export enum OriginPermission { EVERYONE, ADMIN, OWNER, OPERATOR }
t532-old/ionjs
src/transform/origin.ts
TypeScript
MethodDeclaration
/** Deep-copy a Transform object */ public static from(last: OriginTransform) { const next = new OriginTransform(last._operators) next._manager = MiddlewareManager.from(last._manager) return next }
t532-old/ionjs
src/transform/origin.ts
TypeScript
MethodDeclaration
/** Require the message to be from specific group(s) */ public isFromGroup(...id: number[]) { return this._derive(async function (ctx, next) { if (id.includes(ctx.group_id)) await next() }) }
t532-old/ionjs
src/transform/origin.ts
TypeScript
MethodDeclaration
/** Require the message to be from specific discuss group(s) */ public isFromDiscuss(...id: number[]) { return this._derive(async function (ctx, next) { if (id.includes(ctx.discuss_id)) await next() }) }
t532-old/ionjs
src/transform/origin.ts
TypeScript
MethodDeclaration
/** Require the message to be from specific user(s) */ public isFromUser(...id: number[]) { return this._derive(async function (ctx, next) { if (id.includes(ctx.user_id)) await next() }) }
t532-old/ionjs
src/transform/origin.ts
TypeScript
MethodDeclaration
/** Require the message to be specific type(s) */ public isType(...types: string[]) { return this._derive(async function (ctx, next) { if (types.some(i => contextTypeOf(ctx).includes(i))) await next() }) }
t532-old/ionjs
src/transform/origin.ts
TypeScript
MethodDeclaration
/** Require the message's sender to have a specific level of permission */ public hasPermission(level: OriginPermission) { return this._derive(async function (ctx, next) { switch (level) { case OriginPermission.EVERYONE: await next() break case OriginPermission.OPERATOR: if (this._operators.includes(ctx.user_id)) await next() break case OriginPermission.ADMIN: if (!ctx.sender.role || ctx.sender.role === 'admin' || ctx.sender.role === 'owner') await next() break case OriginPermission.OWNER: if (!ctx.sender.role || ctx.sender.role === 'owner') await next() break } }) }
t532-old/ionjs
src/transform/origin.ts
TypeScript
MethodDeclaration
private _derive(mw: IMiddleware<IExtensibleMessage>) { const next = OriginTransform.from(this) next._manager = this._manager.use(mw) return next }
t532-old/ionjs
src/transform/origin.ts
TypeScript
ArrowFunction
p => p.theme.breakpoints.down("md")
jean182/blog-182
src/components/newsletter/newsletter.styled.ts
TypeScript
ArrowFunction
p => p.theme.breakpoints.up("md")
jean182/blog-182
src/components/newsletter/newsletter.styled.ts
TypeScript
ClassDeclaration
/** * Kubernetes * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v1.21.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * TokenReviewSpec is a description of the token authentication request. */ export declare class V1beta1TokenReviewSpec { /** * Audiences is a list of the identifiers that the resource server presented with the token identifies as. Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver. */ 'audiences'?: Array<string>; /** * Token is the opaque bearer token. */ 'token'?: string; static discriminator: string | undefined; static attributeTypeMap: Array<{ name: string; baseName: string; type: string; }>; static getAttributeTypeMap(): { name: string; baseName: string; type: string; }[]; }
hermaproditus/javascript
dist/gen/model/v1beta1TokenReviewSpec.d.ts
TypeScript
MethodDeclaration
static getAttributeTypeMap(): { name: string; baseName: string; type: string; }[];
hermaproditus/javascript
dist/gen/model/v1beta1TokenReviewSpec.d.ts
TypeScript
ArrowFunction
(name: string, document: Element | Document): Element[] => { return Array.from(document.querySelectorAll("meta")).filter(meta => { return meta.getAttribute("name") === name; }); }
HataYuki/rikaaa-paging
src/getMeta.ts
TypeScript
ArrowFunction
meta => { return meta.getAttribute("name") === name; }
HataYuki/rikaaa-paging
src/getMeta.ts
TypeScript
ClassDeclaration
export default class Collapse extends React.Component<Props> {}
AshoneA/collapse
index.d.ts
TypeScript
InterfaceDeclaration
export interface Props { children: React.ReactChild, prefixCls: string, activeKey: string | string[], defaultActiveKey: string | string[], openAnimation: object, onChange: (key: any) => void, accordion: boolean, className: string, style: object, destroyInactivePanel: boolean, expandIcon: (props: object) => React.ReactNode, }
AshoneA/collapse
index.d.ts
TypeScript
ClassDeclaration
@Entity('sougou_dict_metas') export class SougouDictMetaEntity { @PrimaryColumn({ type: 'int' }) id: number; @Column('text', { nullable: false }) name: string; @Column('text', { nullable: true }) createdBy: string; @Column('timestamp', { // comment: 'Unix Timestamp', // transformer: { // from(value: any): any { // if (value instanceof Date) { // return value; // } // return value ? new Date(value * 1000) : null // }, // to(value: any): any { // if (typeof value === 'number') { // return value; // } // return value ? Math.fround(+(value as Date) / 1000) : null // } // } }) updatedAt: Date; @Column('int') size: number; @Column('int') count: number; @Column('int') downloadCount: number; @Column('int', { default: 0 }) version: number; }
wenerme/apis
src/libs/sougou/dict/schema.ts
TypeScript
ArrowFunction
() => { let page: AppPage; beforeEach(() => { page = new AppPage(); }); it('should display welcome message', () => { page.navigateTo(); expect(page.getTitleText()).toEqual('cacc-web-frontend app is running!'); }); afterEach(async () => { // Assert that there are no errors emitted from the browser const logs = await browser.manage().logs().get(logging.Type.BROWSER); expect(logs).not.toContain(jasmine.objectContaining({ level: logging.Level.SEVERE, } as logging.Entry)); }); }
kkoripl/CACCGeneratorWeb
e2e/src/app.e2e-spec.ts
TypeScript
ArrowFunction
() => { page = new AppPage(); }
kkoripl/CACCGeneratorWeb
e2e/src/app.e2e-spec.ts
TypeScript
ArrowFunction
() => { page.navigateTo(); expect(page.getTitleText()).toEqual('cacc-web-frontend app is running!'); }
kkoripl/CACCGeneratorWeb
e2e/src/app.e2e-spec.ts
TypeScript
ArrowFunction
async () => { // Assert that there are no errors emitted from the browser const logs = await browser.manage().logs().get(logging.Type.BROWSER); expect(logs).not.toContain(jasmine.objectContaining({ level: logging.Level.SEVERE, } as logging.Entry)); }
kkoripl/CACCGeneratorWeb
e2e/src/app.e2e-spec.ts
TypeScript
ArrowFunction
() => { let component: DiscoverComponent; let fixture: ComponentFixture<DiscoverComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [DiscoverComponent], }).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(DiscoverComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it("should create", () => { expect(component).toBeTruthy(); }); }
DanteDeRuwe/zappr-frontend
src/app/series/discover/discover.component.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ declarations: [DiscoverComponent], }).compileComponents(); }
DanteDeRuwe/zappr-frontend
src/app/series/discover/discover.component.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(DiscoverComponent); component = fixture.componentInstance; fixture.detectChanges(); }
DanteDeRuwe/zappr-frontend
src/app/series/discover/discover.component.spec.ts
TypeScript
ArrowFunction
() => { let httpPutAction: HttpPutAction; beforeEach(() => { httpPutAction = new HttpPutAction(null, null); }); it('should be created', () => { expect(httpPutAction).to.be.ok; }); }
Rothen/http-ts
spec/controller/helper/http_method/HTTPPutAction.spec.ts
TypeScript
ArrowFunction
() => { httpPutAction = new HttpPutAction(null, null); }
Rothen/http-ts
spec/controller/helper/http_method/HTTPPutAction.spec.ts
TypeScript
ArrowFunction
() => { expect(httpPutAction).to.be.ok; }
Rothen/http-ts
spec/controller/helper/http_method/HTTPPutAction.spec.ts
TypeScript
ClassDeclaration
export class WowfModel implements DeserializableModel<WowfModel> { //TODO field name : type deserialize(input: any): WowfModel { Object.assign(this, input); return this; } }
morgan630218/Test
src/app/models/wowf-model.ts
TypeScript
MethodDeclaration
//TODO field name : type deserialize(input: any): WowfModel { Object.assign(this, input); return this; }
morgan630218/Test
src/app/models/wowf-model.ts
TypeScript
ArrowFunction
(rgbString: string): boolean => { if (typeof rgbString !== 'string') throw new Error(`'rgbString' must be a string`); if (rgbString.startsWith('#')) return validateHexRGB(rgbString); else return validateFunctionalRGB(rgbString); }
pr357/is-valid-css-color
src/isValidRGB/index.ts
TypeScript
FunctionDeclaration
function useHookWithRefCallback<T>(init: T) { const [rect, setRect] = React.useState(init); const ref = React.useCallback((node: T) => { setRect(node); }, []); return [rect, ref] as const; }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
FunctionDeclaration
function Button({ onClick, direction }: { onClick: () => any direction: 'left' | 'right' }) { return ( <div className={styles.buttonWrap} style={{ [direction]: 0, justifyContent: direction === 'left' ? 'flex-start' : 'flex-end' }}
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
FunctionDeclaration
export function Carousel<T>({ id, data, renderItem, keyExtractor, inverted = false, ItemSeparatorComponent, ListEmptyComponent, ListHeaderComponent, ListFooterComponent, className, style, initialIndex = 0, onChange = () => {}, width = 200, forwardRef, enableArrowKeys = false }: CarouselProps<T>) { const [ div, internalRef ] = useHookWithRefCallback<HTMLDivElement | null>(null); const [index, setIndex] = React.useState(initialIndex ?? 0); const [ loading, setLoading ] = React.useState(true); const scrollTimeout = React.useRef<number | undefined>(); React.useEffect(() => { if (!div) return; div.scrollLeft = index * width; }, [width]); React.useEffect(() => { setLoading(true); if (forwardRef) { forwardRef(div); } if (!div) return; setIndex(initialIndex); const newIndex = clamp( 0, initialIndex, data.length - 1 ); div.scrollLeft = newIndex * width; // timeout prevents scroll animation on load let timeout = setTimeout(() => { setLoading(false); }, 50); return () => { clearTimeout(timeout); } }, [div, id]); const updateScroll = React.useCallback( (offset: number) => { if (!div) return; const newIndex = clamp(0, index + offset, data.length - 1); // div.scrollLeft = newIndex * width; div.scroll({ top: 0, left: newIndex * width, behavior: 'smooth' }); }, [data.length, div, index, width] ); React.useEffect(() => { if (!enableArrowKeys || typeof window === 'undefined') { return; } const LEFT_ARROW = 37; const RIGHT_ARROW = 39; const handleEsc = (event: KeyboardEvent) => { if (event.keyCode === LEFT_ARROW) { updateScroll(-1); } if (event.keyCode === RIGHT_ARROW) { updateScroll(1); } }; window.addEventListener('keydown', handleEsc); return () => { window.removeEventListener('keydown', handleEsc); }; }, [updateScroll, enableArrowKeys]); if(data.length === 0) { return ListEmptyComponent ? ( <> {ListEmptyComponent} </> ) : null; } function renderItemWithExtras(item: any, i: number) { return <> {i !== 0 ? ItemSeparatorComponent : null} {renderItem(item, i)} </>; }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
FunctionDeclaration
function renderItemWithExtras(item: any, i: number) { return <> {i !== 0 ? ItemSeparatorComponent : null}
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
FunctionDeclaration
function CarouselResponsive<T>({ ...props }: CarouselBase<T>) { const [ width, setWidth ] = React.useState(0); const [ div, ref ] = useHookWithRefCallback<HTMLDivElement | null>(null); const handleResize = React.useCallback( () => { const newWidth = div?.offsetWidth ?? 0; if (newWidth !== width) { setWidth(div?.offsetWidth ?? 0); } }, [width, div] ); React.useEffect(() => { handleResize(); }, [div]); React.useEffect(() => { if(process.browser && div) { window.addEventListener('resize', handleResize, { passive: true }); return () => { window.removeEventListener('resize', handleResize); } } }, [div, handleResize]); return ( <Carousel width={width} forwardRef={ref} {...props} /> ) }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
(node: T) => { setRect(node); }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { if (!div) return; div.scrollLeft = index * width; }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { setLoading(true); if (forwardRef) { forwardRef(div); } if (!div) return; setIndex(initialIndex); const newIndex = clamp( 0, initialIndex, data.length - 1 ); div.scrollLeft = newIndex * width; // timeout prevents scroll animation on load let timeout = setTimeout(() => { setLoading(false); }, 50); return () => { clearTimeout(timeout); } }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { setLoading(false); }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { clearTimeout(timeout); }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
(offset: number) => { if (!div) return; const newIndex = clamp(0, index + offset, data.length - 1); // div.scrollLeft = newIndex * width; div.scroll({ top: 0, left: newIndex * width, behavior: 'smooth' }); }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { if (!enableArrowKeys || typeof window === 'undefined') { return; } const LEFT_ARROW = 37; const RIGHT_ARROW = 39; const handleEsc = (event: KeyboardEvent) => { if (event.keyCode === LEFT_ARROW) { updateScroll(-1); } if (event.keyCode === RIGHT_ARROW) { updateScroll(1); } }; window.addEventListener('keydown', handleEsc); return () => { window.removeEventListener('keydown', handleEsc); }; }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
(event: KeyboardEvent) => { if (event.keyCode === LEFT_ARROW) { updateScroll(-1); } if (event.keyCode === RIGHT_ARROW) { updateScroll(1); } }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { window.removeEventListener('keydown', handleEsc); }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { if (crntIndex !== index) { setIndex(crntIndex); onChange(crntIndex); } }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
(item: any, i: number) => ( <React.Fragment key={keyExtractor(item, i)}> <div className
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { const newWidth = div?.offsetWidth ?? 0; if (newWidth !== width) { setWidth(div?.offsetWidth ?? 0); } }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { handleResize(); }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { if(process.browser && div) { window.addEventListener('resize', handleResize, { passive: true }); return () => { window.removeEventListener('resize', handleResize); } } }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { window.removeEventListener('resize', handleResize); }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
InterfaceDeclaration
interface CarouselBase<T> { id?: string; data: T[]; renderItem: (item: T, index: number) => ReactChildren; keyExtractor: (item: T, index: number) => string | number; inverted?: boolean; ItemSeparatorComponent?: ReactChildren; ListEmptyComponent?: ReactChildren; ListHeaderComponent?: ReactChildren; ListFooterComponent?: ReactChildren; className?: string; style?: React.CSSProperties; initialIndex?: number; onChange?: (index: number) => any; width?: number; enableArrowKeys?: boolean }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
InterfaceDeclaration
interface CarouselProps<T> extends CarouselBase<T> { forwardRef?: ((instance: HTMLDivElement | null) => void) | null }
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
MethodDeclaration
cn( className, styles
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
MethodDeclaration
keyExtractor(item, i)
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
MethodDeclaration
renderItemWithExtras(item, i)
jac-wida/daily-targum-website
src/components/Carousel.tsx
TypeScript
ArrowFunction
() => { const [response, setResponse] = useState<DebugResponse | null>(null) const [host, setHost] = useState("127.0.0.1") const [port, setPort] = useState("45678") const [endpoint, setEndpoint] = useState("search") const [requestBody, setRequestBody] = useState("") const [loading, setLoading] = useState(false) const handleRequest = async () => { setLoading(true) console.log("Sending Request Body", JSON.parse(requestBody)) try { const searchResult = await axios.request<DebugResponse>({ method: "post", url: `http://${host}:${port}/${endpoint}`, data: requestBody, headers: { mode: "no-cors", }, }) console.log("Search Result:", searchResult) setLoading(false) if (searchResult.data) { setResponse(searchResult.data) } } catch (e) { setLoading(false) alert("Error: " + e) } } return ( <Container data-name="debuggingTool"> <Grid container spacing={2}> <Grid item xs={12}> <Card> <CardContent> <Grid container spacing={2}> <Grid item xs={4}> <TextInput label="Host" variant="outlined" value={host} onChange={(e)
anhgeeky/dashboard
src/views/DebuggingTool.tsx
TypeScript
ArrowFunction
async () => { setLoading(true) console.log("Sending Request Body", JSON.parse(requestBody)) try { const searchResult = await axios.request<DebugResponse>({ method: "post", url: `http://${host}:${port}/${endpoint}`, data: requestBody, headers: { mode: "no-cors", }, }) console.log("Search Result:", searchResult) setLoading(false) if (searchResult.data) { setResponse(searchResult.data) } } catch (e) { setLoading(false) alert("Error: " + e) } }
anhgeeky/dashboard
src/views/DebuggingTool.tsx
TypeScript
TypeAliasDeclaration
export type ResponseMode = "text" | "image" | "audio" | "video"
anhgeeky/dashboard
src/views/DebuggingTool.tsx
TypeScript
TypeAliasDeclaration
export type Route = { end_time: string start_time: string pod: string pod_id: string }
anhgeeky/dashboard
src/views/DebuggingTool.tsx
TypeScript
TypeAliasDeclaration
export type Score = { description: string op_name: string ref_id: string operands?: Score[] value?: number }
anhgeeky/dashboard
src/views/DebuggingTool.tsx
TypeScript
TypeAliasDeclaration
export type Match = { id: string scores: { values: { [key: string]: Score } } mime_type: string adjacency?: number granularity?: number text?: string uri?: string }
anhgeeky/dashboard
src/views/DebuggingTool.tsx
TypeScript
TypeAliasDeclaration
export type Chunk = { id: string granularity?: number content_hash: string mime_type: string parent_id: string text?: string uri?: string matches: Match[] }
anhgeeky/dashboard
src/views/DebuggingTool.tsx
TypeScript
TypeAliasDeclaration
export type Doc = { id: string tags: { [key: string]: string } adjacency?: number modality?: string score?: { value: number } text?: string uri?: string mime_type?: string matches?: Match[] chunks?: Chunk[] }
anhgeeky/dashboard
src/views/DebuggingTool.tsx
TypeScript
TypeAliasDeclaration
export type DebugResponse = { request_id: string parameters: { mode: ResponseMode } routes: Route[] header: { exec_endpoint: string } data: { docs: Doc[] } | Doc[] }
anhgeeky/dashboard
src/views/DebuggingTool.tsx
TypeScript
ArrowFunction
(path:string) => { if (fs.existsSync(path)) { return dotenv.parse(fs.readFileSync(path, 'utf8').toString()) } return {}; }
kaiquelupo/twilio-pulumi
src/utils/index.ts
TypeScript
ArrowFunction
(attributes: any) => { const { envPath, env, cwd } = attributes; const newAttributes = { ...attributes }; newAttributes.cwd = path.join(process.cwd(), cwd); newAttributes.pkgJson = require(path.join(newAttributes.cwd, "package.json")); if(envPath) { newAttributes.env = { ...env, ...getEnv(path.join(newAttributes.cwd, envPath)) } } return newAttributes; }
kaiquelupo/twilio-pulumi
src/utils/index.ts
TypeScript
ArrowFunction
(cwd:string) => { const absolutePath = cwd ? path.join(process.cwd(), cwd) : process.cwd(); const pathMatch = absolutePath.match(/.*\/(src\/.*)/); const relativePath = pathMatch ? pathMatch[1] : ""; return { absolutePath, relativePath } }
kaiquelupo/twilio-pulumi
src/utils/index.ts
TypeScript
ArrowFunction
(opts?:any) => { const { isServerless=false } = opts || {}; const { TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, TWILIO_USERNAME, TWILIO_PASSWORD } = process.env; if(isServerless) { return new TwilioServerlessApiClient({ username: (TWILIO_USERNAME || TWILIO_ACCOUNT_SID)!, password: (TWILIO_PASSWORD || TWILIO_AUTH_TOKEN)! }) } return TWILIO_USERNAME ? twilio(TWILIO_USERNAME, TWILIO_PASSWORD, { accountSid: TWILIO_ACCOUNT_SID }) : twilio(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN); }
kaiquelupo/twilio-pulumi
src/utils/index.ts
TypeScript
ArrowFunction
props => props.theme.space.sm
Bojagi/zendesk-react-components
packages/tables/stories/examples/Scrollable.tsx
TypeScript
ArrowFunction
props => props.theme.lineHeights.xl
Bojagi/zendesk-react-components
packages/tables/stories/examples/Scrollable.tsx
TypeScript
ArrowFunction
props => props.theme.fontSizes.xl
Bojagi/zendesk-react-components
packages/tables/stories/examples/Scrollable.tsx
TypeScript
ArrowFunction
() => ( <Dropdown onSelect={(selectedKey: any)
Bojagi/zendesk-react-components
packages/tables/stories/examples/Scrollable.tsx
TypeScript
ArrowFunction
(data: any) => { /** * Ensure correct placement relative to trigger **/ data.offsets.popper.top -= 2; return data; }
Bojagi/zendesk-react-components
packages/tables/stories/examples/Scrollable.tsx
TypeScript
ArrowFunction
({ foo }) => ( <div role="grid"
Bojagi/zendesk-react-components
packages/tables/stories/examples/Scrollable.tsx
TypeScript
ArrowFunction
data => ( <Row key={data.id}
Bojagi/zendesk-react-components
packages/tables/stories/examples/Scrollable.tsx
TypeScript
InterfaceDeclaration
interface IRow { id: number; subject: string; requester: string; requested: string; type: string; }
Bojagi/zendesk-react-components
packages/tables/stories/examples/Scrollable.tsx
TypeScript
ClassDeclaration
/* * Copyright 2021 Marcus Portmann * * Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an 'AS IS' BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The Session class holds the information for an active user session associated with an * authenticated user. All values are stored as strings to support the serialization of the user * session. * * @author Marcus Portmann */ export class Session { /** * The base-64 encoded OAuth2 JWT access token for the user session. */ accessToken: string; /** * The date and time the OAuth2 JWT access token for the user session will expire. */ accessTokenExpiry?: Date; /** * The codes for the functions assigned to the user associated with the user session. */ functionCodes: string[]; /** * The name of the user. */ name: string; /** * The base-64 encoded OAuth2 refresh token for the user session. */ refreshToken?: string; /** * The codes for the roles assigned to the user associated with the user session. */ roleCodes: string[]; /** * The OAuth2 scopes for the user session. */ scopes: string[]; /** * The ID for the selected tenant for the user session. */ tenantId?: string; /** * The IDs for tenants the user is associated with. */ tenantIds: string[]; /** * The ID for the user directory the user is associated with. */ userDirectoryId: string; /** * The username for the user, the user session is associated with. */ username: string; /** * Constructs a new Session. * * @param username The username for the user the user session is associated with. * @param userDirectoryId The ID for the user directory the * user is associated with. * @param name The name of the user. * @param scopes The OAuth2 scopes for the user session. * @param roleCodes The codes for the roles assigned to the user associated with * the user session. * @param functionCodes The codes for the functions assigned to the user associated * with the user session. * @param tenantIds The IDs for the tenants the user * is associated with. * @param accessToken The base-64 encoded OAuth2 JWT access token for the user session. * @param accessTokenExpiry The string representation of the epoch timestamp giving the date and * time the OAuth2 JWT access token for the user session will expire. * @param refreshToken The base-64 encoded OAuth2 refresh token for the user session. */ constructor(username: string, userDirectoryId: string, name: string, scopes: string[], roleCodes: string[], functionCodes: string[], tenantIds: string[], accessToken: string, accessTokenExpiry?: Date, refreshToken?: string) { this.username = username; this.userDirectoryId = userDirectoryId; this.name = name; this.scopes = scopes; this.roleCodes = roleCodes; this.functionCodes = functionCodes; this.tenantIds = tenantIds; this.accessToken = accessToken; this.accessTokenExpiry = accessTokenExpiry; this.refreshToken = refreshToken; } /** * Confirm that the user associated with the session has the specified authority. * * @param requiredAuthority The required authority. * * @return True if the user associated with the session has the specified authority or false * otherwise. */ hasAuthority(requiredAuthority: string): boolean { if (requiredAuthority.startsWith('ROLE_')) { if (requiredAuthority.length < 6) { return false; } else { return this.hasRole(requiredAuthority.substr(5)); } } if (requiredAuthority.startsWith('FUNCTION_')) { if (requiredAuthority.length < 10) { return false; } else { return this.hasFunction(requiredAuthority.substr(9)); } } return false; } /** * Confirm that the user associated with the session has been assigned the required function. * * @param requiredFunctionCode The code for the required function. * * @return True if the user associated with the session has been assigned the required function * or false otherwise. */ hasFunction(requiredFunctionCode: string): boolean { for (const functionCode of this.functionCodes) { if (functionCode.localeCompare(requiredFunctionCode, undefined, {sensitivity: 'accent'}) === 0) { return true; } } return false; } /** * Confirm that the user associated with the session has been assigned the required role. * * @param requiredRoleCode The code for the required role. * * @return True if the user associated with the session has been assigned the required role or * false otherwise. */ hasRole(requiredRoleCode: string): boolean { for (const roleCode of this.roleCodes) { if (roleCode.localeCompare(requiredRoleCode, undefined, {sensitivity: 'accent'}) === 0) { return true; } } return false; } }
marcusportmann/inception
src/inception-angular/projects/ngx-inception/core/src/session/services/session.ts
TypeScript
MethodDeclaration
/** * Confirm that the user associated with the session has the specified authority. * * @param requiredAuthority The required authority. * * @return True if the user associated with the session has the specified authority or false * otherwise. */ hasAuthority(requiredAuthority: string): boolean { if (requiredAuthority.startsWith('ROLE_')) { if (requiredAuthority.length < 6) { return false; } else { return this.hasRole(requiredAuthority.substr(5)); } } if (requiredAuthority.startsWith('FUNCTION_')) { if (requiredAuthority.length < 10) { return false; } else { return this.hasFunction(requiredAuthority.substr(9)); } } return false; }
marcusportmann/inception
src/inception-angular/projects/ngx-inception/core/src/session/services/session.ts
TypeScript
MethodDeclaration
/** * Confirm that the user associated with the session has been assigned the required function. * * @param requiredFunctionCode The code for the required function. * * @return True if the user associated with the session has been assigned the required function * or false otherwise. */ hasFunction(requiredFunctionCode: string): boolean { for (const functionCode of this.functionCodes) { if (functionCode.localeCompare(requiredFunctionCode, undefined, {sensitivity: 'accent'}) === 0) { return true; } } return false; }
marcusportmann/inception
src/inception-angular/projects/ngx-inception/core/src/session/services/session.ts
TypeScript
MethodDeclaration
/** * Confirm that the user associated with the session has been assigned the required role. * * @param requiredRoleCode The code for the required role. * * @return True if the user associated with the session has been assigned the required role or * false otherwise. */ hasRole(requiredRoleCode: string): boolean { for (const roleCode of this.roleCodes) { if (roleCode.localeCompare(requiredRoleCode, undefined, {sensitivity: 'accent'}) === 0) { return true; } } return false; }
marcusportmann/inception
src/inception-angular/projects/ngx-inception/core/src/session/services/session.ts
TypeScript
FunctionDeclaration
function Layout(props) { return ( <div className={`${bulmaStyles.hero} ${bulmaStyles.isFullheight} ${ layoutStyles.isFullheight }`}
okandavut/iftimer
src/app/layouts/default/layout.tsx
TypeScript
FunctionDeclaration
export declare function switchMode(mode: Mode): Mode;
beauwilliams/MSA-AUS-2020-AzureML
.codedoc/node_modules/@codedoc/core/dist/es5/components/darkmode/mode.d.ts
TypeScript
EnumDeclaration
export declare enum Mode { Dark = 0, Light = 1 }
beauwilliams/MSA-AUS-2020-AzureML
.codedoc/node_modules/@codedoc/core/dist/es5/components/darkmode/mode.d.ts
TypeScript
ArrowFunction
(plotDiv: HTMLDivElement | null): void => { this.plotDiv = plotDiv; }
alexisthual/hydrogen
lib/components/result-view/plotly.tsx
TypeScript