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
0798fc99c0a4d13202a3d57624bc15dd273af4ac
TypeScript
jimmyn/pinpoint-playground
/src/lib/modelUtils.ts
2.640625
3
import {Model, Query, Scan} from 'dynogels-promisified'; import {NotFound, UnprocessableEntity} from 'http-errors'; import {capitalize, decodeJSON, encodeJSON} from './utils'; /** * Gets an item from dynamoDB table * Throws a NotFound http error if item is not found * This is an example of functional approach to ex...
0423fca431502e7e9a34a64b81db3144c5303210
TypeScript
CJAC35/Golf-Game
/src/Player.ts
2.703125
3
import * as MRE from '@microsoft/mixed-reality-extension-sdk'; export class Player{ public user: MRE.User; public scores: number[]; public currLevel: number; public totalScore: number; public constructor(user: MRE.User){ this.user = user; this.scores = []; this.currLevel = ...
a8ed0c6d70beb8998896e81ba79854479e477efd
TypeScript
ringteki/ringteki
/server/game/cards/19.1-AS01/Unicorn/IchigoKun.ts
2.625
3
import AbilityContext = require('../../../AbilityContext'); import { CardTypes, Elements, Players, TargetModes } from '../../../Constants'; import AbilityDsl = require('../../../abilitydsl'); import DrawCard = require('../../../drawcard'); const VULNERABLE_ELEMENT = 'ichigo-kun-fire'; const MORE_MIL_LESS_GLORY = 'Inc...
2abc43225bb509a06997db532ccf6a43414dd9c7
TypeScript
dyhaz/angular4-coreui
/src/app/views/animations/animations.component.ts
2.515625
3
import { Component } from '@angular/core'; import { trigger, state, style, transition, animate, keyframes } from '@angular/animations'; @Component({ templateUrl: 'animations.component.html', styles: [` p { width:200px; background:lightgray; margin:100px auto; ...
07c61d0f65bce270a5b6545e2d6086c60cd1dc70
TypeScript
franpsif/final-app
/src/app/recipes/recipe.service.ts
2.515625
3
import { AuthService } from '../auth/auth.service'; import { Observable } from 'rxjs/Observable'; import { Injectable } from '@angular/core'; import { Ingredient } from '../shared/ingredient.model'; import { Recipe } from './recipe.model'; import { Subject } from 'rxjs/Subject'; import { Http, Response } from '@angular...
1cf038b20afee18f392e5e738e0a3238f1066c81
TypeScript
SupertigerDev/express-deno
/Response.ts
2.65625
3
import { ServerRequest } from "https://deno.land/std@v0.42.0/http/server.ts"; export default class Response { _status: number; req: ServerRequest; constructor(req: ServerRequest) { this.req = req; this._status = 200 } send(body: string) { this.req.respond({body, status: thi...
13809b0c979bab2f03e24ea1728a9b3be78bb21f
TypeScript
bartversluijs/simple-custom-errors
/examples/handling.ts
3.328125
3
import SimpleCustomErrors from '../build/index'; // Create FooError const FooError = SimpleCustomErrors.createError('FooError', [ { code: 'Bar', description: 'Bar {{foo}}', params: [ 'foo', ], }, ]); try { // Throw error throw new SimpleCustomErrors.Errors.FooError('Bar', { foo: ['Te...
69879b2f06f16b276383a73e6f62496b198c6b70
TypeScript
gustavom12/PokedexSimulation
/src/app/directives/pokemon-type.directive.ts
2.78125
3
import { Directive, Input,ElementRef, AfterViewInit } from '@angular/core'; @Directive({ selector: '[PokemonType]' }) export class PokemonTypeDirective implements AfterViewInit{ @Input("PokemonType")text: String //Set color to pokemon types constructor(public el:ElementRef) { } $el:HTMLElement = this.el.native...
87c40845f14a34269f8db3c5e004bfeba10dd110
TypeScript
projectcemetery/NimesisOld
/minimalClient/typescript/Packets.ts
3.40625
3
namespace Utils { /** * Request types */ export enum RequestType { ADD_CLASS_REQUEST } /** * Response types */ export enum ResponseType { INTERNAL_ERROR, ADD_CLASS_RESPONSE } /** * Response codes */ export enum ResponseCode { ...
9218ec487bb3dc58ab4dd6280b6ecaad5e12a149
TypeScript
bravehager/marionette
/src/routine.ts
2.890625
3
import fs from "fs"; import path from "path"; import * as Puppeteer from "puppeteer"; import { Command, parse } from "./parser"; import { CommandType } from "./token"; /** A Routine is a sequence of Puppeteer commands. */ export class Routine { /** An array of commands which defines the routine. */ private comman...
61455f5875e2cf31f79fe494855471086649a9f7
TypeScript
RobertBeilich/hashcode_2021
/src/app.ts
3.03125
3
import {Car} from "./Car"; import {Intersection} from "./Intersection"; import {Street} from "./Street"; import fs from 'fs'; import {Simulation} from "./Simulation"; const getMatchingIntersectionOrNew = (intersections: Intersection[], id: number): Intersection => { if(!intersections[id]) { intersections[id] = ...
d705deb6b8d52edd9e468632a2c3169a1a680a10
TypeScript
jpalumickas/react-native-activestorage
/src/lib/createBlobRecord.ts
2.671875
3
import getChecksum from './checksum'; import { File } from '../types'; interface CreateBlobRecordParams { directUploadsUrl: string; file: File; headers?: object; } interface BlobParams { filename: string; content_type: string; byte_size: number; checksum: string; metadata?: object; } const createBlob...
0942fa3634cc07364f48fa3d38afaebda690c62c
TypeScript
caravelx/magento2
/packages/composables/src/composables/getters/addressGetter.ts
2.5625
3
import { Countries, Country } from '@vue-storefront/magento-api'; import { AddressGetter } from '../../types'; const countriesList: AddressGetter['countriesList'] = (countries: Countries[]) => countries .filter((c) => c.id && c.full_name_english && c.full_name_locale) .map((c) => ({ id: c.id, label: c.full...
726ab1c55d96294c0d54009b264c716a0187248e
TypeScript
Loppik/lemonade
/frontend/src/modules/homeEvents/types.ts
2.671875
3
type DataType = null|undefined|EventType[]; type ErrorType = null|undefined|string; export interface HomeEventsState { data: DataType isLoading: boolean isError: ErrorType } export interface GetHomeEventsAction { type: string, payload: { location?: { longitude: number, latitude: number }, data?: Dat...
1c11c7c5274968baef1fe523d478601242eada5b
TypeScript
dominique-mueller/angular-package-builder
/src/transformer/external-resources/angular-external-resources.analyzer.ts
2.78125
3
import { posix as path } from 'path'; import { ObjectLiteralExpression, ClassDeclaration, SourceFile, Decorator, PropertyAssignment, StringLiteral } from 'ts-simple-ast'; /** * [Abstract] Angular External Resources Analyzer */ export abstract class AngularExternalResourcesAnalyzer { /** * Get a component ...
24bbda449f8f21a70c1cd806666e4290636ab6cc
TypeScript
PriyankaMali-13/CaseStudy-Eshop
/client/src/app/orders/order.service.ts
2.515625
3
import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { map } from 'rxjs/operators'; import { Order } from '../models/orders'; @Injectable({ providedIn: 'root', }) export class OrderService { orderPlaceUrl = 'http://localhost:7000/add/orders'; getUserAllOrders = 'h...
29af212cbb49fbab7c2c569c12d4cc9b1fcab93a
TypeScript
jonnyboyC/kos-language-server
/server/test/directives/include.spec.ts
2.921875
3
import { DirectiveTokens } from '../../src/directives/types'; import { createToken } from '../utilities/factories'; import { TokenType } from '../../src/models/tokentypes'; import { Include } from '../../src/directives/include'; import { DiagnosticSeverity } from 'vscode-languageserver'; import { DIAGNOSTICS } from '.....
64a3f0eac13755956f322d7208de3f8d175e1c57
TypeScript
pb82/waml-compiler
/src/parser/ExpressionParser.ts
3.28125
3
import {Parser, Parsing} from "./Parser"; import {TokenProvider} from "../tokenizer/TokenProvider"; import {ASTNode} from "./types/ASTNode"; import {Token} from "../tokenizer/Token"; import {TOKEN_TYPE} from "../tokenizer/Definitions"; import {UnknownBuiltinError} from "../errors/UnknownBuiltinError"; import NumberNode...
ade31b48e4b8542842eb7d89c04713f3852eef6e
TypeScript
Voya100/VoyaCode
/src/app/projects/color-picker/sliders/color-slider/color-slider.component.ts
2.59375
3
import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild } from '@angular/core'; /** * Slider component that displays data input as a background and adds selector to x position that matches value input. */ @Component(...
95fb262421ae3fde206abb0897a66e455b2d1190
TypeScript
hsuanxyz/ts-simple-ast
/src/structurePrinters/namespace/NamespaceDeclarationStructurePrinter.ts
2.5625
3
import { CodeBlockWriter } from "../../codeBlockWriter"; import { NamespaceDeclarationStructure } from "../../structures"; import { StructurePrinterFactory } from "../../factories"; import { FactoryStructurePrinter } from "../FactoryStructurePrinter"; import { BlankLineFormattingStructuresPrinter } from "../formatting...
f5f5695d6b95e1048d5116106b4efcd0046410ba
TypeScript
matibm/padron-frontend
/src/app/pipes/primer-nombre.pipe.ts
2.609375
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'primerNombre' }) export class PrimerNombrePipe implements PipeTransform { transform(nombreCompleto: String, ...args: unknown[]): unknown { let nombre = nombreCompleto nombre = nombre.split(' ')[0] return nombre; } }
01a3968910af18d3bad5cf2577987814fedd2016
TypeScript
akshaynair319/infinite-canvas
/src/instructions/path-instruction-builders/from-point-to-point/path-instruction-builder-from-point-to-point.ts
2.71875
3
import {PathInstructionBuilder} from "../path-instruction-builder"; import {Position} from "../../../geometry/position"; import {isPointAtInfinity} from "../../../geometry/is-point-at-infinity"; import { PathInstructionBuilderProvider } from "../path-instruction-builder-provider"; import { InfiniteCanvasPathInstruction...
133a14d65b49dfaf92d81424cb9151726adabf3c
TypeScript
ldrly-tristan/dankest-dungeon
/src/app/lib/entity/static-entity-data-accessor.ts
2.875
3
import { AssetKey, AssetType } from '../../asset-enums'; import { StaticEntityDataId } from '../../lib/entity'; import { StaticEntityData } from '../../models/entity'; /** * Static entity data accessor. */ export class StaticEntityDataAccessor<T, U extends StaticEntityData<T>, V> { /** * Instantiate static enti...
5674b51d3265efa7258a852ae54898a51e1abf72
TypeScript
TeikokuDB/unacast
/src/main/youtube-chat/live-chat.ts
2.546875
3
import { EventEmitter } from 'events'; import axios from 'axios'; import { actionToRenderer, CommentItem, parseData } from './parser'; import { sleep } from '../util'; type LiveChatResponse = [ { page: string; csn: string; }, { url: string; response: { responseContext: any; contents: ...
2ef7f5493f8c288331015b8dd6a1974d36afabdf
TypeScript
jonamat/telegram-socket-bot
/tests/unit/utils/getAlias.test.ts
2.53125
3
/* ----------------------------- Unit test suite ---------------------------- * * * Target: getAlias function * Tests: * - Behavior * - Data consistency * * -------------------------------------------------------------------------- */ import { mocked } from 'ts-jest/utils'; import validatePartialSchema from '@...
7adaf9de8aa4bf7e4237fb3d56237b0641db4464
TypeScript
Gui-dev/node-next
/api/src/modules/users/infra/typeorm/entities/User.ts
2.65625
3
import { Column, CreateDateColumn, Entity, PrimaryColumn } from 'typeorm' import { v4 as uuid } from 'uuid' @Entity('users') export class User { @PrimaryColumn() public readonly id: string @Column() public name: string @Column() public email: string @CreateDateColumn() // eslint-disable-next-line ca...
96cace83451837d19fb21391092f884054191305
TypeScript
stv94/fun-di
/main.ts
3.265625
3
import {injectable, Kernel} from "./src" abstract class IPerson{ abstract name: string; } @injectable class Human implements IPerson { constructor(public name: string){}; } abstract class IWeapon{ abstract kill(person: IPerson); } @injectable class FiberWire implements IWeapon { kill(person: IPerson...
c53026609013bfcad137d3181ff51b2727b52866
TypeScript
Nishant1500/discord-economy-super
/typings/interfaces/WorkObject.d.ts
2.734375
3
import TimeObject from './TimeObject' /** * Object that returns on 'Economy.work()' method. */ declare class WorkObject { /** * The status of receiving money. */ status: boolean /** * If reward is already claimed: time object; else: work reward. */ value: TimeObject...
e6c07f77e7d0f279215174f7931b03b71bb48231
TypeScript
lightningkite/butterfly-web
/src/views/html.ts
2.6875
3
import {post} from "../delay"; import {xViewRemovedGet} from "../rx/DisposeCondition.ext"; import {DisposableLambda} from "../rx/DisposableLambda"; export function loadHtmlFromString(data: string): HTMLElement { const d = document.createElement("div"); d.innerHTML = data; return d.firstChild as HTMLElement...
72f5cbb99b9f72e63cc0e46669c93390d20ff0b9
TypeScript
yujidxl/background-application
/src/utils/index.ts
2.90625
3
export function param2Obj(url: string) { const search = url.split('?')[1]; if (!search) { return {}; } return JSON.parse( '{"' + decodeURIComponent(search) .replace(/"/g, '\\"') .replace(/&/g, '","') .replace(/=/g, '":"') + '"}' ); } export function fixNum(num: num...
899413e568e90902db71e00cd8710c18cda1b752
TypeScript
bolinfest/typescript
/tests/ls/getInScopeNamesAndTypesFromPosition.ts
2.625
3
///<reference path='..\..\src\compiler\typescript.ts' /> ///<reference path='..\..\src\harness\harness.ts' /> describe('getInScopeNamesAndTypesFromPosition', function () { var code: string = Harness.readFile('ls/testCode/scopelist.ts'); var script: TypeScript.Script = null; var ls: TypeScript.TypeScr...
c5f77f13bfd6ffaaa98c59fce17c633d9ca4f280
TypeScript
jirevwe/ts-starter
/src/data/base/base.repo.ts
2.734375
3
import { injectable, unmanaged } from 'inversify'; import mongoose, { Model, Schema, FilterQuery } from 'mongoose'; import { DuplicateModelError, ModelNotFoundError } from '.'; import { Repository, Query, QueryResult, PaginationQuery } from '.'; @injectable() export class BaseRepository<T> implements Repository<T> { ...
bcdbdac4d5460931f0969df88e74c9125138df3a
TypeScript
Klynger/nest-rest-generator
/src/templates/model.template.ts
2.75
3
import { pipe } from 'ramda'; import { addIdentationSpacesFn } from '../utils'; import { DEFAULT_TAB_SIZE, FileType } from '../shared/constants'; import { Import, FileImport, generateImports } from './imports.template'; import { CreateModelDto, ModelAttribute, ImportableModelAttribute } from '../shared/models/create-mo...
e0c7433da15407bb83d2dbb02b369306c2471ab6
TypeScript
wuzinong/JsLearning
/DotNetCoreSingleApplication/SSR-REACT/Scripts/async-thunks.ts
2.515625
3
import {receiveHelloWorldData,IHelloWorldData} from './redux-actions'; import {fetch,addTask} from 'domain-task'; // export function retrieveData() { // return (dispatch: <T>(action: any) => T, getState: () => any) => { // fetch('/Home/GetHelloWorldData', { method: 'get' }) // .then(response =>...
116a92cf886c7ee706321e9469f3bea737958c1b
TypeScript
exegesis-js/exegesis
/samples/typescript-example/server.ts
2.796875
3
//Import librarys used import * as express from 'express'; import * as exegesisExpress from 'exegesis-express'; import * as path from 'path'; //You may choose HTTP or HTTPS, if HTTPS you need a SSL Cert import * as http from 'http'; import * as https from 'https'; const PORT = 3000; async function createServer() {...
3e300f423282c697ddf59ef21f0c61344553120d
TypeScript
TJAlferes/nobullshitcooking-api
/src/modules/chat/message/model.ts
2.9375
3
import { assert, string } from 'superstruct'; import { GenerateUUIDv7StringId, UUIDv7StringId } from './shared'; export class Chatmessage { private chatmessage_id; private kind; private chatroom_id; private sender_id; private receiver_id; private content; private image_id; private video_id; // Times...
33613b652db568d1d3a9b9499b89351fa31c066a
TypeScript
GZJack/wensdk
/src/cache/src/drivers/Storage.ts
2.96875
3
// 引入接口 import {CacheInterface} from './Inf'; import {Tools,Crypto,cyt} from '../../lib/Index'; import {Data} from '../Data'; /** * 实现本地缓存 localStorage 且必须继承 统一的接口 * * @export * @class WStorage * @implements {CacheInterface} */ export class WStorage implements CacheInterface{ /** * 当前的用户 key,每一个用户都会有一个...
f252f36f5e9faaae66a1f9eb83236f2fe1b36e98
TypeScript
kellyjandrews/todo-cli
/src/commands/delete.ts
2.625
3
import { Command, flags } from '@oclif/command' import { getTodos, deleteTodos } from '../helpers' import { prompt } from 'prompts' export default class Delete extends Command { static description = 'Delete a todo.' static examples = [ `$ todo delete `, ] static strict = false static flags = { hel...
db0d1603985c70d31e2edb338e4fd5f3d2fac386
TypeScript
eugen-eugen/sudoku
/lib/Cell.ts
3.828125
4
import { Group } from './Group'; /** * This class represents a single cell of a sudoku field. * * A cell's model is the set of values, which the cell can yet have. * The class have a couple of utility methods which evolve the cell * while sudoku is being be solved. */ export class Cell{ /** * This arr...
5b7eca4c1ca408ee31c26c5d99bb6232902aa5e5
TypeScript
zalari/ts-analyze
/base/src/classes/walker-language-service.class.ts
2.9375
3
import { Node, Project, Symbol, SyntaxKind } from 'ts-morph'; export class WalkerLanguageService { constructor(private _project: Project) { } /** * Gets the respective project-attached node for a given unattached node. * * @param unattachedNode */ attach<T extends Node>(unattachedNode: ...
62ba76d1564704890537267e17135b4d414e57d3
TypeScript
SaioAU/ingrid_website
/src/routes/seasons.ts
2.65625
3
import { Request, Response, Router } from 'express'; import { StatusCodes } from 'http-status-codes'; import { Season, Product } from '../entities'; import { checkJwt } from './middlewares'; const router = Router(); const { BAD_REQUEST, INTERNAL_SERVER_ERROR, NOT_FOUND, OK } = StatusCodes; // curl http://localhost...
3987cee04f1b1b001bbdb623649ed8e36498d47c
TypeScript
3darkman/Infinity2d20
/WebTools/src/helpers/careerEvents.ts
2.546875
3
import {character} from '../common/character'; import {EventModel} from '../common/eventModel'; import {Faction, FactionsHelper} from './factions'; import {YouthEventsHelper} from './youthEvents'; import {Career} from'./careers'; import {SocialClassesHelper} from './socialClasses'; import {Attribute} from './att...
245dc8353c582392272d0699456ed744bd668aaa
TypeScript
jaquelineramosit/projeto_zenklub_entrega
/src/middlewares/errorHandlerMiddleware.ts
2.578125
3
import { NextFunction, Request, Response } from 'express'; import HttpException from './httpException'; const errorHandler = (err: HttpException, req: Request, res: Response, next: NextFunction) => { interface ErrorHandler { status: number, message: string } const error: ErrorHandler = { ...
e6b2871a9912fb58db259aacee3271e689657b9a
TypeScript
julia-vscode/julia-vscode
/src/notebook/helpers.ts
3.09375
3
import { NotebookDocument, workspace, WorkspaceEdit } from 'vscode' /** * Use this to perform updates on all cells. * We cannot update cells in parallel, this could result in data loss. * E.g. assume we update execution order, while that's going on, assume we update the output (as output comes back from jupyter). ...
55b02008eb48f5b0c31ae84f023ca7577dd44965
TypeScript
yuanhjty/code-template-tool
/src/utils/path.ts
2.6875
3
import { statSync } from 'fs'; import { dirname, resolve } from 'path'; import { homedir } from 'os'; import { workspace, window } from 'vscode'; import { pipe } from './function'; function parseDirPath(filePath: string | undefined): string | undefined { if (!filePath) { return undefined; } try { const ...
5ec86e74be107a1ceb25f121d4fc42aaf07bba75
TypeScript
jakemmarsh/react-native-diff-view
/src/tokenize/to_token_trees.ts
2.96875
3
import { IHunk, IChange, Side } from '../types'; import { INode } from './back_to_tree'; import { computeOldLineNumber, computeNewLineNumber } from '../utils'; import { last } from '../utils/diff/util'; // This function mutates `linesOfCode` argument. const applyHunk = (linesOfCode: string[], { newStart, changes }: IH...
0ba8cd87dbb15edca9aec554f057039d8eb87223
TypeScript
bookwormdevelopment/typescript-uml
/src/uml/node.ts
2.765625
3
import { Association } from './association'; import { Stereotype } from './stereotype'; export class Node { private _identifier: string; private _stereotype: Stereotype; public get identifier(): string { return this._identifier; } public set identifier(value: string) { this._identifier = value; }...
d96ba87cfd29b1d0567bebaa7518ad4f2549d207
TypeScript
mwojslaw/new-layout
/src/mixins/withFlex.ts
2.703125
3
import { CSSObject } from 'styled-components'; import { WithTheme } from '../Theme'; import * as CSS from 'csstype'; import { Length, ResponsiveLength, ResponsiveProp, getLengthValueFactory, getBreakpointsFromProps, isResponsiveProp } from '../utils'; export type WithFlexConfig = { flexWrap?: CSS.Property.FlexWrap...
e658b57161d55d17efee1c71cc148428dc05f80b
TypeScript
toketeeman/Ng8-Production-BioLab-FrontEnd
/src/app/dialogs/error-dialog/error-dialog.service.ts
2.625
3
import { Injectable } from '@angular/core'; import { MatDialog, MatDialogConfig } from '@angular/material'; import { ErrorDialogComponent } from './error-dialog.component'; @Injectable({ providedIn: 'root' }) export class ErrorDialogService { constructor(private dialog: MatDialog) { } openDialogForMessages(err...
f48c9e018bc57ccd688ce2ed9e531d878d440093
TypeScript
nicolaspayot/bic
/test/bic.test.ts
3.015625
3
import bic from '../src/index'; describe('bic.isValid', () => { test('Undefined should not be valid as BIC', () => { // @ts-expect-error expect(bic.isValid()).toBe(false); }); test('An empty string should not be valid as BIC', () => { expect(bic.isValid('')).toBe(false); }); ...
25bcf1e17d86e462428c5bf80dd545efa9c03450
TypeScript
GeorgDV/turbulenz_engine
/apps/multiworm/tsscripts/worm/gamebadges.ts
2.765625
3
// Copyright (c) 2011-2012 Turbulenz Limited /*global TurbulenzEngine: false*/ /*global Badge: false*/ // // GameBadges: Class to manage game badges, and their html elements // class GameBadges { badgesManager: BadgeManager; onInitialization: { (): void; }; unachievedBadges: { [name: string]: Badge; }; ...
6e3fcc41b1640f72d50d140bf04ed4e66dd4b8c0
TypeScript
vladimirdotk/auth-service
/app/src/services/userService.ts
2.546875
3
import url = require('url'); import bcrypt = require('bcrypt'); import { NOT_FOUND } from 'http-status-codes'; import { getRandomName } from './../utils'; import { User, IUser } from './../models/User'; import * as mailService from './../services/mailService'; import { IError } from './../interfaces/error'; interface ...
119dd6c38a4e8fc972129a53db99ceb5dc40ee01
TypeScript
rmalibiran/98labs-api-starter-project
/src/models/user.ts
2.671875
3
import { Sequelize, Model, DataTypes, BuildOptions, } from 'sequelize'; export class User extends Model { public id!: number; public email: string; public password: string; public readonly createdAt!: Date; public readonly updatedAt!: Date; } export type UserRepository = typeof Model & { new (valu...
cd60ea13dafc701ce9cfa7fbf7786862fb2bf8b2
TypeScript
dusanbass/ts-new-test
/Point3D.ts
3.34375
3
import Point2D from "./Point2D"; export default class Point3D extends Point2D { z: number; constructor(x: number = 0, y: number = 0, z: number = 0) { super(x, y); // new Point2D(x, y) this.z = z; }; // overwrite - write over some previously defined method position(): string { // th...
b0ce595b03c869fad21880e81ed55e183031653d
TypeScript
jupyterlab/jupyterlab
/packages/apputils/src/toolbar/registry.ts
2.546875
3
/* * Copyright (c) Jupyter Development Team. * Distributed under the terms of the Modified BSD License. */ import { CommandToolbarButton, LabIcon, Toolbar } from '@jupyterlab/ui-components'; import { CommandRegistry } from '@lumino/commands'; import { Widget } from '@lumino/widgets'; import { IToolbarWidgetRe...
8f74a668ce81eace0c8ce61ff8123b55829c915f
TypeScript
michitaro/gl-wrapper
/src/index_buffer.ts
3.046875
3
import * as glUtils from './utils' export interface DataOption { usage?: number, array: Int16Array, } export class IndexBuffer { private name: WebGLBuffer private usage!: number private _length!: number constructor(readonly gl: WebGLRenderingContext, dataOption?: DataOption) { this.na...
1dc341d9a488fa60ceb42dc4d04c041a808de5b1
TypeScript
Ihor-Kulpekin/social_media_backend
/src/entities/User.ts
2.96875
3
import {Entity as TOEntity, Column, Index, BeforeInsert} from 'typeorm'; import {IsEmail, Length} from 'class-validator'; import BaseEntity from "./Entity"; import {hashPassword} from "../utils/hashPassword"; import { Exclude } from 'class-transformer'; @TOEntity('user') export default class User extends BaseEntity {...
57740c46151d5840c200e0601952a59c3b11e8ab
TypeScript
2284730142/G2Plot
/src/plots/tiny-area/adaptor.ts
2.5625
3
import { isFunction } from '@antv/util'; import { theme, scale } from '../../adaptor/common'; import { Params } from '../../core/adaptor'; import { flow } from '../../utils'; import { DEFAULT_TOOLTIP_OPTIONS } from '../tiny-line/constants'; import { TinyAreaOptions } from './types'; /** * 字段 * @param params */ func...
413921bb520e001d3c159c6f04694e64f38358e1
TypeScript
tommck/hoopy
/postProcessing/HoopHouseProcessor.ts
2.546875
3
import {IStatsProcessor} from './IStatsProcessor'; import {config} from '../config'; import {sendPushbulletNotification} from '../services/pushbullet'; import {ITableEntry} from '../TableEntry'; export class HoopHouseProcessor implements IStatsProcessor { processEntries(hostName: string, entries: ITableEntry[]) {...
eb2928afbc8a220579442fdf7de9c315ee76f862
TypeScript
briggySmalls/late-train-mate
/src/app/national-rail/hsp-details.model.ts
2.75
3
import { List } from 'linqts'; import * as moment from 'moment'; import { HspApiData, Station, TimeOnly, DateOnly } from './shared/hsp-core.model'; import { ResourceService } from './resource.service'; export class StopDetails extends HspApiData { public station: Station; public scheduledDeparture: moment.Moment...
a1e321b5c062e722cb68c01aabc11b5a54856365
TypeScript
42BV/jarb-final-form
/tests/utils.test.ts
2.671875
3
import { mostSpecificInputTypeFor, getFieldConstraintsFor, isRequired, hasFractionLength, hasMaximumLength, hasMinimumLength, hasRadix, hasPattern, hasMin, hasMax, getFieldConstraints } from '../src/utils'; import { Constraints } from '../src/models'; import { setConstraints } from '../src'; test...
f4e1222bdf946c3cc3741bd6911a2ee32e67a06f
TypeScript
superdev0505/angular-billy
/src/features/directives/range-validator.directive.spec.ts
2.515625
3
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Component, OnInit } from '@angular/core'; import { FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms'; import createTestComponent from '@test/create-test-component'; import RangeValidatorDirective from './range-validator.direc...
f1999dff3fbc387d16c2739e641a94c1c1cae873
TypeScript
MusixNotMusic/drawMind
/src/constants/utils.ts
3.390625
3
/** * 下划线转换驼峰 * stroke-line --> strokeLine */ export function lineToCamel(name: string) { return name.replace(/\-(\w)/g, function(all, letter){ return letter.toUpperCase(); }); } /** * 驼峰转换下划线 * strokeLine --> stroke-line */ export function camel2Line(name: string) { return name.replace(/([A-Z]...
e80c48f608a2a26b79705b1395164169b574ba38
TypeScript
bliny/fe-demo
/src/app/base-module/components/multiple-select-with-autocomplete/multiple-select-with-autocomplete.pipe.ts
2.625
3
import { Pipe, PipeTransform } from '@angular/core'; import {PatrolAction} from "../../services/patrol-action.service"; @Pipe({ name: 'autoCompleteNamePipe'}) export class AutoCompleteNamePipe implements PipeTransform { transform(arrayWithNames: Array<any>, nameAutoComplete: string): Array<PatrolAction> { if (!a...
31fc1113eaedbdf1a4fa6ddbf146e2cf81ee1512
TypeScript
LucaScorpion/advent-of-code
/2021/day_8/solution.ts
3.296875
3
import fs from 'fs'; const input = fs.readFileSync(0).toString().trim().split('\n'); const segmentLetters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; interface Entry { patterns: string[]; value: string[]; } function alphabetize(value: string): string { return value.split('').sort().join(''); } const entries: Entr...
06301462e729e770597d6783797524eb5d10f887
TypeScript
kant/varnish
/theme/spacing.ts
2.9375
3
import { convertPixelsToRem, convertRemToPx } from '../utils/base'; export class Spacing { constructor(public displayName: string, public px: string, public rem: string) {} static fromPixels(displayName: string, px: number) { return new Spacing(displayName, `${px}px`, convertPixelsToRem(px)); } ...
f2c122a96ea60c8a9afe97bd37b2dc10986a896a
TypeScript
wmattei/thoughts-infra
/wolke/di/injector.ts
2.65625
3
const Injector = { register: function (name: string, obj: {}) { const t = {} as any; t[name] = obj; Object.assign(this, t); }, getRegistered: function (key: string): any { const that: any = this; return that[key]; }, }; export default Injector;
f66d99888a2f96e0cebfeed4ff89f8c8fab8cb42
TypeScript
kingdom0608/H6-server
/resources/posts.resource.ts
2.875
3
export class PostsResource { private userIndex; private postsCategoryIndex; private title; private content; constructor(postsData) { this.setUserIndex(postsData.userIndex); this.setPostsCategoryIndex(postsData.postsCategoryIndex); this.setTitle(postsData.title); this.setContent(postsData.content); } ge...
b0560114b242f31218321bdbd8a737de6a54c92f
TypeScript
parthraghav/United-Poll
/functions/src/Requests/User.ts
2.609375
3
import * as functions from 'firebase-functions'; import * as admin from 'firebase-admin'; import * as firebaseHelper from 'firebase-functions-helper'; import * as express from 'express'; import * as bodyParser from "body-parser"; const db = admin.firestore(); const app = express(); const main = express(); main.use(b...
87074caf2d920e8c70070533d20a735fdbded462
TypeScript
workgames/otus-react-lessons
/scripts/calc/RPNTransform.ts
2.984375
3
import { mathematicalFormulasFunc, mathOperatorsIds, mathOperatorsPriorities, scalarFunc, trigonomenticFunc, } from './operators'; /** * Класс перевода infix в postfix */ class RPNTransform { /** * * @param val * @returns */ isValid(val: string): boolean { return !isNaN(parseFloat(val))...
098bad7e8d1fcb8c1366cef93eacd30e8db4eaaa
TypeScript
Geass1000/argen
/src/@core/di/entity.di.ts
2.734375
3
import * as _ from 'lodash'; import * as Interfaces from '../interfaces'; import * as Consts from '../consts'; import * as Errors from '../errors'; export class Entity { public readonly className: string = 'DI:Entity'; private reflect: typeof Reflect; /** * `active` status flag. * * @ty...
cdc92977f450da636010dd045fe49e7db068e4a0
TypeScript
JirkaDellOro/SofDesSS2020
/L02_Zufallsgedicht_Kommilitone/main.ts
2.921875
3
let subjects: string[] = ["Hermine", "Ron", "Dumbledore", "Hagrid", "McGonnegal", "Snape"]; let objects: string[] = [" zaubert ", " bekämpft ", " liebt ", " zerstört ", " hasst ", " braut "]; let verbs: string[] = ["Voldemort", "Flittwick", "Sprout", "Malfoy", "Bellatrix", "Zaubertränke"]; let poem: string[] = Array(6...
fb2687f844c2f214cd4d6993f3859804cbc82be7
TypeScript
cancerberoSgx/magica
/apps/node-gtk-tests/src/gobjectTypes.ts
2.90625
3
// /** // * Using public APIs example: // * // ```js // import { equal } from 'assert'; // const nodegtk = require('node-gtk'); // const Gtk = nodegtk.require('Gtk') // const GObject = nodegtk.require('GObject') // nodegtk.startLoop(); // Gtk.init() // const win = new Gtk.Window() // equal(GObject....
92b6f67bf6b118288055c44ac2ebca407cb392f8
TypeScript
thibautRe/othrworld
/packages/app/src/hooks/useEscKeyHandler.ts
3.1875
3
import React from 'react' // Keep track of all event handlers in a global array // Implementation note: an event handler to the document for each item does not work // when using nested items that can be esc-keyed. const _handlers = [] as Array<() => void> // Keep track of if the global event listener is mounted or n...
2e4286b22a65b311ab6649a113c3f801aa6c8f4e
TypeScript
wuzhenquan/thing
/frontend/react-tsx/src/api/index.ts
2.5625
3
// interface RequestInit { // body?: any; // cache?: RequestCache; // credentials?: RequestCredentials; // headers?: HeadersInit; // integrity?: string; // keepalive?: boolean; // method?: string; // mode?: RequestMode; // redirect?: RequestRedirect; // referrer?: string; // referrerPolicy?: Refe...
bff4e8d847468146659ea12035e0a184c5c3a0dc
TypeScript
kiruba48/SKY_TECHTEST
/src/state/reducers/betSlipReducer.ts
2.65625
3
import { ActionType } from '../constants/eventsConstants'; import { BetSlipAction } from '../actions/betSlipInterface'; import { EventOutcomeInterface } from '../actions/outcomeInterfaces'; export const betSlipReducer = ( state: EventOutcomeInterface[] = [], action: BetSlipAction ) => { switch (action.type) { ...
de71997036a280bc1d43ea35f008289dd2fd8496
TypeScript
oppia/oppia
/core/templates/domain/story/story-summary.model.ts
2.515625
3
// Copyright 2018 The Oppia Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by ap...
03ea28ee7886b254682132ae395570f4f2f89454
TypeScript
Arkator7/project_euler
/src/euler034.ts
3.328125
3
import {factorial} from './generic_library'; export function euler034() { let result : number = 0; //409113 = 9! + 8! + ... + 1! for (let i = 10; i <= 409113; i++) { result += checkFactSum(i); } return result; } export function checkFactSum(i: number) : number { let sumOfFacts : number = 0; let ...
d1ce42485c9e14a5e981b118d7323c62198d4ac8
TypeScript
AntonellaM/upplication-coding-test-angular
/src/app/point-card.ts
2.578125
3
import {PointCardDetail} from './point-card-detail'; export class PointCard { private _points: number; private _pointsCard: Array<PointCardDetail>; get points(): number { return this._points; } set points(value: number) { this._points = value; } get pointsCard(): Array<PointCardDetail> { ...
d2c0fd15b5175a124216ed48ac1aace48342b388
TypeScript
yuritopia-net/graph-view
/src/index.ts
3
3
export class GraphView { root: HTMLElement; elements: GraphElement[]; constructor(element: HTMLElement) { this.root = element; this.elements = []; } addSimpleElement(title: string, body: string) { const elm = GraphElement.createSimpleElement(title, body); this.elements.push(elm); this.r...
0bf3e914268997d146797483c4e812e003891325
TypeScript
pmndrs/jotai
/src/vanilla/utils/atomFamily.ts
3.21875
3
import type { Atom } from '../../vanilla.ts' type ShouldRemove<Param> = (createdAt: number, param: Param) => boolean export interface AtomFamily<Param, AtomType> { (param: Param): AtomType remove(param: Param): void setShouldRemove(shouldRemove: ShouldRemove<Param> | null): void } export function atomFamily<Pa...
357a4d24396568aded089ef53bfb970cbe7b917d
TypeScript
green-fox-academy/feketeakos23
/week-03/day-03/animal.ts
3.5
4
'use strict'; class Animal { hunger: number; thirst: number; constructor(hunger: number = 50, thirst: number = 50) { this.hunger = hunger; this.thirst = thirst; } public eat(): number { return this.hunger = this.hunger - 1; } public drink(): number { return ...
aac941b5a73c7b9ff1bc1eb1f931e3eb5a6df520
TypeScript
jonasoesch/morphingchart
/Drawable.ts
2.6875
3
export interface Drawable { name:string // It's presumed that there is an element in the HTML with an id of name draw():void drawScene():void drawCharacters():void hide():void hideCharacters():void }
373a585d8fe621ee7cb5c692109c3749eed7818f
TypeScript
robt1019/algorithms-etc.-
/binary-search.ts
4.03125
4
class TreeNode { data: number; left: TreeNode; right: TreeNode; constructor(data: number) { this.data = data; } } function insert(node: TreeNode, data: number) { if (data <= node.data) { if (node.left) { insert(node.left, data); } else { node.left = new TreeNode(data); } } el...
2bfba5577faff6ad0c40614dfcb00054d4c7d611
TypeScript
huangyuer/tsTest
/src/utils/sClickOutside.ts
2.671875
3
const on = (element, event, handler)=> { if (element && event && handler) { element.addEventListener(event, handler, false); } }; const off = (element, event, handler)=> { if (element && event && handler) { element.removeEventListener(event, handler, false); } }; let elem: any = null; ...
99e5892633bdb01e36d7f06b1b2d8a6242efb1de
TypeScript
dbz-tribute-reforged/dbz-tribute-reforged
/src/Core/SagaSystem/Sagas/SagaBuuGroup.ts
2.5625
3
import { AdvancedSaga } from "./AdvancedSaga"; import { Saga } from "./BaseSaga"; import { SagaHelper } from "../SagaHelper"; import { Constants } from "Common/Constants"; export class BabidiSaga extends AdvancedSaga implements Saga { name: string = '[DBZ] Babidi Saga'; protected dabura: unit | undefined; prote...
f698f5c93b9c8558d64358bb2aa16bb189497108
TypeScript
sravyaysk/Type-script-calculator
/calc.ts
3.375
3
class Calculate{ calculate(buttonobj,dispobj,current){ var value=buttonobj.value; if(value=='=') { current = eval(current); } else if(value=='C') { current='0'; } else{ if(current=='0'){ current=value; } else{ current+=value...
f290a96b44f6de74ad95269fae7cc5506143a311
TypeScript
sergeysova/sova.dev
/src/data/forem.ts
2.546875
3
import * as t from 'runtypes'; import {cachedFetch} from './server-request'; const foremServices = { 'dev.to': { url: 'https://dev.to', apiKey: import.meta.env.DEVTO_API_KEY, }, 'community.effector': { url: 'https://community.effector.dev', apiKey: import.meta.env.EFFECTOR_COMMUNITY_API_KEY, }, ...
3b1bfec4a1380eafc6909acb00bc3f84a4f726bc
TypeScript
mrsekut/react-hook-form-website
/src/components/codeExamples/v6/useWatchTs.ts
3.125
3
export default `import React from "react"; import { useForm, useWatch } from "react-hook-form"; interface FormInputs { firstName: string; lastName: string; } function FirstNameWatched({ control }: { control: Control<FormInputs> }) { const firstName = useWatch({ control, name: "firstName", // without sup...
d35dbb34b308d97f160a6a93a2f5716f28c292a6
TypeScript
matheusfischer0/matheusfischer-api
/src/modules/shipmentRoutes/services/CreateShipmentRouteService.ts
2.546875
3
import { startOfHour } from 'date-fns'; import { inject, injectable } from 'tsyringe'; import AppError from '@shared/errors/AppError'; import ShipmentRoute from '@modules/shipmentRoutes/infra/typeorm/entities/ShipmentRoute'; import IShipmentRoutesRepository from '../repositories/IShipmentRoutesRepository'; interface...
d4af25570fa97dde00888d200b7c37f24ebfd804
TypeScript
kstdn/react-graph
/example/mock-backend.ts
2.75
3
import { GraphNodeDef } from './..'; let nodes = new Map<string, GraphNodeDef<string>>(); nodes.set('1', new GraphNodeDef('Node 1', '1', ['2', '3', '5'])); nodes.set('2', new GraphNodeDef('Node 2', '2', ['4', '6'])); nodes.set('3', new GraphNodeDef('Node 3', '3', ['2', '4'])); nodes.set('4', new GraphNodeDef('Node 4',...
48565cc1e61bfbc80389453615861208c1684c0a
TypeScript
WaywardGame/tars
/src/core/planning/IPlanner.ts
2.984375
3
/*! * Copyright 2011-2023 Unlok * https://www.unlok.ca * * Credits & Thanks: * https://www.unlok.ca/credits-thanks/ * * Wayward is a copyrighted and licensed work. Modification and/or distribution of any source files is prohibited. If you wish to modify the game in any way, please refer to the modding guide: * ...
226d3d549cfa7153f9861e1fad8b058772f8026e
TypeScript
bwrrp/slimdom.js
/test/NodeType.tests.ts
2.609375
3
import * as slimdom from '../src/index'; describe('NodeType', () => { it('is exposed as constants on the Node constructor', () => { expect(slimdom.Node.ELEMENT_NODE).toBe(1); expect(slimdom.Node.ATTRIBUTE_NODE).toBe(2); expect(slimdom.Node.TEXT_NODE).toBe(3); expect(slimdom.Node.CDATA_SECTION_NODE).toBe(4); ...
048e2f74f9d22d4b9ed8377c3ab4318baba413f0
TypeScript
x3rAx/nuxt-testable
/modules/example/store/__tests__/todos.api.mock.ts
2.71875
3
import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import { ITodo } from '../types'; const $instance = axios.create(); const mock = new MockAdapter($instance); const todos: ITodo[] = [] /** * get todos */ mock.onGet('/todos').reply((config) => { return [200, JSON.stringify(todos)] }) /** ...
9a272fef0dac4d034320e5460bd805981b53f97d
TypeScript
mass10/typescript.note
/code/stacktrace/src/Main.ts
2.765625
3
import { Logger } from './Logger'; namespace Main { function style1(): void { var obj = {}; Error.captureStackTrace(obj); // @ts-ignore console.log(obj?.stack); } export function run(): void { Logger.trace("### start ###"); Logger.trace("%d", 999); Logger.trace("%s >> %s", "aaa", "...
8f130e49bdc7531fdda5567da6bc32dd3d7b8ac7
TypeScript
TheColorRed/phoenix
/src/core/GameObject.ts
2.765625
3
namespace Phoenix { export class GameObject extends Object { private _isActive: boolean = true public sprite: Sprite public tag: string = '' public get isActive(): boolean { return this._isActive } public readonly name: string public constructor(name?: string) { super() this.nam...
d6e618fd6cb1e9453560cccd2e138d1bb7eb5432
TypeScript
martijnvanduijneveldt/picklesdoc-compare
/src/util/jsdiff.util.ts
2.828125
3
import { diffWords, Change } from 'diff'; import { JsonTableDataRow } from '../models/json-table'; import { JsonTableDataRowCompare } from '../compare-models/json-table-compare'; import { Comparable } from '../helper-models/comparable'; import { JsonTestResult } from '../models/json-test-result'; import { DiffEle } fro...
8e7ff8852aead078236d93b42de08eb2438fa1d4
TypeScript
sarahbacha/watson
/server/apis/wa-adapter.ts
2.515625
3
var prompt = require('prompt-sync')(); var conversation = require('watson-developer-cloud/conversation/v1'); export class WatsonAssistantAdapter { private conv; private workspace_id; constructor() { this.conv = new conversation({ username: 'f808e1b8-6041-476a-9314-4d3ae2e026d5', // replace with servic...
000de155706e5406b637137372c1b8480de944d3
TypeScript
noramehesz/timesheet
/timesheet_server/src/models/User.ts
2.734375
3
import mongoose from 'mongoose'; import TimeSheetModel from './Timesheet'; enum UserType { student = 'student', studentClub = 'studentClub', company = 'company', } const UserSchema = new mongoose.Schema({ email: {type: String, required: true}, name: {type: String, required: false}, password: {...
d90160b77ded39857e9c83a0ef26ac6ef8519fcc
TypeScript
anhducc13/react-typescript-boilerplate
/src/helpers/user.ts
2.59375
3
import commonConstants from 'constants/common'; import { userServices } from 'services'; import { IRoute } from 'interfaces'; const { ALL } = commonConstants; const permission = (app: string, resource: string, action?: string) => { return [app, resource, action].filter(x => !!x).join(':'); }; const checkPermission...