type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
(resource) => resource.status?.conditions?.find( (c) => c.type === 'Upgradeable' && c.status === K8sResourceConditionStatus.False, )
DaoDaoNoCode/console
frontend/public/module/k8s/cluster-settings.ts
TypeScript
ArrowFunction
(c) => c.type === 'Upgradeable' && c.status === K8sResourceConditionStatus.False
DaoDaoNoCode/console
frontend/public/module/k8s/cluster-settings.ts
TypeScript
ArrowFunction
(resources) => resources.filter((resource) => getConditionUpgradeableFalse(resource))
DaoDaoNoCode/console
frontend/public/module/k8s/cluster-settings.ts
TypeScript
ArrowFunction
(resource) => getConditionUpgradeableFalse(resource)
DaoDaoNoCode/console
frontend/public/module/k8s/cluster-settings.ts
TypeScript
EnumDeclaration
export enum ClusterUpdateStatus { UpToDate = 'Up to Date', UpdatesAvailable = 'Updates Available', Updating = 'Updating', Failing = 'Failing', UpdatingAndFailing = 'Updating and Failing', ErrorRetrieving = 'Error Retrieving', Invalid = 'Invalid Cluster Version', }
DaoDaoNoCode/console
frontend/public/module/k8s/cluster-settings.ts
TypeScript
ArrowFunction
(date?: Date | null, format = DefaultFormat) => { if (date) { return dayjs(date).format(format); } return date; }
doly-dev/mobile-more
src/components/BizForm/demos/components/ItemSpecialDatePicker/SpecialDatePicker.tsx
TypeScript
ArrowFunction
(type: string, data: number) => { switch (type) { case 'year': return data + '年'; case 'month': return data + '月'; case 'day': return data + '日'; default: return data; } }
doly-dev/mobile-more
src/components/BizForm/demos/components/ItemSpecialDatePicker/SpecialDatePicker.tsx
TypeScript
ArrowFunction
({ value, format = DefaultFormat, readOnly = false, placeholder = '请选择', specialValue = safeDate('9999-12-31'), specialLabel = '长期', onConfirm, onClose, ...restProps }) => { const fmtValue = value ? formatDate(value, format) : value; const isSpecial = React.useMemo( () => fmtValue === formatDate(specialValue, format), [fmtValue, format, specialValue] ); const handleChange = React.useCallback( (checked: boolean) => { onClose?.(); if (!readOnly) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore onConfirm?.(checked ? specialValue : undefined); } }, [onClose, onConfirm, readOnly, specialValue] ); // console.log(specialLabel, value, isSpecial); return ( <div className={styles.specialDatePicker}> {!isSpecial && ( <div className={styles.datePicker}> <DatePicker value={value} onConfirm={onConfirm} onClose={onClose} renderLabel={labelRenderer} {...restProps} > {(value)
doly-dev/mobile-more
src/components/BizForm/demos/components/ItemSpecialDatePicker/SpecialDatePicker.tsx
TypeScript
ArrowFunction
() => fmtValue === formatDate(specialValue, format)
doly-dev/mobile-more
src/components/BizForm/demos/components/ItemSpecialDatePicker/SpecialDatePicker.tsx
TypeScript
ArrowFunction
(checked: boolean) => { onClose?.(); if (!readOnly) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore onConfirm?.(checked ? specialValue : undefined); } }
doly-dev/mobile-more
src/components/BizForm/demos/components/ItemSpecialDatePicker/SpecialDatePicker.tsx
TypeScript
InterfaceDeclaration
export interface SpecialDatePickerProps extends DatePickerProps { format?: string; readOnly?: boolean; specialValue?: Date; specialLabel?: React.ReactNode; placeholder?: string; }
doly-dev/mobile-more
src/components/BizForm/demos/components/ItemSpecialDatePicker/SpecialDatePicker.tsx
TypeScript
ArrowFunction
({ erOverstyrt, utbetaling, style }: UtbetalingCellProps) => ( <Cell erOverstyrt={erOverstyrt}
navikt/helse-speil
src/client/routes/saksbilde/utbetaling/utbetalingstabell/UtbetalingCell.tsx
TypeScript
InterfaceDeclaration
interface UtbetalingCellProps extends React.HTMLAttributes<HTMLTableDataCellElement> { erOverstyrt?: boolean; utbetaling?: number; }
navikt/helse-speil
src/client/routes/saksbilde/utbetaling/utbetalingstabell/UtbetalingCell.tsx
TypeScript
MethodDeclaration
somPenger(utbetaling)
navikt/helse-speil
src/client/routes/saksbilde/utbetaling/utbetalingstabell/UtbetalingCell.tsx
TypeScript
FunctionDeclaration
/** * Recursively process the handlebars templates for the given project. * @param {string} currentPath * @param {string} fullFolderPath */ function processFolder(currentPath, fullFolderPath) { fs.readdirSync(fullFolderPath).forEach(function(fileName) { let f = parseFileName(fileName, projectParameters) let fullLocalPath = path.join(currentPath, f.name); let fullFilePath = path.join(fullFolderPath, f.originalName); if (fileName == ".noars") { console.log(colors.yellow("Ignoring file : " + ".noars")) return } if (isDirectory(fullFilePath)) { if (isDirectory(fullLocalPath)) { console.log(colors.yellow("Already exists folder: " + fullLocalPath)); } else { console.log(colors.cyan("Creating folder : " + fullLocalPath)) fs.mkdirSync(fullLocalPath); } processFolder(fullLocalPath, fullFilePath); return; } if (f.keepExisting && isFile(fullLocalPath)) { console.log(colors.yellow("Keeping regular file : " + fullLocalPath)) return; } if (!f.hbsTemplate) { if (!isFile(fullLocalPath)) { console.log(colors.cyan("Copying regular file : " + fullLocalPath)) fsExtra.copySync(fullFilePath, fullLocalPath); return; } if (fs.readFileSync(fullFilePath, "utf-8") == fs.readFileSync(fullLocalPath, "utf-8")) { console.log(colors.cyan("No update needed : " + fullLocalPath)); return; } // we have a conflict. let fullLocalPathOrig = fullLocalPath + ".orig" fsExtra.copySync(fullLocalPath, fullLocalPathOrig); fsExtra.copySync(fullFilePath, fullLocalPath); executeDiff(ARS_DIFF_TOOL, fullLocalPath, fullLocalPathOrig); fs.unlinkSync(fullLocalPathOrig); console.log(colors.red("Conflict resolved : " + fullLocalPath)); return; } let templateContent = fs.readFileSync(fullFilePath, "utf-8") let template = handlebars.compile(templateContent) let content = template(projectParameters) if (!isFile(fullLocalPath)) { console.log(colors.cyan("Parsing HBS template : " + fullLocalPath)) fs.writeFileSync(fullLocalPath, content, {encoding: "utf-8"}) return; } if (content == fs.readFileSync(fullLocalPath, "utf-8")) { console.log(colors.cyan("No update needed : " + fullLocalPath)); return; } let fullLocalPathOrig = fullLocalPath + ".orig" fsExtra.copySync(fullLocalPath, fullLocalPathOrig); fs.writeFileSync(fullLocalPath, content, {encoding: "utf-8"}) executeDiff(ARS_DIFF_TOOL, fullLocalPath, fullLocalPathOrig); fs.unlinkSync(fullLocalPathOrig); console.log(colors.red("Conflict resolved HBS: " + fullLocalPath)); }); }
bmustiata/ars
src/main.ts
TypeScript
FunctionDeclaration
/** * parseFileName - Parse the file name * @param {string} fileName * @param {any} projectParameters * @return {Object} */ function parseFileName(fileName, projectParameters) { const result = { name: null, originalName: fileName, keepExisting: false, hbsTemplate: false }; let name = fileName; if (/\.KEEP$/.test(name)) { result.keepExisting = true name = name.substring(0, name.length - ".KEEP".length) } if (/\.hbs/.test(name)) { result.hbsTemplate = true name = name.substring(0, name.length - ".hbs".length) } result.name = handlebars.compile(name)(projectParameters); return result; }
bmustiata/ars
src/main.ts
TypeScript
FunctionDeclaration
/** * isDirectory - Checks if the given file path is a directory. * @param {string} name * @return {boolean} */ function isDirectory(name) { try { return fs.statSync(name).isDirectory(); } catch (e) { return false; } }
bmustiata/ars
src/main.ts
TypeScript
FunctionDeclaration
/** * isFile - Checks if the given file path is an existing file * @param {string} name * @return {boolean} */ function isFile(name) { try { return fs.statSync(name).isFile(); } catch (e) { return false; } }
bmustiata/ars
src/main.ts
TypeScript
FunctionDeclaration
/** * executeDiff - Execute the given diff process. * @param {string} diff program name * @param {string} file1 first file to diff * @param {string} file2 second file do diff * @return {void} */ function executeDiff(processName, file1, file2) { childProcess.execSync( `${processName} "${file1}" "${file2}"`, {stdio:[0,1,2]}); }
bmustiata/ars
src/main.ts
TypeScript
ArrowFunction
(it) => { console.log(` * ${it}`) }
bmustiata/ars
src/main.ts
TypeScript
FunctionDeclaration
/** * Get specific province data with IDataProvince object structure * * Return object data based on provided province key * * @param {string} provinceKey - Array key of the province * @return {IDataProvince} IDataProvince object **/ export function getDataProvince(provinceKey: string): IDataProvince { return prov.getData(provinceKey) as IDataProvince }
agraris/nusantara-valid
src/ts/functions/extended/_province.extended.ts
TypeScript
FunctionDeclaration
/** * Get all province data with IDataProvince object structure * * Return all IDataProvince object in Array<IDataProvince> * * @return {IDataProvince[]} Array of IDataProvince object **/ export function getDataProvinces(): IDataProvince[]{ return prov.getData() as IDataProvince[] }
agraris/nusantara-valid
src/ts/functions/extended/_province.extended.ts
TypeScript
FunctionDeclaration
/** * Get all regencies in a Province * * Return an array of regencies in a Province * * @param {string} provinceKey - Key of the province * @return {IDataRegency[]} Array of IDataRegency object **/ export function getDataRegenciesInProvince(provinceKey: string): IDataRegency[] { return prov.getDataRegenciesInProvince(provinceKey) as IDataRegency[] }
agraris/nusantara-valid
src/ts/functions/extended/_province.extended.ts
TypeScript
FunctionDeclaration
/** * Get all districts in a Regency * * Return an array of districts in a Regency * * @param {string} regencyKey - Key of the regency * @return {IDataDistrict[]} Array of IDataDistrict object **/ export function getDataDistrictsInRegency(regencyKey: string): IDataDistrict[] { return prov.getDataDistrictsInRegency(regencyKey) as IDataDistrict[] }
agraris/nusantara-valid
src/ts/functions/extended/_province.extended.ts
TypeScript
ArrowFunction
({ bpsCode, name }) => ({ bpsCode, name })
agraris/nusantara-valid
src/ts/functions/extended/_province.extended.ts
TypeScript
ClassDeclaration
/** * Nusantara Valid: _province.extended.ts * * Licensed under MIT (https://github.com/agraris/nusantara-valid/blob/master/LICENSE) * * @class The ProvinceExtended class **/ class ProvinceExtended extends Province { getDataRegenciesInProvince(provinceKey: string): IDataRegency[] { const REGENCIES = PROVINCE_DATA_EXTENSION[provinceKey].regencies as [] const regencies = REGENCIES.map(({ bpsCode, name }) => ({ bpsCode, name })) return regencies } getDataDistrictsInRegency(regencyKey: string): IDataDistrict[] { const provinceKey = regencyKey.split('.')[0] const REGENCIES = PROVINCE_DATA_EXTENSION[provinceKey].regencies let DISTRICTS = [] for (const element of REGENCIES) { if (element.bpsCode == regencyKey) { DISTRICTS = element.districts } } return DISTRICTS as IDataDistrict[] } }
agraris/nusantara-valid
src/ts/functions/extended/_province.extended.ts
TypeScript
MethodDeclaration
getDataRegenciesInProvince(provinceKey: string): IDataRegency[] { const REGENCIES = PROVINCE_DATA_EXTENSION[provinceKey].regencies as [] const regencies = REGENCIES.map(({ bpsCode, name }) => ({ bpsCode, name })) return regencies }
agraris/nusantara-valid
src/ts/functions/extended/_province.extended.ts
TypeScript
MethodDeclaration
getDataDistrictsInRegency(regencyKey: string): IDataDistrict[] { const provinceKey = regencyKey.split('.')[0] const REGENCIES = PROVINCE_DATA_EXTENSION[provinceKey].regencies let DISTRICTS = [] for (const element of REGENCIES) { if (element.bpsCode == regencyKey) { DISTRICTS = element.districts } } return DISTRICTS as IDataDistrict[] }
agraris/nusantara-valid
src/ts/functions/extended/_province.extended.ts
TypeScript
ArrowFunction
({ messages, }: { messages: MessageUI[] }): ReactElement => { const message = messages[0] return ( <View style={{ alignItems: 'flex-start', justifyContent: 'flex-start', }}
terra-money/station-mobile
src/components/history/HistoryItem.tsx
TypeScript
ArrowFunction
(item, index) => { return ( <Text key={`message.summary-${index}`}
terra-money/station-mobile
src/components/history/HistoryItem.tsx
TypeScript
ArrowFunction
({ item }: { item: TxUI }): ReactElement => { return ( <ExtLink url={item.link} title={ <View> {_.some(item.messages) && ( <Message messages={item.messages} />
terra-money/station-mobile
src/components/history/HistoryItem.tsx
TypeScript
ArrowFunction
async () => { const container = await createContainer(); process.on("uncaughtException", (err) => { container.resolve<Logger>("logger").error(`Uncaught: ${err.toString()}`, err); process.exit(1); }); process.on("unhandledRejection", (err) => { if (err) { container.resolve<Logger>("logger").error(`Unhandled: ${err.toString()}`, err); } process.exit(1); }); const server: Server = container.resolve("server"); const port = container.resolve("port"); server.listen(port); container.resolve<Logger>("logger").info(`listening on port: ${port}`); }
low-cpu/express-boilerplate
src/index.ts
TypeScript
ArrowFunction
(err) => { container.resolve<Logger>("logger").error(`Uncaught: ${err.toString()}`, err); process.exit(1); }
low-cpu/express-boilerplate
src/index.ts
TypeScript
ArrowFunction
(err) => { if (err) { container.resolve<Logger>("logger").error(`Unhandled: ${err.toString()}`, err); } process.exit(1); }
low-cpu/express-boilerplate
src/index.ts
TypeScript
ArrowFunction
item => item.id !== categoryId
felagos/store-app
src/product/services/product/product.service.ts
TypeScript
ClassDeclaration
@Injectable() export class ProductService { constructor( @InjectRepository(ProductRepository) private productRepository: ProductRepository, @InjectRepository(BrandRepository) private brandRepository: BrandRepository, @InjectRepository(CategoryRepository) private categoryRepository: CategoryRepository) { } findAllPagination(filter?: FilterProductsDto): Promise<PaginationResponseDto<Product[]>> { return this.productRepository.findAllPagination(filter); } async findOne(id: number): Promise<Product> { const product = await this.productRepository.findOne(id); if (!product) throw new NotFoundException('Product not found'); return product; } async create(payload: CreateProductDTO): Promise<Product> { const newProduct = this.productRepository.create(payload); if (payload.brandId) { const brand = await this.brandRepository.findOne(payload.brandId); newProduct.brand = brand; } if (payload.categoriesIds) { const categories = await this.categoryRepository.findByIds(payload.categoriesIds); newProduct.categories = categories; } return this.productRepository.save(newProduct); } async update(id: number, changes: UpdateProductDTO): Promise<Product> { const product = await this.productRepository.findOne(id); if (changes.brandId) { const brand = await this.brandRepository.findOne(changes.brandId); product.brand = brand; } if (changes.categoriesIds) { const categories = await this.categoryRepository.findByIds( changes.categoriesIds, ); product.categories = categories; } this.productRepository.merge(product, changes); return this.productRepository.save(product); } async remove(id: number) { const result = await this.productRepository.delete(id); if (result.affected === 0) throw new NotFoundException('Product not found'); } async removeCategoryByProduct(productId: number, categoryId: number) { const product = await this.productRepository.findOne(productId, { relations: ['categories'], }); product.categories = product.categories.filter(item => item.id !== categoryId); return this.productRepository.save(product); } async addCategoryToProduct(productId: number, categoryId: number) { const product = await this.productRepository.findOne(productId, { relations: ['categories'] }); const category = await this.categoryRepository.findOne(categoryId); product.categories.push(category); return this.productRepository.save(product); } }
felagos/store-app
src/product/services/product/product.service.ts
TypeScript
MethodDeclaration
findAllPagination(filter?: FilterProductsDto): Promise<PaginationResponseDto<Product[]>> { return this.productRepository.findAllPagination(filter); }
felagos/store-app
src/product/services/product/product.service.ts
TypeScript
MethodDeclaration
async findOne(id: number): Promise<Product> { const product = await this.productRepository.findOne(id); if (!product) throw new NotFoundException('Product not found'); return product; }
felagos/store-app
src/product/services/product/product.service.ts
TypeScript
MethodDeclaration
async create(payload: CreateProductDTO): Promise<Product> { const newProduct = this.productRepository.create(payload); if (payload.brandId) { const brand = await this.brandRepository.findOne(payload.brandId); newProduct.brand = brand; } if (payload.categoriesIds) { const categories = await this.categoryRepository.findByIds(payload.categoriesIds); newProduct.categories = categories; } return this.productRepository.save(newProduct); }
felagos/store-app
src/product/services/product/product.service.ts
TypeScript
MethodDeclaration
async update(id: number, changes: UpdateProductDTO): Promise<Product> { const product = await this.productRepository.findOne(id); if (changes.brandId) { const brand = await this.brandRepository.findOne(changes.brandId); product.brand = brand; } if (changes.categoriesIds) { const categories = await this.categoryRepository.findByIds( changes.categoriesIds, ); product.categories = categories; } this.productRepository.merge(product, changes); return this.productRepository.save(product); }
felagos/store-app
src/product/services/product/product.service.ts
TypeScript
MethodDeclaration
async remove(id: number) { const result = await this.productRepository.delete(id); if (result.affected === 0) throw new NotFoundException('Product not found'); }
felagos/store-app
src/product/services/product/product.service.ts
TypeScript
MethodDeclaration
async removeCategoryByProduct(productId: number, categoryId: number) { const product = await this.productRepository.findOne(productId, { relations: ['categories'], }); product.categories = product.categories.filter(item => item.id !== categoryId); return this.productRepository.save(product); }
felagos/store-app
src/product/services/product/product.service.ts
TypeScript
MethodDeclaration
async addCategoryToProduct(productId: number, categoryId: number) { const product = await this.productRepository.findOne(productId, { relations: ['categories'] }); const category = await this.categoryRepository.findOne(categoryId); product.categories.push(category); return this.productRepository.save(product); }
felagos/store-app
src/product/services/product/product.service.ts
TypeScript
ClassDeclaration
@NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule], }) export class AppRoutingRoutingModule { }
stefanwalther/angular-markdown-editor
src/app/app-routing.module.ts
TypeScript
ArrowFunction
(user) => user.profileId
gemma-Kim/study-nest
src/module/user/entity/user.entity.ts
TypeScript
ClassDeclaration
// @Entity('user') // export class User { // @PrimaryGeneratedColumn() // id: number; // @Column() // email: string; // @Column() // nickname: string; // @Column() // password: string; // @CreateDateColumn() // createAt: string; // @UpdateDateColumn() // updateAt: string; // @OneToMany(() => User, (user) => user.profileId) // profileId: Profile[]; // } @Entity('user') export class User extends BaseEntity { @PrimaryGeneratedColumn() id: number; @Column() email: string; @Column() nickname: string; @Column() password: string; @CreateDateColumn() createAt: string; @UpdateDateColumn() updateAt: string; @OneToMany(() => User, (user) => user.profileId) profileId: Profile[]; // constructor( // //id: number, // email: Password, // password: Password, // nickname: Nickname, // ) { // super(); // //if (!id) throw new NotAcceptableException('INVALID_USER_ID'); // if (!email) throw new NotAcceptableException('INVALID_EMAIL'); // if (!password) throw new NotAcceptableException('INVALID_PASSWORD'); // if (!nickname) throw new NotAcceptableException('INVALID_NICKNAME'); // //this.id = id; // this.email = email.value; // this.password = password.value; // this.nickname = nickname.value; // } }
gemma-Kim/study-nest
src/module/user/entity/user.entity.ts
TypeScript
ClassDeclaration
@Injectable() export class TodoService { constructor( @InjectRepository(ToDo) private todoRepository: Repository<ToDo>, ) {} async findAll(): Promise<ToDo[]> { return await this.todoRepository.find(); } async findById(id_todo: number): Promise<ToDo[]> { return await this.todoRepository.find({ id_todo }); } async findToDosByUserId(userId: number): Promise<ToDo[]> { return await this.todoRepository.find({ where: { user: userId } }); } async create(todo: CrearToDo): Promise<ToDo> { let actividad = this.todoRepository.create(todo); return await this.todoRepository.save(actividad); } async update(todo: ModificarToDo): Promise<ToDo> { let modificado = await this.findById(todo.id_todo); modificado[0].actividad = todo.actividad; modificado[0].finalizada = todo.finalizada; return await this.todoRepository.save(modificado[0]); } async remove(id_todo: number) { await this.todoRepository.delete(id_todo); } }
Inushin/pruebaNestJS
src/todo/todo.service.ts
TypeScript
MethodDeclaration
async findAll(): Promise<ToDo[]> { return await this.todoRepository.find(); }
Inushin/pruebaNestJS
src/todo/todo.service.ts
TypeScript
MethodDeclaration
async findById(id_todo: number): Promise<ToDo[]> { return await this.todoRepository.find({ id_todo }); }
Inushin/pruebaNestJS
src/todo/todo.service.ts
TypeScript
MethodDeclaration
async findToDosByUserId(userId: number): Promise<ToDo[]> { return await this.todoRepository.find({ where: { user: userId } }); }
Inushin/pruebaNestJS
src/todo/todo.service.ts
TypeScript
MethodDeclaration
async create(todo: CrearToDo): Promise<ToDo> { let actividad = this.todoRepository.create(todo); return await this.todoRepository.save(actividad); }
Inushin/pruebaNestJS
src/todo/todo.service.ts
TypeScript
MethodDeclaration
async update(todo: ModificarToDo): Promise<ToDo> { let modificado = await this.findById(todo.id_todo); modificado[0].actividad = todo.actividad; modificado[0].finalizada = todo.finalizada; return await this.todoRepository.save(modificado[0]); }
Inushin/pruebaNestJS
src/todo/todo.service.ts
TypeScript
MethodDeclaration
async remove(id_todo: number) { await this.todoRepository.delete(id_todo); }
Inushin/pruebaNestJS
src/todo/todo.service.ts
TypeScript
MethodDeclaration
/** * 检查指定的组是否正在加载中 * @method RES.ResourceLoader#isGroupInLoading * @param groupName {string} * @returns {boolean} */ public isGroupInLoading(groupName:string):boolean{ return this.itemListDic[groupName]!==undefined; }
000D/egret-core
src/extension/resource/core/ResourceLoader.ts
TypeScript
MethodDeclaration
/** * 开始加载一组文件 * @method RES.ResourceLoader#loadGroup * @param list {egret.Array<ResourceItem>} 加载项列表 * @param groupName {string} 组名 * @param priority {number} 加载优先级 */ public loadGroup(list:Array<ResourceItem>,groupName:string,priority:number=0):void{ if(this.itemListDic[groupName]||!groupName) return; if(!list||list.length==0){ egret.$warn(3201, groupName); let event:ResourceEvent = new ResourceEvent(ResourceEvent.GROUP_LOAD_ERROR); event.groupName = groupName; this.dispatchEvent(event); return; } if(this.priorityQueue[priority]) this.priorityQueue[priority].push(groupName); else this.priorityQueue[priority] = [groupName]; this.itemListDic[groupName] = list; let length:number = list.length; for(let i:number=0;i<length;i++){ let resItem:ResourceItem = list[i]; resItem.groupName = groupName; } this.groupTotalDic[groupName] = list.length; this.numLoadedDic[groupName] = 0; this.next(); }
000D/egret-core
src/extension/resource/core/ResourceLoader.ts
TypeScript
MethodDeclaration
/** * 加载一个文件 * @method RES.ResourceLoader#loadItem * @param resItem {egret.ResourceItem} 要加载的项 */ public loadItem(resItem:ResourceItem):void{ this.lazyLoadList.push(resItem); resItem.groupName = ""; this.next(); }
000D/egret-core
src/extension/resource/core/ResourceLoader.ts
TypeScript
MethodDeclaration
/** * 加载下一项 */ private next():void{ while(this.loadingCount<this.thread) { let resItem:ResourceItem = this.getOneResourceItem(); if(!resItem) break; this.loadingCount++; if(resItem.loaded){ this.onItemComplete(resItem); } else{ let analyzer:AnalyzerBase = this.resInstance.$getAnalyzerByType(resItem.type); analyzer.loadFile(resItem,this.onItemComplete,this); } } }
000D/egret-core
src/extension/resource/core/ResourceLoader.ts
TypeScript
MethodDeclaration
/** * 获取下一个待加载项 */ private getOneResourceItem():ResourceItem{ if (this.failedList.length > 0) return this.failedList.shift(); let maxPriority:number = Number.NEGATIVE_INFINITY; for(let p in this.priorityQueue){ maxPriority = Math.max(maxPriority,<number><any> p); } let queue:any[] = this.priorityQueue[maxPriority]; if(!queue||queue.length==0){ if(this.lazyLoadList.length==0) return null; //后请求的先加载,以便更快获取当前需要的资源 return this.lazyLoadList.pop(); } let length:number = queue.length; let list:Array<ResourceItem>; for(let i:number=0;i<length;i++){ if(this.queueIndex>=length) this.queueIndex = 0; list = this.itemListDic[queue[this.queueIndex]]; if(list.length>0) break; this.queueIndex++; } if(list.length==0) return null; return list.shift(); }
000D/egret-core
src/extension/resource/core/ResourceLoader.ts
TypeScript
MethodDeclaration
/** * 加载结束 */ private onItemComplete(resItem:ResourceItem):void{ this.loadingCount--; let groupName:string = resItem.groupName; if(!resItem.loaded){//加载失败 let times = this.retryTimesDic[resItem.name] || 1; if (times > this.maxRetryTimes) { delete this.retryTimesDic[resItem.name]; ResourceEvent.dispatchResourceEvent(this.resInstance, ResourceEvent.ITEM_LOAD_ERROR, groupName, resItem); } else { this.retryTimesDic[resItem.name] = times + 1; this.failedList.push(resItem); this.next(); return; } } if(groupName){ this.numLoadedDic[groupName]++; let itemsLoaded:number = this.numLoadedDic[groupName]; let itemsTotal:number = this.groupTotalDic[groupName]; if(!resItem.loaded){ this.groupErrorDic[groupName] = true; } ResourceEvent.dispatchResourceEvent(this.resInstance,ResourceEvent.GROUP_PROGRESS,groupName,resItem,itemsLoaded,itemsTotal); if(itemsLoaded==itemsTotal){ let groupError:boolean = this.groupErrorDic[groupName]; this.removeGroupName(groupName); delete this.groupTotalDic[groupName]; delete this.numLoadedDic[groupName]; delete this.itemListDic[groupName]; delete this.groupErrorDic[groupName]; if(groupError){ ResourceEvent.dispatchResourceEvent(this,ResourceEvent.GROUP_LOAD_ERROR,groupName); } else{ ResourceEvent.dispatchResourceEvent(this,ResourceEvent.GROUP_COMPLETE,groupName); } } } else{ this.callBack.call(this.resInstance,resItem); } this.next(); }
000D/egret-core
src/extension/resource/core/ResourceLoader.ts
TypeScript
MethodDeclaration
/** * 从优先级队列中移除指定的组名 */ private removeGroupName(groupName:string):void{ for(let p in this.priorityQueue){ let queue:any[] = this.priorityQueue[p]; let index:number = 0; let found:boolean = false; let length:number = queue.length; for(let i:number=0;i<length;i++){ let name:string = queue[i]; if(name==groupName){ queue.splice(index,1); found = true; break; } index++; } if(found){ if(queue.length==0){ delete this.priorityQueue[p]; } break; } } }
000D/egret-core
src/extension/resource/core/ResourceLoader.ts
TypeScript
FunctionDeclaration
export declare function getPermissionTypes({ includeRestrictedPermissions }: { includeRestrictedPermissions?: boolean | undefined; }): Readonly<{ access_activity: { name: string; description: string; }; access_user_profile: { name: string; description: string; }; access_heart_rate: { name: string; description: string; }; access_location: { name: string; description: string; }; access_internet: { name: string; description: string; }; run_background: { name: string; description: string; }; }>;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function normalizeProjectConfig(config: any, defaults?: Partial<AppProjectConfiguration & ClockProjectConfiguration>): ProjectConfiguration;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function validateAppType(config: ProjectConfiguration): DiagnosticList;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function validateDisplayName(name: string): string | true;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function validateProjectDisplayName(config: ProjectConfiguration): DiagnosticList;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function validateWipeColor(config: ProjectConfiguration): DiagnosticList;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function validateRequestedPermissions({ requestedPermissions }: ProjectConfiguration): DiagnosticList;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function validateBuildTarget({ buildTargets }: ProjectConfiguration): DiagnosticList;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function validateLocaleDisplayName({ i18n }: ProjectConfiguration, localeKey: keyof typeof LOCALES): DiagnosticList;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function validateLocaleDisplayNames(config: ProjectConfiguration): DiagnosticList;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function validateSupportedLocales({ i18n }: ProjectConfiguration): DiagnosticList;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function validateAppUUID({ appUUID }: ProjectConfiguration): DiagnosticList;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
FunctionDeclaration
export declare function validate(config: ProjectConfiguration): DiagnosticList;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
InterfaceDeclaration
export interface BaseProjectConfiguration { appType: AppType; appDisplayName: string; appUUID: string; requestedPermissions: string[]; i18n: LocalesConfig; buildTargets: BuildTarget[]; enableProposedAPI?: true; }
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
InterfaceDeclaration
export interface AppProjectConfiguration extends BaseProjectConfiguration { appType: AppType.APP; wipeColor: string; iconFile: string; }
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
InterfaceDeclaration
export interface ClockProjectConfiguration extends BaseProjectConfiguration { appType: AppType.CLOCKFACE; }
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
EnumDeclaration
export declare enum AppType { APP = "app", CLOCKFACE = "clockface" }
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
EnumDeclaration
export declare enum BuildTarget { HIGGS = "higgs", MESON = "meson" }
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
TypeAliasDeclaration
export declare type LocalesConfig = { [locale: string]: { name: string; }; };
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
TypeAliasDeclaration
declare type ProjectConfiguration = AppProjectConfiguration | ClockProjectConfiguration;
Judge24601/Lumohacks
FitBit/node_modules/@fitbit/sdk/lib/ProjectConfiguration.d.ts
TypeScript
ArrowFunction
w => w.name === name
RetrogradeAmnesia/Bot
src/api/modules/logging/webhook-logger.ts
TypeScript
ClassDeclaration
export class WebhookLogger { constructor( private bot = Deps.get<Client>(Client) ) {} public async get(channelId: string, name: string) { const channel = this.bot.channels.cache.get(channelId) as TextChannel; if (!channel) return; const webhooks = await channel.fetchWebhooks(); return webhooks.find(w => w.name === name) ?? await channel.createWebhook(name, { avatar: this.bot.user.displayAvatarURL(), reason: `Created for ${process.env.BOT_NAME}'s webhook logger.` }); } public async feedback(message: string) { const webhook = await this.get(process.env.FEEDBACK_CHANNEL_ID, `${process.env.BOT_NAME} - Feedback`); if (!webhook) return; await webhook.send(new MessageEmbed({ title: 'Feedback', description: message })); } public async vote(userId: string, votes: number) { const webhook = await this.get(process.env.VOTE_CHANNEL_ID, `${process.env.BOT_NAME} - Vote`); if (!webhook) return; await webhook.send(new MessageEmbed({ title: 'Vote', description: `✅ <@!${userId}> has entered, and now has \`${votes}\` entries!` })); } }
RetrogradeAmnesia/Bot
src/api/modules/logging/webhook-logger.ts
TypeScript
MethodDeclaration
public async get(channelId: string, name: string) { const channel = this.bot.channels.cache.get(channelId) as TextChannel; if (!channel) return; const webhooks = await channel.fetchWebhooks(); return webhooks.find(w => w.name === name) ?? await channel.createWebhook(name, { avatar: this.bot.user.displayAvatarURL(), reason: `Created for ${process.env.BOT_NAME}'s webhook logger.` }); }
RetrogradeAmnesia/Bot
src/api/modules/logging/webhook-logger.ts
TypeScript
MethodDeclaration
public async feedback(message: string) { const webhook = await this.get(process.env.FEEDBACK_CHANNEL_ID, `${process.env.BOT_NAME} - Feedback`); if (!webhook) return; await webhook.send(new MessageEmbed({ title: 'Feedback', description: message })); }
RetrogradeAmnesia/Bot
src/api/modules/logging/webhook-logger.ts
TypeScript
MethodDeclaration
public async vote(userId: string, votes: number) { const webhook = await this.get(process.env.VOTE_CHANNEL_ID, `${process.env.BOT_NAME} - Vote`); if (!webhook) return; await webhook.send(new MessageEmbed({ title: 'Vote', description: `✅ <@!${userId}> has entered, and now has \`${votes}\` entries!` })); }
RetrogradeAmnesia/Bot
src/api/modules/logging/webhook-logger.ts
TypeScript
ClassDeclaration
export declare class Abbr extends Root { constructor(id: string); }
mariousm/TestingAWE
dist/libraryWIO/class/Abbr.d.ts
TypeScript
FunctionDeclaration
function definePowerCreepGetter<T extends keyof PowerCreep>( property: T, handler: (self: PowerCreep) => PowerCreep[T], ) { defineGetter<PowerCreep, PowerCreepConstructor, T>( PowerCreep, property, handler, ) }
stachu3478/screeps-bot
src/overloads/powerCreep/PowerCreep.ts
TypeScript
FunctionDeclaration
function memoizeByPowerCreep<T>(fn: (c: PowerCreep) => T) { return _.memoize(fn, (c: PowerCreep) => c.id) }
stachu3478/screeps-bot
src/overloads/powerCreep/PowerCreep.ts
TypeScript
ArrowFunction
(c: PowerCreep) => c.id
stachu3478/screeps-bot
src/overloads/powerCreep/PowerCreep.ts
TypeScript
ArrowFunction
(c) => new PowerCreepCorpus(c)
stachu3478/screeps-bot
src/overloads/powerCreep/PowerCreep.ts
TypeScript
ArrowFunction
(self) => powerCreepCorpus(self)
stachu3478/screeps-bot
src/overloads/powerCreep/PowerCreep.ts
TypeScript
ArrowFunction
(self) => 0
stachu3478/screeps-bot
src/overloads/powerCreep/PowerCreep.ts
TypeScript
ArrowFunction
params => { // this.serviceMaintenanceId = params['id']; }
https-github-com-blackshot/auto-frontend
src/app/features/service-maintenance/components/service-maintenance-control/service-maintenance-control.component.ts
TypeScript
ArrowFunction
(res) => { this.openSnackBar('Данные успешно сохранены!'); this.serviceMaintenance = new ServiceMaintenance(); console.log('res', res); }
https-github-com-blackshot/auto-frontend
src/app/features/service-maintenance/components/service-maintenance-control/service-maintenance-control.component.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-service-maintenance-control', templateUrl: './service-maintenance-control.component.html', styleUrls: ['./service-maintenance-control.component.scss'] }) export class ServiceMaintenanceControlComponent implements OnInit, OnDestroy { @Output() public myOutput = new EventEmitter(); serviceMaintenance: ServiceMaintenance; horizontalPosition: MatSnackBarHorizontalPosition = 'center'; verticalPosition: MatSnackBarVerticalPosition = 'top'; private _unsubscribeAll: Subject<any>; constructor( private _serviceMaintenanceService: ServiceMaintenanceService, private _route: ActivatedRoute, private router: Router, private _snackBar: MatSnackBar ) { this._unsubscribeAll = new Subject(); } ngOnInit(): void { this.serviceMaintenance = new ServiceMaintenance(); // this.loadServiceMaintenance(); this._route.params.subscribe(params => { // this.serviceMaintenanceId = params['id']; }); } ngOnDestroy(): void { this._unsubscribeAll.next(); this._unsubscribeAll.complete(); } public buttonClick(): void { this.myOutput.emit(true); } // loadServiceMaintenance(): void { // this._serviceMaintenanceService.getServiceMaintenance(this.serviceMaintenanceId) // .pipe(takeUntil(this._unsubscribeAll)).subscribe((res) => { // this.serviceMaintenance = res; // console.log(this.serviceMaintenance); // }); // } create(): void { this._serviceMaintenanceService.createServiceMaintenance(this.serviceMaintenance) .pipe(takeUntil(this._unsubscribeAll)).subscribe((res) => { this.openSnackBar('Данные успешно сохранены!'); this.serviceMaintenance = new ServiceMaintenance(); console.log('res', res); }); } openSnackBar(message: string) { this._snackBar.open(message, '', { duration: 2000, horizontalPosition: this.horizontalPosition, verticalPosition: this.verticalPosition, }); } }
https-github-com-blackshot/auto-frontend
src/app/features/service-maintenance/components/service-maintenance-control/service-maintenance-control.component.ts
TypeScript
MethodDeclaration
ngOnInit(): void { this.serviceMaintenance = new ServiceMaintenance(); // this.loadServiceMaintenance(); this._route.params.subscribe(params => { // this.serviceMaintenanceId = params['id']; }); }
https-github-com-blackshot/auto-frontend
src/app/features/service-maintenance/components/service-maintenance-control/service-maintenance-control.component.ts
TypeScript
MethodDeclaration
ngOnDestroy(): void { this._unsubscribeAll.next(); this._unsubscribeAll.complete(); }
https-github-com-blackshot/auto-frontend
src/app/features/service-maintenance/components/service-maintenance-control/service-maintenance-control.component.ts
TypeScript
MethodDeclaration
public buttonClick(): void { this.myOutput.emit(true); }
https-github-com-blackshot/auto-frontend
src/app/features/service-maintenance/components/service-maintenance-control/service-maintenance-control.component.ts
TypeScript
MethodDeclaration
// loadServiceMaintenance(): void { // this._serviceMaintenanceService.getServiceMaintenance(this.serviceMaintenanceId) // .pipe(takeUntil(this._unsubscribeAll)).subscribe((res) => { // this.serviceMaintenance = res; // console.log(this.serviceMaintenance); // }); // } create(): void { this._serviceMaintenanceService.createServiceMaintenance(this.serviceMaintenance) .pipe(takeUntil(this._unsubscribeAll)).subscribe((res) => { this.openSnackBar('Данные успешно сохранены!'); this.serviceMaintenance = new ServiceMaintenance(); console.log('res', res); }); }
https-github-com-blackshot/auto-frontend
src/app/features/service-maintenance/components/service-maintenance-control/service-maintenance-control.component.ts
TypeScript
MethodDeclaration
openSnackBar(message: string) { this._snackBar.open(message, '', { duration: 2000, horizontalPosition: this.horizontalPosition, verticalPosition: this.verticalPosition, }); }
https-github-com-blackshot/auto-frontend
src/app/features/service-maintenance/components/service-maintenance-control/service-maintenance-control.component.ts
TypeScript