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
92cf237a2e154938719fefdd162d5514dc1ec884
TypeScript
SaffronCode/SaffronCodeJS
/src/framework/pageManager/PageData.ts
2.625
3
export default class PageData{ url:string; pageName:string; component?:React.ComponentClass; pageData:any; pageParams?:string[] constructor(URL:string='',PageName:string='', Component?:React.ComponentClass, PageParams?: string[]) { this.url = URL ; this.pageName = PageName ...
095cb7772d0bf2794e4277204c1902f763dbda41
TypeScript
GoVivant/govivant-sdk
/src/api/addresses.ts
2.5625
3
import ApiClient from '.' import Address from '../models/Address' export default class ApiAddresses { private api: ApiClient constructor(api: ApiClient) { this.api = api } list(customer_id: string, page: number = 1, limit: number = 15) { return this.api.get(`/addresses/${customer_id}...
3bb79f8287df7fe14cfbb3af5d88cb4e1163b1ef
TypeScript
pedromsilvapt/data-collectors
/src/collections/groupingBy.ts
2.84375
3
import { Collector, BaseCollector, Supplier, collect } from "../collector"; import { toArray } from "./toArray"; import { mapping } from "../transformers/mapping"; export interface Mapper<T, U> { ( value : T ) : U; } export class GroupingByCollector<T, K, A, D, M extends Map<K, D>> extends BaseCollector<T, Map<K,...
8c4e171731a14ef60857ede5eea0ecebf6d259bc
TypeScript
robertherber/kingstinct-utils
/src/node/graphql/scalars/Time.ts
2.640625
3
import * as validator from 'is-my-date-valid'; import ScalarFactory from './utils/ScalarFactory'; const validateTime = validator({ format: 'HH:mm:ss' }); const GraphQLTimeScalar = ScalarFactory( 'Time', 'Represents a specific time of day. Format: HH:mm:ss', validateTime, ); export default GraphQLTimeScalar;
91987d247b2fab8d7c5f9b8d6d34f345adc7483c
TypeScript
sourcegraph/sourcegraph
/client/shared/src/util/rxjs/throttleTimeWindow.test.ts
2.828125
3
import { of } from 'rxjs' import { mergeMap } from 'rxjs/operators' import { TestScheduler } from 'rxjs/testing' import { throttleTimeWindow } from './throttleTimeWindow' const scheduler = (): TestScheduler => new TestScheduler((a, b) => expect(a).toEqual(b)) describe('throttleTimeWindow', () => { test('emit the...
30d0a44519727511a8b50038bad53df61eede630
TypeScript
ChaoSun02/WFE-1-Final-project-skeleton
/src/app/models/mine-mines.ts
2.75
3
export class MineMines { constructor( private Name: string, // this is the level name private X: number, private Y: number, private id: string = null ) { } public getLevelName():string { return this.Name; } public getX() : number { return this.X; } public...
6c5d1656bdd525fdbb10b461858582cf53b21883
TypeScript
RiinaVi/yalantis-node-test
/src/utils/deleteImageById.ts
2.5625
3
import fs from 'fs'; import path from 'path'; import { IMAGES_DIRECTORY } from './constants'; const deleteImageById = (id: string) => { fs.readdirSync(IMAGES_DIRECTORY).find((file) => { if (file.includes(id)) { fs.unlinkSync(path.join(IMAGES_DIRECTORY, file)); } }); }; export default deleteImageByI...
a6532723ad9d4103e6124b217b5e59e643dfeccb
TypeScript
pppguru/MEAN-learning
/cgi-she-exam-app/src/app/model/exam/CategoryScore.ts
2.703125
3
export class CategoryScore { constructor() {} public name: string; public id: string; get data(): any[] { return [this.correct, this.total - this.correct]; } public correct: number; public total: number; get percent(): string { if (this.total === 0) return '...
baa165aa58b168d288f8460627a65ec94983322c
TypeScript
meganetaaan/alife
/src/life-game/index.ts
3.34375
3
const HEIGHT = 50; const WIDTH = 50; class Matrix { #matrix: Uint8Array; #height: number; #width: number; constructor({ height, width }: { height: number; width: number }) { this.#matrix = new Uint8Array(height * width); this.#height = height; this.#width = width; } get(top: number, left: numbe...
9ec26bf1480d43077ef35e58d665a485be9447d0
TypeScript
bagbag/tstdl
/base/source/collections/observable/observable-sorted-array-list.ts
3.125
3
import { binarySearch, binarySearchFirst, binarySearchFirstIndexEqualOrLarger, binarySearchInsertionIndex, binarySearchLast, binarySearchLastIndexEqualOrSmaller } from '#/utils/binary-search.js'; import { compareByValue } from '#/utils/comparison.js'; import type { Comparator } from '#/utils/sort.js'; import { isDefine...
e56de0cf6e584925b16f2a7eb886f34257f0214c
TypeScript
Luobata/simply-chart
/src/lib/Vector.ts
3.65625
4
/** * @description Vector */ import { IPoint } from '@/lib/interface'; /** * default class Vector */ export default class Vector { public vector: IPoint; public value: number; // 向量长度 constructor(vector: IPoint) { this.vector = vector; this.value = this.getValue(this); } // 向量...
7b8fc784531dfc18b3a2f6e514f9c9621759f621
TypeScript
jonasalessi/coding-challenge-backend-c
/test/units/FuzzyText.test.ts
3
3
import { expect } from 'chai'; import { describe } from 'mocha'; import { FuzzyVector, SearchCityFuzzy } from '../../src/types/Fuzzy'; import { City } from '../../src/types/City'; import FuzzyResolver from '../../src/services/search/FuzzyResolver'; import FuzzyCityIndexer from '../../src/services/search/FuzzyCityIndexe...
9bdca02bc90e502c1e97268de5b6796f79e87cfc
TypeScript
MacKentoch/react-bootstrap-webpack-starter
/front/src/contexts/withDevTools/index.ts
2.921875
3
// #region types export type DevToolsMessageType = 'DISPATCH' | string; export type DevToolsMessagePayload = { type?: string; state?: any; }; export type DevToolsMessage = { type?: DevToolsMessageType; payload?: DevToolsMessagePayload; }; export type DevTools = { init: () => void; connect: () => any; s...
1970a2801e80a444156912a030ba4ccfec79b7bc
TypeScript
DianaJT/second-largest-v2
/src/algorithmA.ts
3.15625
3
function secondLargest(numberArray: number[]) { if (numberArray.length < 2) return null; let numberA: number; let numberB: number; if (numberArray[0] > numberArray[1]) { [numberA, numberB] = numberArray; } else { [numberB, numberA] = numberArray; } for (let i = 2; i < numberArray.le...
074db44756ac40476de4eafcbfea14e2169ab9d2
TypeScript
mosaicnetworks/evm-lite-cli
/src/commands/accounts-update.ts
2.640625
3
import * as fs from 'fs'; import Inquirer from 'inquirer'; import Vorpal from 'vorpal'; import utils from 'evm-lite-utils'; import Session from '../core/Session'; import Command, { Arguments, Options } from '../core/Command'; type Opts = Options & { old: string; new: string; }; type Args = Arguments<Opts> & { ...
408acefa44ed8d2cf51913e7d428a0f69309a377
TypeScript
shafiqabedin/RsnaDemo-master
/app/directives/vis.text.directive.ts
2.578125
3
/** * @TO DO * * Copyright (c) 2016, acme and/or its affiliates. All rights reserved. * * @author Shafiq Abedin (sabedin@us.acme.com) * @version 1.0 * @since 2016-9-1 */ import { Directive, Input, Renderer, ElementRef } from "@angular/core"; import { TextVisualizationDataModel } from '../models/text-visuali...
461aa8d269c3dd98dfa8eb6ccf1d2aa4985030fb
TypeScript
AjaiGuvaliour/doodle-chart-app
/client/app/helpers/password-match.validation.ts
2.703125
3
import { AbstractControl } from '@angular/forms'; export const mustMatchPassword = (controlName: string, matchingControlName: string) => { return (control: AbstractControl): { mismatch: boolean } | null => { const input = control.get(controlName); const matchingInput = control.get(matchingControlNa...
985ec6004ce32375e8ad1086790feeabb39fbeb6
TypeScript
ZdravkoKirilov/rademono
/apps/clients/projects/ui/src/lib/helpers/OnChange.ts
2.734375
3
import { Dictionary } from '@end/global'; export interface PropChange<T> { firstChange: boolean; previousValue: T; currentValue: T; isFirstChange: () => boolean; } export function OnChange<T, Self>( callback: (value: T, self: Self, simpleChange?: PropChange<T>) => void, ) { let _cachedValue: T; let _isF...
6fa318d1688a036ebf7dffd29c57068b81bb818a
TypeScript
ca0v/html-playground
/collage/fun/getImageResolution.ts
2.671875
3
export function getImageResolution(image: HTMLImageElement) { let style = getComputedStyle(image); let w = parseFloat(style.width); let h = parseFloat(style.height); let isPortrait = h > w; // 512 is the maximum width/height of the placeholder image let scale = (isPortrait ? h : w) / 512.0; let rect = ima...
6902a95b84d24c324a70663ac2a3bb6577a6c057
TypeScript
unbyte/deno-xml-parser
/parser.ts
2.6875
3
import { matchAttrs, MatchedFragment, matchFragments } from './regexp.ts' import { reflectValue, removeNamespace } from './utils.ts' import { Node } from './xml.ts' export interface Options { // skip parsing some tags, default to false (comparison of tag names is after removing namespace if ignoreNamespace) ignore...
243633740c6d82327e54acfaddc9de8831ea4e5a
TypeScript
laolarou726/larou-azure-devops-status
/src/helper/randomHelper.ts
3.5
4
export default class RandomHelper { public static randomSample<T>(arr: T[]): T | null { if (arr.length === 0) { return null; } return arr[this.randomNumber(0, arr.length)]; } public static randomSamples<T>(arr: T[], count: number): T[] { const result: T[] = []; ...
97ee7948bcf06a10ed3dfc5d017dc2f4d176a6cc
TypeScript
cejaramillof/ts-data-structures-and-design-patterns
/patterns/structural/proxy/ServerProxy.ts
2.6875
3
import { IServer } from "./IServer" import { Server } from "./Server" export class ServerProxy implements IServer { private server: Server; constructor(public serverUrl: string) { this.server = new Server(serverUrl) } isUserLogged(): boolean { return Math.round(Math.random()) === 1 } triggerPeti...
f3fc09bd21a11a23c24c70b4a004b92d7a760ec0
TypeScript
magsouza/formation
/formation-common/musica.ts
2.578125
3
import { Usuario } from './usuario'; export class Musica { titulo: string; artista: string; integrantes: String []; usuariosInteressados: Usuario[]; constructor() { this.titulo = ""; this.artista = ""; this.integrantes = []; this.usuariosInteressados = []; } clea...
d3836c0e414cdb163151007ed5cb727918398acb
TypeScript
trueutkarsh/WookiesMovieApp
/data/Data.ts
2.59375
3
const BASE_URL = "https://wookie.codesubmit.io"; export function getMovies() { let URL = BASE_URL + "/movies" let headers = new Headers(); headers.append("Authorization", "Bearer Wookie2019"); return fetch(URL, { method: 'GET', headers: headers }) .then(response => response...
1a6f23e4d247bafad561fada69ec498107b974c5
TypeScript
xuxicheta/swagger-interface-generator
/src/tools/dash-to-camel.ts
2.78125
3
export function dashToCamel(str: string|undefined): string { return str ? str .replace(/(-[a-z])/g, $1 => $1.toUpperCase().replace('-', '')) .replace(/^[a-z]/, s => s.toUpperCase()) : ''; }
81b0e9cc74863301f5ac9852c9838fd7e12e232a
TypeScript
SergioMorchon/fitbit-sdk-types
/types/device/exercise.d.ts
2.515625
3
declare module 'exercise' { export interface ExerciseStats { readonly activeTime: number; readonly calories: number; readonly distance: number; readonly elevationGain: number; readonly heartRate: { readonly current: number; readonly max: number; readonly average: number; }; readonly pace: { r...
1fac98e1fa24c89499d7934352290c352b4fe242
TypeScript
ReactiveX/IxJS
/src/asynciterable/operators/buffer.ts
3.453125
3
import { AsyncIterableX } from '../asynciterablex'; import { OperatorAsyncFunction } from '../../interfaces'; import { wrapWithAbort } from './withabort'; import { throwIfAborted } from '../../aborterror'; export class BufferAsyncIterable<TSource> extends AsyncIterableX<TSource[]> { private _source: AsyncIterable<TS...
84bca575920d1e9ab7b34b01951cb6e86ced89cc
TypeScript
qizhenshuai/nestjs-starter
/src/modules/users/dto/create-user.dto.ts
2.6875
3
import { IsString, IsEmail, IsNotEmpty, Matches, MinLength, MaxLength, IsOptional, ValidateNested, IsArray } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; import { Type } from 'class-transformer'; import { IsUsernameAlreadyExist, IsEmailAlreadyExist } from '../../../common/validators'; import ...
c9038c207b7c36c1597652c4245a8d9fe6141757
TypeScript
sooty1892/minesweeper_solver
/app/minesweeper.ts
2.96875
3
export interface Minesweeper { initiate(level: Level): void; markAsBomb(square: Square): void; open(square: Square): void; board(): Promise<string[][]>; hasFinished(): boolean; } export interface Square { hCoor: number; wCoor: number; } export interface Level { url: string; height:...
c6f11996e6c6e17580e60f7768b868a69e387de3
TypeScript
drleq/CppUnitTestFramework
/vscode-cpputf-test-adapter/src/CppUnitTestFramework/DisposableSet.ts
2.671875
3
import * as vscode from 'vscode'; export class DisposableSet implements vscode.Disposable { private readonly _set = new Set<vscode.Disposable>(); public add(disposable: vscode.Disposable) { this._set.add(disposable); } public remove(disposable: vscode.Disposable) { this._set.delete(di...
54279f8d54f687cdcd340e74a93865cd4fc81a7e
TypeScript
it-and-services/state-store
/projects/ngx-state-store/src/lib/state/state-context.ts
3.546875
4
export interface StateContext<S> { /** * Get the current state. */ getState(): S; /** * Reset the state to a new value. */ setState(state: S); /** * Patch the existing state with the provided value. */ patchState(val: Partial<S>); }
370ef081c8f67bda9aa5a66f2c13d86cb5e6e149
TypeScript
sfia-andreidaniel/wysiwyg-canvas
/UndoManager.ts
2.734375
3
class UndoManager extends Events { public viewport: Viewport; public entries: UndoEntry[] = []; public index: number = 0; public maxUndoLevels: number = 100; private locked: boolean = false; private prevOp: string = null; constructor ( viewport: Viewport ) { super(); this.viewport = viewport; } publ...
415059c7969f5901b67e9b134cc6ce2f69c0ba71
TypeScript
waspeer/galassasa-website
/sanity/lib/data-types/date.ts
3.09375
3
import type { DataType, ValidatorFunction, Validator } from './common'; export interface DateValidator extends Validator<DateValidator> { /** * Maximum date (inclusive). maxDate should be in ISO 8601 format. */ max(minDate: string | number | Date): DateValidator; /** * Minimum date (inclusive). minDate...
7a7e48c90bbc36a5916e50594d75a7865831673e
TypeScript
NikitaGlukhi/angular-add-remove-dynamic-components
/src/app/dynamic-components/dynamic.component.ts
2.515625
3
import { Component } from '@angular/core'; export interface myInterface { removeComponent(index: number); } @Component({ templateUrl: './dynamic.component.html' }) export class DynamicComponent { public index: number; public selfRef: DynamicComponent; public compInteraction: myInterface; constructor() ...
7c231aad3861b34ccda2d45e9c46c04444bf6248
TypeScript
aleagustin/pillsbox-server
/src/controllers/medicine.controller.ts
2.609375
3
import { Request, Response} from 'express'; import { medicineDao } from '../dao/medicine.dao'; import { Medicine } from '../models/medicine.model'; class MedicineController { /** * Verificar las credenciales del usuario (email, contrasaña). * Si las credenciales son válidas, se devuelve el token gener...
b8e424b139387b243fc159579d6cd5131c862586
TypeScript
bl458/musicians-backend
/src/dto/dto.user.piano.session.ts
2.515625
3
import { IsNotEmpty, IsEmail, MaxLength, Length } from 'class-validator'; export class CreatePianoUserSessionDto { @IsNotEmpty() @IsEmail() @MaxLength(254) readonly email: string; @IsNotEmpty() @Length(8, 25) readonly pw: string; }
3fcf15bc1eef1cb91c87e73a55bee41e38ef8c4d
TypeScript
Rhadow/nature_of_code
/src/experiments/vehicle.ts
2.828125
3
import * as numjs from 'numjs'; import { ICanvasState } from '../components/Canvas/CanvasInterfaces'; import { ICreature, IEnvironment } from "../elements/ElementInterface"; import { width, height } from '../constants/world'; import Vehicle from '../elements/Vehicle'; import Path from '../elements/Path'; import FlowFie...
4ed245f3bd282a8e836e72f448678481f7036c92
TypeScript
jeanmolossi/fuse-dev-courses
/src/validation/validators/required-field/required-field.ts
2.609375
3
import { RequiredFieldError } from '@/validation/errors'; import { FieldValidation } from '@/validation/protocols/field-validation'; export class RequiredFieldValidation implements FieldValidation { constructor(readonly fieldName: string) {} validate(fieldValue: string): Error { return fieldValue ? null : new...
05a9a460373ab1fceccb4b84da29129c6191fb5c
TypeScript
tayduivn/SchoolSquirrel
/SchoolSquirrel/src/app/_resources/file-types.ts
2.609375
3
export const documentFileTypes = { text: ["docx", "doc", "txt", "rtf", "odt"], spreadsheet: ["xlsx", "xls", "ods"], presentation: ["pptx", "ppt", "odp"], }; export const fileTypes = { document: [], image: ["jpg", "jpeg", "png", "tif", "svg", "gif", "bmp"], video: ["mp4", "avi", "mov"],...
0c6469a450d6664d744a7d3a3b254224a4269ce8
TypeScript
mvs24/Prisma-Apollo-InstaClone
/apolloServer/resolvers/Mutation/User/User.ts
2.703125
3
import crypto from "crypto"; import bcrypt from "bcryptjs"; import jwt from "jsonwebtoken"; import { Signup, Login, ResetPassword } from "./types"; import { Context } from "./types"; import Email from "../../../../utils/Email"; const signToken: (id: string) => string = (userId) => { if (!process.env.JWT_SECRET) thro...
ebe4bb0d3a08d1ce59d04b11fb3fc262c62fad60
TypeScript
quik-link/core
/ts/objects/Link.ts
2.5625
3
/** * Elijah Cobb * elijah@elijahcobb.com * elijahcobb.com * github.com/elijahjcobb */ import {SiObject} from "@element-ts/silicon"; import {Visit} from "./Visit"; import {HObject} from "@element-ts/hydrogen"; export interface LinkProps { url: string; userId: string; name: string; } export class Link extends...
7d5c6c0cb1118828f9986ed52057b469d8fc6bb3
TypeScript
nikhilknoldus/comp-interaction-interceptor
/src/app/my-http-interceptor.ts
2.625
3
import { Injectable, Injector } from '@angular/core'; import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; import { catchError } from 'rxjs/operators'; import { tap } from 'rxjs/operators'; @Injectable() export class MyHttpInterc...
d040a13b2609b9bb96bad5c7cd2ccb8e9c993304
TypeScript
guo-haozhong/RN_ts_example
/src/redux/actions/LoginAction.ts
2.578125
3
import * as actionType from '../actionsTypes/index' export function login(name:string, psw:string) { // console.log(name, psw); return (dispatch:any) => { //登录中 dispatch(logining()) fetch('https://www.baidu.com/', {method:'get'}) .then(res => { dispatch(login...
16ccc9f23b4c00b0474179407f91c273ab10351c
TypeScript
ShawnStewart/admin-bro-sequelize
/src/models/User.ts
3.15625
3
import { Association, DataTypes, HasManyAddAssociationMixin, HasManyAddAssociationsMixin, HasManyCountAssociationsMixin, HasManyCreateAssociationMixin, HasManyGetAssociationsMixin, HasManyHasAssociationMixin, HasManyHasAssociationsMixin, HasManyRemoveAssociationMixin, HasMany...
54afe0fdf689def9b51b2958e7374e842548dbbc
TypeScript
eguneys/cchheess
/src/isequal.ts
3.515625
4
type Within<A> = A[] type Literal<A> = A type Star = "*" type Matcher<A> = Within<A> | Literal<A> | Star type MapMatcher<A> = { [K in keyof A]: Matcher<A[K]> } export type Query<A> = MapMatcher<A> | Star export function mapmatch<A>(a: A, m: Query<A>): boolean { if (m === '*') { return true; } else if (Ar...
7b630cdfcd37d91196afe6afe7803bcca7149a79
TypeScript
superdesk/superdesk-planning
/e2e/cypress/support/planning/events/linkInput.ts
2.84375
3
import {Input} from '../../common/inputs'; /** * Wrapper class for Superdesk Event's website link input * @extends Input */ export class LinkInput extends Input { /** * Returns the dom node for the ADD button * @returns {Cypress.Chainable<JQuery<HTMLElement>>} */ get addButton() { ret...
eaab491fc0d8c2f446c88090efb6bd1795aeef5a
TypeScript
yagoananias/typescript-course
/scripts/interface_readonly.ts
2.765625
3
interface ICurso { readonly titulo: string; descricao?: string; preco: number; cargaHoraria: number; classificacao: number; } const curso: ICurso = { titulo: "Typescript", preco: 5000, cargaHoraria: 10, classificacao: 5 } curso.titulo = "Php 8"
3a25c98aeca496ba6811c1bd7e62add5ec884f1d
TypeScript
grlgmrs/DevChallenge
/music-library-page-react/src/services/api.ts
2.671875
3
import playlistData from "./playlists.json"; import profileViewData from "./profile_views.json"; import trackData from "./tracks.json"; export interface Playlist { image: string; title: string; trackCount: number; } export interface ProfileView { image: { path: string; anchor: { x: number; ...
603e6de361f6aa8291a234f726087ff269f5741d
TypeScript
dizco/LOG3900
/serveur/test/websockets/websocket-rooms.test.ts
2.625
3
import { Room } from "../../src/websockets/room"; import { WebSocketDecorator } from "../../src/decorators/websocket-decorator"; import { expect } from "chai"; import * as sinon from "sinon"; import { SinonSandbox } from "sinon"; import { FakeWebSocket } from "./fake-websocket"; describe("rooms", function() { desc...
33c4977cc1cf8a39911ab0f9cb51a3b9827f19be
TypeScript
ludative/paybook
/client/src/utils/generateUniqueString.ts
2.96875
3
const generateUniqueString = ():string => { const ts:string = String(new Date().getTime()) let out:string = ''; for (let i = 0; i < ts.length; i += 2) { out += Number(ts.substr(i, 2)).toString(36); } return out; } export default generateUniqueString;
f0bfcff7d4c5a8e464a47efb0b286d9be6d323d5
TypeScript
koddsson/island.is
/.github/actions/detection.ts
2.796875
3
import { ActionsListWorkflowRunsForRepoResponseData } from '@octokit/types' const getSuccessWorkflowsForBranch = ( response: ActionsListWorkflowRunsForRepoResponseData, ) => { return response.workflow_runs .map((wr) => ({ run_number: wr.run_number, sha: wr.head_sha, branch: wr.head_branch, ...
c0debdccf228358f45bcf0b4fa88a0f32111df62
TypeScript
nest-don/veu3-examples-ts
/src/pages/vuejs.org-examples/git-commits/helpers.ts
2.734375
3
export function truncate(v: string): string { const newline = v.indexOf("\n"); return newline > 0 ? v.slice(0, newline) : v; } export function formatDate(v: string): string { return v.replace(/T|Z/g, " "); }
5f60338c5fc032622c4d1008e7100a22b0097b55
TypeScript
Belphemur/condo-seacher
/server/business/action/pushbullet/PushbulletAction.ts
2.546875
3
import { ISearchKeyword } from '@business/search/SearchKeyword' import { IAd } from '@business/search/provider/IProvider' import { ISearchService } from '@services/searches/SearchService' import { IActionExecutor } from '@business/action/IActionExecutor' export class PushbulletAction<T extends ISearchKeyword> implemen...
bf87e4b97171e429a23f68d1af6ba60526e5090e
TypeScript
albertivini/api-blog-ts
/src/useCases/UpdateUser/UpdateUserController.ts
2.640625
3
import { Request, Response } from "express" import { UpdateUserUseCase } from "./UpdateUserUseCase" export class UpdateUserController { async handle(req: Request, res: Response) { try { const id = req.userId const token = req.headers.authorization.split(' ')[1] co...
11f814389166d35351749f1abcd05d7405e8e884
TypeScript
ukon1990/wow-auction-helper
/api/src/utils/pet.util.spec.ts
2.546875
3
import {PetUtil} from './pet.util'; import {Pet} from '../shared/models'; describe('PetUtil', () => { describe('getPet', () => { it('can get valid id', async () => { const id = 39; const pet: Pet = await PetUtil.getPet(id); expect(pet.speciesId).toBe(id); // Is now a string: expect(pet.pe...
358db2f18ce8f25e27132b8ff17b0fa96b54ce2e
TypeScript
NickGreenSF/ilovethissong
/server/src/controllers/listing/postListing.ts
2.625
3
import { Request, Response } from 'express' import { Listing } from '../../database/entities/Listing' import { User } from '../../database/entities/User' import { getConnection } from 'typeorm' export const postListing = async (req: Request, res: Response) => { const connection = getConnection() if ( !req.bod...
199d9e847c1ed5ac14dcca1359814328046f1be3
TypeScript
tnguye20/OurQuirkyAdventure
/functions/src/utils/isFilterEmpty.utils.ts
2.828125
3
import { FilterCriteria } from "../interfaces"; const isFilterEmpty = (filterCriteria: FilterCriteria | null): boolean => { if (filterCriteria === null) return true; return Object.values(filterCriteria).reduce((prev, curr) => { if (Array.isArray(curr)) { return prev && curr.length === 0 } return...
5ccef7698fa03eb4674b15d9dddd957b478f350a
TypeScript
Giovanifsa/NFEStatusFrontend
/nfestatus/src/app/data/QueryOption.ts
2.53125
3
export default interface QueryOption { optionLabel: string; } class QueryByDistinctAuthorizerAndLatestCapture implements QueryOption { public optionLabel = "Consultar mais recentes com Autorizadores distintos"; } class QueryTreatUnknownNFEStatusAsOffline implements QueryOption { public optionLabel = "Cons...
9de1f6eb4a2849c104996bb1437e314312b30809
TypeScript
zxbodya/flowts
/packages/babel-plugin-flow-to-typescript/test/visitors/ImportDeclaration.test.ts
2.875
3
import { testTransform } from '../transform'; test('import type statement', () => { const result = testTransform(`import type { A } from "module"; import type { B, C } from './mod'; import type D from './mod';`); expect(result.babel).toMatchInlineSnapshot(` "import type { A } from "module"; import type { B...
93eec5dfa6963b7e7d7c0a4cbfa0015f579ff0c0
TypeScript
TatsuyaYamamoto/coupling-tune-player
/packages/share/src/models/CouplingPlayer/CouplingPlayer.ts
2.625
3
import { EventEmitter } from "eventemitter3"; import { analyzeBpm, AnalyzeResult } from "./BpmAnalyzer"; export type CouplingPlayerEventTypes = "play" | "pause" | "update" | "end"; const log = (message: string, ...data: any[]) => { console.log(`[CouplingPlayer] ${message}`, ...data); }; export class CouplingPlaye...
729a6a58a89b181a65dcde211277a714352d7bcd
TypeScript
wix-playground/wix-meido-improver
/extension/src/modules/waitForSelector.ts
2.6875
3
export function waitForSelector(selector: string): Promise<HTMLElement> { return new Promise(resolve => { const el: HTMLElement | null = document.querySelector(selector); if (el) { resolve(el); } else { setTimeout(() => resolve(waitForSelector(selector)), 100); } }); } export function w...
17bf27ce84c2f9ed7f2fc116c60f4d100745ce81
TypeScript
simiancraft/Editor
/src/editor/edition-tools/procedural-textures/wood-tool.ts
2.5625
3
import { WoodProceduralTexture } from 'babylonjs-procedural-textures'; import AbstractEditionTool from '../edition-tool'; export default class WoodProceduralTool extends AbstractEditionTool<WoodProceduralTexture> { // Public members public divId: string = 'WOOD-PROCEDURAL-TOOL'; public tabName: string = '...
334b5a3bb46b33941b014483f7a11f5422cb8f37
TypeScript
martink-rsa/trivia-app-server
/src/tests/utils.test.ts
2.9375
3
const { generateRandomNumber, getRandomNumbers, getRandomQuestions, } = require('../utils/utils'); describe('utils', () => { describe('getRandomNumber', () => { it('should get a random number between 0 and 1', () => { const minimum = 0; const maximum = 1; for (let i = 0; i < 10; i += 1) {...
ce96aad920864459f2b940d990178d4bec5aaa89
TypeScript
wen-js/wenjs
/src/whois/who.ts
3.515625
4
export default class Who { constructor( // 群友名称 别名 readonly name:string | string[], // 群友简介 readonly dec: string ) {} // 名称匹配规则 pattern(input: string): boolean { const inputName = input.trim() if(Array.isArray(this.name)) { return this.name.some(name => name.trim() === inputName) ...
be25f024260c6aba820c0d3de818bb1574d7ecd8
TypeScript
danikaze/terminal-runner
/src/ui/blessed/widgets/modal/index.ts
3
3
import * as blessed from 'blessed'; import { Widget, WidgetOptions, ResizeData } from '..'; export interface ModalOptions extends WidgetOptions { children: blessed.Widgets.BlessedElement[]; onFocus?: () => void; } /** * Reusable way to create consistent Modal widgets */ export class Modal implements Widget { ...
7273918ba8de51f9240d358770db19b8f0a4a44b
TypeScript
mymyoux/Typescript-Ghost-framework
/browser/graphics/Sprite.ts
2.71875
3
//missing import {View} from "browser/graphics/View"; //convert /* ghost.events.EventDispatcher */ import {EventDispatcher} from "ghost/events/EventDispatcher"; //convert-files import {ISprite} from "./ISprite"; ///<module="framework/ghost/utils"/> ///<module="framework/ghost/events"/> //convert-import import {Maths...
651427a93f470c04ef7abcbe56cdbfc567ccf2cf
TypeScript
f-space/cthulhu-tools
/src/components/pages/character-edit/attribute-input/expression-arranger.ts
2.859375
3
import { AST, Reference, AttributeType, Attribute, PropertyResolver } from "models/status"; export class ExpressionArranger { private context!: Attribute; private depth!: number; public constructor(readonly resolver: PropertyResolver) { } public arrange(attribute: Attribute): string[] { this.context =...
a589cdd7e0ca0e4db99248bbc4889aecf5d8d697
TypeScript
willymilimo/lwsc
/redux/actions/theme.ts
2.53125
3
import { ThemeType, ThemeReducer } from "../../types/theme"; import Actions, { ActionI } from "../Actions"; export const setThemeReducer = (payload: ThemeReducer) => ({ type: Actions.SET_THEME_REDUCER, payload, }); export const setTheme = (theme: ThemeType): ActionI => ({ type: Actions.SET_THEME, payload: the...
9b0013d1060b3a21ca371a754b25f29d974e1131
TypeScript
mtchdev/Inferno
/api/app/controllers/ReminderController.ts
2.59375
3
import { Controller } from 'vendor/astro/http/Controller'; import { Request } from 'express'; import { Reminder } from 'app/models/Reminder'; export class ReminderController extends Controller { constructor(data) { super(data); } /** * Add a reminder * @param request The API request...
8fe01fceea8dba49437df55d6120811cde93eabb
TypeScript
PerminovEugene/event-hub
/packages/shared/src/domain/auth.ts
3.25
3
export enum Role { admin = "admin", superAdmin = "superAdmin", manager = "manager", guest = "guest", client = "client" } export enum GroupName { "all" = "all", "authorised" = "authorised", "staff" = "staff", "admins" = "admins", "unauthorised" = "unauthorised" } type Group = { [key in keyof Grou...
e8a91e14ffbdec653eca81d0a0440607b2587bf9
TypeScript
eventia-io/eventia-core
/source/EventHandling/EventHandler.ts
3.15625
3
import { CodeMetadata } from "../Infrastructure/CodeMetadata"; import { EventFactory } from "../Infrastructure/EventFactory"; export type EventHandlerFunction = (event: any, metadata?: any, message?: any) => Promise<void>; export function EventHandler<T>( classConstructor: {}, methodName: string, params:...
1eccc738a59be37ceafbcefca99d4f6fbe53262a
TypeScript
meliorence/react-native-render-html
/packages/render-html/src/elements/getDimensionsWithAspectRatio.ts
2.59375
3
export default function getDimensionsWithAspectRatio( width: number | null, height: number | null, aspectRatio: number | undefined ) { return { width: width ?? (aspectRatio && height ? height * aspectRatio : null), height: height ?? (aspectRatio && width ? width / aspectRatio : null) }; }
ac0b4f3e04d919457cff0f9b2fcfebfc2ca201bc
TypeScript
osti2021/demo-crud-nestjs
/src/commons/service.commons.ts
2.625
3
import { FindManyOptions, Repository } from "typeorm"; export abstract class BaseService<T> { abstract getRepository() : Repository<T>; findAll() : Promise<T[]> { return this.getRepository().find(); } findOne(id: any): Promise<T> { return this.getRepository().findOne(id); } s...
3ad3e580f8dc5053ce95cbf286c58876c6792ff1
TypeScript
PierreCapo/react-native-socials
/src/Twitter/api.ts
2.734375
3
import { TwitterPostApiResponse, UserMention } from "./typings"; import { generateFetchRequestHeaders } from "./generateTwitterHeaders"; export const getPostData = async ( postId: string, consumerKey: string, consumerSecret: string ) => { const url = `https://api.twitter.com/1.1/statuses/show/${postId}.json`; ...
51773442d425563712d8881a1f375ebb83f94023
TypeScript
YevgeniGitin/Express-Exercise-1and2
/src/controllers/product.controllers.ts
2.546875
3
import { Request, Response, NextFunction } from "express"; import { Product } from "../models/product"; import * as productServices from "../services/product.services"; //handlers to routing export const findProduct = productServices.findProduct; export const findProductIndex = productServices.findProductIndex; export...
c9bf433f045862d4f7d8ae0d1a96009e0fe077c1
TypeScript
cavanbecksmith/Phaser-Ts-Examples
/src/Examples/UsingInputsEXT.ts
3.015625
3
class UsingInputsEXT { game: Phaser.Game; jetSprite: Phaser.Sprite; W: Phaser.Key; A: Phaser.Key; S: Phaser.Key; D: Phaser.Key; constructor() { this.game = new Phaser.Game(640, 480, Phaser.AUTO, 'content', { create: this.create, preload: this.preload }); } ...
432d21a123afc3c9f58b0a44ba543599bab20bb1
TypeScript
jiongran/project
/src/util/index.ts
2.65625
3
import setting from '@/settings' import i18n from '@/lang' /** * @remarks 根据语言枚举返回对应翻译(如没有则返回默认) * @param language 语言枚举 * @returns 语言枚举对应翻译 */ const getLange = (language: string = setting.defaultLanguage) => { const stringEmum: any = { 'zhchs': '简体中文', 'en': 'English' } return stringEmum[language] ||...
eb7ff41faf6af9d4ebb68e4a8657018ab525f2d6
TypeScript
KiranMantha/plumejs
/src/lib/domTransition.service.ts
2.53125
3
import { Injectable } from './decorators'; import { fromEvent } from './utils'; class DomTransition { private transition = ''; constructor() { this.whichTransitionEnd(); } onTransitionEnd(element: HTMLElement, cb: () => void, duration: number) { let called = false; let unSubscribeEvent = null; ...
b2db5e7aee045f709ebc0fce60680ae6c5356bd7
TypeScript
tumit/reusable-strategy-demo
/src/app/reusable-route-strategy.ts
2.59375
3
import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router'; import { Member } from './member'; export class ReusableRouteStrategy implements RouteReuseStrategy { // handlers to store detached route private handlers: { [key: string]: DetachedRouteHandle } = {}; private reusa...
2db64fbd7b39b508be875e84b9f2dc07f6ac42db
TypeScript
Vontus/UrbanDictionaryBot
/src/urban-api/ud-cache.ts
2.765625
3
import { UdDefinition } from './ud-definition' interface IDictionary { [index: string]: UdDefinition[] } const searchCache: IDictionary = {} export function addSearchCache (search: string, definitions: UdDefinition[]) { searchCache[normalizeWord(search)] = definitions } export function getSearchCache (word: str...
7809c8d72c1be5242e0da477b4937762fb2e431c
TypeScript
crisbeto/material2
/tools/tslint-rules/symbolNamingRule.ts
3.078125
3
import ts from 'typescript'; import * as Lint from 'tslint'; /** Lint rule that checks the names of classes and interfaces against a pattern. */ export class Rule extends Lint.Rules.AbstractRule { /** Pattern that we should validate against. */ private _pattern: RegExp; constructor(options: Lint.IOptions) { ...
ac8be21d55c77a0307761cedd1f500560f3130cd
TypeScript
ALongLi/react-admin
/src/utils/constants.ts
2.71875
3
import { DefaultOptionType } from 'antd/es/select'; /** * @description: 公用常量 */ /** * 颜色 */ export enum colors { success = 'green', primary = '#409EFF', warning = '#E6A23C', danger = 'red', info = '#909399' } export interface Constant extends Omit<DefaultOptionType, 'children'> { value: string | num...
68ce699446c9957e1bfea65d73e08e747aece00f
TypeScript
FleMo93/dcs-kellergeschwader-web
/src/helper/TimeToString.ts
3.15625
3
export function getDateString(date: Date): string { return date.getUTCFullYear() + '-' + (date.getUTCMonth() + 1).toString().padStart(2, '00') + '-' + date.getUTCDate().toString().padStart(2, '00'); } export function getTimeString(date: Date): string { return date.getUTCHours() + ':' + ...
64fccd3937136b0bc597862f6e6d70f7c5256103
TypeScript
clearcodeweb/lorder.ui
/src/#/@store/@common/helpers/mapEnum.ts
3.421875
3
export function mapEnum<EnumType>(enumerable: EnumType, fn: (el: any) => any): any[] { // get all the members of the enum const enumMembers: any[] = Object.keys(enumerable).map(key => enumerable[key]); // we are only interested in the numeric identifiers as these represent the values const enumValues: number[]...
6fd9b60d3e7a142d83ed34db2bea3a9df0fa9c48
TypeScript
atakangah/banking-api
/src/utilities/bcrypt.hash.ts
2.78125
3
import bcrypt from "bcrypt"; import { User } from "../interfaces/user.interface"; export const encryptPassword = async (user: User) => { return await bcrypt.hash(user?.password, user?.phone.length); }; export const verifyPassword = async (inputPassword: string, userPassword: string) => { return await bcrypt.compa...
fd241ca6488ade75634e410ca1d8506c50b50dbe
TypeScript
I-luv-chuletas/El_Lobby
/src/app/services/in-memory-data.service.ts
2.625
3
import {InMemoryDbService} from 'angular-in-memory-web-api'; export class InMemoryDataService implements InMemoryDbService { createDb(){ let shouts = [ {id:1, rating:6, userID:"Anon2", commentSectionId:1, title:"Cobros tardios departe de @Recursos Humanos", message:"Lorem ipsum...
25d954843dba762f1cb15cdad3d86791d80d144c
TypeScript
tategakibunko/nehan
/src/space-char.ts
3
3
import { ICharacter, LogicalSize, SpaceCharInfo, SpaceCharTable, Font, TextEmphaData, ILogicalNodeEvaluator, TextMeasure, } from "./public-api"; // more detailed version // let rexSpace = /^[\u0009-\u000D\u001C-\u/0020\u00A0\u034F\u11A3-\u11A7\u1680\u180E\u2000-\u200F\u2028-\u202E\u2061-\u2063\u3000\u3...
83906662cd04a45524464640dbd29a9e2cc68541
TypeScript
depekur/eating-time
/frontend/src/app/ration/model/ration.model.ts
2.90625
3
import * as moment from 'moment'; export interface IGetRationRequest { date: string; } export interface IGetRationIntervalRequest { startDate: string; endDate: string; } export interface IDeleteRationRequest { date: number; } export interface IRation { } /** * response and request to get\set day ration ...
ead84ba930edaefefc76f407f22077048ab97c3a
TypeScript
ohayobrew/harvester-test
/app/utils/deserializer.ts
2.609375
3
import {Logger} from './logger'; import * as _ from 'lodash'; import {IImageModel, IRequestMetadata, eImageTask, eSkippedCropReason} from '../models/image/image.model.interface' import {ICropArea} from "../models/image/image.model.interface"; import {eImageStatus} from "../models/image/image.model.interface"; import {e...
f6e140ae118485cbfd30362cede45f396003db9e
TypeScript
tbergqvist/noble-cream
/src/systems/render-player-stats-system.ts
2.515625
3
import {ISystem} from "../engine/isystem"; import {ScoreComponent, HealthComponent} from "../components"; import {requiredComponent} from "../engine/node"; import {Space} from "../engine/space"; import { GameCanvas } from "../game-canvas"; export class PlayerStatsNode { entityId: string; @requiredComponent score...
986fdb10531c4d903e52702eae0e92805463d8f6
TypeScript
ajmesa9891/ngrx-generator
/templates/_reducer.ts
2.5625
3
import { createEntityAdapter, EntityAdapter, EntityState } from '@ngrx/entity'; import { {{ properCase name }} } from '{{position "models"}}/{{ kebabCase name }}.model'; import * as {{ camelCase name }} from '{{position "actions"}}/{{ kebabCase name }}.actions'; // Keep these 2 (and delete the other 3) exports if you...
e5b5f4ba8c0a9f258124b917a2b25a111c35b2d9
TypeScript
Rhodanthe1116/lyrics-typing
/src/api/datasources/musixmatch.ts
2.515625
3
import { RESTDataSource, RequestOptions } from 'apollo-datasource-rest' import { Track, Lyrics } from 'shared/interfaces' import { MusixmatchTrackWrapperObject, MusixmatchAlbumWrapperObject, MusixmatchTrack, MusixmatchLyrics, MusixmatchAlbum, } from './interfaces' const apiKey = process?.env?.MUSIXMATCH_APIK...
fe8a728ffa8bdc13f164ab9c95dab51c27824b10
TypeScript
2006NodeDev/tattooshop-booking-service
/src/routers/bookings-router.ts
2.640625
3
import express, {Request, Response, NextFunction} from 'express' import { InvalidIdError } from '../errors/InvalidIdError'; import { Bookings } from '../models/Bookings'; import { BookingInputError } from '../errors/BookingInputError'; import { getAllBookingsService, UpdateExistingBookingService, SubmitNewBookingServ...
dd5079f593a03c95bd6f4b2e5b0a954d1eae2c02
TypeScript
midhatdrops/rpg-sololeveling-generateitemroll
/src/Service/RegularRoll/translators/conditionTranslator.ts
2.921875
3
export function conditionTranslator(equipType: string, roll: number) { if (equipType === 'Arma') { if (roll >= 1 && roll < 7) { return { points: 0, useCondition: 'Ser Arma da Classe' }; } if (roll >= 7) { return { points: -5, useCondition: 'Ter Maestria com a Arma' }; } } else { swit...
687900da4ba7377ddda91698dfcc3f85c14178e1
TypeScript
FrancisRoc/nhl-pool-api
/tests/features/step_definitions/utils.steps.ts
2.96875
3
import { utils } from "../../../src/utils/utils"; import * as Promise from "bluebird"; export default function () { const self = this; let stringToConvert: string; let result: boolean; self.Given(/^Le paramètre "str" est renseigné avec "([^"]*)"$/, function (valParam: string) { const promise =...
a465999da3e438e4a833ff073b29e0e197209e93
TypeScript
TFrascaroli/definition-header
/src/utils.ts
2.9375
3
/// <reference path="./../typings/tsd.d.ts" /> 'use strict'; var lineExp = /\r?\n/g; export interface Position { column: number; line: number; } export function getPosition(stream: string, index: number): Position { var position: Position = { column: 0, line: 0 }; var match: RegExpExecArray; var nextLineS...
5f7274bc1fdd7c5d63056870af2b46763a9ebfe1
TypeScript
MihirJayavant/chat-api
/src/api-models/Login.ts
2.75
3
import { IsNotEmpty, IsString, Length } from 'class-validator' export class LoginModel { @IsNotEmpty() @IsString() @Length(3, 50) username: string @IsNotEmpty() @IsString() @Length(5, 20) password: string } export function createLoginModel(data: any): LoginModel { const { username, password } = d...
72eaf6a5ab88125ae5c38f39babab9e5bb6d62c3
TypeScript
ZeroDAO/socircles-backend
/src/app/comm/utils.ts
2.609375
3
import { Inject, Provide } from '@midwayjs/decorator'; import * as ipdb from 'ipip-ipdb'; import * as _ from 'lodash'; import { Context } from 'egg'; import * as createKeccakHash from 'keccak'; /** * 帮助类 */ @Provide() export class Utils { @Inject() baseDir; /** * 获得请求IP */ async getReqIP(ctx: Context)...
203ae408fb6c6155252493e181e035bacc5e6032
TypeScript
VanHouten97/simaze-server
/src/lib/config.ts
2.671875
3
import { Error } from '@interfaces'; export const database = { host: 'localhost', port: 27017, dbName: 'simaze', dbUser: 'fl0ppy', dbPass: 'zootek%402018' }; export const secret = 'zootek2018@smz'; export function err(e: number, d?: any): Error { function model(n: number, d: any, internal?: a...
ab46763b70266861e4348b14aee98bb7df7fec8f
TypeScript
sh33dafi/adventofcode2020
/day2/solution.ts
3.1875
3
const normalizeInput = (input: string): Array<any> => { const normalizeChar = (char: string): string => { return char.replace(':', ''); }; const normalizeNumbers = (occurrence: string): Array<number> => { return occurrence.split('-').map(v => parseInt(v, 10)); }; const [occurrence,...