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
8e675c5e18ba2f1390e5495c10a26f137661deb9
TypeScript
Ramdhanll/trishop
/src/contexts/UserReducer.ts
3.140625
3
import { Dispatch } from 'react' // context initial state type export interface InitialState { user: null | UserPayload dispatchUser: Dispatch<Action> } export type UserPayload = { _id: string name: string email: string // password: string role: 'ADMIN' | 'USER' createdAt: string updatedAt: string }...
0af2a06621f381867d649d25bfa13ee421e4c484
TypeScript
mikgor/Wallethon
/frontend/src/app/shared/models/transactions-summary/sell-related-transaction.ts
2.625
3
import {StockTransaction} from '../../../main/components/dashboard/models/StockTransaction'; import {Money} from '../money'; export class SellRelatedTransaction { soldQuantity: number; originQuantitySoldRatio: number; costs: Money; income: Money; public constructor(soldQuantity: number, originQuantitySoldRa...
8b35aecc1f5d63802f159b33c65fce7736dde149
TypeScript
victorfernandesraton/control-warehouse
/src/adapters/Storage.ts
2.75
3
import Storage from '../core/entity/Storage'; export interface CreateStorageParams { id?: string; name: string; description?: string; } export default class StorageAdapter { static create({ id, name, description }: CreateStorageParams): Storage { return new Storage({ id, name, description...
8447463b8345d1314bd29c093a9bbbca523b6564
TypeScript
Akashh1996/Skylab-Bootcmamp-2020
/eric-martinez/ts-demo/greeter.ts
3.5
4
class Student { fullname: string constructor(public firstname: string, public lastname: string) { this.firstname = firstname; this.lastname = lastname; this.fullname = `${firstname} ${lastname}` } } interface Person { firstname: string; lastname: string; } function g...
8a51d34bfb1cba9ae7be4920b5d9383dfaafefae
TypeScript
DaVince/Excalibur
/src/engine/Graphics/Context/renderer.ts
2.5625
3
import { BatchCommand } from './batch'; import { Shader } from './shader'; // import { Pool, Poolable } from './pool'; import { GraphicsDiagnostics } from '../GraphicsDiagnostics'; import { Pool, Poolable } from '../../Util/Pool'; export interface Renderer { render(): void; } export interface Ctor<T> { new (): T;...
3eeba0b54e13d0a0b1fb3a9e5b6244b3f340033f
TypeScript
jajaperson/IxJS
/src/asynciterable/fromeventpattern.ts
3.40625
3
import { AsyncIterableX } from './asynciterablex'; import { AsyncSink } from './asyncsink'; import { memoize } from './operators/memoize'; /** * Creates asnyc-iterable from an event emitter by adding handlers for both listening and unsubscribing from events. * * @template TSource The type of elements in the event e...
a7c686bc4b68790629aad1c23550ff4be8d8abcb
TypeScript
hombrevrc/prerender
/lib/PrerenderWorker.ts
2.515625
3
import * as puppeteer from "puppeteer"; import {CrawlPage} from "./CrawlPage"; import {crawlerSanitizePage, crawlerScrapeAllLinks} from "./Helpers"; export class PrerenderWorker { private browser = null; private readonly crawlRegex: RegExp; constructor(crawlRegex: RegExp) { this.crawlRegex = crawl...
10a75a96124c39725fd75ac8390d8191b31b465d
TypeScript
Svetov/angular-calendar
/src/app/root-store/clock-store/clock-action.ts
2.546875
3
import { Action } from '@ngrx/store'; export enum ClockActionTypes { SELECT_CLOCKS = 'SELECT_CLOCKS', } export class selectClockAction implements Action { readonly type = ClockActionTypes.SELECT_CLOCKS; constructor(public payload: { clocks: Array<string> }) {} } export type ClockActions = selectClockAction;
387dc1bf9d2bc22353a9e75e87c146e4a03dce4c
TypeScript
nathan-oliveira/Projeto_Financas_Pessoais_Backend
/app/controllers/Controller.ts
2.53125
3
import * as express from "express"; abstract class Controller { public req: express.Request; public res: express.Response; constructor(req: express.Request, res: express.Response) { this.req = req; this.res = res; } protected response(result: any) { return this.res.status(result.statusCode).js...
aa86044d4a5d2cf5169f0ddf7d9c4cb36060dc50
TypeScript
c2c-project/prytaneum-typings
/src/auth.ts
2.6875
3
import faker from 'faker'; export interface RegisterForm { password: string; email: string; confirmPassword: string; firstName: string; lastName: string; } export const makeRegisterForm = (): RegisterForm => { const password = faker.internet.password(); return { password, e...
6ccf72acbe9d05c2fd68d50eaf9cf577c197cf34
TypeScript
EvgeniyGordinskiy/trello_api_node
/app/Controllers/authController.ts
2.625
3
import {Response, Request} from 'express'; import passport from 'passport'; import bcrypt from 'bcrypt'; import _passport from '../passport/passport'; _passport(passport); import User from '../models/user'; import validations from '../helpers/validations'; let auth = { // Render register page getRegister(re...
2abad98f856a8423c7d511283cbf02e2a150e4c9
TypeScript
Harsh-Pareek-Commits/MyTrip-FrontEnd
/src/app/Models/feedback.ts
2.6875
3
import { Customer } from "./customer"; export class Feedback{ feedbackId:number; customer:Customer; feedback:string; rating:number; submitDate:Date; constructor(feedbackId:number, customer:Customer, feedback:string, rating:number, submitDate:Date) { this.feedbac...
f1bcc9555f3bc732ef7745ee9e804cff6c4fbe30
TypeScript
juliandavidmr/Servue
/core/decorators/controller.ts
2.546875
3
import * as Vue from 'vue' import * as clone from 'clone' import Config from './_config' import * as cf from "../constants/request_classifier"; import { ITarget } from "../interfaces/ITarget"; declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void; export function VueContro...
0ae8f056082f081d96a7ebd2ead6ccce03172f97
TypeScript
zumo/zumokit-react-native
/src/utility/errorProxy.ts
2.8125
3
import { ZumoKitError } from '../ZumoKitError'; /** @internal */ function handler(fun: any) { return function bar(this: any) { try { // eslint-disable-next-line prefer-rest-params const res = fun.apply(this, arguments); if (Promise.resolve(res) === res) { return res.catch((e: any) => { ...
09be3cfab19a37111580e9950026c6286a63b6c4
TypeScript
aizigao/BracketEnum
/src/BracketEnum/index.ts
3.234375
3
type Code = string; type Value = string | number; type Desc = string; type Extra = any; const isNil = (v: any) => v == null; export type IEnumOption<IEmumValue, IEmumDesc> = { label?: IEmumDesc; value?: IEmumValue; key?: IEmumValue; extra?: any; }; type IValueEnum = Record< string, { text: string; ...
4751f76027ede5eaad44ee342104048cef50ec8b
TypeScript
bnteau/deno-todolist
/todo.ts
3.390625
3
import { Drash } from "https://deno.land/x/drash@v1.5.1/mod.ts"; interface Todo { id: number, title: string, completed: boolean } // Juste des fausses données let todos:Todo[] = [ { id: 1, title: "Passer à Typescript", completed: false, }, { id: 2, title...
714477796d9ecfb834ab5c76a57644243561f730
TypeScript
KosmosKey/Aiflow_Backend
/src/Mongo/ContactListService.service.ts
2.890625
3
// Importing dependencies.... import { ListDataType } from './ListDataType'; import { Model } from 'mongoose'; import { Injectable } from '@nestjs/common'; import { InjectModel } from '@nestjs/mongoose'; // Injecting the MongoDB Modals // This is where all the functions happens when it comes to Create Data and Get Dat...
9df140bec44198e4c9dc3a86b6ef401f93f09d32
TypeScript
seangomes/matchfinder
/src/app/shared/models/user.ts
2.515625
3
export class User { uid?: string; email: string; password?: string; photoUrl?: string; username: string; firstname?: string; lastname?: string; online: boolean; clan?: string; favweap?: string; rank?: string country?: string; age?: number; // constructor(public uid: string, public email: st...
f24964d27a0da05eee540dae5359d301b0b83177
TypeScript
Grupo-E-022018-DAPP-sgonzalez-lvaquel/Grupo-E-react-frontend
/src/store/selectors/bets.ts
2.53125
3
import { IStore } from '../reducers/rootReducer'; export function getBetsByIds(state: IStore, ids: [number]) { return ids.map(id => getBetById(state, id)) } export function getBetById(state: IStore, id: number) { return state.bets.byIds[id] }
ccb31372f74758d4a340fb57c5d209295adb8d16
TypeScript
cocytus1223/TypeScript
/src/learning/datetype.ts
4.09375
4
// 原始类型 let bool: boolean = true let num: number = 123 let str: string = 'abc' // 数组 let arr1: number[] = [1, 2, 3] let arr2: Array<number> = [1, 2, 3] let arr3: Array<number | string> = [1, 2, 3, '4'] // 元组 let tuple: [number, string] = [0, '1'] // 函数 let Add = (x: number, y: number) => x + y let compute: (x: numbe...
aa19f5512cdf4f943328d17b02c478ff8104a2e4
TypeScript
amiraElmergawy/NTI2-REPO
/session15/src/app/interfaces/tasks.ts
2.53125
3
export interface Tasks { taskTitle: string taskStatus: boolean taskType: string }
3e1c4f3da5ac3639407c2d3efea39b0c831a9b37
TypeScript
dhmw/dynamo-easy
/src/decorator/metadata/property-metadata.model.ts
3.0625
3
/** * @module metadata */ import * as DynamoDB from 'aws-sdk/clients/dynamodb' import { MapperForType } from '../../mapper/for-type/base.mapper' import { Attribute } from '../../mapper/type/attribute.type' import { ModelConstructor } from '../../model/model-constructor' export interface TypeInfo { type: ModelConst...
4ef700f8ab6fd0c4176cbf6c087aeceaeaea1174
TypeScript
DeveloperMetal/kecs-cli
/src/generator/generators/interfaces.ts
2.5625
3
import { IECSSchema } from "../../schema/types"; import { reduce } from "../utils"; export const generate = (data: IECSSchema) => ` ${reduce(Object.values(data.components), (component) => ` export interface I${component.component} { ${component.component}: {${reduce(Object.entries( component.fields || {}), ([fie...
04629948be74f22e8da3beb05ced5e56757f1f78
TypeScript
MSXALL/DeZog
/src/remotes/zsimulator/z80cpu.ts
2.5625
3
import {Z80Ports} from './z80ports'; import {Z80RegistersClass} from '../z80registers'; import {MemBuffer, Serializeable} from '../../misc/membuffer' import {Settings} from '../../settings'; import * as Z80 from '../../3rdparty/z80.js/Z80.js'; import {SimulatedMemory} from './simmemory'; export class Z80Cpu implemen...
fe4032d4c0269c9d9b2f6722ce8b8c718ef30122
TypeScript
KJStrand/ngl
/src/buffer/mapped-buffer.ts
3.046875
3
/** * @file Mapped Buffer * @author Alexander Rose <alexander.rose@weirdbyte.de> * @private */ import { getUintArray } from '../utils' import { calculateCenterArray, serialArray } from '../math/array-utils' import Buffer, { BufferParameters, BufferData } from './buffer' export type MappingType = 'v2'|'v3' /** *...
49f1c4dc4d6b1255d260b657036a05e4b431e0c3
TypeScript
14923523/test-cases-3d
/assets/cases/ui/17.sprite-atlas/TS/Test.ts
2.609375
3
import { _decorator, Component, Label, Sprite, EditBox, SpriteFrame, Vec3, find } from "cc"; const { ccclass, property } = _decorator; @ccclass("Test") export class Test extends Component { @property({type:EditBox}) public editbox: EditBox = null!; @property({type:SpriteFrame}) public sf: SpriteFrame...
da988d8a94a5d682592909ff671494d35c33a37d
TypeScript
deepshikha02/Learn-Angular
/basics/src/app/directives/directives.component.ts
2.6875
3
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-directives', templateUrl: './directives.component.html', styleUrls: ['./directives.component.css'] }) export class DirectivesComponent implements OnInit { constructor() { } ngOnInit() { } // STRUCTURAL DIRECTIVES /* Struc...
3614ac303e841cdcada08531d14ff8eae837ffc9
TypeScript
alissonkruger/sudokuAngular
/src/app/services/sudoku.service.ts
2.8125
3
import { Injectable } from '@angular/core'; import { sudoku } from "../../assets/sudoku.js"; @Injectable({ providedIn: 'root' }) export class SudokuService { constructor() { } // Gero novo jogo Sudoku public newSudokuGame(difficulty){ var game; if(difficulty != 0){ game = sudoku.generate(diffi...
99c1521fa58fedfb3092a66a9a5c8ddd3bbd078c
TypeScript
chiyuCoder/myclass
/func/num.ts
3.171875
3
export function strToInt(str:string, whenNaN:number = 0): number { let num = parseInt(str); if (isNaN(num)) { return whenNaN; } return num; } export function strToNum(str:string, whenNaN: number = 0): number { let num = parseFloat(str); if (isNaN(num)) { return whenNaN; } ...
1b0a5762b68a0880e1989dcf68e56f64046c3012
TypeScript
Zackwn/ezOrders
/src/@types/index.d.ts
2.703125
3
import { ISocketIO } from '../providers/socket/ISocketIO' declare global { namespace Express { interface Request { socketIo: ISocketIO } } type Channels = 'newOrder' | 'changeOrderStatus' type Status = 'PENDING' | 'DONE' | 'CANCELED' /** * @param operator SQL Comparison Operators and "LIK...
33a35019842cca722fc5b0eb50ce5393dda63d70
TypeScript
iCShopMgr/EZ_Start_Kit_for_MakeCode_NL
/main.ts
2.515625
3
//% weight=0 color=#B3203E icon="\uf118" block="EZ Start Kit" namespace ezstartkit { /* ===EZ Start Kit : ButtonAB=== */ led.enable(false) pins.setPull(DigitalPin.P5, PinPullMode.PullNone) pins.setPull(DigitalPin.P11, PinPullMode.PullNone) export enum Button_read { //% blo...
5930d83d4a6cb086a048799fcd0cb2b842e55c15
TypeScript
aishimeth2135/Toram_Grimoire
/src/lib/Character/Stat/StatBase.ts
3
3
import Grimoire from '@/shared/Grimoire' import { isNumberString, lastChar } from '@/shared/utils/string' import { StatTypes } from './enums' interface StatShowData { result: string title: string value: string tail: string } type StatValue = number | string class StatBase { static sortStats = function (sta...
5a466dc5622dbf3662cb7031c6bd582c04c81e50
TypeScript
angular-schule/ngrx-duplicated-code
/projects/03-example-with-reduceReducers/src/app/store/book.reducer.ts
2.8125
3
import { createReducer, on } from '@ngrx/store'; import reduceReducers from 'reduce-reducers'; import { Action, ActionReducer } from '@ngrx/store'; import { SubmittableItem, Status, combineSomeReducer } from 'projects/shared/api-adapter'; import { Book } from 'projects/shared/book'; import { authorsApiAdapter, booksA...
82a3f3c78189f5aa0e9bcd1aa3fc96a906813e0b
TypeScript
msheila1/ipea-web
/src/store/criminal/index.ts
2.53125
3
import { GetterTree, MutationTree, ActionTree, ActionContext } from 'vuex'; import { Criminal } from '@/models'; import { PessoasService } from '@/services'; export enum Types { MODAL = 'list_all', MODAL_SUCCESS = 'list_all_success', NO_RESULT = 'no_result', CLEAR = 'clear', FAILURE = 'failure', } export i...
b079377bff73ad5f4e9784c86ca12bfa6a46c682
TypeScript
juliandavidmr/SAT
/src/providers/service-sensores.ts
2.546875
3
import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import { Storage } from '@ionic/storage'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; import * as constants from './constants'; /* Generated class for the Sensores provider. See https://angular.io/docs/ts/late...
242646ab0f628c4e4b9047d131bea9bcfa2397e9
TypeScript
AmrAhmedAli/moviesapp-frontend
/src/actions/moviesListActions.ts
2.640625
3
import axios from "axios"; import { Dispatch } from "redux"; import { MoviesListDispatchTypes, MOVIES_FAIL, MOVIES_LOADING, MOVIES_SUCCESS, } from "./moviesListActionTypes"; export const GetMoviesList = () => async (dispatch: Dispatch<MoviesListDispatchTypes>) => { try { dispatch({ type: MOV...
3206d000a2bef1195511031a5463b0795639d7f6
TypeScript
qwerty-is-my-best-pass/dasreda
/src/useDefferedLogStrings.ts
3.0625
3
import {useState, useRef, useMemo} from 'react' import { createTimerChain } from './utils'; /** * Здесь странность в том что первый аргумент deferredStringPush - функция, а интуитивно ждешь строку * Но т.к. это решение сложнее чем со строкой и при этом у меня нет ни контекста, ни каких-то принятых норм * Ниже я про...
01cf631dbbb74739400b1eb7ad331385a1d8d7e1
TypeScript
danielrpg/third-cass-typescript
/app5.ts
3.578125
4
class Employee { public empName: string; protected empCode: number; constructor(name: string, code: number) { this.empName = name; this.empCode = code; } } class SalesEmployee extends Employee { private address: string; constructor(name: string, code: number, address: string)...
ee098b55fd41a92ff1f9c60b319aee119e6fdc8a
TypeScript
manuelroemer/stumatch-backend
/src/middlewares/validateRequestBody.ts
2.9375
3
import { RequestHandler } from 'express'; import { BaseSchema, ValidationError } from 'yup'; import { BadRequestError } from '../dtos/apiErrors'; import { asyncRequestHandler } from '../utils/asyncRequestHandler'; const baseValidationErrorMessage = `Validation failed. The request body had an invalid format.`; /** * ...
0d90de2f0deaec6bf8575bdd383c1f78c6750bf8
TypeScript
Ahornzweig/EIA2
/A3/A3.ts
2.75
3
/*Aufgabe: Aufgabe 3 Name: Sarah Lnnqvist Matrikel: 259116 Datum: 10.11.2018 Hiermit versichere ich, dass ich diesen Code selbst geschrieben habe. Er wurde nicht kopiert und auch nicht diktiert. */ namespace A3 { document.addEventListener("DOMContentLoaded", (uno)); function instalListener(): vo...
53e18367bbf6d64d19ced883cb813de265172dda
TypeScript
mrvillage/rift-boltz
/src/services/prices.ts
2.59375
3
import { Request, Response } from "express"; import supabase from "../supabase"; type Trade = { date: string; nation_id: number; amount: number; price: number; total_value: number; }; type Resource = { avg_price: number; market_index: string; highest_buy: Trade; lowest_buy: Trade; }; interface Price ...
20b798ed914b9826f4c754b23af12ffb383e5e73
TypeScript
d-theo/Grulirogue2
/src/game/utils/matrix.ts
3.171875
3
import * as _ from 'lodash'; export function matrixMap<T,U>(c: T[][], f:(x: T) => U): U[][] { const res: U[][] = []; for (const i of c) { const line = []; for (const el of i) { line.push(f(el)); } res.push(line) } return res; } export function matrixForEach<...
2fb3dc26f9217ae017b0e31ac0122d5483dec1cb
TypeScript
Khongchai/lineman-wongnai-coding-challenges
/web/src/utils/removeDuplicatesFromArray.ts
3.046875
3
export default function removeDuplicatesFromArray(array: any[]): any[] { const filteredArray = []; const hashCheck = []; for (let i = 0, length = array.length; i < length; i++) { const indexedItem = hashCheck[array[i]]; if (!indexedItem) { hashCheck[array[i]] = true; filteredArray.push(array[...
b47334eb4662339e3e87001e41da5a75caab8410
TypeScript
qfl1ck32/bluelibs
/packages/x/src/models/defs.ts
3.0625
3
export enum ModelRaceEnum { GRAPHQL_TYPE = "graphql-type", CLASSLIKE = "class-like", INTERFACE = "interface", GRAPHQL_INPUT = "graphql-input", } export enum GenericFieldTypeEnum { STRING = "string", BOOLEAN = "boolean", FLOAT = "float", INT = "integer", DATE = "date", OBJECT = "object", ID = "id"...
3b7f9346fa1355ebdac6e3af2e0d3077858201d9
TypeScript
HealthML/StyleGAN2-Hypotheses-Explorer
/client/src/logic/actions/switchImage.ts
2.6875
3
// switch image // - style view // -> nothing (only local update) // - result view // -> generate all styles + ratings new import { displayedStyles, SpriteMapImage } from "../stores/displayed"; import { activeGenerator } from "../stores/generator"; import { selectedImage } from "../stores/selectedImage"; import { copy...
3073db62c4f4d29a8f499315625fec799f4bdd74
TypeScript
Jesus/rc-coffee-chats
/src/crons/matchify/__tests__/create-suitor-acceptor-pool.test.ts
2.84375
3
import { createSuitorAcceptorPool } from '../create-suitor-acceptor-pool'; describe('createSuitorAcceptorPool(): ', () => { /** * case 1: * given even pool --> should not be a fallback person * * case 2: * given odd pool --> should be a fallback person * * case 3: * each suitor's prioritie...
c85f2e59803ae4a3226af76fee66bb98d594c8a4
TypeScript
prynix/vscode-pxplus
/src/features/pxplusGlobals.ts
2.625
3
/* -------------------------------------------------------------------------------------------- * Copyright (c) Rick Mathers. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * -------------------------------------------------------------------------...
a1e25480bd279a6b75a6b9a34d4993f402ec1329
TypeScript
green-fox-academy/JialinWang1JS
/week-02/day-03/BinarySearch.ts
4.09375
4
let array: number[] = [1, 45, 6, 12, 13, 11, 25, 98, 778, 612450, 2674, 32165, 564, 65, 865] // 1 6 45 12 function BubbleSort(array): number[] { for (let i = 0; i < array.length; i++) { for (let j = i + 1; j < array.length; j++) { if (array[i] > array[j]) { let temp = array[i] ...
3af6881f8ff8eefe02bb462190c2d59048000360
TypeScript
Divan5841/widget
/src/utils/helpers.ts
2.59375
3
import moment from "moment"; import 'moment/locale/ru' export const setupMoment = () => { moment.locale('ru') } export const getRangeArray = (start: number, end: number): number[] => Array(end - start + 1) .fill(0) .map((_, idx) => start + idx) export const isEmpty = (arr: any[]) => arr.length === 0
82bf775fe3fddd568f55b353c6b20e48f818da7a
TypeScript
broerjuang/umbrella
/packages/vectors/src/internal/templates.ts
2.953125
3
import type { Fn, FnU2 } from "@thi.ng/api"; import type { Template } from "../api"; type HOFTpl = Fn<string, Template>; type HOFTpl2 = FnU2<string, Template>; /** @internal */ // prettier-ignore export const MATH: HOFTpl = (op) => ([o, a, b]) => `${o}=${a}${op}${b};`; /** @internal */ // prettier-ignore export const...
2752b551d706c4a16299e9f9b948db30114ac9e0
TypeScript
andersonmiyahira/SOVARRB
/src/APP/src/app/telas-gerais/visualizar-arquivo/models/log-arquivo.ts
2.796875
3
export class LogArquivoResponse { idArquivo: number; nomeArquivo: string; resultado: Array<LogArquivo>; headerSucesso: Array<LogArquivo>; headerErro: Array<LogArquivo>; detalheSucesso: Array<LogArquivo>; detalheErro: Array<LogArquivo>; trailerSucesso: Array<LogArquivo> trailerErro...
ad31cb0c0f377f1d579517dfefd200eea4c79926
TypeScript
t5w0rd/tStarship
/src/base/Skill.ts
3.078125
3
class Skill { ship: HeroShip; power: number; level :number = 1; public constructor(power: number) { this.power = power; } public cast(): boolean { if (!this.ship.isEnergyFull()) { return false; } if (this.ship.energy < this.power) { return false; } this.ship.addEnergy(-this.pow...
e1b20788abe360eae34155c943504f846b010ae0
TypeScript
HappyCodeDay/ng2Shoppers
/client/app/core/product.service.ts
2.546875
3
import { Injectable } from '@angular/core'; import { Product } from '../../app/core/product'; import { CartService } from '../../app/core/cart.service'; import { PRODUCTS } from '../../app/data/mock-products'; @Injectable() export class ProductService{ private cartItems: Product[] = []; constructor(priv...
3ec27baf3f75c13f42620330876e9ea8570003f7
TypeScript
breslavsky/serialize
/src/serializers/serializer.ts
2.5625
3
export interface Serializer<T extends Object> { serialize(model: T, additionalInfo?: any): Object | null; deserialize(json: Object, additionalInfo?: any): T | null; }
5e17f2f84fa91dd370084c7f6ee8b90b5e97f0c3
TypeScript
kirianchelo/owge
/game-frontend/src/app/service/resource-manager.service.ts
2.828125
3
import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import { Observable } from 'rxjs/Observable'; import { ResourcesEnum } from '../shared-enum/resources-enum'; import { UserPojo } from '../shared-pojo/user.pojo'; /** * Thi service contains the logged in user resources...
3209912b3a0919f23808e5d5ef33fabca007a795
TypeScript
guiflr/stock-control
/src/repositories/ingredient/IngredientCurrentStockRepository.ts
2.5625
3
import { IIngredientCurrentStock, IIngredientCurrentStockDTO, } from "./IIngredientCurrentStockRepository"; import IngredientCurrentStock from "../../database/schemas/IngredientCurrentStockSchema"; class IngredientCurrentStockRepository implements IIngredientCurrentStock { async create({ quantity, ingre...
9d6133cf59a0dc93ce9fe628560ac34ef7e1b333
TypeScript
ivanv88/ghTrending
/src/app/model/dateRange.model.ts
2.640625
3
export interface IDateRange { view: 'Today' | 'This week' | 'This month', value: 'daily' | 'weekly' | 'monthly' }
916a72b64c0f1e6b9fef9fd7da448b165cd283ea
TypeScript
mister-what/ex-patterns
/test/pattern/parentCapturing.test.ts
2.78125
3
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-expressions */ import { expect } from 'chai'; import { match, _, A, B, C } from '../../src'; describe('the match function: parent capturing', () => { it('should be able to capture parent matches', () => { const pattern = A({ user: B }); const ...
e56297d36a72223c4c144f0b0ea90a33527b0cf7
TypeScript
JayKay24/coding_challenges
/algo_expert/max_path_sum_in_binary_tree.ts
3.8125
4
class BinaryTree { value: number; left: BinaryTree | null; right: BinaryTree | null; constructor(value: number) { this.value = value; this.left = null; this.right = null; } } export function maxPathSum(tree: BinaryTree) { let maxSum = -Infinity; const traversePostOrder = (node: BinaryTree) ...
aee700e19d0c19aee0ba0279dcdefbdc71c5d0c7
TypeScript
judoaseeta/bitfetch
/src/core/lib/entities/cryptoArticle.ts
2.65625
3
interface RawCryptoArticle { id: string; guid: string; published_on: number; imageurl: string; title: string; url: string; source: string; body: string; categories: string; upvotes: string; downvotes: string; lang: string; source_info: { name: string; ...
65905582c377463f334ae3cfaebd47276bef15f7
TypeScript
iphuongtt/learn-loopback-4
/src/services/greeting.service.ts
3.1875
3
import {Getter, config} from '@loopback/context'; import {extensions, extensionPoint} from '@loopback/core'; import chalk from 'chalk'; import { GREETER_EXTENSION_POINT_NAME, Greeter } from '../types'; /** * Options for the greeter extension point */ export interface GreetingServiceOptions { color: string; } ...
c59d0cbcddb33694be4b0eb9a09c83578f275796
TypeScript
annaojdowska/kiohub
/kiohub-client/src/app/ui-elements/spinner/updatable-spinner.ts
3.015625
3
import { SpinnerComponent } from './spinner.component'; export abstract class UpdatableSpinner extends SpinnerComponent { // list of successfully uploaded elements' names succesList: string[] = []; // list of badly uploaded elements' names failedList: string[] = []; // updatable info string to disp...
3c1e2ed0fb3f4f75d4179adbe38c08265de497e9
TypeScript
Nobuyukigo/comptes-pwa
/src/utils/models.ts
2.625
3
export type Category = | 'restaurant' | 'alimentation' | 'loisirs' | 'shopping' | 'divers'; export interface Debt { summary: string; value: number; } export interface Distribution { percentage: number; key: Category; svg?: { fill: string; }; value: number; } export interface Expense { i...
11f524296e27585f5aca9c083c61fdb9d4f37e81
TypeScript
supaflyENJOY/srcds-rcon-controller
/src/utils/ip-resolver.ts
2.59375
3
import * as isLocal from 'is-local-ip'; import * as myLocalIp from 'my-ip'; import * as myPublicIp from 'public-ip'; export default (ip : string) : Promise<string> => { if(isLocal(ip)) { return Promise.resolve(myLocalIp()); } return myPublicIp.v4(); }
564abc82b5866d26a83fb3f1ad51524270efc771
TypeScript
hfxiang93/vue3-admin
/src/utils/index.ts
3.140625
3
/* * @Author: shen * @Date: 2021-01-20 10:13:02 * @LastEditors: shen * @LastEditTime: 2021-01-31 16:23:55 * @Description: */ import { AnyFunction } from '@/types' /** * @description 延迟方法,异步函数 * @param {number} delay 延迟的时间,单位 毫秒 * @returns */ export const sleep = async (delay: number) => { return new Promi...
7f1c1a6f66a84514845d7131c0a5c6a72703525f
TypeScript
devpt-org/estirador
/src/internals/databases/simple-entity/simple-entity.repository.ts
2.578125
3
import { Class, ConcreteClass, } from '@app/shared/internals/utils/types/classes-types'; import { AuditContext } from 'src/internals/auditing/audit-context'; import { AbstractRepository, DeepPartial, EntityManager, FindOperator, } from 'typeorm'; import { SimpleEntity } from './simple.entity'; import { gene...
5986ad3ed7160582da707d0a22c6a96bb8d05613
TypeScript
NoQuarterTeam/tails
/src/templates/service.ts
2.671875
3
import { capitalize } from "@noquarter/utils" export const ServiceTemplate = (name: string) => { const capitalName = capitalize(name) return `import { Service } from "typedi" import { ${capitalName} } from "./${name}.entity" import { ${capitalName}Repository } from "./${name}.repository" @Service() export class ...
f74a957d0ce573865fc439ef6e8152c47f63d6ce
TypeScript
SsooloomM/Adwarlak
/front-end/src/app/models/StoreProduct.ts
2.6875
3
import { Product } from './product'; import { Store } from './store'; export class StoreProduct { private product: Product; private store: Store; private id: number; private views: number; private solds: number; private available: number; private price: number; constructor(){ } /** * G...
25c23c8623c59eb82d30eb71cffb969ac7a2feca
TypeScript
demo-source/wasaby-controls
/Controls/_input/Base/InputUtil.ts
3.28125
3
import {ISelection, ISplitValue} from '../resources/Types'; export interface IInputData { oldValue: string; oldSelection: ISelection; newValue: string; newPosition: number; } /** * Get split by entered string. * @param {String} oldValue Values in the field before changing it. * @param {String} newValue...
bc6c9def016089e176cbbd26e1fb57662e0749fe
TypeScript
IronOnet/codebases
/codebases/coursera.org/static/bundles/promotions/utils/abandonedCartPromoUtils.ts
2.59375
3
import localStorage from 'js/lib/coursera.store'; import logger from 'js/app/loggerSingleton'; import user from 'js/lib/user'; import moment from 'moment'; import { stringKeyToTuple } from 'js/lib/stringKeyTuple'; type AbandonCartPromoData = { userId?: number; expiresAt?: number; promoCode: string; productType...
a02b6cfdc3e0eb4c81188c6e5745a334e1ddc2f8
TypeScript
TimeToogo/ff-proxy
/client/node/tests/tcp-to-ff-socket.test.ts
2.875
3
import { FfClient, FfRequestOptions } from "../src/client"; import { TcpToFfSocket } from "../src"; describe("TcpToFfSocket", () => { it("Calls FfClient.sendRequest with correct options", async () => { const mockClient = ({ sendRequest: jest.fn().mockReturnValue(new Promise(() => {})) } as any) as FfCl...
fb79016b9141be3fb3e55a2e8c94baf005e72657
TypeScript
RGPosadas/Mull
/apps/mull-api/src/app/auth/auth.guard.spec.ts
2.515625
3
import { createMock } from '@golevelup/nestjs-testing'; import { ExecutionContext, UnauthorizedException } from '@nestjs/common'; import { ROUTE_ARGS_METADATA } from '@nestjs/common/constants'; import jwt from 'jsonwebtoken'; import { authenticatedSubscription, AuthenticatedUser, AuthGuard } from './auth.guard'; jest....
bf793c3a91fc7fbd5f3ed6a3f4592d556f06e67a
TypeScript
dietmarw/search
/src/lib/Store.ts
2.96875
3
import { ImpactIndex } from './Index'; import { SubState, Observable } from './State'; // This class represents the storage of all state information for the // application. Each of these states is represented by an instance of // SubState which provides an interface which is essentially read only // and can be passed...
499181e4dfd3c89dc6ae9adb1298b669eae1f090
TypeScript
cyberbobjr/rogue-game-angular
/src/app/core/classes/base/game-monster-class.ts
2.578125
3
import {JsonMonster, JsonMonsterClass} from '../../interfaces/json-interfaces'; import {Utility} from '../utility'; import {Sprite} from './sprite'; import {Weapon} from '../gameObjects/weapon'; import {GameObjectFactory} from '../../factories/game-object-factory'; export class GameMonsterClass { get weapons(): Arr...
d2b426d59b590659a24cc769d157bf9e1c233ef3
TypeScript
alexroutledge/angular-memoize-pipe-example
/src/app/memoize.pipe.ts
2.671875
3
import { Injector, Pipe, PipeTransform } from '@angular/core'; import { memoize, bind, MemoizedFunction, isUndefined, keys } from 'lodash'; import { FibonacciPipe } from './fibonacci.pipe'; @Pipe({ name: 'memoize' }) export class MemoizePipe implements PipeTransform { private readonly PIPES: {[key: string]: Pipe}...
2a606bcea415f16d8364469dafd95b0f11887b63
TypeScript
thetinyspark/texture-packer
/test/service/FileService.spec.ts
2.796875
3
import { createCanvas } from "canvas"; import FileService from "../../lib/core/service/FileService"; describe('FileService test suite', ()=>{ const currentFile = __filename; const service = new FileService(); const tmpPath = __dirname+"/tmp/"; const subPath = tmpPath+"sub/"; const jsonPa...
2caeeab97b41bb470f92dee35b50ede43071d80b
TypeScript
fakoua/soxa
/src/helpers/isAbsoluteURL.ts
3.484375
3
/** * Determines whether the specified URL is absolute * * @param {string} url The URL to test * @returns {boolean} True if the specified URL is absolute, otherwise false */ const isAbsoluteURL = function (url: string): boolean { // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-r...
bbfa1ab9536665e6d3260c193fb1ede4c8448516
TypeScript
nafsar/templateForms-version7
/src/app/app.component.ts
2.515625
3
import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { emails = ['', 'naser@angular.io', 'templateFormat@angular.io', 'test@gm.com', '', 'form@uiux.bi']; model = new Data('Earth...
21fa18e39545116602637a0b0734fffb34119abf
TypeScript
paiboon15721/refinitiv-test
/question-two/src/app/filter.pipe.ts
2.6875
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'filter', }) export class FilterPipe implements PipeTransform { transform(xs: string[] | null, term: string): string[] { const lowerTerm = term.toLowerCase(); return xs ? xs.filter((x) => x.toLowerCase().indexOf(lowerTerm) !== -1) ...
ade1bc31a6b9908af57b8f05d6fbbfa0b0fe0544
TypeScript
green-fox-academy/Galicz555
/week-03/day-4/farm.ts
3.5625
4
import { animal } from '../day-3/animal' class Farm { private _list: animal[]; private _slots: number; public currentNumAnimals: number = 0; constructor(slots: number = 10, listOfAnimals?: animal[]) { this._slots = slots if (listOfAnimals) { this._list = listOfAnimals; ...
d353ea6ebbe28a6e0d7c512ef4194da25e0992db
TypeScript
annavlz/minesweeper
/app/jspm_packages/npm/rx@3.1.0/ts/core/linq/observable/delaywithselector.ts
3.40625
3
/// <reference path="../../observable.ts" /> module Rx { export interface Observable<T> { /** * Time shifts the observable sequence based on a subscription delay and a delay selector function for each element. * * @example * 1 - res = source.delayWithSelector(function (x) {...
89a70551d80f1ce39d40f1bc0350b42f90389fb6
TypeScript
ericrkuo/BE-hackcamp
/src/main/entity/Nutrition.ts
3.015625
3
import {Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn} from "typeorm"; import {Dish} from "./Dish"; @Entity() export class Nutrition { constructor(name: string, value: number, unit: string) { this.name = name; this.value = value; this.unit = unit; } @PrimaryGenerat...
1e5309a1d1211134c8e89d2866e581f19cd2da8c
TypeScript
kennysng/node-jql-core
/src/core/task.ts
3.046875
3
import { CancelablePromise } from '@kennysng/c-promise' import { JQL } from 'node-jql' import uuid = require('uuid/v4') import EventEmitter from 'wolfy87-eventemitter' import { TaskError } from '../utils/error/TaskError' /** * Status function */ export type TaskFn<T> = (task: Task) => CancelablePromise<T> /** * Re...
0431b9988c4be874a0c5ebbd71d5fe036bde910c
TypeScript
TomokiMiyauci/coin-monitor
/api/src/bot/rate.ts
2.515625
3
import admin from 'firebase-admin' import type { ServiceAccount } from 'firebase-admin/lib/credential' import { NowRequest, NowResponse } from '@vercel/node' import { factory } from '../rate' const createApp = ( cert: ServiceAccount = { projectId: process.env.FIREBASE_PROJECT_ID, clientEmail: process.env.FIRE...
4414eff238dee6df8b9997a90e03c827b70e275d
TypeScript
toystars/football-simulator
/src/utils/validators/__tests__/pitch-validators.util.spec.ts
2.9375
3
import { validatePitch } from '../pitch-validators.util'; import { IPitch, PitchDimensionsLength, PitchDimensionsWidth, PitchTurfType, PitchValidationError } from '../../../types'; const draftPitch: IPitch = { length: 0, width: 0 }; describe('Pitch Validator', () => { it('should throw PitchValidationError on empt...
8df8e028db425862854a84dcfd0b573cce6cac77
TypeScript
dearamy/dagger-online
/server/tests/worldTests.ts
2.609375
3
/// <reference path='../src/types' /> import chai = require('chai'); var should = chai.should(); var expect = chai.expect; import _ = require('lodash'); import World = require('../src/gameServer/models/World'); import Zone = require('../src/gameServer/models/Zone'); import GameObject = require('../src/gameServer/mode...
a924abe24fb3895c35e14803d21b563419611cd9
TypeScript
JirkaDellOro/Computergrafik.Online
/docs/assets/dist/interactions/05-Aufloesung-Ausgabe/Aufloesung-eines-Monitors/main.ts
2.515625
3
let rangeInput: HTMLInputElement; let rangeValue: number; let currWidth: number; let difference: number; let maxHeight: number = 2800; let img: HTMLDivElement; window.addEventListener("load", main); function main(): void { rangeInput = document.getElementById("rangeIP") as HTMLInputElement; rangeVa...
b8e0bbc4562245e4515fa6419a9f549774d0a868
TypeScript
origami-team/geogami
/src/app/services/language.service.ts
2.609375
3
import { TranslateService } from '@ngx-translate/core'; import { Injectable } from '@angular/core'; import { Storage } from '@ionic/storage'; const LNG_KEY = 'SELECTED_LANGUAGE'; const lngs = ['de', 'en']; @Injectable({ providedIn: 'root' }) export class LanguageService { selected = ''; constructor(private tra...
2b209fd4dbd839044a84880e2adaa5953ab2756e
TypeScript
jotauribe/ABank
/src/app/store/loan-request-form/reducers.ts
2.671875
3
import { Client } from '../../models/client.model'; import * as LoanRequestActions from './actions'; export interface State { clients: Client[]; response: string; loanAmount: number; wasSuccessful: boolean; wasSubmitted: boolean; } const initialState: State = { clients: [], response: 'NOT PROCESSED', ...
8e6145dfaf52d0b26a93ee4e95f2f2778a7f8533
TypeScript
zbiju/adverity-etl
/src/api/ApiClient.test.ts
2.53125
3
import { DataEntry, DataEntryAPI } from '../models/DataEntry'; import { extractDatasourcesAndCampaigns, getData, mapData } from './ApiClient'; const fs = require('fs'); describe('API', () => { let loadedData: DataEntryAPI[]; let mappedData: DataEntry[]; beforeAll(async () => { const file = fs.crea...
fd6fb8434caf289a7f17b5b0103001dac33f8808
TypeScript
automerge/hypermerge
/src/Actor.ts
2.59375
3
import { Change } from 'automerge' import { ID, ActorId, DiscoveryId, encodeActorId } from './Misc' import Queue from './Queue' import * as Block from './Block' import * as Keys from './Keys' import Debug from './Debug' import FeedStore, { FeedId, Feed } from './FeedStore' const log = Debug('Actor') export type Actor...
6769d1f4c30c3c8ad042d153bf2293f08fa10e92
TypeScript
250391Ivan/Ejercicio-Angular-5
/src/app/carros/carros.component.ts
2.546875
3
//Este componente se encarga de realizr mis funciones que voy a utilizar el las vistas y las tuberias. import { Component, OnInit } from '@angular/core'; import { NgModule } from '@angular/core'; //se importa el nombre del servicio import { PeticionesService } from '../services/peticiones.service'; @...
5b8e6d99f6b4444de55bddc613cb0f2e1518606e
TypeScript
WooodHead/codelab.ai
/libs/backend/src/core/domain/AggregateRoot.ts
2.765625
3
import { AggregateRoot as NestjsAggregateRoot } from '@nestjs/cqrs' import { Type, classToPlain, plainToClass } from 'class-transformer' import { ClassType } from 'class-transformer/ClassTransformer' import { TransformBoth } from '../../common/TransformBoth' import { BaseTypeOrm } from '../../infrastructure/persistence...
15ebddc9fae6f88620630279467f827d37bee23e
TypeScript
steveperkins/co-forage
/src/models/SearchParams.ts
3.078125
3
/** * API search parameters. Clients can search for product inventory state reports by * location (geocoordinate or geohash) and radius, a known store (storeId), and * either a barcode or start of a product's generic name (category). * * If `storeId` is provided, all other geolocation attributes are ignored. * If...
501e0d8831b2bd8b44ab88fb00642d35296d9b12
TypeScript
KeesCBakker/hubot-command-mapper
/src/entities/parameters/ChoiceParameter.ts
3.5
4
import { ParameterBase } from "./ParameterBase" import { escapeRegExp } from "../../utils/regex" /** * Parameter that has a fixed set of values. Remember all values * are not case sensitive. * * @export * @class ChoiceParameter * @extends {ParameterBase} */ export class ChoiceParameter extends ParameterBase { ...
06fa76aadfb5cf32c5e08f9a30eb20fc70bbc2c9
TypeScript
cgronseth/SPToolBox
/src/spt.storage.ts
2.953125
3
import { SPData } from "./sharepoint/spt.sharepoint.entities"; export interface IListItemLight { ID: number; Author: string; Editor: string; Created: Date; Modified: Date; File?: { FilePath: string; FileName: string; Length: number; } ItemData?: SPDa...
84629c0d4b44c2d4b63697737817dfc8c39cf2b8
TypeScript
PennOhio/uniswap-v3-simulator
/src/util/LiquidityMath.ts
2.71875
3
import JSBI from "jsbi"; import { NEGATIVE_ONE, ZERO, MaxUint128 } from "../enum/InternalConstants"; import assert from "assert"; export abstract class LiquidityMath { static addDelta(x: JSBI, y: JSBI): JSBI { assert(JSBI.lessThanOrEqual(x, MaxUint128), "OVERFLOW"); assert(JSBI.lessThanOrEqual(y, MaxUint128)...
ebfce70f5652a46048c84a9db161b9e0f2cbd371
TypeScript
TrumanGao/trumangao-utils
/src/utils/cryptoJs.ts
3.0625
3
import cryptoJS from "crypto-js"; export class CryptoJS { key: cryptoJS.lib.WordArray; iv: cryptoJS.lib.WordArray; constructor(key: string, iv: string) { this.key = cryptoJS.enc.Utf8.parse(key); this.iv = cryptoJS.enc.Utf8.parse(iv); } /** * AES 加密 */ aesEncrypt(message: string | cryptoJS.l...
a890871fade0c1265c358b7cd34fd4f6a2f591ad
TypeScript
Sts0mrg0/encodable
/packages/encodable/test/typeGuards/Scale.test.ts
2.890625
3
import { scaleLinear, scaleOrdinal, scaleTime, scaleLog, scaleThreshold, scaleQuantize, scaleQuantile, } from 'd3-scale'; import { isTimeScale, isContinuousScale, isDiscretizingScale } from '../../src/typeGuards/Scale'; import { StringLike } from '../../src/types'; describe('type guards', () => { descr...
a5854fb653abe710d005d65c16bd4f03d61e7094
TypeScript
daxingyou/Racing
/H5/Client/src/MyUI/Welfare/Components/OnlineItemRender.ts
2.546875
3
namespace MyUI.Welfare { /** * 在线奖励列表项 */ export class OnlineItemRender extends ui.Welfare.Components.OnlineItemRenderUI { private mNeedTime: number; // 领奖需要的在线时间(秒) private mCurGetState: RewardState; // 当前领奖状态 private mGetGoodsStopIdx: number; // 抽到的物品所在列表的索引 private ...