type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
MethodDeclaration
_getContextFont() { return Text.prototype._getContextFont.call(this); }
phucdo1711/konva
src/shapes/TextPath.ts
TypeScript
MethodDeclaration
_getTextSize(text) { var dummyCanvas = this.dummyCanvas; var _context = dummyCanvas.getContext('2d'); _context.save(); _context.font = this._getContextFont(); var metrics = _context.measureText(text); _context.restore(); return { width: metrics.width, height: parseInt(this.a...
phucdo1711/konva
src/shapes/TextPath.ts
TypeScript
MethodDeclaration
getSelfRect() { if (!this.glyphInfo.length) { return { x: 0, y: 0, width: 0, height: 0, }; } var points = []; this.glyphInfo.forEach(function (info) { points.push(info.p0.x); points.push(info.p0.y); points.push(info.p1.x); points.push...
phucdo1711/konva
src/shapes/TextPath.ts
TypeScript
TypeAliasDeclaration
export type ListServicesExceptionsUnion = | AccessDeniedException | IllegalArgumentException | InvalidPaginationTokenException | ServiceException | TooManyRequestsException;
Dylan0916/aws-sdk-js-v3
clients/browser/client-service-quotas-browser/types/ListServicesExceptionsUnion.ts
TypeScript
FunctionDeclaration
export function Main() { const [text, setText] = useState(''); const [searchWords, setSearchWords] = useState<string[]>([]); const [categories, setCategories] = useState<Record<string, string>>({}); const [highlightedText, setHighlightedText] = useState<string>(''); const [wordsByCategory, setWords...
lapythie/hseling-repo-antidict
hseling-web-antidict/src/pages/main.tsx
TypeScript
ArrowFunction
() => { const response = fetch('/rpc/', { method: 'POST', headers: { 'Content-Type': 'application/json;charset=utf-8' }, body: JSON.stringify({ "jsonrpc": "2.0", "method": "process_input_text", "para...
lapythie/hseling-repo-antidict
hseling-web-antidict/src/pages/main.tsx
TypeScript
ArrowFunction
response => { const arrWords = [] const arrCategories: Record<string, string> = {} for (const element of response.result) { for (const el of element.analysis) { const category = el.categories const word ...
lapythie/hseling-repo-antidict
hseling-web-antidict/src/pages/main.tsx
TypeScript
ArrowFunction
(event: ChangeEvent<HTMLTextAreaElement>) => { setText(event.target.value); }
lapythie/hseling-repo-antidict
hseling-web-antidict/src/pages/main.tsx
TypeScript
ArrowFunction
({ item, checkboxUpdate, editDeleteOnClick, }: { item: ListItem; checkboxUpdate: CheckboxUpdateHandler; editDeleteOnClick: EditDeleteOnClickHandler; }) => ( <li> <div className="d-flex ListItem"> <div className
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
ArrowFunction
({ items, checkboxUpdate, editDeleteOnClick, }: { items: ListItem[]; checkboxUpdate: CheckboxUpdateHandler; editDeleteOnClick: EditDeleteOnClickHandler; }) => { return ( <ul> {items.map((item, index) => ( <SortableListItem key={`list-item-${index}`} ...
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
ArrowFunction
(item, index) => ( <SortableListItem key={`list-item-${index}`
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
ArrowFunction
() => this.getListInfo()
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
ClassDeclaration
export default class List extends React.Component<any, ListState> { private refreshTimeout: NodeJS.Timeout; constructor(props: any) { super(props); this.state = { refreshClicked: false, newItemFormGood: false, newItemSubmitClicked: false, editNameFormGood: true, editNameSubm...
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
InterfaceDeclaration
interface ListItem { listItemID: string; content: string; position: number; checked: boolean; }
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
InterfaceDeclaration
interface ListInfo { title: string; items: ListItem[]; }
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
InterfaceDeclaration
interface ListState { refreshClicked: boolean; newItemFormGood: boolean; newItemSubmitClicked: boolean; editNameFormGood: boolean; editNameSubmitClicked: boolean; deleteListClicked: boolean; editItemFormGood: boolean; editItemSubmitClicked: boolean; editingItemID: string; deleteListItemClicked: boo...
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
TypeAliasDeclaration
type CheckboxUpdateHandler = (listItemID: string) => void;
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
TypeAliasDeclaration
type EditDeleteOnClickHandler = (listItemID: string) => void;
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
MethodDeclaration
public componentWillMount() { if (getCookie("loggedIn") !== "true") { this.props.history.push( `/login?after=/list/${this.props.match.params.listID}` ); } }
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
MethodDeclaration
public componentDidMount() { this.getListInfo(); }
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
MethodDeclaration
public render() { if (this.state.listInfo === null) { return ( <div className="List"> <h1 className="mb-3">List</h1> <p className="loading">Fetching list data...</p> </div> ); } else { return ( <div className="List"> <h1 className="mb-3"> ...
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
MethodDeclaration
clearTimeout(this
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
MethodDeclaration
if (res
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
MethodDeclaration
if (res1
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
MethodDeclaration
if (event
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
MethodDeclaration
setTimeout(
WKHAllen/Notenheim
app/src/components/List.tsx
TypeScript
ArrowFunction
(): CTX => { const context = CTXContext.use().value; if (!context) { // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions throw new Error(`Expected modern context, but got: ${context}`); } return context; }
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
ArrowFunction
(): Config => { const config = ConfigContext.use().value; if (!config) { // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions throw new Error(`Expected modern config, but got: ${config}`); } return config; }
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
ArrowFunction
(): WebpackConfig => { const webpackConfig = WebpackConfigContext.use().value; if (!webpackConfig) { // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions throw new Error(`Expected webpack config, but got: ${webpackConfig}`); } return webpac...
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
ArrowFunction
(): BabelConfig => { const babelConfig = BabelConfigContext.use().value; if (!babelConfig) { // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions throw new Error(`Expected babel config, but got: ${babelConfig}`); } return babelConfig; }
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
ArrowFunction
async (context: CTX) => { const runner = await main.init(); main.run(() => { CTXContext.set(context); }); runner.prepare(); // eslint-disable-next-line @typescript-eslint/no-shadow const { config, webpackConfig, babelConfig } = runner.config({ config: defaultConfig, webpackConfig: defaultWebp...
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
ArrowFunction
() => { CTXContext.set(context); }
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
ArrowFunction
() => { ConfigContext.set(config); WebpackConfigContext.set(webpackConfig); BabelConfigContext.set(babelConfig); }
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
InterfaceDeclaration
// eslint-disable-next-line @typescript-eslint/no-empty-interface export interface ExternalProgress {}
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
TypeAliasDeclaration
// eslint-disable-next-line @typescript-eslint/ban-types export type CTX = {};
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
TypeAliasDeclaration
// eslint-disable-next-line @typescript-eslint/ban-types export type Config = {};
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
TypeAliasDeclaration
// eslint-disable-next-line @typescript-eslint/ban-types export type WebpackConfig = {};
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
TypeAliasDeclaration
// eslint-disable-next-line @typescript-eslint/ban-types export type BabelConfig = {};
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
TypeAliasDeclaration
export type TestAsyncHooks = ExternalProgress & typeof lifecircle;
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
TypeAliasDeclaration
export type TestAsyncPlugin = PluginOptions< TestAsyncHooks, AsyncSetup<TestAsyncHooks> >;
huxuezhi/modern.js
packages/toolkit/plugin/tests/fixtures/async/core/index.ts
TypeScript
FunctionDeclaration
export function MessageHeader({ tag = "div", ...props }: MessageHeader<HTMLElement>) { const className = classNames("message-header", props.className); return React.createElement(tag, {...props, className}); }
paolobueno/bloomer
src/components/Message/MessageHeader.tsx
TypeScript
InterfaceDeclaration
export interface MessageHeader<T> extends Bulma.Tag, React.HTMLProps<T> {}
paolobueno/bloomer
src/components/Message/MessageHeader.tsx
TypeScript
ArrowFunction
() => { let fixture: ComponentFixture<DataTableHeaderCellComponent>; let component: DataTableHeaderCellComponent; let element: any; // provide our implementations or mocks to the dependency injector beforeEach(() => { TestBed.configureTestingModule({ declarations: [DataTableHeaderCellComponent] ...
4SELLERS/ngx-datatable
projects/swimlane/ngx-datatable/src/lib/components/header/header-cell.component.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ declarations: [DataTableHeaderCellComponent] }); }
4SELLERS/ngx-datatable
projects/swimlane/ngx-datatable/src/lib/components/header/header-cell.component.spec.ts
TypeScript
ArrowFunction
() => { TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(DataTableHeaderCellComponent); component = fixture.componentInstance; element = fixture.nativeElement; }); }
4SELLERS/ngx-datatable
projects/swimlane/ngx-datatable/src/lib/components/header/header-cell.component.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(DataTableHeaderCellComponent); component = fixture.componentInstance; element = fixture.nativeElement; }
4SELLERS/ngx-datatable
projects/swimlane/ngx-datatable/src/lib/components/header/header-cell.component.spec.ts
TypeScript
ArrowFunction
() => { it('should have a component instance', () => { expect(component).toBeTruthy(); }); }
4SELLERS/ngx-datatable
projects/swimlane/ngx-datatable/src/lib/components/header/header-cell.component.spec.ts
TypeScript
ArrowFunction
(item: Log) => console.log( bytes.hexDataSlice(item.topics[1], 12), bytes.hexDataSlice(item.topics[2], 12), parseInt(item.topics[3]) )
RusAlex/arbitrum-review
src/parse.ts
TypeScript
TypeAliasDeclaration
type Log = { address: string; topics: string[4]; };
RusAlex/arbitrum-review
src/parse.ts
TypeScript
TypeAliasDeclaration
type Logs = [Log];
RusAlex/arbitrum-review
src/parse.ts
TypeScript
ArrowFunction
(loginUser: LoginUserDto): Observable<UserEntity> => // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore this._userDao.findByUsername(loginUser.username).pipe( catchError((e) => throwError(() => new UnprocessableEntityException(e.message)), ), mergeMap((use...
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(e) => throwError(() => new UnprocessableEntityException(e.message))
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => new UnprocessableEntityException(e.message)
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(user: User) => !!user ? of(user) : throwError( () => new UnauthorizedException("Username and Password don't match"), )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => new UnauthorizedException("Username and Password don't match")
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(user: User) => ({ user, // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore passwordIsValid: this._securityService.checkPassword( loginUser.password, Buffer.from(user.password_hash), ), })
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(_: { user: User; passwordIsValid: Observable<boolean> }) => merge( _.passwordIsValid.pipe( filter((passwordIsValid: boolean) => !!passwordIsValid), map(() => _.user), ), _.passwordIsValid.pipe( filter((passwordIsValid: boolean) => !passwordIsVa...
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(passwordIsValid: boolean) => !!passwordIsValid
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => _.user
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(passwordIsValid: boolean) => !passwordIsValid
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => throwError( () => new UnauthorizedException( "Username and Password don't match", ), )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => new UnauthorizedException( "Username and Password don't match", )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(user: User & { id: string }) => // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore this._userDao.updateLastAccessTime(user.id).pipe( catchError((e) => throwError(() => new UnprocessableEntityException(e.message)), ), mergeMap((...
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(e) => throwError(() => new UnprocessableEntityException(e.message))
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(user: User) => !!user ? of(user) : throwError( () => new PreconditionFailedException( 'An error occurred during login process', ), )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => new PreconditionFailedException( 'An error occurred during login process', )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(user: User) => delete user.password_hash
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(user: User) => new UserEntity(user)
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(user: CreateUserDto): Observable<UserEntity> => // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore this._securityService.hashPassword(user.password).pipe( map((hashPassword: Buffer) => ({ username: user.username, display_name: user.display_name, passw...
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(hashPassword: Buffer) => ({ username: user.username, display_name: user.display_name, password_hash: hashPassword, })
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(_: Omit<CreateUserDto, 'password'> & { password_hash: Buffer }) => // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore this._userDao.save(_)
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(e) => e.code === 11000 ? throwError( () => new ConflictException( `Username '${user.username}' already exists`, ), ) : throwError(() => new UnprocessableEntityException(e.message))
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => new ConflictException( `Username '${user.username}' already exists`, )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(id: string, user: PatchUserDto): Observable<UserEntity> => of(of(user)).pipe( mergeMap((obs: Observable<PatchUserDto>) => merge( obs.pipe( filter( (_: PatchUserDto) => typeof _ !== 'undefined' && Object.keys(_).length > 0, ), ...
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(obs: Observable<PatchUserDto>) => merge( obs.pipe( filter( (_: PatchUserDto) => typeof _ !== 'undefined' && Object.keys(_).length > 0, ), // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore ...
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(_: PatchUserDto) => typeof _ !== 'undefined' && Object.keys(_).length > 0
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(_: PatchUserDto) => this._userDao.patch(id, _)
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(e) => e.code === 11000 && !!user.username ? throwError( () => new ConflictException( `Username '${user.username}' already exists`, ), ) : throwError(() => new Unproce...
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => new ConflictException( `Username '${user.username}' already exists`, )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(user: User) => !!user ? of(user) : throwError( () => new PreconditionFailedException( `User with id "${id}" doesn't exist in the database`, ), )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => new PreconditionFailedException( `User with id "${id}" doesn't exist in the database`, )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(_: PatchUserDto) => typeof _ === 'undefined' || Object.keys(_).length === 0
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => throwError( () => new BadRequestException( 'Payload should at least contains one of "username", "display_name" or "skip_authenticator_registration"', ), )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => new BadRequestException( 'Payload should at least contains one of "username", "display_name" or "skip_authenticator_registration"', )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(id: string): Observable<UserEntity> => // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore this._userDao.findById(id).pipe( catchError((e) => throwError(() => new UnprocessableEntityException(e.message)), ), mergeMap((user: User) => !!user ...
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(user: User) => !!user ? of(user) : throwError( () => new UnauthorizedException( 'User cannot use this authenticator to authenticate', ), )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => new UnauthorizedException( 'User cannot use this authenticator to authenticate', )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(user: User & { id: string }) => // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore this._userDao.updateLastAccessTime(user.id).pipe( catchError((e) => throwError(() => new UnprocessableEntityException(e.message)), ), mergeMap((...
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
(user: User) => !!user ? of(user) : throwError( () => new PreconditionFailedException( 'An error occurred during webauthn login process', ), )
akanass/webauthn
src/user/user.service.ts
TypeScript
ArrowFunction
() => new PreconditionFailedException( 'An error occurred during webauthn login process', )
akanass/webauthn
src/user/user.service.ts
TypeScript
ClassDeclaration
@Injectable() export class UserService { /** * Class constructor * * @param {UserDao} _userDao dependency injection of UserDao instance * @param {SecurityService} _securityService dependency injection of SecurityService instance */ constructor( private readonly _userDao: UserDao, private rea...
akanass/webauthn
src/user/user.service.ts
TypeScript
FunctionDeclaration
/** * Updates the column sizes of the columns provided based on the column definition metadata for each column. * The final width represent a static width, it is the value as set in the definition (except column without width, where the calculated global width is set). */ export function resetColumnWidths(rowWidth: ...
Danieliverant/ngrid
libs/ngrid/src/lib/grid/utils/width.ts
TypeScript
FunctionDeclaration
async function getPage(config: CanvasConfig, link: string): Promise<CanvasStudent[]> { return fetch(link, { headers: { Authorization: `Bearer ${config.token}`, } }).then(resp => { // check if we have next. If we do, RETURN OURSELVES! // if we don't even _have_ links,...
CS1371/canvas-quiz-parser
src/canvas/getStudents.ts
TypeScript
FunctionDeclaration
/** * getStudents will fetch all available students from the specified course. * This also uses the Canvas API, but only expects the basic information to * be given. Incidentally, this also returns a promise that resolves to the * array of all canvas students. * @param config The canvas configuration * @returns A...
CS1371/canvas-quiz-parser
src/canvas/getStudents.ts
TypeScript
ArrowFunction
resp => { // check if we have next. If we do, RETURN OURSELVES! // if we don't even _have_ links, make one up let next = ""; if (resp.headers.has("link")) { const links = { current: "", next: "", first: "", last...
CS1371/canvas-quiz-parser
src/canvas/getStudents.ts
TypeScript
ArrowFunction
async pagerResponse => { // concatenate with our own response! const current = await resp.json(); // concat and return return current.concat(pagerResponse); }
CS1371/canvas-quiz-parser
src/canvas/getStudents.ts
TypeScript
FunctionDeclaration
// reducers function todosReducer(state: Todos, action: Action): Todos { if (action.type === 'TODO_LOADED') { return { selected: action.payload }; } else { return state; } }
Domratchev/nx
packages/nx/spec/data-persistence.spec.ts
TypeScript
FunctionDeclaration
function userReducer(state: string, action: Action): string { return 'bob'; }
Domratchev/nx
packages/nx/spec/data-persistence.spec.ts
TypeScript
FunctionDeclaration
function userReducer() { return 'bob'; }
Domratchev/nx
packages/nx/spec/data-persistence.spec.ts
TypeScript
ArrowFunction
() => { beforeEach(() => { TestBed.configureTestingModule({ declarations: [RootCmp, TodoComponent], imports: [ StoreModule.forRoot({ todos: todosReducer, user: userReducer }), StoreRouterConnectingModule, RouterTestingModule.withRoutes([ { path: 'todo...
Domratchev/nx
packages/nx/spec/data-persistence.spec.ts
TypeScript