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
3c6a28c58a8c611713287911b101dbc6c6d6d565
TypeScript
hollyoops/algorithm
/src/reverseLinkedList.test.ts
4.125
4
/** * * Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL */ interface INode { value: number next?: INode } class NodeList { private first?: INode private tail?: INode get head() { return this.first } addNode(value: number) { const ...
6a6fa5032c89bac1d30b85d7a923c96d16ee345d
TypeScript
Type-Any/WTT
/src/utils/hooks/useMutation.ts
2.765625
3
import {useCallback, useState} from 'react'; export const useMutation = <Req = any, Res = any>( fetcher: (endpoint: string, req?: Req) => Promise<Res>, revalidateFn?: () => void, ): [ excute: (endpoint: string, req: Req) => Promise<Res | undefined>, loading: boolean, error: string | null, ] => { const [loa...
223f3abea2a49a8a64b106889e6585a371fd0fa1
TypeScript
mytlogos/enterprise-lister
/packages/scraper/src/tools.ts
2.890625
3
import { TocEpisode, TocPart, TocContent } from "./externals/types"; /** * Returns true if the value is a TocEpisode. * * @param tocContent value to check */ export function isTocEpisode(tocContent: TocContent): tocContent is TocEpisode { return "url" in tocContent; } /** * Returns true if the value is a TocPa...
71213542501dc3c698488d57f8fd13538469e88e
TypeScript
ryanvanrooyen/csscrape
/Source/httpClient.ts
2.890625
3
import * as urls from 'url'; import { ILogger, NullLogger } from './logging'; import { IHttpTransport, HttpTransport} from './httpTransport'; export interface IHttpClient { get(url: string): Promise<IHttpResponse>; } export interface IHttpResponse { url: string, data: string } export class HttpClient implemen...
dc8422866e76ecab7e09fb4961cdbb79fae05104
TypeScript
leandrogr/chat-api
/src/users/dto/create-user.dto.ts
2.65625
3
import { IsEmail, IsNotEmpty, Matches } from 'class-validator'; import { RegExHelper } from 'src/helpers/regex.helper'; import { MessagesHelper } from 'src/helpers/messages.helper'; export class CreateUserDto { @IsNotEmpty() name: string; @IsNotEmpty() @IsEmail() email: string; @IsNotEmpty() @Matches(R...
e0b183c3db776f36aa793279c399f0d91f21f1f1
TypeScript
haniot/timeseries
/test/unit/models/user.model.spec.ts
2.84375
3
import { assert } from 'chai' import { User } from '../../../src/application/domain/model/user' describe('Models: User', () => { const userJSON: any = { id: '5a62be07d6f33400146c9b61', type: 'patient' } describe('fromJSON()', () => { context('when the json is correct', () => { ...
7a15e47c2de09840bc97b379480e9d10d1f633e3
TypeScript
JoshuaSkootsky/svelte-ts-electron-forge
/packages/utils/src/fibonacci.ts
3.625
4
export function fibonacci(n: number): number { if (n < 0) { throw new Error('Can\'t compute the fibonacci number of a negative index') } if (n < 2) { return 1 } return fibonacci(n - 1) + fibonacci(n - 2) }
0893eb8f59a6d6d0a8ea53cfc75ff4c7b3032794
TypeScript
zengming00/node-gd-bmp
/src/demo/test.ts
2.53125
3
import * as http from 'http'; import { BMP24 } from '../BMP24'; // gd-bmp import * as font from '../font'; /* 用PCtoLCD2002取字模 行列式扫描,正向取模(高位在前) */ const cnfonts: font.IFont = { // 自定义字模 w: 16, h: 16, fonts: '中国', data: [ [0x01, 0x01, 0x01, 0x01, 0x3F, 0x21, 0x21, 0x21, 0x21, 0x21, 0x3F, 0x21,...
e3c8916f97ed0ffff726b0680b0cb833df2c2db0
TypeScript
terzeron/Angular2Test
/typescript_test/test07.ts
3.421875
3
class MyCar { _numTier: number; _carName: string; constructor(carName: string, numTier: number) { this._carName = carName; this._numTier = numTier; } getCarName(): String { return this._carName; } numTier() { return this._numTier; } } let myCar: MyCar ...
3f0d1ea27c432bf3447ad41f1a7a6115afcbaea6
TypeScript
truenas/webui
/src/app/interfaces/keychain-credential.interface.ts
2.625
3
import { KeychainCredentialType } from 'app/enums/keychain-credential-type.enum'; import { SshCredentials } from 'app/interfaces/ssh-credentials.interface'; export type KeychainCredential = | KeychainSshKeyPair | KeychainSshCredentials; export interface KeychainSshKeyPair { attributes: SshKeyPair; id: number;...
932e96852ab0155dca6577758d30922d70ec9c75
TypeScript
adham-ta/RepoBot
/test/integration/webhook.test.ts
2.578125
3
import Stream from "stream"; import request from "supertest"; import pino from "pino"; import { Probot } from "../../src"; import * as data from "../fixtures/webhook/push.json"; describe("webhooks", () => { let probot: Probot; let output: any; const streamLogsToOutput = new Stream.Writable({ objectMode: true ...
9c3dbb6ff73b6aa7cad93db3d0d62eed9e1beedb
TypeScript
KairuRengu/OpenORPG
/OpenORPG.TypeScriptClient/Game/States/GameplayState.ts
2.6875
3
 module OpenORPG { // The gameplay state manages export class GameplayState extends Phaser.State { private zone: Zone = null; private currenTrack: Phaser.Sound; private ChatManager: ChatManager; private inventoryWindow: InventoryWindow; private characterWindow: Char...
cc7b3d0b911b0ffcb1264b36b072d63c6380783d
TypeScript
usagihana/ducktools
/src/createEventBus.ts
2.8125
3
export function createEventBus(debug = false){ const subscribers = {} // channel => array[callback()] function on(channel, func){ let out = func if(debug){ out = function(rest){ func(rest) console.log(' %cEVENT - '+channel,'color:orange;',JSON.stringify(rest)) } } ...
d2d21c6c1f6154e3539c21fa99a53d465e384e7b
TypeScript
felipeVoid/a-club
/src/app/pipes/file-icon.pipe.ts
2.515625
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'fileIcon' }) export class FileIconPipe implements PipeTransform { transform(type: any): string { try { switch(type.trim().toLowerCase()) { case 'jpg': case 'jpeg': case 'png': case 'svg': case 'ic...
e357ca9526f97154234e47fcdccc75f564b06a4e
TypeScript
MagusM/food-chooser-server
/src/repositories/postgres.ts
2.59375
3
import { ICheckboxFoodOption, IUser } from '../entities/interfaces' import postgresConnection from './dbConfig'; const { Pool } = require('pg'); const pool = new Pool(postgresConnection); export async function getAllFoods() { return pool.query('SELECT * FROM foods') } export async function addNewFood(foodName: ...
9b22b72134b42cc468e856c7399fb6110193ccc6
TypeScript
AlexMunoz/preact-devtools
/src/view/components/profiler/flamegraph/transform/patchTree.ts
2.875
3
import { ID, Tree } from "../../../../store/types"; import { mapChildren, adjustNodesToRight, deepClone } from "./util"; export function patchTree(old: Tree, next: Tree, rootId: ID): Tree { const out: Tree = new Map(old); const oldRoot = old.get(rootId); const root = next.get(rootId)!; if (next.size === 0) { re...
37a167a51de8fbb1ef3f006be8d6c2d3f48169e4
TypeScript
ExcelDurant/helpme_nest_backend
/src/auth/auth.service.ts
2.546875
3
import { Injectable } from '@nestjs/common'; import { UsersService } from '../users/users.service'; import { JwtService } from '@nestjs/jwt'; import { User } from '../users/schemas/user.schema'; import * as bcrypt from 'bcrypt'; @Injectable() export class AuthService { constructor( private usersService: Us...
8686d1baf5940ee0c8afbd7657e5b9e0f597af12
TypeScript
thisissoon-fm/frontend
/src/app/player/store/reducers/current.reducer.ts
2.734375
3
import * as fromCurrent from '../actions/current.action'; import { QueueItem } from '../../../api'; export interface CurrentState { loaded: boolean; loading: boolean; current: QueueItem; } export const initialState: CurrentState = { loaded: false, loading: false, current: null }; const newState = (state,...
06cfbccd2c55924e2d368dcdaa7af97b1e2f5f89
TypeScript
ULL-ESIT-INF-DSI-2021/ull-esit-inf-dsi-20-21-prct08-filesystem-notes-app-Nitro1000
/tests/note.spec.ts
2.765625
3
import 'mocha'; import {expect} from 'chai'; import {Note} from '../src/note'; describe('Test Note', () => { const testNota = new Note('Test Nota', 'Nota prueba', 'Blue'); it('La nota es una intancia de la clase Note', () => { expect(testNota).to.be.instanceOf(Note); }); it('El titulo de la nota es Test ...
22de62d64378502aebde14b8b47b8ae621c43ef0
TypeScript
evilive3000/umbrella
/examples/mandelbrot/src/gradient.ts
2.6875
3
import { TAU } from "@thi.ng/math/api"; import { clamp01 } from "@thi.ng/math/interval"; import { comp } from "@thi.ng/transducers/func/comp"; import { normRange } from "@thi.ng/transducers/iter/norm-range"; import { tuples } from "@thi.ng/transducers/iter/tuples"; import { push } from "@thi.ng/transducers/rfn/push"; i...
025a57bfa82b6a99dcbe310a6a52f6c10193e745
TypeScript
Zeng95/facile-translation-cli
/client/src/utils.ts
2.734375
3
export const truncate = (query: string) => { const len = query.length; if (len <= 20) { return query; } return query.substring(0, 10) + len + query.substring(len - 10, len); };
b41bca4f20468add15af293a97fc1183c0ab80b2
TypeScript
lanemt/definitelytyped.github.io
/types/overload-protection/overload-protection-tests.ts
2.59375
3
import op = require('overload-protection'); const config1: op.ProtectionConfig = { production: true, clientRetrySecs: 2, sampleInterval: 1, maxEventLoopDelay: 40, maxHeapUsedBytes: 25, maxRssBytes: 321, errorPropagationMode: true, logging: console.log, logStatsOnReq: false, }; cons...
01cc4be5e1fb08b4d20874c9b42dd7f57aed40f6
TypeScript
d-o-n-u-t-s/note-editor
/src/utils/TimeCalculator.ts
3.078125
3
import { Fraction, IFraction } from "../math"; import { Measure } from "../objects/Measure"; import { OtherObject } from "../objects/OtherObject"; class BPMChangeData { private readonly unitTime: number; private readonly time: number; private stopTime: number; public readonly bpm: number; public readonly mea...
d18ef532e3c02b6f88f5324b72f814b1b3176d25
TypeScript
mdimai666/vue-quasar-typescript-example
/src/controllers/JobsController.ts
2.71875
3
import { QController, IQBackend_ListRequestParam, ISResponseList } from './QController' import JobItem from 'src/models/JobItem' export interface IRequestJobsListFilter { m_spam?: bool m_link?: bool deleted?: bool dt_actual?: bool } function JobsKindToFilter(kind: EJobsKind): IRequestJobsListFilter {...
ed40c707f5f8e7400530880fa416bcfc190e58eb
TypeScript
CWSpear/discord.ts
/examples/command/discords/simple commands.ts
2.9375
3
import { Discord, SimpleCommand, SimpleCommandMessage, SimpleCommandOption, } from "../../../src/index.js"; import { GuildMember, Role, User } from "discord.js"; @Discord() export abstract class commandTest { @SimpleCommand("race") race(command: SimpleCommandMessage): void { command.message.reply( ...
ba464413a97c59a49b28a20212772c7e33e94f1a
TypeScript
cameronmarlow/microcovid
/src/data/FormatPrecision.ts
3.21875
3
const SIGFIGS = 1 /** * Format points for display - fixed point with a set precision. * This is necessary because float.toPrecision will use exponential notation for large or small numbers. */ export function fixedPointPrecision(val: number | null): string { if (!val) { return '0' } const orderOfMagnitude...
e69fef8d60addb966f3aa30f53cbca418814c8a3
TypeScript
QingqiShi/fier-client
/src/hooks/useFirebaseAuth.ts
2.703125
3
import { auth } from 'firebase/app'; import user from 'stores/user'; import useFirebaseError from 'hooks/useFirebaseError'; function useFirebaseAuth() { const [userState, userActions] = user.useStore(); const handleError = useFirebaseError(); function signUp({ email, password, name, }: { emai...
9439456c1ccaddad04efefba1f5e2f4e22df5ccf
TypeScript
mjeson/IntroToTypeScript
/ExternalModules/Program.ts
2.609375
3
import answers = require("./ExternalAnswers"); class Program { public static Main() { let answer = new answers.ExternalAnswers.TheAnswer(); console.log(answer.state()); } } Program.Main();
b1b90402b8d0957c358a8845916082c6add7b4cf
TypeScript
miikey/mento-fi
/src/utils/addresses.ts
3.03125
3
import { getAddress, isAddress } from '@ethersproject/address' import { logger } from 'src/utils/logger' export function isValidAddress(address: string) { // Need to catch because ethers' isAddress throws in some cases (bad checksum) try { const isValid = address && isAddress(address) return !!isValid } ...
9bfc59cb985dbb62ad49d55798b846b13d9a3920
TypeScript
milg15/noya
/packages/noya-utils/src/__tests__/getIncrementedName.test.ts
2.921875
3
import { getIncrementedName } from '../index'; test('empty Space', () => { expect(getIncrementedName('', [''])).toEqual(' 2'); }); test('one word', () => { expect(getIncrementedName('A', ['A'])).toEqual('A 2'); }); test('one digit number', () => { expect(getIncrementedName('A 5', ['A 5'])).toEqual('A 6'); }); ...
b4156323a82f5a23a5d8dc89c9150fccf220c4a7
TypeScript
ttn1129/VueTypescriptSample
/src/models/MyOption/Prefecture.ts
2.671875
3
import MyOptionInterface from "./MyOptionInterface"; export default class Prefecture implements MyOptionInterface { id: number; name: string; constructor(p__id: number, p__name: string) { this.id = p__id; this.name = p__name; } }
3784f5de4be92097931e1238c64665697c2bf9da
TypeScript
Tibo-lg/iLiving
/app/js/controllers/timedUsageCtrl.ts
2.53125
3
/// <reference path='../_all.ts' /> module iLiving.controllers{ export interface TimedUsageScope{ timeserie: TimeSerie; height: number; width: number; setResolution: Function; resolutionClass: Function; $parent: iLivingScope; } export class TimedUsageCtrl{ private scope: TimedUs...
2774cb7e6bbae620a79c65e527ffb8944ab607d9
TypeScript
prashu18400/angular-ivy-p1ze6f
/src/app/app.component.ts
2.5625
3
import { Component, VERSION } from '@angular/core'; import {Hero} from './hero'; @Component({ selector: 'my-app', template : ` <h1>My name is Prashanth</h1> <p>The hero's birthday is {{ birthday | date }}</p>`, templateUrl: './app.component.html', styleUrls: [ './app.component.css' ] }) export class AppComp...
6ba68f3851a59177792ef2c49dcab559887b9c59
TypeScript
howardyan93/NgNode
/ng2ts/rpc/serialization.ts
2.8125
3
import * as cgi from '../cgi/cgi'; import * as path from 'path'; import * as pathreducer from 'pathreducer'; /** * You must provide a Module Name for the this Serializable decorator. It uses the Module Name to deserialize the object. * @param moduleName */ export function Serializable (moduleName: string) { re...
c6b021c4013050b587f83c7c2611a9e25ea08d78
TypeScript
agg23/mercury-parser
/src/extractors/custom/news.ycombinator.com/index.ts
2.578125
3
import { Comment } from 'extractors/types'; const findCommentParent = (comments: Comment[], indentLevel: number) => { const stack: Array<{ comment: Comment; depth: number }> = comments.map( comment => ({ comment, depth: 0 }) ); while (stack.length > 0) { const { comment, depth } = stack.pop()!; if ...
efb81f5c5b6170c91925dc48aa4ecfade75742ce
TypeScript
SMasiu/GraphJS
/src/labels/value-label.ts
3.296875
3
import { Label } from './label' export class ValueLabel extends Label { values: number[] identifier: 'value' = 'value' constructor( public start: number, public end: number, public step: number, { reverse }: { reverse?: boolean } = {} ) { super() this.reverse = reverse || false thi...
4f8b0759c1c0b9444816eb774e12648331b2a72d
TypeScript
Diogny/adt
/test/graph-directed-create.ts
2.65625
3
import { Edge, WeightedEdge } from "../src/lib/Graph"; import { DirectedEdgeAnalizer, DirectedComponentAnalizer } from "../src/lib/Graph-Directed-Analizers"; import { fromJSON } from "../src/lib/Graph-Utils"; import { dfsAnalysis } from "../src/lib/Graph-Search"; //independent run // node --require ts-node/register --...
72b8b80d0e9422577a903d325c2c0cb39d7226a8
TypeScript
mipli/cabalites
/src/EffectsHandler.ts
3.1875
3
import * as Core from './core'; export interface TintEffect { position: Core.Vector2, color: Core.Color } export class EffectsHandler { private static instance: EffectsHandler; private tints: TintEffect[][]; private count: number; get hasEffects(): boolean { return this.count > 0; } public stati...
d52c4b12fd628430fe6f4361448f10da4eb3394d
TypeScript
cpmsys/vuex-typesafe-class
/test/inheritance.spec.ts
2.6875
3
import "jest"; import Vue from "vue"; import Vuex from "vuex"; interface IAmbient { $test: { test(): any }; } import { createModule, MutationKeys, Mutation, StateMap, StateFactory, useStore } from "../src/index"; Vue.config.productionTip = false; Vue.config.devtools = false; describe("Builder", () => ...
ec24cdf3b6e2e0d0fe24bb05871fced54cef6b8a
TypeScript
concord-consortium/hurricane-model
/src/math-utils.test.ts
2.65625
3
import { latLngPlusVector } from "./math-utils"; import { distanceTo } from "geolocation-utils"; test("latLngPlusVector", () => { const initialPos = {lat: 0, lng: 0}; let newPos = {lat: 0, lng: 20}; const dist1 = distanceTo(initialPos, newPos); let newPosCalculated = latLngPlusVector(initialPos, {u: dist1, v...
274b1b146dad9887aa26f1d81e0530d02a703ade
TypeScript
Mirdoriss/Mirdocsify.github.io
/题题对战/代码/实时服务器/mgobexs/pushHandler.ts
2.546875
3
import { mgobexsInterface } from "./mgobexsInterface"; import { AnsGameData, Player, GameState } from "./msgHandler"; import { Que } from "./Question"; import { calcScore } from "./Util"; export const ANS_TIME = 16500; export const ANS_COUNT = 5; export const ANS_FULL = 200; export interface SerPushMsg { cmd: SER...
085130ca3df8e87cb9d7af79cd766bda34a3480e
TypeScript
ghoullier/zetapush
/packages/common/src/utils/files.ts
2.6875
3
import * as path from 'path'; import * as fs from 'fs'; import * as os from 'os'; export const mkdirs = (file: string) => { let dirs = []; for (let dir of path.parse(file).dir.split(path.sep)) { dirs.push(dir); let dirPath = dirs.join(path.sep); if (dirPath) { fs.existsSync(dirPath) || fs.mkdirSy...
a2be23bcefb47e2d5620d7689ff5521cc11fa146
TypeScript
7Power/taleweaver
/packages/core/lib/key/utils/getKeySignatureFromKeyboardEvent.ts
2.6875
3
import Key from '../Key'; import * as keys from '../keys'; import KeySignature from '../KeySignature'; import ModifierKey from '../ModifierKey'; import { AltKey, CtrlKey, MetaKey, ShiftKey } from '../modifierKeys'; const KEY_STRING_TO_KEY_MAP: { [key: string]: Key } = { 'a': keys.AKey, 'b': keys.BKey, 'c':...
2f5d9007dbfff95f18479913b34a1e7f1ad5c93d
TypeScript
getabetterpic/fly-my-rockets
/apps/fly-my-rockets/src/app/rockets/functions/rocket-photo-ref.spec.ts
2.59375
3
import { rocketPhotoRef, ThumbnailSizes } from './rocket-photo-ref'; describe('rocketPhotoRef', () => { let originalRef; beforeEach(() => { originalRef = 'asdf1234/images/rockets/IMG_1234.jpg'; }); describe('when getting the small ref', () => { it('returns the correct string', () => { const ref...
f29c0a91c855ad90f67b536f913fea82d6bfd412
TypeScript
r00t-101-LoL/replikit
/packages/commands/src/composition.ts
2.53125
3
import { command, CommandBuilder, MiddlewareLike, NormalizeType, TextParameterOptions } from "@replikit/commands"; import { CommandContext, ParameterOptions, Command as CommandInfo, DefaultOptions, CommandResultAsync, Parameters, RestParameterOptions } from "@replikit/com...
7a1c109b901abe3480adfcdb464bb24da7d3a9b1
TypeScript
brynbellomy/fibonacci-trap
/logic-x.d.ts
2.875
3
declare class Event { channel:number; send (): void; sendAfterMilliseconds (ms:number): void; sendAtBeat (beat:number): void; sendAfterBeats (beats:number): void; trace(): void; } declare class Note extends Event { pitch:number; velocity:number; articulationID:number; inStartF...
03c69cf9fc925bba8d6183077e113d961108b780
TypeScript
zimejin/SlagalicaGame
/apps/slagalica-api/src/app/game/multiplayer/state/slagalica.ts
3.03125
3
import { ArraySchema } from '@colyseus/schema'; import { SlagalicaGame } from '@slagalica-api/game/shared'; import { WordModel } from '@slagalica-api/models'; import { GameWinner } from '@slagalica/data'; import { Schema, type } from 'colyseus.js'; class SlagalicaPlayer extends Schema { @type('string') word: strin...
28bc89895f2c14ef8c9c597e040e9a73f5818858
TypeScript
saptam007/Hunger-Truck
/src/main.ts
2.625
3
import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; if (environment.production) { enableProdMode(); } platformBrowserDynamic().bootstrapMod...
19c75cff3fb212ebe551d96556eb241a9c8fbe46
TypeScript
Everpoint/sGis
/source/layers/FeatureLayer.ts
3.078125
3
import {Layer, LayerConstructorParams} from "./Layer"; import {error} from "../utils/utils"; import {Feature} from "../features/Feature"; import {Bbox} from "../Bbox"; import {sGisEvent} from "../EventHandler"; import {Render} from "../renders/Render"; import {StaticImageRender} from "../renders/StaticImageRender"; ex...
c5a95ddb6a34bb5bd68dc80b88c7cea6799aa552
TypeScript
standardnotes/auth
/src/Domain/User/User.spec.ts
2.53125
3
import { User } from './User' describe('User', () => { const createUser = () => new User() it('should indicate if support sessions', () => { const user = createUser() user.version = '004' expect(user.supportsSessions()).toBeTruthy() }) it('should indicate if does not support sessions', () => { ...
05425b23d3beee32d1a788548ce0f175024329eb
TypeScript
codepink/typescript
/notes/2C-typeguard-typeof.ts
3.375
3
// - `typeof로 number, string, boolean, symbol 타입을 찾을 때 타입 가드가 됨 // - 원시 타입에만 사용 가능 function getLast(value: number | string | any[]) { if (typeof value === 'number') { return value % 10; // return value[value.length - 1]; // ERROR } if (typeof value === 'string') { return value.charAt(value.length - 1...
cc93b185c3927c2d566d6436fcd9a87384177bb6
TypeScript
toadius2/Wedding-APP-API-PROJECT
/src/error/notserializeableerror.ts
2.9375
3
import BasicError from "./baseerror" /** * This error class indicates a NotSerializeableError */ export default class NotSerializeableError extends BasicError { type: string; status: number; /** * Constructs a new NotSerializeableError * @param message - The error message */ construc...
ffd68e06f39043fb0cdf55ee1dc4ef203ec9fcd5
TypeScript
marcjmiller/dafcbts
/frontend/src/models/CbtModel.ts
2.53125
3
export class CbtModel { public id: number; public name: string; public description: string; public webAddress: string; public cbtSource: string; constructor(id: number, name: string, description: string, webAddress: string, cbtSource: string) { this.id = id; this.name = name; this.description...
30a6cff312662fe200568205c84516f63ee2d94a
TypeScript
ORCID/orcid-angular
/src/app/shared/pipes/record-holder-roles/record-holder-roles.pipe.spec.ts
2.75
3
import { RecordHolderRolesPipe } from './record-holder-roles.pipe' import { Contributor } from '../../../types' describe('RecordHolderContributionPipe', () => { let pipe: RecordHolderRolesPipe beforeEach(() => { pipe = new RecordHolderRolesPipe() }) it('create an instance', () => { expect(pipe).toBeT...
701555aa5190eb08149e7b0b5e22067a313ac3d3
TypeScript
dmitrolov/dmt2
/src/app/types/adventure/mechanics.ts
3.078125
3
import { Multilanguage } from "../General"; // Категории размеров interface CreatureSizes { value: string; title: Multilanguage; area: number; } export const creatureSize: CreatureSizes[] = [ { value: 'tiny', title: { en: 'Tiny', ru: 'Крошечный' }, ...
da8b3d76209311e261c18345ded8b3f85769e2ea
TypeScript
cq-pandora/projects
/services/bot/src/util/functions/chancesRoll.ts
2.953125
3
import random from './random'; import { RollChances } from '../../common-types'; export default function chancesRoll(chances: RollChances): string { let sum = 0; for (const weight of Object.values(chances)) { sum += weight; } const roll = random(0, sum - 1); let shift = 0; for (const [form, weight] of Obje...
09795ad9e01f922046f28d50fe487f2601259109
TypeScript
orzngo/ghost
/src/entities/layers/LayerManager.ts
2.765625
3
import {Layer} from "./Layer"; export class LayerManager { baseLayer:Layer; managedLayers:Layer[] = []; constructor(public scene:g.Scene, public base:Appendable = scene) { this.baseLayer = new Layer(scene, "LayerManagerBase"); this.base.append(this.baseLayer); } add(name:string, p...
6f3f7d6bd35f8435ae539b15400a847c68fbaacc
TypeScript
Kalashin1/sabiman-backend
/data/validators/validator.ts
2.609375
3
// validating email const isEmail = function (val: string){ return new RegExp(/^[\w]+(\.[\w]+)*@([\w]+\.)+[a-z]{2,7}$/).test(val) } // // validating passwords const isPassword = function(val: string){ return new RegExp(/([a-z]?[A-Z]+[a-z]+[0-9]+)/).test(val) } export { isEmail, isPassword }
4e1b678f974d4b72bfefa5fb25c5b7c196ae22d6
TypeScript
jimjsong/node-red-contrib-differences
/src/differences-node.ts
2.59375
3
/* ========================================================================= Copyright 2020 T-Mobile USA, Inc. 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...
136c81120b96a2c9fcd33e16143f81ea2f8b0370
TypeScript
PlatinBae/plugins
/packages/api/src/lib/structures/api/ApiRequest.ts
2.734375
3
import { IncomingMessage } from 'http'; import type { AuthData } from '../http/Auth'; export class ApiRequest extends IncomingMessage { /** * The query parameters. */ public query: Record<string, string | string[]> = {}; /** * The URI parameters. */ public params: Record<string, string> = {}; /** * Th...
afe6eb91edd0433502fddaefa68eafcbeeef963a
TypeScript
kedrzu/vuvu
/src/formz/model.ts
2.65625
3
import Vue from 'vue'; import * as jsep from 'jsep'; const jsepParse = require('jsep'); interface ModelBase { $errors?: ModelErrors; } export interface ModelError { key: string; message: string; } export interface ModelErrors { [key: string]: string[]; } export function hasErrors<T extends object>(...
7c0eb4b06861bf8cf5a93e0a3355c328fae5fce2
TypeScript
kapturoff/secret-santa-vk
/src/helpers/requestHandlers/roomCreated.ts
2.828125
3
import { ClientInfo, MessageResponse, Room } from 'interfaces' import Markup from 'node-vk-bot-api/lib/markup' export default function roomCreatedHandler(clientInfo: ClientInfo, room: Room): MessageResponse { return { text: `Поздравляю, ты только что создал комнату для проведения "Тайного Санты" 👀 Вот название ко...
055e2a3f41033e99d7b7272204e038fbaa888c3b
TypeScript
sanjevShakya/react-redux-typescript-boilerplate
/src/reducers/data/items/ids.ts
2.765625
3
import * as ItemActions from "../../../actions/data/items"; import * as ItemProps from "./types"; const { FETCH_ITEMS_FULFILLLED, FETCH_ITEMS_REJECTED, SAVE_ITEMS_FULFILLLED } = ItemActions.ACTIONS; const DEFAULT_STATE: ItemProps.IDsProps = []; export default (state = DEFAULT_STATE, action: ItemProps.ActionTyp...
b0860a3bc10414cbef75157b6775dae6be26627e
TypeScript
djudorange/apihive
/packages/apihive/src/components/ErrorResponse/index.ts
2.640625
3
import Base from '../Base'; import { Component } from '..'; import Text from '../Text'; declare global { namespace JSX { interface IntrinsicElements { ERRORRESPONSE: any; //React.PropsWithChildren<Props>; } } } interface ErrorResponseProps { status: number; name: string; appCode?: number; } e...
ff331482528a73af5131d73c368ff6b5c5fe5dc6
TypeScript
mocoolka/mocoolka-function
/src/create.ts
3.078125
3
import setName from './setName'; /** * Create a Function with those param * @param name * @param params * @param functionBody * @return {Function} */ const create = (name:string, params, functionBody:string):Function=> { let temp = new Function(params, functionBody); setName(temp, name); return temp; }; ex...
ed6d1cb24f2a1ec4d45ad94646b27ae89acae3c3
TypeScript
IanPSRocha/2019.1-PretEvent
/front-end/pret-event/src/app/models/event.ts
2.65625
3
export class Event { id: number; title: string; date: string; place: string; points: number; description: string; // tslint:disable-next-line: variable-name url_image: string; // tslint:disable-next-line: variable-name reward_id: number; creator_id: number; constructor(title: string, date: stri...
443fd7095d577c7277b4ae926d7d0c801dea06cd
TypeScript
mmaterowski/raft
/raft-frontend/src/app/servers/circle.ts
2.5625
3
export class Circle { constructor( public x: number, public y: number, public r: number, public color: string, public text: string ) {} }
f7af9757844425008986673a975d78100ae3f2e0
TypeScript
SomtoUgeh/sw-client
/src/components/roots/redux/reducer.ts
2.84375
3
import { ResourceState } from 'models/common'; import { FETCH_ROOT, FETCH_ROOT_FAILURE, FETCH_ROOT_SUCCESS, FetchRootActionType, } from './type'; export interface RootsCompleteInterface { roots: Record<string, unknown>; error: string; status: ResourceState; } const INITIAL_STATE: RootsCompleteInterface ...
41385451bffdee7dde5b27e5c39155f27bab43a3
TypeScript
helospark/helospark-site
/helospark-core-ui/src/app/common/authentication-store/authentication-store.service.ts
2.578125
3
import { Token } from './token'; import { AuthenticationTokens } from './authentication-tokens'; import { Injectable, OnInit } from '@angular/core'; @Injectable() export class AuthenticationStoreService { private thresholdTime:number = 1000; private tokenKey:string = "Authentication-tokens"; private authenticat...
d75ca162ba39af97164095f061afb851caea873f
TypeScript
oracle/nosql-node-sdk
/src/types/param.d.ts
2.703125
3
/*- * Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved. * * Licensed under the Universal Permissive License v 1.0 as shown at * https://oss.oracle.com/licenses/upl/ */ import type { CapacityMode } from "./constants"; import type { PutOpt, DeleteOpt } from "./opt"; import type { SyncPoli...
3e66de513cd176f04b189f2ef02cd99cba984cbf
TypeScript
nklincoln/persona-maps
/src/app/common/persona.spec.ts
2.9375
3
import { Aspect } from './aspect'; import { PersonaAspect } from './persona-aspect'; import { Persona } from './persona'; import * as sinon from 'sinon'; import * as chai from 'chai'; let should = chai.should(); describe('Persona', () => { let myAspect0: Aspect; let myAspect1: Aspect; let myAspect2: Aspe...
827ea9589f967634f6bfe2861b727b4d51a15103
TypeScript
Quramy/copl-ts
/src/structure/traverser.ts
3
3
export interface Tree<Kind extends string = string> { readonly kind: Kind; } export type Select<T extends Tree, Kind extends T["kind"]> = T & { kind: Kind }; export type TraverserCallbackFn<T extends Tree, Context, Result, Kind extends T["kind"]> = ( node: Select<T, Kind>, ctx: Context, next: (node: T, ctx: C...
72350dd2a97af19f228b6dcbd62f90c22b35b73a
TypeScript
naddeoa/systemconf
/src/lib/systemconf-parser-git.ts
2.828125
3
import * as command from "../lib/command"; import * as parseTypes from "../config/parse-types"; import * as parseUtils from "../lib/parse-utils"; function installFn(parseResult: parseTypes.ParseResult): string { return `git clone ${parseResult.tokens[0]} ${parseResult.tokens[1]}`; } function uninstallFn(parseRes...
e3e8bbc9ceb19deefdff1364a394a580935cf542
TypeScript
subzerodeluxe/distanceBox_prototypes
/src/components/countdown/countdown.ts
2.8125
3
import { Component, Input } from '@angular/core'; import { AlertController } from "ionic-angular"; // interface import { ICountdown } from "../i-countdown/i-countdown"; @Component({ selector: 'countdown', templateUrl: 'countdown.html' }) export class CountdownComponent { @Input() timeInSeconds: number; ...
a237cb8ae2bd2260fc8715d528dd1120ad4ef156
TypeScript
huridocs/uwazi
/app/api/authorization.v2/services/AuthorizationService.ts
2.796875
3
import { User } from 'api/users.v2/model/User'; import { PermissionsDataSource } from '../contracts/PermissionsDataSource'; import { UnauthorizedError } from '../errors/UnauthorizedError'; import { EntityPermissions } from '../model/EntityPermissions'; import { Relationship } from 'api/relationships.v2/model/Relationsh...
f89ddd30955405930249c43cdc62e69a6d4479ee
TypeScript
ZhidkovGV/smart-chess
/src/helpers/BoardModel.ts
3.3125
3
import { Bishop, Figure, figureColor, FigureConstructor, King, Knight, Pawn, Queen, Rook } from "./Figures"; import { xor } from "./xor"; interface TeamConfig { pawnsRow: number; bigGuysRow: number; color: figureColor; } const blackConfig: TeamConfig = { pawnsRow: 1, bigGuysRow: 0, color: 'black' } cons...
426d89acdb37a68b36ee42d3023f412b5cba5210
TypeScript
antonyjim/osm
/packages/core/src/lib/log.ts
2.6875
3
/** * /lib/log.ts * Provide core logging features to the site */ // Node Modules // NPM Modules import { debug as rawDebug } from 'debug' // Local Modules import { Querynator, simpleQuery } from './queries' // Constants and global variables class Log { private tableName: string private requiresContext?: boo...
8b00790b9a89aa7ee9aa4868223eba247cb5c942
TypeScript
GobilINC/mirror-graph
/src/graphql/resolvers/CdpResolver.ts
2.5625
3
import { In, MoreThan, Raw } from 'typeorm' import { Resolver, Query, Arg } from 'type-graphql' import { Service } from 'typedi' import { Cdp } from 'graphql/schema' import { CdpService } from 'services' @Service() @Resolver((of) => Cdp) export class CdpResolver { constructor(private readonly cdpService: CdpService)...
e68f1312129d9fd1e1c0d14c829fdb0385880fb1
TypeScript
Mrowa96/account
/src/modules/StoredAccountData/StoredAccountData.ts
2.953125
3
const ACCOUNT_DATA_KEY = 'accountData'; export function store(email: string): void { localStorage.setItem( ACCOUNT_DATA_KEY, btoa( JSON.stringify({ email, }), ), ); } export function get(): { email: string } | undefined { const storedData = localStorage.getItem(ACCOUNT_DATA_KEY);...
43cd9d917a01cf46fabccf15a8e408817540eb7b
TypeScript
MiracleUFO/squares
/src/squares/squares.service.ts
2.75
3
import { Injectable } from '@nestjs/common'; @Injectable() export class SquaresService { getSquare(number: number) { const square = number * number; return square; } getSquareRoot(number: number) { const squareRoot = Math.sqrt(number); return squareRoot; } }
ab81e401ba261398c374b8846f22b85d393fee71
TypeScript
stochi00/WebEng07_Gr11
/UEB2/lab2/app/components/control.boolean.component.ts
2.703125
3
import {Component, Input} from '@angular/core'; import {ControlUnit} from "../model/controlUnit"; import {DatePipe} from "@angular/common"; @Component({ moduleId: module.id, selector: 'control-boolean', templateUrl: '../views/controlboolean.html' }) export class ControlBoolean { @Input() controlunit: ...
859149dad82d3ddee3561f9957c33657934684fe
TypeScript
fabricjs/fabric.js
/src/gradient/parser/misc.ts
2.546875
3
import type { GradientType, GradientUnits } from '../typedefs'; export function parseType(el: SVGGradientElement): GradientType { return el.nodeName === 'linearGradient' || el.nodeName === 'LINEARGRADIENT' ? 'linear' : 'radial'; } export function parseGradientUnits(el: SVGGradientElement): GradientUnits { ...
475c6cdb3234baf52b106f57df717d3b90ddd816
TypeScript
ruisunon/machinat
/packages/auth/src/types.ts
2.625
3
import type { IncomingMessage, ServerResponse, IncomingHttpHeaders, } from 'http'; import type { MachinatUser, MachinatChannel } from '@machinat/core'; import type { RoutingInfo } from '@machinat/http'; import type AuthError from './error'; type TokenBase = { iat: number; exp: number; }; export type AuthPay...
fa04aa92298b927d263ca6f55f0e0f61ba9966a6
TypeScript
nmarsden/fireworks
/src/app/tile-hints.ts
3.015625
3
import { ArrayUtils } from './array-utils'; export class TileHints { includedColours: string[] = []; excludedColours: string[] = []; includedNumbers: number[] = []; excludedNumbers: number[] = []; isSame(tileHints: TileHints): boolean { return ArrayUtils.compareArrays(this.includedColours, tileHints.inc...
6aac7acef46cafd6b18b46efb823ea854a97d035
TypeScript
nicolasxu/learn_ts
/004.object-key-type.ts
3.4375
3
// example 1 let stuff: {[key: string]: string} = {} stuff['a'] = 'hellow' // note: in ES6, key can be a variable in object, just use [] oprator /* e.g.: var obj = { [var1]: 'hello world' // var1 is variable } obj[var1] to access the val of this variable key */ // example 2 export interface I...
81553c304a49e2188e8e3b6f90a6c2064ae59456
TypeScript
kashyaprahul94/smart-home
/Mobile/src/common/networking/models/response.ts
2.6875
3
import { HttpHeaders as Headers } from "@angular/common/http"; export class Response { private _ok: boolean; private _status: number; private _statusText: string; private _data: any; private _headers: Headers; constructor ( ok: boolean = false, status: number = -1, statusText: string = "", headers: Headers = n...
fe3e7f4021aeef7daa6ec281c5e76043301e516a
TypeScript
Gui-dev/gallery-repo
/src/services/photo.ts
2.765625
3
import { deleteObject, getDownloadURL, listAll, ref, uploadBytes } from 'firebase/storage' import { v4 as uuid } from 'uuid' import { firebaseStorage } from './firebase' type PhotoProps = { name: string url: string } export const getAllPhotos = async (): Promise<PhotoProps[]> => { const list: PhotoProps[] = []...
f6069b26eab22a4ddb4e88a086af6081ac08afc2
TypeScript
Somrlik/mad-cows
/src/utils/shutdown.ts
2.609375
3
import logger from './logger'; const BLOCKING_HANDLER_TIMEOUT = 10000; type ImmediateShutdownCallback = (() => (number | void)); type BlockingShutdownCallback = (() => Promise<any>); export let immediateShutdownCallbacks: Set<ImmediateShutdownCallback> = new Set(); export let blockingShutdownHandlers: Set<BlockingSh...
08ffd653636e1988be86b04e8ae024c794519270
TypeScript
antomarsi/malditos-goblins-discordjs
/Goblin/index.ts
3.078125
3
import { getRandomOcupacao, IOcupacao } from './Ocupacao'; import { getRandomColoracao, IColoracao } from './Coloracao'; import { getRandomCaracteristica, ICaracteristica } from './Caracteristica'; import { randomInt } from '../utils/math'; export default class Goblin { public ocupacao: IOcupacao; public coloracao...
090ba97ab3aab83c27a2989c4ee53e5c53b70999
TypeScript
mndrake/doodle-classifier
/frontend/src/store/layout/actions.ts
2.765625
3
import {Action, Dispatch} from "redux"; import {action} from "typesafe-actions"; import {PayloadAction} from "typesafe-actions/dist/types"; import axios from "axios"; import Round from "../../models/Round"; export type TimerAction = | PayloadAction<'TIMER_START', number> | Action<'TIMER_TICK'> | Action<'TI...
256056df7f1802322a2761c09250438d5277d17a
TypeScript
green-fox-academy/heshrian
/foundation w1-5/week-02/day-03/drawing/18 envelopestar/envelopestar.ts
2.65625
3
'use strict'; const canvas = document.querySelector('.main-canvas') as HTMLCanvasElement; const ctx = canvas.getContext('2d') as CanvasRenderingContext2D; export = {} // DO NOT TOUCH THE CODE ABOVE THIS LINE // Fill the canvas with a checkerboard pattern. let length: number = 600 / 2; ctx.beginPath(); ctx.moveTo(...
800b239a7b2c37ab0d3da42c119d0534b52805c0
TypeScript
wesib/generic
/src/shares/shareable.ts
2.890625
3
import { AfterEvent, AfterEvent__symbol, afterValue, EventKeeper, trackValueBy, ValueTracker, } from '@proc7ts/fun-events'; import { noop, valueProvider, valueRecipe } from '@proc7ts/primitives'; import { ComponentContext } from '@wesib/wesib'; import { SharerAware } from './sharer-aware'; const Shareable$...
0f19fe234336fc7f64fbf9ca015fbcfa96cfcc5d
TypeScript
Vittorg3/Fortune-Cookie
/src/domain/entities/phrase.entitie.ts
2.84375
3
export const phrasesContent: string[] = [ 'Motivação é a arte de fazer as pessoas fazerem o que você quer que elas façam porque elas o querem fazer.', 'Toda ação humana, quer se torne positiva ou negativa, precisa depender de motivação.', 'No meio da dificuldade encontra-se a oportunidade.', 'Lute. Acre...
ef9357c0ac5473707db7bcce0b91dd37a7aa1037
TypeScript
green-fox-academy/Adamman48
/week-03/day-02/copy-file.ts
3.296875
3
'use strict'; export{}; // Write a function that copies the contents of a file into another // It should take the filenames as parameters // It should return a boolean that shows if the copy was successful const fs = require('fs'); let copyFrom: string = 'content-to-copy.txt'; let copyTo: string = 'copied-content.tx...
2568eca11328e002eff3101c78e0170bb3995908
TypeScript
jarthursantos/multicast
/packages/shared/web-components/ScheduleCalendar/types.ts
2.546875
3
import { Dispatch, SetStateAction } from 'react' export interface IScheduleCalendarProps { selectedDate: Date setSelectedDate: Dispatch<SetStateAction<Date>> daysWithSchedules: IDayWithSchedule[] } export interface IDayWithSchedule { date: Date state: 'normal' | 'priority' | 'request' }
eb4987bfed820a844ca6fe5acfe09a01ef0f3c14
TypeScript
DreamLarva/js-ts-Algorithms
/算法/排序算法/quickSort.ts
3.890625
4
import { swap } from "./util"; import insertionSort from "./insertionSort"; /** * 快速排序 * 它是一种分而治之的算法,通过递归的方式将数据依次分解为包含较小元素和较大元素的不同子序列。 * 该算法不断重复这个步骤直到所有数据都是有序的。 * 这个算法首先要在列表中选择一个元素作为基准值(pivot)。 * 数据排序围绕基准值进行,将列表中小于基准值的元素移到数组的底部,将大于基准值的元素移到数组的顶部。 * */ export function qSort(list: number[]): number[] { if (list.l...
9aeee7bce0152fcf6a5f0407f8a332994c3d42ef
TypeScript
MalakronikMausi/WebValueCharts
/client/resources/modules/app/services/AuthGuard.service.ts
2.640625
3
/* * @Author: aaronpmishkin * @Date: 2016-08-05 16:07:21 * @Last Modified by: aaronpmishkin * @Last Modified time: 2016-08-30 18:51:30 */ // Import Angular Classes: import { Injectable } from '@angular/core'; import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot } from '@a...
6853f148caf88cd330df8aae30e1a032d0ed171c
TypeScript
MohamedAliHabib/poc-express-graphql
/src/tests/integration/middleware/auth.test.ts
2.640625
3
import request from 'supertest'; import User from '../../../db/models/UserModel'; import server from '../../../app'; import mongoose from 'mongoose'; import TestUtils from '../../testUtils'; const users = [ new User({ name: 'user1', email: 'user1@testing.com', password: 'Test1234!', age: 25, phon...
bb711a147faf92351a86c100999bcee48da404c5
TypeScript
opticdev/optic
/projects/optic/src/utils/id.ts
2.546875
3
export const getEndpointId = (endpoint: { method: string; path: string; }): string => { return `${endpoint.method.toUpperCase()} ${endpoint.path.toLowerCase()}`; };
f53746a8aef424785adb74bb5a5a3cfff1f78132
TypeScript
maxcodefaster/superlogin-next
/src/sessionAdapters/MemoryAdapter.ts
2.875
3
import { SessionAdapter } from '../types/adapters'; export class MemoryAdapter implements SessionAdapter { #keys: Record<string, string>; #expires: Record<string, number>; constructor(config?: any) { this.#keys = {}; this.#expires = {}; console.log('Memory Adapter loaded'); } storeKey(key: strin...