type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
FunctionDeclaration |
function Home() {
const context = useDocusaurusContext();
const { siteConfig } = context;
return (
<Layout description={siteConfig.tagline} title="Safely render HTML in React">
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<div className={styles.buttons}>
<Link
className={clsx('button button--secondary button--lg', styles.getStarted)}
to={useBaseUrl('docs/')}
>
Get started
</Link>
<iframe
frameBorder="0"
scrolling="0"
src="https://ghbtns.com/github-btn.html?user=milesj&repo=interweave&type=star&count=true&size=large"
title="GitHub"
/>
</div>
</div>
</header>
<main>
<section className={styles.features}>
<div className="container">
<div className="row">
{features.map((props, idx) => (
// eslint-disable-next-line react/no-array-index-key
<Feature key={idx} {...props} />
))}
</div>
</div>
</section>
</main>
</Layout>
);
} | milesj/react-interpose | website/src/pages/index.tsx | TypeScript |
ArrowFunction |
(props, idx) => (
// eslint-disable-next-line react/no-array-index-key
<Feature key={idx} | milesj/react-interpose | website/src/pages/index.tsx | TypeScript |
InterfaceDeclaration |
interface FeatureProps {
title: string;
description: React.ReactNode;
imageUrl?: string;
} | milesj/react-interpose | website/src/pages/index.tsx | TypeScript |
MethodDeclaration |
clsx('col col--4', styles | milesj/react-interpose | website/src/pages/index.tsx | TypeScript |
MethodDeclaration |
useBaseUrl('docs/') | milesj/react-interpose | website/src/pages/index.tsx | TypeScript |
ClassDeclaration |
@Injectable()
export class RedisService {
private _client: RedisClient;
get client(): RedisClient {
return this._client;
}
constructor(private readonly apiConfigModule: ApiConfigService) {
this._client = createClient({ url: this.apiConfigModule.redisUrl });
}
} | thesoundfromthesky/play-with-nestjs | src/feature/auth/services/redis.service.ts | TypeScript |
ArrowFunction |
() => {
const { items, addTodoItem, loadTodoItemById } = useTodo();
const todoInput = useRef<HTMLInputElement>(null);
const todoIdInput = useRef<HTMLInputElement>(null);
const onSubmit = () => {
const todoItemValue = todoInput?.current?.value;
if (todoItemValue) {
addTodoItem(todoItemValue);
}
};
const sendRequest = async () => {
const todoItemId = todoIdInput?.current?.value;
if (todoItemId) {
loadTodoItemById(todoItemId);
}
};
return (
<div className="App">
<div className="Todo-header">
<h2>Todo list:</h2>
<div className="Todo-elements">
<input ref={todoInput} type="text" name="todo" />
<button type="submit" onClick={onSubmit}>
Add todo
</button>
</div>
<div className="Todo-elements">
<input ref={todoIdInput} type="number" defaultValue="1" name="todo" />
<button type="submit" onClick={sendRequest}>
Load item
</button>
</div>
</div>
<div className="Todo-list">
{items &&
items.map((it: string, index: number) => (
<p key={index} className="Todo-item">
{it}
</p>
))} | simplify-apps/simplify-redux-app | example/src/App.tsx | TypeScript |
ArrowFunction |
() => {
const todoItemValue = todoInput?.current?.value;
if (todoItemValue) {
addTodoItem(todoItemValue);
}
} | simplify-apps/simplify-redux-app | example/src/App.tsx | TypeScript |
ArrowFunction |
async () => {
const todoItemId = todoIdInput?.current?.value;
if (todoItemId) {
loadTodoItemById(todoItemId);
}
} | simplify-apps/simplify-redux-app | example/src/App.tsx | TypeScript |
ArrowFunction |
(it: string, index: number) => (
<p key={index} | simplify-apps/simplify-redux-app | example/src/App.tsx | TypeScript |
ArrowFunction |
secs => meta => setTimeout(meta.commit, secs) | KevCJones/kaop-ts | test/advice-merge.spec.ts | TypeScript |
ArrowFunction |
meta => setTimeout(meta.commit, secs) | KevCJones/kaop-ts | test/advice-merge.spec.ts | TypeScript |
ArrowFunction |
() => {
beforeAll(() => {
carInstance = new Car()
})
it("Delay advice should stop the execution", done => {
const time = Date.now()
carInstance.startEngine(() => {
expect(Date.now() - time).toBeGreaterThan(3000)
expect(Date.now() - time).toBeLessThan(3100)
done()
})
})
} | KevCJones/kaop-ts | test/advice-merge.spec.ts | TypeScript |
ArrowFunction |
() => {
carInstance = new Car()
} | KevCJones/kaop-ts | test/advice-merge.spec.ts | TypeScript |
ArrowFunction |
done => {
const time = Date.now()
carInstance.startEngine(() => {
expect(Date.now() - time).toBeGreaterThan(3000)
expect(Date.now() - time).toBeLessThan(3100)
done()
})
} | KevCJones/kaop-ts | test/advice-merge.spec.ts | TypeScript |
ArrowFunction |
() => {
expect(Date.now() - time).toBeGreaterThan(3000)
expect(Date.now() - time).toBeLessThan(3100)
done()
} | KevCJones/kaop-ts | test/advice-merge.spec.ts | TypeScript |
ClassDeclaration |
class Car {
@someBehavior
startEngine (cbk) {
cbk()
}
} | KevCJones/kaop-ts | test/advice-merge.spec.ts | TypeScript |
MethodDeclaration |
@someBehavior
startEngine (cbk) {
cbk()
} | KevCJones/kaop-ts | test/advice-merge.spec.ts | TypeScript |
ArrowFunction |
photo =>
this.photo = ({
...photo,
dateuploaded: (new Date(Number(photo.dateuploaded) * 1000).toLocaleDateString('fr-FR'))
}) | Shr0Om/ProjetAngular | src/app/image-details/image-details.component.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'app-image-details',
templateUrl: './image-details.component.html',
styleUrls: ['./image-details.component.less'],
providers: [ApiService]
})
export class ImageDetailsComponent implements OnInit {
photo: any = {
title: {},
owner: {},
description: {}
};
constructor(
@Inject(MAT_DIALOG_DATA)
public data: ImageDetailData,
private api: ApiService
) { }
ngOnInit(): void {
this.api.getImageDetails(this.data.id).subscribe(photo =>
this.photo = ({
...photo,
dateuploaded: (new Date(Number(photo.dateuploaded) * 1000).toLocaleDateString('fr-FR'))
}));
}
getUrl() {
return this.photo['server']
? convertImageUrl({photo: this.photo, resolution: Resolution.large})
: '';
}
} | Shr0Om/ProjetAngular | src/app/image-details/image-details.component.ts | TypeScript |
InterfaceDeclaration |
export interface ImageDetailData {
title: String;
id: String;
} | Shr0Om/ProjetAngular | src/app/image-details/image-details.component.ts | TypeScript |
MethodDeclaration |
ngOnInit(): void {
this.api.getImageDetails(this.data.id).subscribe(photo =>
this.photo = ({
...photo,
dateuploaded: (new Date(Number(photo.dateuploaded) * 1000).toLocaleDateString('fr-FR'))
}));
} | Shr0Om/ProjetAngular | src/app/image-details/image-details.component.ts | TypeScript |
MethodDeclaration |
getUrl() {
return this.photo['server']
? convertImageUrl({photo: this.photo, resolution: Resolution.large})
: '';
} | Shr0Om/ProjetAngular | src/app/image-details/image-details.component.ts | TypeScript |
ArrowFunction |
(update: Partial<Environment>) => {
this.environment = Object.assign({}, this.environment, update);
} | AMoo-Miki/OpenSearch-Dashboards | src/plugins/home/public/services/environment/environment.ts | TypeScript |
ClassDeclaration |
export class EnvironmentService {
private environment = {
cloud: false,
apmUi: false,
ml: false,
};
public setup() {
return {
/**
* Update the environment to influence how the home app is presenting available features.
* This API should not be extended for new features and will be removed in future versions
* in favor of display specific extension apis.
* @deprecated
* @param update
*/
update: (update: Partial<Environment>) => {
this.environment = Object.assign({}, this.environment, update);
},
};
}
public getEnvironment() {
return this.environment;
}
} | AMoo-Miki/OpenSearch-Dashboards | src/plugins/home/public/services/environment/environment.ts | TypeScript |
InterfaceDeclaration | /*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you 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.
*/
/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
/** @public */
export interface Environment {
/**
* Flag whether the home app should advertise cloud features
*/
readonly cloud: boolean;
/**
* Flag whether the home app should advertise apm features
*/
readonly apmUi: boolean;
/**
* Flag whether the home app should advertise ml features
*/
readonly ml: boolean;
} | AMoo-Miki/OpenSearch-Dashboards | src/plugins/home/public/services/environment/environment.ts | TypeScript |
TypeAliasDeclaration |
export type EnvironmentServiceSetup = ReturnType<EnvironmentService['setup']>; | AMoo-Miki/OpenSearch-Dashboards | src/plugins/home/public/services/environment/environment.ts | TypeScript |
MethodDeclaration |
public setup() {
return {
/**
* Update the environment to influence how the home app is presenting available features.
* This API should not be extended for new features and will be removed in future versions
* in favor of display specific extension apis.
* @deprecated
* @param update
*/
update: (update: Partial<Environment>) => {
this.environment = Object.assign({}, this.environment, update);
},
};
} | AMoo-Miki/OpenSearch-Dashboards | src/plugins/home/public/services/environment/environment.ts | TypeScript |
MethodDeclaration |
public getEnvironment() {
return this.environment;
} | AMoo-Miki/OpenSearch-Dashboards | src/plugins/home/public/services/environment/environment.ts | TypeScript |
ArrowFunction |
err => FileuploadService.handleError(err) | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
ClassDeclaration |
@Injectable({
providedIn: 'root'
})
export class FileuploadService {
apiUrl: string;
constructor(
private http: HttpClient,
) {
this.apiUrl = ApisModel.apiUrl
}
uploadUserImage(fd : FormData) {
const url = `${ApisModel.apiUrl}/${ApisModel.fileupload}/${ApisModel.user}/upload`;
return this.http.post(url, fd).pipe(
catchError(err => FileuploadService.handleError(err))
);
}
uploadSocietyImage(fd: FormData, societyId: string): Observable<any> {
const url = `${ApisModel.apiUrl}/${ApisModel.fileupload}/${ApisModel.society}/${societyId}`;
return this.http.post(url, fd).pipe(
catchError(err => FileuploadService.handleError(err))
);
}
uploadTrashImages(fd: FormData, trashId: string): Observable<any> {
const url = `${ApisModel.apiUrl}/${ApisModel.fileupload}/${ApisModel.trash}/${trashId}`;
return this.http.post(url, fd).pipe(
catchError(err => FileuploadService.handleError(err))
);
}
uploadCollectionImages(fd: FormData, collectionId: string): Observable<any> {
const url = `${ApisModel.apiUrl}/${ApisModel.fileupload}/${ApisModel.collection}/${collectionId}`;
return this.http.post(url, fd).pipe(
catchError(err => FileuploadService.handleError(err))
);
}
deleteUserImage() {
const url = `${this.apiUrl}/${ApisModel.fileupload}/${ApisModel.user}/delete`;
return this.http.delete(url).pipe(
catchError(err => FileuploadService.handleError(err))
);
}
deleteSocietyImage() {
}
deleteTrashImages() {
}
deleteCollectionImagesFromEvent(images: string[], eventId: string, eventPickerModel: EventPickerModel) {
const imagesQueryParam = images.join();
const url = `${this.apiUrl}/${ApisModel.fileupload}/${ApisModel.collection}/delete?ids=${imagesQueryParam}event=${eventId}&picker=${eventPickerModel.Id}&asSociety=${eventPickerModel.AsSociety}`;
return this.http.delete(url).pipe(
catchError(err => FileuploadService.handleError(err))
);
}
deleteCollectionImagesFromRandom(images: string[], collectionId: string) {
const imagesQueryParam = images.join();
const url = `${this.apiUrl}/${ApisModel.fileupload}/${ApisModel.collection}/delete/${collectionId}?ids=${imagesQueryParam}`;
return this.http.delete(url).pipe(
catchError(err => FileuploadService.handleError(err))
);
}
private static handleError<T>(error: HttpErrorResponse, result?: T) {
if (error.error instanceof ErrorEvent) {
// A client-side or network error occurred. Handle it accordingly.
console.error('An error occurred:', error.error.message);
} else {
// The backend returned an unsuccessful response code.
// The response body may contain clues as to what went wrong,
console.error(
`Backend returned code ${error.status} \n` +
`TITLE: ${error.error.errorMessage} \n` +
`TYPE ${error.error.errorType} `);
}
// return an observable with a user-facing error message
if (result == null) {
return throwError(error);
}
return of(result as T);
};
} | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
MethodDeclaration |
uploadUserImage(fd : FormData) {
const url = `${ApisModel.apiUrl}/${ApisModel.fileupload}/${ApisModel.user}/upload`;
return this.http.post(url, fd).pipe(
catchError(err => FileuploadService.handleError(err))
);
} | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
MethodDeclaration |
uploadSocietyImage(fd: FormData, societyId: string): Observable<any> {
const url = `${ApisModel.apiUrl}/${ApisModel.fileupload}/${ApisModel.society}/${societyId}`;
return this.http.post(url, fd).pipe(
catchError(err => FileuploadService.handleError(err))
);
} | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
MethodDeclaration |
uploadTrashImages(fd: FormData, trashId: string): Observable<any> {
const url = `${ApisModel.apiUrl}/${ApisModel.fileupload}/${ApisModel.trash}/${trashId}`;
return this.http.post(url, fd).pipe(
catchError(err => FileuploadService.handleError(err))
);
} | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
MethodDeclaration |
uploadCollectionImages(fd: FormData, collectionId: string): Observable<any> {
const url = `${ApisModel.apiUrl}/${ApisModel.fileupload}/${ApisModel.collection}/${collectionId}`;
return this.http.post(url, fd).pipe(
catchError(err => FileuploadService.handleError(err))
);
} | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
MethodDeclaration |
deleteUserImage() {
const url = `${this.apiUrl}/${ApisModel.fileupload}/${ApisModel.user}/delete`;
return this.http.delete(url).pipe(
catchError(err => FileuploadService.handleError(err))
);
} | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
MethodDeclaration |
deleteSocietyImage() {
} | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
MethodDeclaration |
deleteTrashImages() {
} | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
MethodDeclaration |
deleteCollectionImagesFromEvent(images: string[], eventId: string, eventPickerModel: EventPickerModel) {
const imagesQueryParam = images.join();
const url = `${this.apiUrl}/${ApisModel.fileupload}/${ApisModel.collection}/delete?ids=${imagesQueryParam}event=${eventId}&picker=${eventPickerModel.Id}&asSociety=${eventPickerModel.AsSociety}`;
return this.http.delete(url).pipe(
catchError(err => FileuploadService.handleError(err))
);
} | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
MethodDeclaration |
deleteCollectionImagesFromRandom(images: string[], collectionId: string) {
const imagesQueryParam = images.join();
const url = `${this.apiUrl}/${ApisModel.fileupload}/${ApisModel.collection}/delete/${collectionId}?ids=${imagesQueryParam}`;
return this.http.delete(url).pipe(
catchError(err => FileuploadService.handleError(err))
);
} | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
MethodDeclaration |
private static handleError<T>(error: HttpErrorResponse, result?: T) {
if (error.error instanceof ErrorEvent) {
// A client-side or network error occurred. Handle it accordingly.
console.error('An error occurred:', error.error.message);
} else {
// The backend returned an unsuccessful response code.
// The response body may contain clues as to what went wrong,
console.error(
`Backend returned code ${error.status} \n` +
`TITLE: ${error.error.errorMessage} \n` +
`TYPE ${error.error.errorType} `);
}
// return an observable with a user-facing error message
if (result == null) {
return throwError(error);
}
return of(result as T);
} | OliverChmelicky/litter3 | ui/src/app/services/fileupload/fileupload.service.ts | TypeScript |
InterfaceDeclaration |
export interface Mnemonic {
phrase: MnemonicPhrase;
password?: MnemonicPassword;
} | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration | /*
* type aliases for better readability around legacy positional arguments
*/
export type MnemonicPhrase = string; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type MnemonicPassword = string; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type Provider = any; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type ProviderUrl = string; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type ProviderOrUrl = Provider | ProviderUrl; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type AddressIndex = number; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type NumberOfAddresses = number; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type PollingInterval = number; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type ShareNonce = boolean; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type DerivationPath = string; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type ChainId = number; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type Hardfork = string; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
TypeAliasDeclaration |
export type ChainSettings = {
hardfork?: Hardfork;
chainId?: ChainId;
}; | 0xfoobar/truffle | packages/hdwallet-provider/src/constructor/types.ts | TypeScript |
FunctionDeclaration |
export function fiboEvenSum(n: number): number {
let [i, j] = [1, 2];
let sum = 0;
while (i < n) {
if (i % 2 === 0) {
sum += i;
}
[i, j] = [j, i + j];
}
return sum;
} | desi-belokonska/project-euler | 02_even-fibonacci-numbers/index.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'app-comp-3756',
templateUrl: './comp-3756.component.html',
styleUrls: ['./comp-3756.component.css']
})
export class Comp3756Component implements OnInit {
constructor() { }
ngOnInit() {
}
} | angular/angular-cli-stress-test | src/app/components/comp-3756/comp-3756.component.ts | TypeScript |
FunctionDeclaration |
export declare function writeBinaryFile(aFile: PathOrFileDescriptor, anObject: PlistJsObj, callback: callbackFn<void>): void; | 1-8192/DogsBestFriendApp | node_modules/simple-plist/dist/writeBinaryFile.d.ts | TypeScript |
FunctionDeclaration |
export declare function writeBinaryFile(aFile: PathOrFileDescriptor, anObject: PlistJsObj, options: WriteFileOptions, callback: callbackFn<void>): void; | 1-8192/DogsBestFriendApp | node_modules/simple-plist/dist/writeBinaryFile.d.ts | TypeScript |
FunctionDeclaration |
function handleLinkToWhatsapp(){
api.post('connections', {
user_id: teacher.id,
});
Linking.openURL(`whatsapp://send?phone=${teacher.whatsapp}`)
} | David-Ackerman/NLW-Proffy-Mobile | src/components/TeacherItem/index.tsx | TypeScript |
FunctionDeclaration |
async function handleToogleFavorite(){
const favorites = await AsyncStorage.getItem('favorites');
let favoritesArray =[];
if (favorites){
favoritesArray = JSON.parse(favorites);
}
if(isFavorited){
const favoriteIndex = favoritesArray.findIndex((teacherItem: Teacher) => {
return teacherItem.id === teacher.id;
});
favoritesArray.splice(favoriteIndex, 1);
setIsFavorited(false);
}else{
favoritesArray.push(teacher);
setIsFavorited(true);
}
await AsyncStorage.setItem('favorites', JSON.stringify(favoritesArray));
} | David-Ackerman/NLW-Proffy-Mobile | src/components/TeacherItem/index.tsx | TypeScript |
ArrowFunction |
({teacher, favorited}) => {
const [isFavorited, setIsFavorited] = useState(favorited);
function handleLinkToWhatsapp(){
api.post('connections', {
user_id: teacher.id,
});
Linking.openURL(`whatsapp://send?phone=${teacher.whatsapp}`)
}
async function handleToogleFavorite(){
const favorites = await AsyncStorage.getItem('favorites');
let favoritesArray =[];
if (favorites){
favoritesArray = JSON.parse(favorites);
}
if(isFavorited){
const favoriteIndex = favoritesArray.findIndex((teacherItem: Teacher) => {
return teacherItem.id === teacher.id;
});
favoritesArray.splice(favoriteIndex, 1);
setIsFavorited(false);
}else{
favoritesArray.push(teacher);
setIsFavorited(true);
}
await AsyncStorage.setItem('favorites', JSON.stringify(favoritesArray));
}
return (
<View style={styles.container} >
<View style={styles.profile} >
<Image
style={styles.avatar}
source={{ uri: teacher.avatar }} | David-Ackerman/NLW-Proffy-Mobile | src/components/TeacherItem/index.tsx | TypeScript |
ArrowFunction |
(teacherItem: Teacher) => {
return teacherItem.id === teacher.id;
} | David-Ackerman/NLW-Proffy-Mobile | src/components/TeacherItem/index.tsx | TypeScript |
InterfaceDeclaration |
export interface Teacher {
id: number;
avatar: string;
bio: string;
cost: number;
name: string;
subject: string;
whatsapp: string;
} | David-Ackerman/NLW-Proffy-Mobile | src/components/TeacherItem/index.tsx | TypeScript |
InterfaceDeclaration |
interface TeacherItemProps{
teacher: Teacher;
favorited: boolean;
} | David-Ackerman/NLW-Proffy-Mobile | src/components/TeacherItem/index.tsx | TypeScript |
MethodDeclaration |
isFavorited ? <Image source={unfavoriteIcon} | David-Ackerman/NLW-Proffy-Mobile | src/components/TeacherItem/index.tsx | TypeScript |
ArrowFunction |
() => {
let component: ExampleListComponent;
let fixture: ComponentFixture<ExampleListComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ExampleListComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ExampleListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
} | kayvanbree/contexr | src/app/modules/example-list/example-list/example-list.component.spec.ts | TypeScript |
ArrowFunction |
() => {
TestBed.configureTestingModule({
declarations: [ ExampleListComponent ]
})
.compileComponents();
} | kayvanbree/contexr | src/app/modules/example-list/example-list/example-list.component.spec.ts | TypeScript |
ArrowFunction |
() => {
fixture = TestBed.createComponent(ExampleListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
} | kayvanbree/contexr | src/app/modules/example-list/example-list/example-list.component.spec.ts | TypeScript |
ClassDeclaration |
class MenuExampleTabShorthand extends React.Component {
render() {
return (
<Menu
defaultActiveIndex={0}
items={items}
underlined
primary
accessibility={tabListBehavior}
aria-label="Today's events"
/>
)
}
} | AnastasiyaSarmant/fluent-ui-react | docs/src/examples/components/Menu/Usage/MenuExampleTabList.shorthand.tsx | TypeScript |
MethodDeclaration |
render() {
return (
<Menu
defaultActiveIndex={0}
items={items}
underlined
primary
accessibility={tabListBehavior}
aria-label="Today's events"
/>
)
} | AnastasiyaSarmant/fluent-ui-react | docs/src/examples/components/Menu/Usage/MenuExampleTabList.shorthand.tsx | TypeScript |
ArrowFunction |
() => ({ id: props.datasetId }) | METASPACE2020/METASPACE | metaspace/webapp/src/modules/Datasets/common/VisibilityBadge.tsx | TypeScript |
ArrowFunction |
() => { queryOptions.enabled = true } | METASPACE2020/METASPACE | metaspace/webapp/src/modules/Datasets/common/VisibilityBadge.tsx | TypeScript |
ArrowFunction |
() => {
if (query.result.value != null) {
const { datasetVisibility, currentUser } = query.result.value
if (datasetVisibility != null) {
const { submitter, group, projects } = datasetVisibility
const submitterName = currentUser && submitter.id === currentUser.id ? 'you' : submitter.name
const all = [
submitterName,
...(group ? [group.name] : []),
...(projects || []).map(p => p.name),
]
return 'These annotation results are not publicly visible. '
+ `They are visible to ${all.join(', ')} and METASPACE Administrators.`
}
}
return null
} | METASPACE2020/METASPACE | metaspace/webapp/src/modules/Datasets/common/VisibilityBadge.tsx | TypeScript |
ArrowFunction |
() => (
<Popover
class="ml-1" | METASPACE2020/METASPACE | metaspace/webapp/src/modules/Datasets/common/VisibilityBadge.tsx | TypeScript |
MethodDeclaration |
setup(props) {
const queryOptions = reactive({ enabled: false })
const queryVars = computed(() => ({ id: props.datasetId }))
const query = useQuery<DatasetVisibilityQuery>(datasetVisibilityQuery, queryVars, queryOptions)
const loadVisibility = () => { queryOptions.enabled = true }
const visibilityText = computed(() => {
if (query.result.value != null) {
const { datasetVisibility, currentUser } = query.result.value
if (datasetVisibility != null) {
const { submitter, group, projects } = datasetVisibility
const submitterName = currentUser && submitter.id === currentUser.id ? 'you' : submitter.name
const all = [
submitterName,
...(group ? [group.name] : []),
...(projects || []).map(p => p.name),
]
return 'These annotation results are not publicly visible. '
+ `They are visible to ${all.join(', ')} and METASPACE Administrators.`
}
}
return null
})
return () => (
<Popover
class="ml-1"
trigger="hover"
placement="top"
onShow={loadVisibility}
>
<div v-loading={visibilityText.value == null}>{visibilityText.value || ''}</div>
<i
slot="reference"
class="el-icon-lock"
/>
</Popover> | METASPACE2020/METASPACE | metaspace/webapp/src/modules/Datasets/common/VisibilityBadge.tsx | TypeScript |
ClassDeclaration | /**
* Class for managing encrypting and decrypting private auth information.
*/
export declare class Crypto extends AsyncOptionalCreatable<CryptoOptions> {
private _key;
private options;
private messages;
private noResetOnClose;
/**
* Constructor
* **Do not directly construct instances of this class -- use {@link Crypto.create} instead.**
* @param options The options for the class instance.
* @ignore
*/
constructor(options?: CryptoOptions);
/**
* Encrypts text. Returns the encrypted string or undefined if no string was passed.
* @param text The text to encrypt.
*/
encrypt(text?: string): Optional<string>;
/**
* Decrypts text.
* @param text The text to decrypt.
*/
decrypt(text?: string): Optional<string>;
/**
* Clears the crypto state. This should be called in a finally block.
*/
close(): void;
/**
* Initialize async components.
*/
protected init(): Promise<void>;
private getKeyChain;
} | oswin-correa/sfdx-plugins | node_modules/@salesforce/command/node_modules/@salesforce/core/lib/crypto.d.ts | TypeScript |
InterfaceDeclaration |
interface CryptoOptions {
keychain?: KeyChain;
platform?: string;
retryStatus?: string;
noResetOnClose?: boolean;
} | oswin-correa/sfdx-plugins | node_modules/@salesforce/command/node_modules/@salesforce/core/lib/crypto.d.ts | TypeScript |
MethodDeclaration | /**
* Encrypts text. Returns the encrypted string or undefined if no string was passed.
* @param text The text to encrypt.
*/
encrypt(text?: string): Optional<string>; | oswin-correa/sfdx-plugins | node_modules/@salesforce/command/node_modules/@salesforce/core/lib/crypto.d.ts | TypeScript |
MethodDeclaration | /**
* Decrypts text.
* @param text The text to decrypt.
*/
decrypt(text?: string): Optional<string>; | oswin-correa/sfdx-plugins | node_modules/@salesforce/command/node_modules/@salesforce/core/lib/crypto.d.ts | TypeScript |
MethodDeclaration | /**
* Clears the crypto state. This should be called in a finally block.
*/
close(): void; | oswin-correa/sfdx-plugins | node_modules/@salesforce/command/node_modules/@salesforce/core/lib/crypto.d.ts | TypeScript |
MethodDeclaration | /**
* Initialize async components.
*/
protected init(): Promise<void>; | oswin-correa/sfdx-plugins | node_modules/@salesforce/command/node_modules/@salesforce/core/lib/crypto.d.ts | TypeScript |
FunctionDeclaration |
export function IsIn15MinuteInterval(): PropertyDecorator {
return function (object: object, propertyName: string) {
registerDecorator({
propertyName,
name: 'isIn15MinuteInterval',
target: object.constructor,
options: { message: `${propertyName} must be in 15-minute intervals` },
validator: {
validate(input: unknown): boolean {
return (
typeof input === 'string' && new Date(input).getMinutes() % 15 === 0
);
},
},
});
};
} | claudealdric/rest-api | src/validators/is-in-15-minute-interval.validator.ts | TypeScript |
MethodDeclaration |
validate(input: unknown): boolean {
return (
typeof input === 'string' && new Date(input).getMinutes() % 15 === 0
);
} | claudealdric/rest-api | src/validators/is-in-15-minute-interval.validator.ts | TypeScript |
ArrowFunction |
(name: string, databaseField?: string) =>
new ArrayField(name, databaseField) | inidaname/tensei | packages/common/src/fields/Array.ts | TypeScript |
ClassDeclaration |
export class ArrayField extends Field {
protected arrayOf: ArrayTypes = 'string'
public component = {
form: 'Array',
index: 'Array',
detail: 'Array'
}
constructor(name: string, databaseField?: string) {
super(name, databaseField)
this.property.type = 'json'
this.rules('array')
this.arrayRules('string')
this.notFilterable()
this.hideOnIndex()
}
public of(arrayOf: ArrayTypes) {
this.arrayOf = arrayOf
this.arrayValidationRules = []
this.arrayRules(
{
string: 'string',
decimal: 'number',
date: 'date',
number: 'number'
}[arrayOf]
)
return this
}
public serialize() {
return {
...super.serialize(),
arrayOf: this.arrayOf
}
}
} | inidaname/tensei | packages/common/src/fields/Array.ts | TypeScript |
TypeAliasDeclaration |
type ArrayTypes = 'string' | 'number' | 'decimal' | 'date' | inidaname/tensei | packages/common/src/fields/Array.ts | TypeScript |
MethodDeclaration |
public of(arrayOf: ArrayTypes) {
this.arrayOf = arrayOf
this.arrayValidationRules = []
this.arrayRules(
{
string: 'string',
decimal: 'number',
date: 'date',
number: 'number'
}[arrayOf]
)
return this
} | inidaname/tensei | packages/common/src/fields/Array.ts | TypeScript |
MethodDeclaration |
public serialize() {
return {
...super.serialize(),
arrayOf: this.arrayOf
}
} | inidaname/tensei | packages/common/src/fields/Array.ts | TypeScript |
FunctionDeclaration |
export function Get(route: string) {
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
if (!target["__methods__"]) target["__methods__"] = []
target["__methods__"].push({
method: "GET",
route: route,
function: target[propertyKey] as any
})
};
} | betagouv/api-subventions-asso | packages/front/src/decorators/http.methods.decorator.ts | TypeScript |
FunctionDeclaration |
export function Post(route: string) {
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
if (!target["__methods__"]) target["__methods__"] = []
target["__methods__"].push({
method: "POST",
route: route,
function: target[propertyKey] as any
})
};
} | betagouv/api-subventions-asso | packages/front/src/decorators/http.methods.decorator.ts | TypeScript |
FunctionDeclaration |
export function Put(route: string) {
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
if (!target["__methods__"]) target["__methods__"] = []
target["__methods__"].push({
method: "PUT",
route: route,
function: target[propertyKey] as any
})
};
} | betagouv/api-subventions-asso | packages/front/src/decorators/http.methods.decorator.ts | TypeScript |
FunctionDeclaration |
export function Delete(route: string) {
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
if (!target["__methods__"]) target["__methods__"] = []
target["__methods__"].push({
method: "DELETE",
route: route,
function: target[propertyKey] as any
})
};
} | betagouv/api-subventions-asso | packages/front/src/decorators/http.methods.decorator.ts | TypeScript |
ClassDeclaration | /** Configure undesired operator variants */
export class PreferredCompareOperatorConf extends BasicRuleConfig {
/** Operators which are not allowed */
public badOperators: string[] = ["EQ", "><", "NE", "GE", "GT", "LT", "LE"];
} | Steve192/abaplint | src/rules/preferred_compare_operator.ts | TypeScript |
ClassDeclaration |
export class PreferredCompareOperator extends ABAPRule {
private conf = new PreferredCompareOperatorConf();
public getKey(): string {
return "preferred_compare_operator";
}
private getDescription(operator: string): string {
return "Compare operator \"" + operator + "\" not preferred";
}
public runParsed(file: ABAPFile) {
const issues: Issue[] = [];
const struc = file.getStructure();
if (struc === undefined) {
return [];
}
const operators = struc.findAllExpressions(Expressions.CompareOperator).concat(
struc.findAllExpressions(Expressions.SQLCompareOperator));
for (const op of operators) {
const token = op.getLastToken();
if (this.conf.badOperators.indexOf(token.getStr()) >= 0) {
const message = this.getDescription(token.getStr());
const issue = Issue.atToken(file, token, message, this.getKey());
issues.push(issue);
}
}
return issues;
}
public getConfig() {
return this.conf;
}
public setConfig(conf: PreferredCompareOperatorConf) {
this.conf = conf;
}
} | Steve192/abaplint | src/rules/preferred_compare_operator.ts | TypeScript |
MethodDeclaration |
public getKey(): string {
return "preferred_compare_operator";
} | Steve192/abaplint | src/rules/preferred_compare_operator.ts | TypeScript |
MethodDeclaration |
private getDescription(operator: string): string {
return "Compare operator \"" + operator + "\" not preferred";
} | Steve192/abaplint | src/rules/preferred_compare_operator.ts | TypeScript |
MethodDeclaration |
public runParsed(file: ABAPFile) {
const issues: Issue[] = [];
const struc = file.getStructure();
if (struc === undefined) {
return [];
}
const operators = struc.findAllExpressions(Expressions.CompareOperator).concat(
struc.findAllExpressions(Expressions.SQLCompareOperator));
for (const op of operators) {
const token = op.getLastToken();
if (this.conf.badOperators.indexOf(token.getStr()) >= 0) {
const message = this.getDescription(token.getStr());
const issue = Issue.atToken(file, token, message, this.getKey());
issues.push(issue);
}
}
return issues;
} | Steve192/abaplint | src/rules/preferred_compare_operator.ts | TypeScript |
MethodDeclaration |
public getConfig() {
return this.conf;
} | Steve192/abaplint | src/rules/preferred_compare_operator.ts | TypeScript |
MethodDeclaration |
public setConfig(conf: PreferredCompareOperatorConf) {
this.conf = conf;
} | Steve192/abaplint | src/rules/preferred_compare_operator.ts | TypeScript |
Subsets and Splits