Datasets:

blob_id
large_stringlengths
40
40
language
large_stringclasses
1 value
repo_name
large_stringlengths
5
119
path
large_stringlengths
4
271
score
float64
2.52
4.84
int_score
int64
3
5
text
stringlengths
26
4.09M
5366e27730172437af7ff2c208161a76030aff6f
TypeScript
PetrovIlyuha/uber-eats
/uber-eats-frontend/src/utils/messaging/toasts.ts
2.625
3
import cogoToast from "cogo-toast"; const defaultOptions = {hideAfter: 3, position: 'top-left'} class ToastFactory { private message: string; private options: Object; constructor(message: string, options: Object = defaultOptions) { this.message = message; this.options = options } showError() { r...
2abb616fd2495a1d5c2b8434518c1bc62c71c4d7
TypeScript
sgobotta/dapp-unq-grupo-f-2017
/backend/src/services/rating-service.ts
2.515625
3
import { inject, injectable } from "inversify"; import * as _ from "lodash"; import { MongoDBClient } from "../config/mongodb/client"; import TYPES from "./../constants/types"; import { User, UserBuilder } from "../models/user"; import { Wove } from "aspect.js"; @Wove() @injectable() export class RatingService { pr...
6c82a0cc2f01215aed25e24af2a0ed7c4a5e2814
TypeScript
marcospmail/rocketseat-gobarber-13
/backend/src/shared/container/providers/StorageProvider/implementations/DiskStorageProvider.ts
2.71875
3
import fs from 'fs' import path from 'path' import uploadConfig from '@config/upload' import IStorageProvider from '@shared/container/providers/StorageProvider/models/IStorageProvider' class DiskStorageProvider implements IStorageProvider { public async save(filename: string): Promise<string> { await fs.promise...
64ef4272e8e9439faf7400de54e36648791f8454
TypeScript
woxiaoyao81/CRender
/es/utils/graph.d.ts
2.734375
3
import { Point } from '../types/core/graph'; /** * @description Get the coordinates of the rotated point */ export declare function getRotatePointPos(rotate: number | undefined, point: Point, origin?: Point): Point; /** * @description Get the coordinates of the scaled point */ export declare function getSca...
624209a4c895947d6057e9b1c493410c1c0a838a
TypeScript
fatum/ts-api-sample
/api/db.ts
2.546875
3
import { State, step, ok, fail } from "../operation"; const db = require("./../models").sequelize; type Model = { create(params: {}, options: {}): {}; create(params: {}, options: {}): {}; findOne(args: {}): {}; }; const load = (model: Model) => step("model.load", async (state: State) => { const params = ...
14cd0bb9adcfaacdddd23cf40147060b7e419d2c
TypeScript
wpflying/05_utils
/src/utils/array/splitToGroups.ts
3.734375
4
/** * 以${groupSize}为一组,进行分割 * @param items 原数组 * @param groupSize 分割的块的容量 * @example * const splited = splitToGroups(['aa', 'bb', 'cc'], 2) // [['aa','bb'], ['cc']] */ export function splitToGroups<T>(items: Readonly<T[]>, groupSize: number) { const result: T[][] = [] let group: T[] = [] for (let i = 0; i <...
ddcd57ab0542e0e685bd4fff30b0c1ce2da16d5c
TypeScript
pnp/sp-dev-fx-extensions
/samples/react-menu-footer-classic-modern/Classic/client/common/model/IHeaderFooterData.ts
2.546875
3
import ILink from './ILink'; // All header-footer data, in the format we expect the JSON to be in export default interface IHeaderFooterData { headerLinks: ILink[]; footerLinks: ILink[]; }
198d15cc44c13f64963ebf0429ae1e01068e1979
TypeScript
dirigeants/utils
/test/isFunction.ts
3.03125
3
import ava from 'ava'; import { isFunction } from '../src'; ava('isFunction(string)', (test): void => { const value = 'Hello World'; test.false(isFunction(value)); }); ava('isFunction(number)', (test): void => { const value = 420; test.false(isFunction(value)); }); ava('isFunction(bigint)', (test): void => { //...
61b93c0f922752aca275086aa7a8045f2df5c5ca
TypeScript
KochankovID/hacatone_miac
/frontend/src/store/PacientDashboard/actions.ts
2.609375
3
import axios from 'axios'; import { baseUrl } from 'helpers'; export enum PatientActions { getMeasurments = 'GET_MEASURMENTS', getPeriodMeasurments = 'GET_PERIOD_MEASURMENTS', getPatientInfo = 'GET_PATIENT_INFO', } export const getMeasurmentsAction = (id: number) => { return async (dispatch: any) => { try...
2f24760e19fff38d003d82800ce04c214ad6388c
TypeScript
Gust4voSales/AppointmentSystemServer
/src/services/ServiceService.ts
2.609375
3
import { getRepository, } from "typeorm" import { Service } from "../models/Service" class ServiceService { async createService(name: string, duration: number) { const repository = getRepository(Service) const newService = repository.create({ name, duration }) return await repository.save(newSer...
f694907dae6bc95be0d2db2a4a17f820ecd21b53
TypeScript
ilyajav/MyUnitTests
/src/08_AssociateArray/08_01.test.ts
2.546875
3
import {UsersType} from "./08_01"; let users: UsersType beforeEach(() =>{ users = { '101': {id: 101, name: 'Ilya'}, '3232312': {id: 3232312, name: 'Natasha'}, '1212': {id: 1212, name: 'Valera'}, '1': {id: 1, name: 'Katya'}, } }) test.skip('Should delete select corresponding us...
d8193dcd8991cc5819eb2a28dd2765cdd12f1648
TypeScript
mp-elearning/project-front-end-sample
/src/app/blogs/blogs.component.ts
2.515625
3
import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { AppRoutingModule } from '../app-routing.module' import { dataCallBlogsService } from 'src/app/services/data-call-blogs.service'; import { blogData } from 'src/app/classes/blog-data'; @Component({ selector: 'app-blog...
1e883336fb7b3a750407ca2be502ca0043281e80
TypeScript
lcsouzamenezes/dragonjs
/src/tools/extensionLang.ts
3.171875
3
interface extensionLangProps { language?: string; extension?: string; } function extensionLang({ language, extension }: extensionLangProps) { let lang = '' if (language === 'javascript') lang = 'js' if (extension === 'js') lang = 'javascript' if (language === 'typescript') lang = 'ts' if (extension ==...
ffa69ec298be35b0ffcf9d51f8faee1ddc737c4d
TypeScript
sijeong/codegen-test
/src/swagger/modules/Managers.ts
2.8125
3
import ApiCommon = require("../api-common") // @ts-ignore import Types = require("../api-types") export type postApiV1Managers_Type = { body?: Types.CreateManagerCommand } export type postApiV1Managers_Response = string /** * POST /api/v1/managers * * Sample request: * * POST /api/v1/managers * { * ...
c943db53cff669442a042fd54c902c31ec2790e3
TypeScript
MikeMnD/ArtemisTS
/src/core/managers/TeamManager.ts
2.953125
3
import MManager = module("core/Manager"); import MEntity = module("core/Entity"); import MBag = module("core/utils/Bag"); import MHashmap = module("core/utils/Hashmap"); /** * * Use this class together with PlayerManager. * * You may sometimes want to create teams in your game, so that * some players are team mat...
b044693abcd3b5de9314cee3b2f353e3eee1840e
TypeScript
future4code/dumont-labenu-system10
/template-express-knex/src/endpoints/insertStudentInMission.ts
2.5625
3
import { Request, Response } from "express"; import { updateStudent } from "../data/updateStudent"; export const studentInMission = async (req: Request, res: Response) => { try { const {missionId, studentId} = req.body if(!req.body.missionId){throw new Error("Favor indicar o id da turma")} if(!req...
e6c786f91d5879ba3ea56c049bc11c7dca1e18c7
TypeScript
vixriihi/Ilmari
/src/app/form/form.actions.ts
2.53125
3
import { Injectable } from '@angular/core'; import { Action } from '@ngrx/store'; import { FormLocation, FormName } from './form.reducer'; @Injectable() export class FormActions { static UPDATE_NAME = '[Form] update name'; static UPDATE_DATE = '[Form] update date'; static UPDATE_LOCATION = '[Form] update locati...
c463772c11dcb6242be8ad061aa01eec50170970
TypeScript
Paul12pp/opensourceweb
/ClientApp/src/app/core/tokens/route-param.token.ts
2.5625
3
import { InjectionToken } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; export const ROUTE_PARAM_TOKEN = new InjectionToken<Observable<string>>( 'Stream of route param from activated route' ); // if you want to get :...
30e21000fee390aba09e20006bc537dc6ebca35e
TypeScript
mombachm/holdermind-stock-service
/src/routingControllers/StockController.ts
2.734375
3
import * as express from "express"; import { RoutingController } from "./abstractRoutingController/RoutingController"; import { StockService } from "../services/StockService"; export enum StockControllerRoute { GetStockMainInfo = "/getStockMainInfo", GetStocksInfo = "/getStocksInfo", SearchStocks = "/searchStock...
ab22200e45ab588c2f9c2bd64c0916510f6bf1ee
TypeScript
siyoola/astrograph
/src/service/dex/offers_graph.ts
2.875
3
import { BigNumber } from "bignumber.js"; import { AssetID } from "../../model"; import { Offer } from "../../orm/entities"; import logger from "../../util/logger"; interface IEdgeData { capacity: BigNumber; orderBook: AssetOrders; } interface IEdge { vertex: AssetID; data: IEdgeData; } class AssetOrder { ...
62ce5cc22c26aac79cfcd92b332bf8a248e185ce
TypeScript
pikou-xr/vcf-generator
/src/utils/vcf.ts
3
3
import { DataHeaders, FieldName, PhoneNumber } from '../types' import vCardsJS from 'vcards-js' const GUESS_PHONE_FIELD_NAME = [ 'téléphone', 'telephone', 'phone', 'phone number', 'numéro de téléphone', ] const GUESS_NAME_FIELD_NAME = ['pseudo'] export const VCF_FIELD_NAMES: Array<VcfFieldName> = ...
bee227c3e6d4860514118ba0eef2620c240056be
TypeScript
Alorel/rxutils
/projects/rxutils/creators/asyncMap.spec.ts
2.796875
3
import {expect} from 'chai'; import {noop} from 'lodash'; import type {Observable} from 'rxjs'; import {lastValueFrom, of, timer} from 'rxjs'; import {map, skip, take, tap} from 'rxjs/operators'; import {finaliseObserver} from '../util/finaliseObserver'; import type {asyncFilter} from './asyncFilter'; import {asyncMap}...
2789ab3bffae8582900fae29a39f9098da547fb3
TypeScript
thienth32/PT15211-WEB-angular
/src/app/components/hero-form/hero-form.component.ts
2.59375
3
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { Hero } from 'src/app/models/hero'; import { Skill } from 'src/app/models/skill'; @Component({ selector: 'hero-form', templateUrl: './hero-form.component.html', styleUrls: ['./hero-form.component.css'] }) export clas...
e6c14f8c8bcbec8d79d15b6895487ae5bf97387f
TypeScript
thiagoleta/coletrasnFrontEnd
/src/app/models/coluna-generica.model.ts
2.6875
3
export class ColunaGenerica { constructor(titulo: string, data: any, ordernar: boolean, largura?: string, dataTitle?: string, style?: object, dataLimited?: boolean) { this.titulo = titulo; this.data = data; this.ordernar = ordernar; this.largura = largura; if (!this.largura || this.la...
44a0eeb0948291c70df27b33bb9be1016967c753
TypeScript
eguneys/csgo-faceit
/modules/pool/poolmember.ts
2.625
3
import { UserId } from '../user/user'; import { SocketSri } from '../socket/socket'; import { Joiner } from './poolapi'; import { PoolConfig } from './poolconfig'; export type RatingRange = 'TODO implement me'; export class PoolMember { static make = (userId: UserId, sri: SocketSri, ...
81e3f336d3bfef7cbe00efe022ca58a34330d1fc
TypeScript
HitoriSensei/omdb
/vendor/store/guard-reducer.ts
3.0625
3
import { HydrateAction } from './initial-state' /** * Type-checks reducer to implement every action of giver Actions set * @param initial * @param f */ export function guardReducer< Actions extends { [action: string]: ActionPayload<any> | null }, Store >(initial: Store, f: (store: Store, action: ActionOf...
8f40d71ebe6ce90bc46702797cefcaacf950ae32
TypeScript
pcn-cad-bupt/api-gateway
/src/auth/jwt.ts
2.859375
3
import * as jwt from 'jsonwebtoken' const secret = 'universe-auth' export interface TokenInfo { username: string, passwd : string, iat : number, // 创建时间 exp : number // 过期时间 } export class Token { // 时间单位为天 public static async sign(username: string, passwd: string, expires?: number): Promise<str...
ecf9d684b5747a62deddc810b8ca6e51e3ffc55c
TypeScript
su37josephxia/kaikeba-code
/node/09/ts-server/src/routes/user.ts
2.6875
3
import * as Koa from 'koa' import { get, post, middlewares, querystring } from '../utils/decors' const users = [{ name: 'tom', age: 20 }] const api = { findByName(name) { return new Promise((resolve, reject) => { setTimeout(() => { if (name === 'xia') { reject...
a35fe127585573c1d3c28100694d5403b4b079fd
TypeScript
forforf/justgraphit
/src/StorageModel/Storage.ts
3.125
3
import IsEmpty from 'lodash.isempty'; import { GraphName, JustGraphitEntry, JustGraphitStore, } from '../JustGraphitTypes'; // ToDo Needs testing: // It's just an thin abstraction layer above a persistent store (local storage in this case) // and should not have any JustGraphit dependencies class LocalStorageWra...
565ef1968d1cf3cf038b7b5409d214cfbeffeee5
TypeScript
ysfaran/react-fluent-form
/test/DefaultValidator.test.ts
3.09375
3
import * as yup from "yup"; import { DefaultValidator } from "../src/validation/DefaultValidator"; import { TestModel } from "./types"; describe("DefaultValidator", () => { let testModel: TestModel; beforeEach(() => { testModel = { aString: "some-string", aDate: new Date(1970, 1, 1), }; });...
52a13b943120943422593d20c33bd9378cb0015a
TypeScript
qstiegler/angular-1-typescript-setup
/src/app/modules/pwned/search.controller.ts
2.625
3
module HaveIBeenPwned { "use strict"; interface ISearchController { //submit(address: string): void } interface ISearchControllerScope extends ng.IScope { vm: ISearchController } class SearchController implements ISearchController { static $inject = ["$scope", "PwnedS...
e67ec0aacb2b9fb00cbdf76f4e3bba8618d3baac
TypeScript
dngwoo/TIL
/Language/Typescript/docs/c- function/5-0.overloads.ts
3.6875
4
let suits = ["hearts", "spades", "clubs", "diamonds"]; function pickCard2(x):any { if(typeof x === "object") { let pickedCard = Math.floor(Math.random() * x.length); return pickedCard } else if(typeof x === "number"){ let pickedSuit = Math.floor(x/13); return { suit: suits[...
91fac65ff339e52fac483432ed2164086448e745
TypeScript
studyTsNote/typescript-learning
/ts-basic/src/example/basic-type.ts
4.15625
4
// 布尔 const bool: boolean = true; // 简单类型 ts 可自动推断,所以实际不用声明 // eslint 也会帮忙自动优化写法,但由于练习代码,故配置里关了该条建议 // 数值 let num: number = 123; num = 0b1111011; num = 0o173; num = 0x7b; // 字符串 const str: string = 'abc'; // 数组 const arr1: number[] = [1, 2, 3]; const arr2: Array<number> = [1, 2, 3]; const arr3: Array<string | number...
f38a1017b9f84beca7765d4439cda86ea645d5dd
TypeScript
flavioespinoza/vsce-wordcounter
/src/wordCounter.ts
2.5625
3
import { ConfigurationChangeEvent, Disposable, EndOfLine, Selection, StatusBarAlignment, StatusBarItem, TextDocument, TextDocumentChangeEvent, TextEditorSelectionChangeEvent, window, workspace, } from 'vscode'; interface TextConfig { word: string; words: string; char: string; chars: strin...
de03b6659951b3d0367282eaea049943ae641477
TypeScript
cucumber/cucumber-js
/src/plugin/plugin_manager.ts
2.671875
3
import { Plugin, PluginCleanup, PluginEvents } from './types' import { IRunEnvironment, IRunOptions } from '../api' import { ILogger } from '../logger' type HandlerRegistry = { [K in keyof PluginEvents]: Array<(value: PluginEvents[K]) => void> } export class PluginManager { private handlers: HandlerRegistry = { m...
f17389cb6551a61ae6d5f63bae939dcfee5020be
TypeScript
kjwdamme/SPA-groep-angular
/src/app/models/energyvalue.model.ts
2.65625
3
import {Info} from './info.model'; export class EnergyValue { private _id: string; private _converterId: string; private _timestamp: Date; private _info: Info[]; constructor(values: Object = {}) { Object.assign(this, values); } get id(): string { return this._id; } set id(value: string) {...
7d1aa4910d4e686f7ee54a057a213fc567f596e5
TypeScript
hongdeyuan/javascript_fullstack
/WoNiu/TypeScript/ts-study/src/class.ts
4.0625
4
// 抽象类 abstract class Animal { abstract makeSound (): void ; move(): void{ console.log('roaming the earth...') } } // 继承抽象类 && 重写 move class Cat extends Animal{ makeSound () { console.log('miao miao') } move(): void{ super.move() console.log('Cat Move') } } // const cat = new Cat() // c...
d53d73d53dc5c97617e8562536e96555097aae6b
TypeScript
robertschurig/photography-portfolio-website
/src/app/shared/image-list.interface.ts
2.59375
3
export interface IImages extends Array<IImage> { [index: number]: IImage; } export interface IImage { title?: string; date?: string; thumb: string; source: string; } export interface ISeries extends Array<ISerie> { [index: number]: ISerie; } export interface ISerie { url: string; } export interface I...
7fee99ae1dfaa2a851f4238c2032a8359accbea4
TypeScript
Zeindelf/vtex-api
/src/updateDocument.ts
2.875
3
import partialUpdate from './services/partialUpdate'; /** * Insert/update a document * * @param {string} id The ID of the item that will be inserted/updated * @param {object} data The data that will be inserted * @param {string} entity The entity of the document to insert * * @module masterdata * * @exa...
20df43f1d977e9ddd07de5949011590afccbd462
TypeScript
tyankatsu0105/react-perfomance
/packages/client/src/app/application/types/scalars.ts
3.109375
3
import format from 'date-fns/format'; import parseISO from 'date-fns/parseISO'; import { locale } from '~client/app/application/shared/modules/date-fns'; export type TypeScalarID = string; export type TypeScalarFloat = number; export type TypeScalarDateTime = string; export type TypeScalarDate = string; export class...
1c715371d2fe2024a652b98f2934ed1ad9c0d63c
TypeScript
macniel/derpyBot
/src/Derpy.ts
2.765625
3
import { Client } from 'discord.io'; import { LetterBag } from './LetterBag'; export class Derpy { private discordClient: Client; private letterBag: LetterBag; private broadcastChannelName: string; constructor(authToken: string) { this.broadcastChannelName = 'general'; this.discord...
afb3bcadc2deef4663903b1f07617e40cbf2f54e
TypeScript
FlorentinMonteil/nanogl-pbr
/src/ChunksSlots.ts
3.25
3
import { Hash, mergeHash, hashString } from "./Hash"; class HashedChunkCode { code: string; hash: Hash; constructor( code : string ){ this.code = code; this.hash = hashString( code ); } } class ChunkSlot { readonly key: string; private _hash: number = 0; private hashset: Set<Hash> = new Set(...
59f72917e52f2b1bd918a31656aaf36f2a097a32
TypeScript
joaquimnet/imager
/src/util/hasValidAttachments.ts
2.609375
3
import { Message } from "discord.js"; import { isValidSharpInput } from "./isValidSharpInput"; export function hasValidAttachments(msg: Message): boolean { if (msg.attachments.size < 1) { return false; } for (const attachment of msg.attachments.values()) { if (isValidSharpInput(attachment.filen...
c4905e08657db5ebd7a5b5578750761d316e6fb1
TypeScript
kng83/compound
/src/functional_programming/added_in_12_2019/either.ts
3.53125
4
import {inspect} from 'util'; namespace Either_1 { class Either<T> { protected $value:T; static of<T>(x:T) { return new Right<T>(x); } constructor(x:T) { this.$value = x; } } class Left<T> extends Either<T> { map(fn: () => T) { ...
d316fe5e872c272b51579df3f8fdd7f81ef4d03d
TypeScript
iconify/iconify
/packages/utils/tests/emoji-cleanup-test.ts
3.125
3
import { convertEmojiSequenceToUTF32 } from '../lib/emoji/convert'; import { getEmojiSequenceFromString, joinEmojiSequences, getUnqualifiedEmojiSequence, splitEmojiSequences, } from '../lib/emoji/cleanup'; describe('Testing formatting emoji cleanup', () => { it('UTF-32 sequence', () => { // Convert from string ...
fb62e3aa7c26a21222b43e2326552ea21da737b0
TypeScript
arolson101/ofx4js
/src/domain/data/seclist/CallType.ts
3.015625
3
/** * Call type for debt. * @see "Section 13.8.5.2, OFX Spec" */ export enum CallType { CALL, PUT, PREFUND, MATURITY } export function CallType_fromOfx(ofxVal: string): CallType { if ("CALL" === ofxVal) { return CallType.CALL; } else if ("PUT" === ofxVal) { return CallType.PUT; } else if ("PR...
62d2119ec9c634d26f603d48cf1222b215a946ff
TypeScript
nikita41196/AngularProjectASDM
/src/app/item.service.ts
2.6875
3
import { Injectable } from '@angular/core'; import { Item } from './Item.model'; @Injectable() export class ItemService{ arr=[ new Item("pizza",2,230,"large size"), new Item("burger",1,70,"with cheese"), new Item("sandwich",3,150,"without cheese"), new Item("lays",2,40,"salted"...
b856a440bda0bb11c568b03284959d8a99797d80
TypeScript
MbugwaSami/react-data-transform
/src/utils/index.ts
2.828125
3
import { useState, useEffect } from "react"; //Generate table data from source data export const GetDataViewProps = <T>( rawData: Array<ViewDataProps<T>>, defaultTableName: string ) => { const [viewTabs, setViewTabs] = useState<Array<Tabs>>([]); const [tableList, setTableList] = useState<Array<TableViewProps<T...
ce36356134e551a1c2600e4b1cba6fa7c5ba7f7f
TypeScript
Carbulator/carbulator-client
/src/app/pipes/moment.pipe.ts
2.953125
3
import {Pipe, PipeTransform} from '@angular/core'; import * as moment from 'moment'; /** * Formats a moment with the given formatting string. */ @Pipe({ name: 'moment' }) export class MomentPipe implements PipeTransform { /** * Transforms the input value by formatting the moment DateTime with the given forma...
048a92f771fc9fe2f1cc8f8053ecaab2d4356649
TypeScript
valmassoi/bitpay-card
/src/_services/auth/user.service.ts
2.59375
3
//https://medium.com/@blacksonic86/angular-2-authentication-revisited-611bf7373bf9#.hpdlvsu4i //https://stackoverflow.com/questions/34376854/delegation-eventemitter-or-observable-in-angular2/35568924#35568924 import { Injectable } from '@angular/core'; import { Http, Headers } from '@angular/http'; import { BehaviorSub...
102d775fa20b1f6f14a851a53e1688286ef16aa2
TypeScript
nklincoln/persona-maps
/src/app/common/persona.ts
2.859375
3
import { PersonaAspect } from './persona-aspect'; import { Aspect } from './aspect'; export class Persona { private name: string; private personaAspects: Array<PersonaAspect> = []; // Color map[6]: grey, red, dark-orange, light-orange, yellow, light-green, green static colorMap = ['#A6ACAF', '#FF0000', '#FF9...
fcd105baf8a55a916a35f813df77367e78522855
TypeScript
naporin0624/firebase-next-test
/src/store/index.ts
2.5625
3
import { useMemo } from "react"; import { configureStore, combineReducers } from "@reduxjs/toolkit"; import { FilteredKeys } from "~/utils/types"; import { isClient } from "~/utils/isClient"; import { currentUserReducer } from "./currentUser"; import { entitiesReducer } from "./entities"; const reducer = combineReduc...
6f851ecc4fa2bba081d6d5ea48b36bf2d6383dce
TypeScript
baozihuihui/Algorithm
/leetCode/239_sliding-window-maximum.ts
3.515625
4
function maxSlidingWindow(nums: number[], k: number): number[] { let result = []; const length = nums.length; let qenue = []; let left = 0, right = 0; if (length < 2) return nums; const peek = (arr: number[]) => arr.length; let qenueLength = null; for (let i = 0; i < length; i++) { qenueLength =...
b870465bc3d8eb40afbd15c3ab11eea0ba95fb46
TypeScript
SauceCode84/rlds-account-backend
/statement/request-mapping.decorators.ts
2.96875
3
import { METHOD_METADATA, PATH_METADATA } from "./constants"; interface RequestMappingMetadata { [key: string]: string; path?: string; method?: string; } const defaultRequestMappingMetadata: RequestMappingMetadata = { [PATH_METADATA]: "/", [METHOD_METADATA]: "GET" } const RequestMapping = (metadata: Reque...
92dda05ade116ead63ee2250eb18ea02f155bd66
TypeScript
PythSomeone/charades_frontend
/charades-frontend/src/app/_models/player.ts
2.765625
3
export class Player { game_id: string; id: string; name: string; points: number; constructor(name: string, points: number) { this.name = name; this.points = points; } }
25a47d11aca633d8756389de34cf48c43339f675
TypeScript
shilpa10kumar9/medtimeline
/medtimeline/src/app/fhir-data-classes/observation-set.ts
2.875
3
// Copyright 2018 Verily Life Sciences Inc. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import {FhirResourceSet} from '../fhir-resource-set'; import {fixUnitAbbreviations} from '../unit_utils'; import {AnnotatedObservation} from './annotated-observation';...
a8535ce217b3be72eb7886e98fac1289a07c158f
TypeScript
danieljameschadwick/ecommerce
/src/util/state/BasketTransform.ts
2.640625
3
import { createTransform } from "redux-persist"; import { Basket } from "./Basket"; import { LocalBasket } from "./LocalBasket"; interface BasketState { basket: Basket; } const BasketTransform = createTransform( // transform state on its way to being serialized and persisted. (inboundState: BasketState, k...
59b6ad8026cbf35bf63b5f0e92822683a5da6d74
TypeScript
animenotifier/notify.moe
/scripts/NotificationManager.ts
2.796875
3
import Diff from "./Diff" export default class NotificationManager { unseen: number icon: HTMLElement counter: HTMLElement constructor(icon: HTMLElement, counter: HTMLElement) { this.icon = icon this.counter = counter } async update() { const response = await fetch("/api/count/notifications/unseen", { ...
7e8bd82a4ca8dd497b35ef0472409504ddc1c74f
TypeScript
thanhcongptit/typescript
/lesson9.ts
2.8125
3
var employee = { id:1, greet : function() { setTimeout(()=> console.log(this.id), 1000); } } console.log(employee.greet());
8bc974e9d66420b51d9974f84a3ed67e7b88688b
TypeScript
chdh/virtual-grid-layout
/src/GridResize.ts
2.8125
3
// Row/column resize logic for grids. import {LayoutController} from "./GridLayout"; interface Point {x: number; y: number; } interface Boundary { // represents a row or column boundary that can be dragged ndx: number; ...
401f61986e944dfecd9c461f540df8b44eff67d2
TypeScript
cancerberoSgx/suitecommerce-types
/jasmine-puppeteer-results/src/wait.ts
2.765625
3
// import { Page, EvaluateFn } from 'puppeteer'; // // TODO: move to misc-utils-of-mine-generic // export async function waitForBrowser(predicate: () => boolean, ms = 300, timeout = 2000): Promise<boolean> { // return new Promise(resolve => { // const t = setInterval(() => { // if (predicate()) { // ...
e094a49f696caf98ef7feca63ffa1ffafeb99a3c
TypeScript
wadackel/toy-tree
/src/types.ts
2.75
3
/** * Utilities */ export type TODO_any = any; /** * Node */ interface BaseNode<T> { type: T; name: string; } export interface FileNode extends BaseNode<'file'> {} export interface DirectoryNode extends BaseNode<'directory'> { children: TreeNode[]; } export interface SymlinkNode extends BaseNode<'symlink'...
28b668dd9481215be44928e569e9e66fd9a33d47
TypeScript
J-HOVELAQUE/rando-server
/src/place/repository/buildPlaceRepository.ts
3.109375
3
import PlaceModel from "../model/PlaceModel"; import HikeModel from "../../hike/model/HikeModel"; import Place from "../../interfaces/place"; import { OutcomeSuccess, OutcomeFailure } from "../../interfaces/outcomes"; type PlaceRepositoryError = | "DATABASE_ERROR" | "UNIQUE_CONSTRAIN_ERROR" | "ID_NOT_FOUND" | ...
ff096f1d1822545bb59ec6e58441909d74886940
TypeScript
calumleask/phaser-framework
/src/core/EventEmitter.ts
3.25
3
type Data = { [key: string]: unknown; }; type EventCallback = ( event: Data & { type: string; target: unknown; }, ) => void; type EventsObject = { [type: string]: EventCallback[] }; export class EventEmitter { private _events: EventsObject; constructor() { this._events = {}; } on(type: st...
a2e6472d0114122b23f197071a23fe423e8b40a0
TypeScript
cosmos-ignite2018-demo/demo
/web_app/static/vendors/bower_components/jqTree/src/save_state_handler.ts
2.734375
3
import { isInt } from "./util"; import { ITreeWidget } from "./itree_widget"; import { Node, NodeId } from "./node"; export default class SaveStateHandler { private tree_widget: ITreeWidget; private _supportsLocalStorage: boolean | null; constructor(tree_widget: ITreeWidget) { this.tree_widget = t...
d8f7bc15a9d9265e95e6d7587dfd68e2aa31fe30
TypeScript
carlocorradini/happypuppy-server
/src/util/OTPUtil.ts
3.21875
3
export default class OTPUtil { public static readonly DIGITS = '0123456789'; public static readonly ALPHABET: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; public static digits(length: number): Promise<string> { let otp = ''; for (let i = 0; i < length; i += 1) { ...
43ccf4b4ab5d5234e1c47285880253c1751bf4eb
TypeScript
WilliamJenner/BournemouthBindicator
/ClientApp/src/ts/actions/http.ts
2.875
3
// https://stackoverflow.com/a/49471725 export const api = <T>(url: string): Promise<T> => { return fetch(url) .then((response) => { if (!response.ok) { throw new Error(response.statusText); } return response.json(); }) .catch((error: Error) => { throw error; /* <-- rethrow...
098a84030e4717601b5e70378c533d4fc3464a71
TypeScript
das-praktische-schreinerlein/mytourbook
/src/frontend/app/shared-tdoc/services/form.utils.ts
2.78125
3
// TODO move to commons export class FormUtils { public static getNumberFormValue(values: {}, formKey: string): number { if (!values[formKey]) { return undefined; } if (Array.isArray(values[formKey])) { return Number(values[formKey][0]); } else { ...
f28abf4606fd343ea917692fc30ba3f72ccda313
TypeScript
Open-Attestation/token-registry
/test/helpers/impersonate-account.ts
2.828125
3
import { ethers, network } from "hardhat"; import { Signer } from "ethers"; /** * Impersonate an account as signer. * @param address Address of account to be impersonated * @param balance Balance in ethers */ export const impersonateAccount = async ({ address, balance = 100, }: { address: string; balance?:...
9bbec4b4059f57b2a1c5240e584ddd52a41e1139
TypeScript
JayJayDee/GBS-Worker
/src/lib/queues/types.ts
2.640625
3
type ConsumerFunction = (payload: any) => Promise<void>; export type Subscribe = ({ topicId, consumer }: { topicId: string, consumer: ConsumerFunction }) => Promise<void>; export type Publish = ({ topicId, payload }: { topicId: string, payload: {[key: string]: any} }) => Promise<void>;
41aa01f7dcb4c995296a0a6e461cabe527661b79
TypeScript
sapir054/mockingbird
/packages/generator/test/e2e/mock-factory.test.ts
2.75
3
import { MockFactory } from '../../src'; import { TestClassesE2E } from './test-classes'; import Dog = TestClassesE2E.Dog; describe('MockFactory e2e Test', () => { when("calling 'many' method with a given class", () => { let result: Dog[]; beforeAll(() => { result = MockFactory<Dog>(Dog).many(3); ...
b0b2419bfd1beea7829627428172b7e042a86f15
TypeScript
andreasmwenzel/ts-cards
/src/decks/pinochle.ts
3.3125
3
import { Deck } from '../deck'; import { Card } from '../card'; import { nine, ten, jack, queen, king, ace } from '../ranks'; import { spades, diamonds, clubs, hearts } from '../suits'; import { Suit } from '../suit'; import { Rank } from '../rank'; /** * @class PinochelDeck * @extends Deck */ export class Pinochle...
8ceb68bcf4a749812f867ac2fc0b6e6df0346dc3
TypeScript
hamada-infocube/romi-dashboard
/src/components/schedule-visualizer/colors.ts
3.15625
3
/** * This can be slow so it should be memoed. * @param name * @param model */ export async function computeRobotColor(name: string, model: string): Promise<string> { const modelHash = new Uint16Array(await _hash(model)); const hue = modelHash[0] % 360; const nameHash = new Uint16Array(await _hash(name)); c...
2f2ba92cc13dc1afd11890cf5540be89f2594594
TypeScript
openinsight-project/grafinsight
/packages/grafinsight-data/src/types/geometry.ts
2.984375
3
/** * A coordinate on a two dimensional plane. */ export interface CartesianCoords2D { x: number; y: number; } /** * 2d object dimensions. */ export interface Dimensions2D { width: number; height: number; }
84ebf74eada69de35b128be47e013586bc9f5acc
TypeScript
Marcel2703/ClientWebservice
/src/app/shared/service/sort-date-formatter.service.ts
2.8125
3
import { Injectable } from '@angular/core'; @Injectable() export class SortDateFormatterService { getDateTime(day: string, hour?: string): any { let output; if (day) { output = new Date( +day.split('-')[0], +day.split('-')[1] - 1, +day.sp...
280dec878db8ffc6bc96f3bb343637084eea7302
TypeScript
brunogamacatao/nodebackend
/src/rotas/secreto.ts
2.5625
3
import { Router } from "express"; import { AuthUtil } from "../util/auth"; export class Secreto { public rotas(): Router { let router = Router(); router.all('*', AuthUtil.estaAutenticado); router.get('/', (req, res) => { res.send('Retorna todos os registros'); }...
e4b42d9e23fe79935cdaf2f1cbc92b8038eb35fc
TypeScript
KYLFYK/miac_backend
/src/patient/interfaces/IPatient.ts
2.578125
3
import { IBaseEntity } from '../../common/interfaces/IBaseEntity'; import {IActivity} from "../../activity/interfaces/IActivity"; export enum sexType { FEMALE = 'female', MALE = 'male' } export enum currentStatusType { NORMAL = 'Нормальное', GOOD = 'Хорошее', SATISFACTORY = 'Удовлитворительное', BAD = 'Пло...
c81affbc988f2ca8e9e3494725587e0bedfccdc9
TypeScript
rope-hmg/lazy_global
/src/test.ts
2.78125
3
import { runTests, assert, assertEq } from "absolute_unit_test"; import { lazy, lazyPromise } from "./index"; runTests( class { "lazy should only evaluate once"() { let evalCount = 0; const lazyString = lazy(() => ((evalCount += 1), "some complicated and expensive thing")); ...
7c14542a9be912be99653f63b927476bd27daa74
TypeScript
Khoding/obsidian-dataview
/src/data/parse/csv.ts
2.671875
3
import { canonicalizeVarName } from "util/normalize"; import { DataObject } from "../value"; import * as Papa from "papaparse"; import { parseFrontmatter } from "data/parse/markdown"; /** Parse a CSV file into a collection of data rows. */ export function parseCsv(content: string): DataObject[] { let parsed = Papa...
0d93e0934dbc464fe08b4af3931facc5b5b3c501
TypeScript
TatianaFischer/Labephoto-Backend
/src/model/Image.ts
2.90625
3
export interface ImageInputDTO { subtitle: string; file: string; collection: string; } export interface TagsInputDTO { id: string; name: ImageTagsName[]; } export enum ImageTagsName { OLEO = "#ÓLEO", AQUARELA = "#AQUARELA", PASTEL = "#PASTEL", ACRILICA = "#ACRÍLICA", AREIA = "#AREIA", DIGITAL = ...
0a9ab2039adae57c46f3c7197cd4997eae3edd8e
TypeScript
pubkey/event-reduce
/javascript/src/truth-table-generator/data-generator.ts
2.703125
3
import Faker from 'faker'; import { datatype as fakerDatatype } from 'faker'; import type { Human, Procedure } from './types'; import type { ChangeEvent } from '../../src/types'; import { getMinimongoCollection, minimongoFind, applyChangeEvent } from './minimongo-helper'; import { UNKNOWN_VALUE } from '...
cbcc32e6a61ee9cc64698de70f05b7ea0dbc2b20
TypeScript
dsmiller95/StandupTelegramBot
/states/waiting.ts
2.65625
3
import { BotState } from './botState'; import { SetupStandup } from './setupStandup'; export class Waiting extends BotState{ constructor(userID: (number | BotState), bot = null){ super(userID, bot); } public receiveMessage(msg): BotState{ var message = ""; var text = msg.text; var match; if((match...
77c8da6ac0c91db0801d2e90cea587accb84d488
TypeScript
StefanSinapov/TelerikAcademy
/09. JavaScript ООП/04. TypeScript Overview/0. Demo/TypeScriptTesting/scripts/interfaces/driver.ts
2.8125
3
 interface Driver extends Person { yearsExperience: number; vehicles: Vehicle[]; addVehicle(vehicle: Vehicle): void; removeVehicle(vehicle: Vehicle): Vehicle; }
c0b4359abe2cc7a3340816f136838d7ce1805e52
TypeScript
gmahechas/tutorial-rxjs
/src/fernando-herrera/08-transformation-operators/switchMap.ts
2.65625
3
/* source: a, b, c subs1: 0, 1 | subs2: a, b, c | subs3: z output: 0, 1, a, b, c, z - switchMap subscribe to the values emitted for source and starts to emit values when the before subs ends */ import { fromEvent, Observable } from 'rxjs'; import { debounceTime, map, pluck, mer...
0771716a5525bb5010f2e31736405471c5728a2c
TypeScript
jorge3186/jnetui
/src/services/menu.service.ts
2.953125
3
/** * @name MenuService * @author Jordan Alphonso * @created 05/01/2017 * * @description * This service will make an {@link Http} call from */ import { Injectable } from "@angular/core"; import { Http } from "@angular/http"; import { Observable } from "rxjs/Rx"; import "rxjs/add/operator/map"; import "rxjs/add...
e1a2c088a7844eda0bc0b666dcca4133b585cc04
TypeScript
luo-677/webcode
/Stage-three/teacher/code05/typescript/code/2-学习ts/src/6-数组.ts
4.375
4
/* * 原生js * const arr = [1,2,3,4] * const arr = new Array(1,2,3,4) */ //? 1. 定义了一个元素只能为number类型的数组 const arr:number[] = [1,2,3,4] // arr.push('a') arr.push(5) //? 2. 定义了一个元素只能为string类型的数组 const arr2:string[] = ['a','b','c','d'] arr2.push('5') //? 3. number&string --- 联合类型 "|" 我...
17ece1139a7adfe89624e9f9224affd1ee4c592d
TypeScript
davorpa/curso-academiawebca-git-terminal-ts
/2-variables/variables.ts
2.90625
3
// Declarar let nombre_de_mi_variable; // Inicializar nombre_de_mi_variable = true; // Declara e Inicializa let equipo = "Real Madrid"; // Constantes const PI = 3.14; //PI = 3.16; // ERROR: Las constantes no se pueden sobrescribir
26370490b63e858b327656a2b444773ce4ab4c6c
TypeScript
gcanti/io-ts-types
/test/fromNewtype.ts
2.953125
3
import * as assert from 'assert' import * as t from 'io-ts' import { fromNewtype } from '../src' import { assertFailure, assertSuccess } from './helpers' import { Newtype, iso } from 'newtype-ts' it('fromNewtype', () => { interface Token extends Newtype<{ readonly Token: unique symbol }, string> {} const T = fromN...
be62eb930b6fb8c692f66f5eb1fbc5076024f4a9
TypeScript
jsflow/jsflow
/src/Engine/Tracing/ForStatement.ts
2.53125
3
import { MonitorBase } from "../../MonitorBase"; import { WorkList, ValueStack } from "../../Context"; import { Task } from "../Task"; import { Label, lub } from "../../Label"; import { GetValue } from "../../GetValue"; import { ToBoolean } from "../../Conversion/ToBoolean"; import * as estree from 'estree'; import { ...
6b9f76c3ea8dfbc24ccc7f56127a0f45053a86fa
TypeScript
Sayuri/parking
/api/src/entities/car.entity.ts
2.515625
3
import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; import { User } from './user.entity'; @Entity() export class Car { @PrimaryGeneratedColumn() id: number; @Column() number: string; @Column() brand: string; @Column() model: string; @ManyToOne(type => User, user => user.b...
48f6c33a43f5447538dd543be15b51e37ec0818f
TypeScript
hal0x2328/neo-one
/packages/neo-one-smart-contract-codegen/src/types/genConstantFunction.ts
2.53125
3
import { ABIFunction } from '@neo-one/client-common'; import { toTypeScriptType } from '../utils'; import { genFunctionParameters } from './genFunctionParameters'; export const genConstantFunction = (abi: ABIFunction): string => { const paramss = genFunctionParameters(abi); if (paramss.length === 1) { return `...
6d0f5a7af93ce47a7194c4364e9def75dd58e20d
TypeScript
hrenx/vscode-easymotion
/src/command.ts
2.875
3
import * as vscode from 'vscode'; class Position { line = 0; offset = 0; combo = ''; } function isCharWhitespace(c: number) { // Space, carriage return, line feed, tab return c === 32 || c === 13 || c === 10 || c === 9; } function isCharNumber(c: number) { return c >= 48 && c <= 57; } functi...
632affa2b065b99a435df51607a59a0de7ba6af2
TypeScript
keyur2714/E_4_Angular_8
/DirectiveDemo/src/app/app.component.ts
2.515625
3
import { Component, ViewChild, OnInit, ElementRef } from '@angular/core'; import { MyStyleDirective } from './my-style.directive'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit{ title = 'DirectiveDemo'; ...
2b83a5b017d01f6cc0148efc031e475aa64b0d7c
TypeScript
freenowtech/react-polygon-editor
/src/PolygonDraw/reducer.ts
2.671875
3
import undoable, { excludeAction } from 'redux-undo'; import { Actions, SELECT_POINTS, ADD_POINT_TO_SELECTION, REMOVE_POINT_FROM_SELECTION, DESELECT_ALL_POINTS, SELECT_ALL_POINTS, MOVE_SELECTED_POINTS, DELETE_POLYGON_POINTS, ADD_POINT, ADD_POINT_TO_EDGE, CHANGE_POLYGON, ...
777bc2918914bc7ec81fb906581bf696b9d3783a
TypeScript
taskie/matome
/src/commons/ts-promisify.ts
3.0625
3
export type AsyncFunction0<O1, O2, O3, O4, O5, O6>= { (callback?: (o1: O1, o2: O2, o3: O3, o4: O4, o5: O5, o6: O6)=>void): void; }; export type AsyncFunction1<I, O1, O2, O3, O4, O5, O6>= { (i: I, callback?: (o1: O1, o2: O2, o3: O3, o4: O4, o5: O5, o6: O6)=>void): void; }; export type AsyncFunction2<I1, I2, O1...
d92b97d305cfb9030e8a435914e09d16b5ed987f
TypeScript
ChrisNotDefined/ClasePokemons
/src/excercises/05-Destructuring.ts
3.46875
3
// Destructuring interface Details { author: string; releaseYear: number; } interface MusicPlayer { volume: number; second: number; track: string; details: Details; } const player: MusicPlayer = { volume: 50, second: 36, track: "Driver", details: { author: "Pendulum", releaseYear: 2020, ...
04e0638ccaaa1710ed0c6bebc44725f99a8dae3a
TypeScript
didierdemoniere/pokeboule
/src/state-management/modules/game.ts
3.015625
3
// actions types const START_GAME = "START_GAME" as "START_GAME"; // action creators export const actionCreators = { startGame: () => ({ type: START_GAME }) }; // reducer export const reducer = function(state = false, action: { type: "START_GAME" }) { switch (action.type) { case START_GAME: return true;...
e3604ca75d9fa68ec2389f58844d9359047b8f3c
TypeScript
jaaamesey/hscenglishbot
/scripts/imagemaker.ts
2.71875
3
const misc = require('../misclib') const fs = require('fs') const memeAmount = 105 var loadedImageData; //var loadedImage = new Image(); drawRandomImage() var textthing = "Compose a piece of writing which persuasively explores the notion of belonging. | | Use the item below as the central element for your writing." ...
5482b2fd4d09295861e97a669eec524c40d48f56
TypeScript
flickswipe/app
/predict/src/modules/track-user-settings/events/listeners/user-updated-setting.ts
2.59375
3
import { Subjects, Listener, UserUpdatedSettingEvent, } from "@flickswipe/common"; import { Message } from "node-nats-streaming"; import { createSuggestions } from "../../../generate-suggestions/generate-suggestions"; import { Setting } from "../../models/setting"; const { QUEUE_GROUP_NAME } = process.env; /**...
10e917d9c202cc312ff8d1b6eed6355314e1137b
TypeScript
ScienceOfComputerProgramming/SCICO-D-20-00066
/src/main/frontend/src/app/models/varListData.ts
3.140625
3
/** * The information about the highlightable variable. */ export interface VarInfo { dataid: string; className: string; methodName: string; var: string; linenum: string; inst: String; count: number; valueList: ValueInfo[]; } /** * The information about the values of variable . */ export interface ...