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
385a0a8373ebf0fc851d7ae61a87d4d7b6878077
TypeScript
dmitrygorkun/athena
/src/common/image/image.dto.ts
2.625
3
import {IsNotEmpty, MaxLength} from 'class-validator'; import {Image} from './image.definition'; export const PHOTO_TITLE_LENGTH = 100; export const PHOTO_LINK_LENGTH = 100; export class ImageDto implements Image { @IsNotEmpty() @MaxLength(PHOTO_TITLE_LENGTH) alt: string; @IsNotEmpty() @MaxLeng...
973aea6b0a435a26e81b26e85333e716a9217c5d
TypeScript
rraziel/es-validation
/packages/decorators/src/decorators/Negative.ts
2.84375
3
import { addConstraint } from './addConstraint'; import { ConstraintDecorator } from './ConstraintDecorator'; import { ConstraintProperties } from './ConstraintProperties'; /** * Negative decorator, used to define that an element must be a negative number * @param target Target * @param propertyKey Property ke...
a218f772819db8c8fb810c936a2516323836a4f4
TypeScript
Yalm/cdiego
/src/products/entities/product.entity.ts
2.515625
3
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, OneToMany, CreateDateColumn, UpdateDateColumn } from 'typeorm'; import { Category } from 'src/categories/entities/category.entity'; import { OrderToProduct } from 'src/orders/entities/order-detail.entity'; @Entity() export class Product { @PrimaryGenerate...
52454a360c83317082be69427bbeede43abe99b8
TypeScript
EmilSroka/ESE-evaluator
/apps/api/src/app/utils/neo4j/props-stringify.ts
3.234375
3
export function propsStringify(object: Record<string, any>): string { const items = []; for (const [key, value] of Object.entries(object)) { if (isObjectOrFunction(value)) throw new Error(`Cannot stringify ${value} to neo4j format`); if (hasSpace(key)) throw new Error(`Key "${key}" contains space`); ...
ad63ae9464843aaffdb63914b1e23fbcc3c1ee05
TypeScript
tbaraza/solution
/src/app/services/tariff/tariff.service.ts
2.765625
3
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { catchError } from 'rxjs/operators'; import { throwError, of, Observable } from 'rxjs'; // TO DO: Move this to a type file export type Tariff = { id: number, name: string, speed: { downloadSpeed: number, ...
ab59115829f83506630063e7b1d6ed3a7a2d6ab4
TypeScript
actions/download-artifact
/src/download-artifact.ts
2.921875
3
import * as core from '@actions/core' import * as artifact from '@actions/artifact' import * as os from 'os' import {resolve} from 'path' import {Inputs, Outputs} from './constants' async function run(): Promise<void> { try { const name = core.getInput(Inputs.Name, {required: false}) const path = core.getInp...
f013f5a2447a55d5f223b911231064ebc7301e03
TypeScript
tingdahaideshengyin/chat
/client/src/core/view/pannel/mediator/PomeloTestMediator.ts
2.671875
3
module game { export class PomeloTestMediator extends BaseMediator{ public static NAME:string = "PomeloTestMediator"; public constructor(viewComponet: any = null) { super(PomeloTestMediator.NAME, viewComponet); } //重写消息列表 public listNotificationInterests():Array<any>{ return [ PanelNotify.OPEN...
b6392075046a11a4a58993a2e1309ddff648de71
TypeScript
geetanaik/Shopping-cart-5.0
/src/app/service/auth.service.ts
2.515625
3
import { Injectable } from '@angular/core'; import { User } from '../model/user.model'; import { Http, RequestOptions, Headers } from "@angular/http"; import { Observable } from "rxjs/Observable"; import "rxjs/add/operator/map"; import { AppResponse } from "../model/app-response"; import { AppSettings } from '../config...
4f32b4c05108328630a3b776ac3302699a500eb6
TypeScript
markusbohl/hexa-contacts
/src/frameworkLayer/validators/NewContactDataValidator.ts
2.828125
3
/* tslint:disable */ import {AbstractValidator} from 'fluent-ts-validator'; import {injectable} from 'inversify'; @injectable() export class NewContactDataValidator extends AbstractValidator<any> { constructor() { super(); this.validateIfAny(data => data.firstName) .isString() ...
50351c538c03a3d9759ccaa154440daedc02db2f
TypeScript
vvtstrain/vite-plugin-externals
/src/utils.ts
2.65625
3
export function isObject(o: unknown):boolean { return Object.prototype.toString.call(o) === '[object Object]' }
b95aff124c675b41f74d12964886f3734b55d4d5
TypeScript
GetStream/stream-js
/src/personalization.ts
2.90625
3
import { StreamClient, APIResponse, UR, DefaultGenerics } from './client'; /** * Manage api calls for personalization * The collection object contains convenience functions such as get, post, delete * @class Personalization */ export type PersonalizationAPIResponse<StreamFeedGenerics extends DefaultGenerics = De...
9179b55f1ff26b022a08e1c719620d839dce9bbd
TypeScript
blockframes/blockframes
/libs/utils/src/lib/form/forms/form-field-list.form.ts
2.8125
3
import { FormArray, FormControl, FormGroup } from '@angular/forms'; // DISCLAIMER // THIS IS A DRAFT, PLEASE DO NOT USE OR EDIT export class FormFieldList extends FormGroup { constructor(private defaultTemplate) { super({ first: new FormControl(), list: new FormArray([]), }) } get first() ...
9fd254ba32014392fb64a45a42d9fa6db42a96a8
TypeScript
geoffb/jamuary-2018
/lib/sim/Entity.ts
2.8125
3
import { IRectangle } from "./math"; export class Entity implements IRectangle { x = 0; y = 0; width = 16; height = 16; health = 1; vx = 0; vy = 0; speed = 60; dx = 0; sprite = -1; jumpImpulse = -125; private jumpCount = 0; public get right(): number { return this.x + this.width...
897529ae71f6d1411478cb2585ae8301c9d744cc
TypeScript
uninitlzd/vite-plugin-markdown
/src/index.ts
2.703125
3
import Frontmatter from 'front-matter' import MarkdownIt from 'markdown-it' import { Transform, Plugin } from 'vite' import { parseDOM, DomUtils } from 'htmlparser2' import { Element, Node as DomHandlerNode } from 'domhandler' export enum Mode { TOC = "toc", HTML = "html", REACT = "react", VUE = "vue" } expor...
2b979d89a6816cbe8dbe6cc470ffbcf52055401d
TypeScript
aleclofabbro/marbles
/src/lib/utils/action-proxy/emitAction.ts
2.71875
3
import { abstractProxy } from './abstractProxy'; import StrictEventEmitter from 'strict-event-emitter-types'; import { EventEmitter } from 'events'; type Emitter<T> = StrictEventEmitter<EventEmitter, T> export const emitAction = <T extends { [key: string]: (...args: any[]) => any }>(emitter: Emitter<T>) => { return ...
cd6cab639db99e66010fa6f1de38c82a61bc2bf3
TypeScript
rontian/navmesh
/packages/navmesh/src/nav-mesh.test.ts
3.421875
3
import NavMesh from "./navmesh"; import Vector2 from "./math/vector-2"; const v2 = (x: number, y: number) => new Vector2(x, y); describe("An empty NavMesh instance", () => { let emptyNavMesh: NavMesh; beforeAll(() => (emptyNavMesh = new NavMesh([]))); it("should not throw an error on construction", () => { ...
816b3ec4f5cfd1d0952f5f207664c72e6928f17c
TypeScript
nehagupta84/stalk-opentracing-js
/tutorials/09-context-propagation-ts-decorators/src/client.ts
2.609375
3
import { opentracing, stalk } from '../../../'; import fetch from 'node-fetch'; const sleep = (duration: number) => new Promise(resolve => setTimeout(resolve, duration)); // Let's require our decorators const { Tag, Component } = stalk.decorators.Tag; const { Trace, TraceAsync } = stalk.decorators.Trace; /** * Set-...
b57cf9a7a06e5fa4dedca8e59ffb6c9225283408
TypeScript
jamesfer/functional-validator
/src/make-constraint.ts
3.1875
3
import { isFunction } from 'lodash-es'; import { castPromise, MaybePromise } from './utils'; /** * A rule message function is a way to create dynamic messages based on the user's input. */ export type RuleMessageFn<P = void> = ( value: any, options: ConstraintOptions, params: P, ) => string; /** * A rule's m...
4c013d1d7af2e5da041a391c9f2f255f9020722b
TypeScript
chenji336/cj-taskmgr
/src/app/login/login/login.component.ts
2.53125
3
import { Component, OnInit } from '@angular/core'; import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms'; import { Observable } from 'rxjs'; import { Store } from '@ngrx/store'; import { Quote } from '../../domain/quote.model'; import * as fromRoot from '../../reducers'; import * as quoteAc...
948a617bd08fe0edc2769180f2598efd484f3545
TypeScript
aitoroses/chevrotain
/test/parse/grammar/resolver_spec.ts
2.5625
3
import {gast} from "../../../src/parse/grammar/gast_public" import {HashTable} from "../../../src/lang/lang_extensions" import {GastRefResolverVisitor} from "../../../src/parse/grammar/resolver" import {ParserDefinitionErrorType} from "../../../src/parse/parser_public" describe("The RefResolverVisitor", () => { i...
6b7ca0a08e5980724fa44f4f96f73b487db7bc2b
TypeScript
aviabird/tax-app
/src/app/services/tax-calculator.service.ts
2.859375
3
import { Investor } from './../models/investor'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { TaxSlabsService } from './tax-slabs.service'; import { Slab } from '../models/slab'; import { SalaryRange } from '../models/salary-range'; @Injectable() export class TaxCa...
e77d34cd996e44ce1f814d90d8eef1dd8d06463d
TypeScript
moepyxxx/practice-ts-pokemon
/src/controller/MainController.ts
2.875
3
import { Hero } from "../model/human/Hero"; import { MapField } from '../model/field/MapField'; import { Place } from '../model/field/Place'; import { Ordinary } from "../model/human/Ordinary"; import { Trainer } from "../model/human/Trainer"; import { PokemonAppearPlace } from "../model/field/PokemonAppearPlace"; impo...
055ae7d2a558045ebd21513d951576abe7adc99b
TypeScript
Moventes/ionic-components
/componentes/src/components/autocomplete/autocomplete-modal.ts
2.765625
3
import { Component, forwardRef, ViewChild } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { NavParams, Searchbar, ViewController } from 'ionic-angular'; /** * Component providing a searchbar input which autocomplete returned by Google Maps API * * @example *...
66c7682d581c29c26495b21ab91963b566dfda3e
TypeScript
stsr9/tv_bland
/src/api/shows-api.ts
2.609375
3
import { http } from './http/http' import { ApiEndpointUrls } from './api-endpoint-urls' import { Show } from 'models/show' import { Actor } from 'models/actor' interface ShowsInterface { fetchEpisodeDetails(id: string): Promise<Show> } class ShowsAPI implements ShowsInterface { fetchEpisodeDetails(id: string): Pro...
9332b33cfd2b4b1db035ec85b0f13d2eadbb2e36
TypeScript
poeticsoft/learning
/streamdata/src/server/server.ts
2.84375
3
// https://medium.com/factory-mind/websocket-node-js-express-step-by-step-using-typescript-725114ad5fe4 import * as express from 'express'; import * as http from 'http'; import * as WebSocket from 'ws'; import * as path from 'path'; const app = express(); // INTERFACE const publicRoot = path.join(__dirname, '../.....
421eb6b0fb6f9345d57d6e2a5a862c763b76eb81
TypeScript
YaoZeyuan/leetcode
/resolve/二刷/100.ts
3.828125
4
/** * Definition for a binary tree node. * class TreeNode { * val: number * left: TreeNode | null * right: TreeNode | null * constructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) { * this.val = (val===undefined ? 0 : val) * this.left = (left===undefined ? nul...
a7ab62c5b2692a9d692bbcac5b2f5ae663021502
TypeScript
wenqi73/ng-template-parser
/src/main.ts
2.953125
3
import { Lexer } from './expression_parser/lexer'; import { Parser } from './expression_parser/parser'; export function parse(expr: any) { switch (typeof expr) { case 'string': const lexer = new Lexer(); const parser = new Parser(lexer); return parser.parse(expr); default: console.log...
0a9f35f2cc72df1f6fd1d8b4646dcb4fdcd8b337
TypeScript
taoalpha/typecript-algorithms
/src/algorithms/math/bits/bitLength.ts
3.625
4
/** * Return the number of bits used in the binary representation of the number. * */ export default function bitLength(number: number): number { let bitsCounter = 0; while ((1 << bitsCounter) <= number) { bitsCounter += 1; } return bitsCounter; }
0bc8e0c2dc8e798de4c190edd5d821c866253a6f
TypeScript
AmirHus/getInformation
/src/utilities/informationLoader.ts
2.84375
3
//IMPORTS GOES HERE export class InformationLoader implements ILoader<InputGeneric, Promise<OutputGeneric>> { //INJECTED DEPENDANCIES dependancyA: ILoader< { input: InputGeneric, }, Promise<{ output: OutputGeneric; }> >; dependancyB: (input: inputGeneric) => Promise<unknown[]>; ...
aa9848356f50e24a869bf0707ed977e3c8dd178d
TypeScript
Guezin/pontte-challenge
/src/modules/users/useCases/UpdateUserUseCases.ts
2.625
3
import { inject, injectable } from 'tsyringe' import AppError from '@shared/errors/AppError' import cpfValidate from '@shared/utils/cpfValidate' import User from '@modules/users/infra/typeorm/entities/User' import IUserRepository from '@modules/users/repositories/IUserRepository' import IContractRepository from '@mod...
67604c6cf10520e0967073c3acb25011290dac1a
TypeScript
teohrt/auth-task
/src/db/dbClient.ts
2.640625
3
/* eslint-disable max-len */ import { Pool, QueryResult, PoolClient } from 'pg'; import { Logger } from 'winston'; export interface DBClient { createUser: (username: string, passwordHash: string, salt: string) => Promise<QueryResult>; getUserByName: (username: string) => Promise<QueryResult>; createTask: (ownerI...
95d55a108d90b44e61ba00ba17a970acda9abff2
TypeScript
ronaldogdn/cicloPagamento
/API/src/controllers/CicloController.ts
2.640625
3
import { Request, Response }from "express"; import { resolveProjectReferencePath } from "typescript"; import CicloSchema from "../models/CicloSchema"; class CicloController{ async listar(request: Request, response:Response){ try{ const ciclos = await CicloSchema.find(); // response....
9d1231f566c0c76228fc46840152371bbb0cf52c
TypeScript
CodeAndChillClub/plusnew
/src/instances/types/Array/Instance.ts
2.703125
3
import PlusnewAbstractElement from '../../../PlusnewAbstractElement'; import ChildrenInstance from '../ChildrenInstance'; import Instance, { getPredeccessor } from '../Instance'; import types from '../types'; import reconcile from './reconcile'; /** * ArrayInstances are used for representing lists in the shadowdon *...
450e2c22641a4a3043efe06f04edb8ed5ea34c61
TypeScript
kagankarakaya/open-conquest-world-server
/src/Response.ts
3.25
3
/** * * * @export * @class Response */ export class Response { public service: string; public operation: string; public data: any; /** *Creates an instance of Response. * @param {*} service * @param {*} operation * @param {*} data * @memberof Response */ constructor(service, operation,...
dd0d27898d81f87e4654b9821c46404411fef72c
TypeScript
AbinJames/MoneyManager
/MoneyManagerAngular/src/app/savings-parameters/savings-parameter-filter.pipe.ts
2.65625
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'SavingsParameterFilterPipe' }) export class SavingsParameterFilterPipe implements PipeTransform { transform(savingsParameterList: any[], savingsParameterName: string, minAmount: number, maxAmount: number, minBalance: number, maxBalance: number, f...
797c2d386baff5fb4572c43ac44b05cec5b698e5
TypeScript
yamatatsu/receptron
/packages/orgWeb/src/domains/org/index.ts
2.65625
3
import { Subject } from "rxjs"; import { scan } from "rxjs/operators"; // Model export type Org = { name: string }; // Events export const orgAdded$ = new Subject<Org>(); // State const initial: Org[] = []; export const orgState$ = orgAdded$.pipe( scan((orgs, org) => [...orgs, org], initial), );
a8a5044538236af54d7e508f380c5eeac79c2bfc
TypeScript
wlf-io/deno-cliffy
/command/upgrade/provider/deno_land.ts
2.578125
3
import { Provider, Versions } from "../provider.ts"; export interface DenoLandProviderOptions { name?: string; } export class DenoLandProvider extends Provider { name = "deno.land"; private readonly repositoryUrl = "https://deno.land/x/"; private readonly registryUrl = "https://deno.land/x/"; private readon...
df62a2579b3b4d89afa6b91edf13dc6aebaa01d6
TypeScript
matthewtff/voter
/build/frontend/ts/room.ts
3
3
/// <reference path="utils.ts" /> class Room { private static kRoomInfoPath = "room.info"; private static kRoomIdFieldName = "room_id"; private static kRoomPageAddress = "/html/room.html"; private room_id_ : string; constructor(room_info : Object) { if (!Room.Validate(room_info)) return null; ...
9907b709b2a4190fe3ce0cf495e8b0e6a0632ec3
TypeScript
andreyshr/weather-widget
/src/modules/geolocation/geolocation.ts
2.796875
3
import { TCoordinates } from "@/api/location-api/types"; export class GeolocationModule { public static getLocation(): Promise<TCoordinates> { return new Promise((resolve, reject) => { const onSuccess = (position: GeolocationPosition) => { resolve({ lat: position.coords.latitude, ...
d74472ac3c3cd5d49aebb058b5e1544881641001
TypeScript
kesla/sucrase
/src/transformers/Transformer.ts
2.546875
3
export default interface Transformer { preprocess(): void; // Return true if anything was processed, false otherwise. process(): boolean; getPrefixCode(): string; getSuffixCode(): string; };
1f009aa65c25bc8f270165b1a79fa3b15d881886
TypeScript
providenetwork/indra
/modules/client/src/lib/utils.ts
2.8125
3
import { BigNumber, bigNumberify, hexlify, randomBytes, solidityKeccak256 } from "ethers/utils"; import { isNullOrUndefined } from "util"; // Give abrv = true to abbreviate hex strings and xpubs to look like "xpub6FEC..kuQk" export const stringify = (obj: object, abrv: boolean = false): string => JSON.stringify( ...
af37275cf78280f7e05434c2f0dbf02f6396908c
TypeScript
sz-piotr/jscodegolf
/frontend/src/domain/groupResults.ts
3.0625
3
import { TestResult } from './execute' import { TestCase } from './challenge' export interface ResultGroup { message: string, type: 'PASS' | 'FAIL', items: ResultGroupItem[], } export interface ResultGroupItem { test: TestCase, result: TestResult, } export function groupResults (cases: TestCase[], results:...
4bc746217c09211a5c1a79ccdab890b892f60d62
TypeScript
luisiiyoo/cards-game-frontend
/src/model/resources.ts
2.734375
3
export type Metadata = string | number | boolean | undefined; export interface Resource { id: number; name: string; shortDescription: string; description: string; url: string; complexity: string; //'easy' | 'medium' | 'hard' | 'god'; tags: string[]; metadata: { [key: string]: Metadata }; }
0ed5927ec201d1e659cb3d66d312d7909e5e0c2a
TypeScript
sekwah41/spq
/src/__tests__/PromiseQueue.test.ts
3.203125
3
import { PromiseQueue } from "../PromiseQueue"; import { QueuedPromiseFactory } from "../TaskTypes"; function sleep(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)); } describe("Basic checks on QueuedPromise", () => { let customQueue: PromiseQueue; let QueuedPromise: QueuedPromiseFactory; ...
2324adf280febbba11f20db0c11ea516483034a9
TypeScript
kolserdav/ads-panel
/src/routes/user/post.forgot.ts
2.640625
3
import * as Types from '../../types'; import * as lib from '../../lib'; import * as orm from '../../orm'; import * as utils from '../../utils'; import express from 'express'; /** * POST /user/forgot * Запрос на смену пароля . * Передаётся почта в email, создается и отправляется ключ, который при переходе на GET /u...
6bf1c85eb1a611a57195ca1ad51e062f48f39d3a
TypeScript
RetroCraft/ics4u-culm
/src/Token.ts
3.734375
4
import { Keyword } from "./Keyword.js"; /** * A JavaScript value that can be represented as other values. * * ex. `false === ![]` */ export class Token extends Keyword { /** * Parent keywords/tokens/primitives */ public keys: Keyword[]; /** * Instantiate a Token * @param value Name/literal value...
3243aabc319c26b4050065a123a23790b005eeb4
TypeScript
sanderlab/AlignmentViewer2.0
/src/common/__tests__/Utils.test.ts
3.171875
3
import { stringToColor } from "../Utils"; const defaultColor = { hex: "#000000", rgb: { red: 0, green: 0, blue: 0 } }; describe("Utilities", () => { describe("stringToColor", () => { it("Should fail to convert hex shorthand with no hash and be default.", () => { expect(stringToColor("fff")).toEqual(de...
755c730ce0a697c1fd56530e08598d56a314cc34
TypeScript
ashikalik/avanto
/src/app/core/service/language-setting.service.ts
2.796875
3
import { Injectable, Inject, PLATFORM_ID } from "@angular/core"; import { isPlatformBrowser } from '@angular/common'; /** * LanguageSettingService service class * Stores the current language in local storage */ @Injectable({ providedIn: "root" }) export class LanguageSettingService { /** The key for language */...
8862be49451e26623a3f3067082dc5dff98965ba
TypeScript
shailendrasharma83/aws-apigw-lambda-dynamodb-typescript
/src/scalar/SensorDataBuilder.ts
2.609375
3
import {SensorData} from "./SensorData"; import { Payload } from "./Payload"; import {SensorDataService} from "../services/sensor-data.service"; import {ResponseBuilder} from "../shared/response-builder"; export class SensorDataBuilder implements Partial<SensorData>{ SensorId: string; TimeStamp: Date; Topi...
1c8dfb24bc84e5027d1558c77bcdb92df3fe33b7
TypeScript
AdamDKing/training-code
/4-web/angular-demo/src/app/pipe.component.ts
2.546875
3
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-pipe', template: ` <p> Pipes are a way to write display-value transformations that you can declare in your HTML.<br> Current date w/o pipe: {{ currentTime }}<br> Current date with medium date and lowercase pipes: {...
3fa434f0f2f7455e9bd71ce2fda56bcdcfee27cf
TypeScript
tjrexer/webiny-js
/packages/app-page-builder-editor/src/contexts/compose.ts
3.125
3
export const composeAsync = (functions: Array<Function> = []): Function => { return (input: unknown): Promise<any> => { if (!functions.length) { return Promise.resolve(); } // Create a clone of function chain to prevent modifying the original array with `shift()` let ind...
0ea74a09de1b5b22ca0e7b5405d8d2d28f99e4a7
TypeScript
pandy123/documentPerisistence
/src/persistent/converter/DateTimeConverter.ts
2.90625
3
import { PersistentAccessEnum } from '../PersistentAccessEnum'; import { PersistentAnnotation } from '../PersistentAnnotation'; import { PersistentContext } from '../PersistentContext'; import { PersistentFactory } from '../PersistentFactory'; import { FieldConverter } from './FieldConverter'; /** * 时间日期持久化器。 */ exp...
13ada6f272e575a51f26a3cc7eebc3bdf6af22b9
TypeScript
Rian8337/Alice
/src/database/managers/aliceDb/ChannelDataCollectionManager.ts
2.828125
3
import { DatabaseCollectionManager } from "@alice-database/managers/DatabaseCollectionManager"; import { ChannelActivity } from "@alice-database/utils/aliceDb/ChannelActivity"; import { DatabaseChannelActivity } from "@alice-structures/database/aliceDb/DatabaseChannelActivity"; import { Collection as DiscordCollection ...
c5d5b5756731a97de1e2e9eab7c072f2ba4fd718
TypeScript
akheron/optics-ts
/src/standalone/reread.tspec.ts
3.15625
3
import { expectType } from './test-utils.tspec.js' import * as O from '.' import type { Expected } from './errors.js' const optic = O.reread((x: string) => x.toUpperCase()) describe('reread', () => { it('get - source not of the correct type', () => { const result = O.get(optic, true) expectType<Expected<str...
75facc0adb078b064bea404c3093e1e9e6971da7
TypeScript
ElliotZacharoff/hypixel-translators-bot
/src/commands/Info/thread.ts
2.53125
3
import { Command, GetStringFunction } from "../../index" const command: Command = { name: "thread", description: "Gives you a link to the thread announcing this discord", cooldown: 120, allowDM: true, channelWhitelist: ["549894938712866816", "624881429834366986", "730042612647723058", "551693960913879071"], ...
a646c69b7370813c90bbb7344f2987854ddb7141
TypeScript
nohanna/angular-micro-frontends
/projects/shared/src/lib/pipes/prefix.pipe.ts
2.578125
3
import { Pipe, PipeTransform } from '@angular/core'; import { ActivatedRoute, UrlSegment } from '@angular/router'; @Pipe({ name: 'prefix', }) export class PrefixPipe implements PipeTransform { constructor(private route: ActivatedRoute) {} transform(route: string[]): string[] { const segments: UrlSegment[] =...
df9587ab344fb5d33805511ff777414af02bce0d
TypeScript
moovin-hackathon/anunnakis-backend
/src/Repository/Contract.ts
2.765625
3
export abstract class RepositoryContract { protected applyPaginator (filter: FilterDefault, options: any) { const page = this.getPage(filter) const size = this.getSize(filter) options.offset = (page - 1) * size options.limit = size } protected getPage (filter: FilterDefault) { ...
a2821cdb3773caf0a5327d3776b3b6e47af25678
TypeScript
mcaon/coopera-favela-back
/models.ts
2.53125
3
const ProducModel = { id: '66a405cb-ec37-4a6b-b91f-a2c979002ba6', name: 'Bolo de Laranja', value: 38.5, description: 'Bolo de Laranja sem cobertura', image: 'iVBORw0KGgoAAAANSUhEUgAAAZAAAADSCAMAAABThmYtAAAAXVB', }; const DeliverymanModel = { id: 'ac105d65-7c26-479c-94a3-cdac214016d2', name: 'Pedro Bastos'...
9a91b4061f88d754fee8f3e8d8296af5b38617c9
TypeScript
bookmarkbao/vscode-jest
/src/setup-wizard/wizard-helper.ts
2.78125
3
/** * helper functions that are used across components/files */ import * as vscode from 'vscode'; import * as path from 'path'; import { WizardStatus, WizardAction, ActionableMenuItem, ActionMenuOptions, ActionableButton, WizardSettings, JestSettings, ConfigEntry, ActionableMessageItem, WizardCont...
e99bae4b58c346a4ce34acd97e52502d3b275189
TypeScript
fearthecowboy/scratchpad
/compute/2015-06-15/models/DiskInstanceView.ts
2.703125
3
import { InstanceViewStatus } from './InstanceViewStatus'; /** * @description The instance view of the disk. */ export interface DiskInstanceView { /** * @description The disk name. */ name: string; /** * @description The resource status information. */ statuses: Array<InstanceView...
2762aa9d7e56139b055d39637d85d8166b9b8e00
TypeScript
Xananax/gameover
/src/utils/Signal/CounterSignal/CounterSignal.d.ts
2.53125
3
/// <reference path="../Signal/Signal.d.ts" /> interface CounterSignal extends Signal<any,any>{ increment(n?:number):CounterSignal; decrement(n?:number):CounterSignal; isCounterSignal:boolean; count:number; }
52cd0654d7d8f6fb934b959f4787e9be2d34f398
TypeScript
ZnoGouDj/codewars-challenges
/7kyu/7kyu-find-the-longest-gap.ts
4.125
4
// A binary gap within a positive number num is any sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of num. // For example: // 9 has binary representation 1001 and contains a binary gap of length 2. // 529 has binary representation 1000010001 and contains two binary ga...
255fc324700b1731691cde6e43ae6ea525e3038a
TypeScript
OlaIstra/cleevio
/src/store/reducers/trips.ts
3.140625
3
import * as actionTypes from '../actions/actionTypes' import { ActionTripType } from '../actions/trips' export type Country = { id?: string value: string text: string icon: string } export type ErrorType = { message: string } type InitialStateType = { countries: Array<Country> loading: boolean error: null | ...
e8cbb1e633218bc25be98b1471c955078973733d
TypeScript
Daru13/interactive-turing-machine
/src/ts/view/graph-interaction/pen-and-touch/Touch.ts
3.09375
3
import { Graph } from "../../Graph"; import { TuringMachine } from "../../../model/TuringMachine"; import { ModifiedPointerEvent } from "../ModifiedPointerEvent"; import { NodeTool } from "../tools/NodeTool"; /** * A class to define actions to do when a user uses touch */ export class Touch{ /** node tool associ...
2cbd065f720319da991278d954f9ebeaa1f642a9
TypeScript
ArchitectingSoftware/se575-container-demo
/rest-node-koa/src/app.ts
2.671875
3
import * as Koa from 'koa' import * as Router from 'koa-router' import {PaperDB, IPaper} from './paperDB' import Axios from 'axios' import * as config from './config.json' let app = new Koa(); let router = new Router(); // Environmental Setup const environment = process.env.NODE_ENV || 'development' let envConfig = ...
da2c62f4fd1f6cc308354675abfef278e3f9f097
TypeScript
blocklycraft/MineBlock
/src/mineblock.ts
2.53125
3
import * as vscode from 'vscode'; import * as path from 'path'; import * as util from './util'; export class MineBlock { static context: vscode.ExtensionContext; constructor(_context: vscode.ExtensionContext) { MineBlock.context = _context; this.regEventListeners(); this.checkEditor();...
392caa48dbb6da2072c2ae6253aa3300c02ee1f6
TypeScript
szpakm/redux-store-templates
/src/toggle/index.d.ts
2.515625
3
declare module "redux-store-templates/toggle"; import { Reducer } from "redux"; import { ApplyOptions } from "../models"; export type ToggleState = boolean; /* create reducer */ export interface ToggleOptions { initial?: boolean; toggleOn?: ApplyOptions; makeTrueOn?: ApplyOptions; makeFalseOn?: ApplyOptions...
e81a011694c542c18086090827a1331b2e10c559
TypeScript
Failender/dgo-frontend
/app/src/app/routes/kampf/kampf-render/konva-util.ts
2.671875
3
import Konva from 'konva'; export function createImage(x: number, y: number, src: string, callback: (element) => any): void { const image = new Image(); image.onload = () => { const element = new Konva.Image({ width: image.width, height: image.height, x, y, image }); if (callbac...
bb090ac76e9f9727d046042f776ff79f927eae6f
TypeScript
papercuptech/eldc
/proto/test2.ts
2.875
3
/* const install = Context.install const {ARG_N, ARG_LAST, CLASS, FRAME,} = install install([ ['global', ['setTimeout', ['$', ARG_N(0)] ] ], ['child_process', ['exec', ['$', ARG_LAST], ['_', ['send', ['$', ARG_LAST]] ] ] ], ['global', ['FileReader', ['_', ['$', ['onload'], ...
1680f89557e1195e73eceb9c4777eeb5bc012148
TypeScript
renanmav/relayable
/packages/server/src/modules/question/QuestionModel.ts
2.546875
3
import mongoose, { Schema, Document, Model } from 'mongoose' import { IUser } from '../user/UserModel' import { IAnswer } from '../answer/AnswerModel' const questionSchema = new Schema( { content: { type: String, required: true, }, upvotes: [ { type: Schema.Types.ObjectId, ...
199607709806036a550fdfffd0a619c9598b1822
TypeScript
qhun-engine/engine
/src/resource/sprite/SpriteImageExtractor.ts
2.59375
3
import { Injectable } from "@qhun-engine/base"; import { SpriteResource } from "./SpriteResource"; import { DimensionSize } from "../../constraint/Dimension"; import { ImageResource } from "./ImageResource"; import { ImageCropService } from "../util/ImageCropService"; import { Rectangle } from "../../math/Rectangle"; ...
76b85c901b3c02458a87820cc2b6bd75655762fc
TypeScript
mattallsop/hack-cambridge-website
/src/hc-scripts/teams/get.ts
2.546875
3
import { Hacker, HackerApplication, Team, TeamMember } from 'server/models'; import { createHandler } from '../utils'; import { getHackerFromEmailOrApplicationSlug } from './utils'; export default { command: 'get <email|applicationId>', desc: 'Get the team for a hacker', aliases: [], builder(yargs) { retur...
8dd19316b59ee03e3cbac557813cf1ea2c57cbc1
TypeScript
nvh/web-build-tools
/apps/api-extractor/src/api/mixins/ApiFunctionLikeMixin.ts
2.640625
3
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. // See LICENSE in the project root for license information.s import { ApiItem, ApiItem_parent, IApiItemJson, IApiItemConstructor, IApiItemOptions } from '../model/ApiItem'; import { ApiParameter } from '../model/ApiParameter';...
2f6af738d058251d5860624b6dad1c2311e9d8c3
TypeScript
ptcmyanmar/Beyond-Horizon-Project
/src/reducers/browser.ts
2.65625
3
import {ActionPayload, Browser, BrowserPayload} from 'actions/interfaces'; import { ADD_BROWSER_TAB, ADD_TO_BROWSER_FAVORITES, ADD_TO_BROWSER_HISTORY, BROWSER_FOCUS, CLEAR_BROWSER_HISTORY, CLOSE_ALL_BROWSER_TABS, CLOSE_BROWSER_TAB, REMOVE_FROM_BROWSER_FAVORITES, SET_ACTIVE_BROWSER_TAB, UPDATE_BROWSE...
88c4aa0e7d8a4bc0c2dc81bc96e489174c353ef2
TypeScript
mglezsosa/type-or-treat-2020
/4.ts
3.46875
3
// You got roped into the cutest halloween competition, judging // doggy halloween pet costumes at the annual parade. declare function decideWinner(breed: string, costume: string): { name: string, video: string } window.decideWinner = someoneElseDecides // Oh, actually you didn't - someone else got to do the f...
216cdf9eea7ad231a16a7e4ecc92043c81bf5a9f
TypeScript
CofeeWithRose/WaveRolling
/release/plugins/decoder/interfaces/IWavDecoder.d.ts
2.578125
3
import { IEventHandle } from "../../../main/interfaces/IEventHandle"; export interface RangeSegment { cacheIndex: number; offset: number; length: number; cacheOffset: number; } export declare class DataBufferRange { length: number; segments: RangeSegment[]; } export interface DecodedInfo { a...
e7af9be26c658364795c5c3681ef9237182ac6e5
TypeScript
HaskellJacobCurry/haskell-ts
/dist/Typeclass/Data/Monoid/Dual_.d.ts
2.84375
3
import { ISemigroup } from '../Semigroup'; import { IMonoid } from '../Monoid'; declare const URI: "Dual"; declare type URI = typeof URI; export { URI }; interface Dual<A> { URI: URI; value: A; } export { Dual }; declare let get: <A>(_: Dual<A>) => A; export { get }; declare let createDual: <A>(value: A) => Dua...
b7aa3c6c2dcc910b7e58c1067cd9a2339c7fab58
TypeScript
KubiGR/ticket-to-ride
/src/model/cards.ts
3.140625
3
import { Connection } from './connection'; import { cardColors } from './trackColor'; export type TC = Map<string, number>[]; export function makeTC(len: number, color1: string, color2 = ''): TC { if (!cardColors.includes(color1)) throw new Error('makeTC Unknown color1: ' + color1); if (color2 !== '' && !card...
0fbcf847cd72a0862f0e63517d0b5dd8e94b7bc4
TypeScript
GhostLmm/coder
/currentProject/UpdateFlag.ts
2.9375
3
import {DebugConfig} from "../euler/DebugConfig"; /** * Created by kris on 2017/3/2. */ export class UpdateFlag { /** 位置和形状标签 **/ public static TAG_POSITION:string = "position"; public static TAG_POLYGON:string = "polygon"; /** 场景中的obj边界 **/ public static TAG_BOUNDARY:string = "boundary"; /** 物体所属房间信息标签...
336af46ae5d969e32ca79e4b102cd90ddac84b01
TypeScript
Nicasiomarques/mochi-test
/modules/utils/helper-functions/__tests__/format-geo-code-result.test.ts
2.78125
3
import { formatGeoCodeResult } from '../index'; const makeSut = () => ({ sut: formatGeoCodeResult }); describe(formatGeoCodeResult.name, () => { it('to returns to formatGeoCodeResult in object with properties street, lat and lng ', () => { const { sut } = makeSut(); const geoCode: any = { formatted_add...
bcea8b616ed9467b44460e1484605104b7525d19
TypeScript
ReExia/font-demos
/ng-use-form/src/app/moel/form-textbox.ts
2.546875
3
import { FormFieldBase } from './form-field-base'; export class FormTextBox extends FormFieldBase<string>{ controlType = "textbox"; type : string; constructor(options : {} = {}){ super(options); this.type = options['type'] || ''; } }
41309e523e1677b9d5052ece43b0f7daffda2945
TypeScript
kushwahashiv/Typescript2xCookbook
/chapter_05/src/14_generators.ts
3.296875
3
namespace chapter_04.generators { // count to 10 function* count() { let count = 0; while (count < 10) { yield count; count = count + 1; } } console.log('iterator:'); const iterator = count(); let item = null; do { item = iterator.next(); console.log(item); } while (it...
644e201eb7cbd5bf3184919b5248f24b937beab9
TypeScript
henck/tads3js
/src/builtin/gen/concat.ts
2.734375
3
import { VmData, VmObject, VmNil } from "../../types"; import { MetaString } from "../../metaimp"; /** * Returns a string with the concatenation of the argument values, in the order given. * @param args Values to concatenate * @returns Concatenated string */ export function builtin_concat(...args: VmData[]): VmDa...
93f06c602c7f9f3206e09b247a10e1854fe8ea85
TypeScript
kuldarim/quiz-homework
/react-ui/src/redux/reducers/reducer.ts
2.65625
3
import { GET_ALL_KATAS, CHANGE_STATUS, CHANGE_SOLUTION, CHANGE_USER, SET_ALERTS } from '../constants/action-types'; import { IKata } from '../constants/interfaces'; const initial = { katas: [], user: '', alerts: {}, }; const reducer = (state = initial, action: any) => { switch (action.type) { case GET_ALL...
23b5c5a00ebaf9c618db1b75685eae52c6f3ac98
TypeScript
gravity2146/teen
/src/models/UserProfile.ts
3.234375
3
/** * Defines a user profile. */ export class UserProfile { userId: string; username: string; firstName: string; lastName: string; fullName: string; photoUrl: string; pk: string; /** * Sets the name of the user. * @param fullName The full name of the user. */ publi...
30bc0af7f1e633ac64e61fc903afdd5de1a422d2
TypeScript
96RadhikaJadhav/earl
/packages/earljs/src/types.ts
2.703125
3
export interface Newable<T> { new (...args: any[]): T } // @note: don't use BigIntConstructor here to avoid relying on modern node typings being installed export type BigIntLike = { asIntN: Function; asUintN: Function; (value?: any): any } export type NewableOrPrimitive<T = any> = Newable<T> | SymbolConstructor | B...
a15ec2ce0144d6ca8221f6fbf377eac32f290d57
TypeScript
AkshayKulkarni03/customer-app
/src/app/shared/services/token/token-storage.service.spec.ts
2.546875
3
import { TestBed } from '@angular/core/testing'; import { TokenStorageService } from './token-storage.service'; describe('TokenStorageService', () => { let service: TokenStorageService; const mockSessionStorage = (() => { let store = {}; return { getItem: (key) => { return store[key]; ...
b1793889f88699bac17d997b628fb0983a55d89a
TypeScript
Kellyzhy/MovieShopSPA
/src/app/core/services/api.service.ts
2.71875
3
import { Injectable } from '@angular/core'; import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams } from '@angular/common/http'; import { Observable, throwError } from 'rxjs'; import { map, catchError } from 'rxjs/operators'; import { environment } from 'src/environments/environment'; @Injectable({ provide...
c38c487400b463a9bbb00e61a749bad1a1a70345
TypeScript
lxfly666/TypeScript2021
/MySnake/src/modules/Snake.ts
3
3
class Snake{ head:HTMLElement; bodies:HTMLCollection; element:HTMLElement; constructor(){ this.element=document.getElementById('snake')!; this.head=document.querySelector('#snake>div') as HTMLElement; this.bodies=this.element.getElementsByTagName('div'); } get X(){ ...
94eb2b3a0135aaf39e34f01bad530830a2fc7b42
TypeScript
ricardoham/moviesit-app
/src/components/Label/styles.ts
2.515625
3
import styled from '@emotion/styled'; interface StyledProps { hasError?: boolean; } export const StyledLabel = styled.label<StyledProps>` color: ${(props) => (props.hasError ? '#ff3243' : '#181818')}; `;
5652fb98277c979beb196d9a61e64110d600485e
TypeScript
chang90/seek-ads
/src/lib/util/getNormalPrice.ts
2.640625
3
import { ShoppingCartMap } from "../interface/shoppingCartMap"; import { RetailPriceRuleMap } from "../interface/retailPriceRuleMap"; export const getNormalPrice = (shoppingCartMap: ShoppingCartMap, retailPriceMap: RetailPriceRuleMap): number => { let resultPrice = 0; for (const productItem in shoppingCartMap) { ...
17d510c6846ef28f2fc36658cc306ce85ee4340c
TypeScript
gitter-badger/x-forward
/packages/app/src/utils/Shell.ts
2.53125
3
import { $, cd, nothrow } from 'zx' /** * install nginx * @param version nginx version need to install * @param handlerMsg handler system std */ export const installNginx = async (version: string, handlerMsg?: (msg: string) => void) => { handlerMsg && handlerMsg(`$ wget http://nginx.org/download/nginx-${versio...
a7ed35abeb0d04245bc34ade99d5961daeabe6a5
TypeScript
Valeriia-Rez/ITA28.09
/Valeriia/Movies_database_project/src/store/reducers/MovieReducer.ts
2.953125
3
import { IMovie } from "../../types"; import { MovieAction} from "../actions/movieActions"; import {MovieActionTypes} from '../actions/actionTypes'; export interface IMovieDetailsState { movie: IMovie | null; isError: boolean } const initialState: IMovieDetailsState = { movie: null, isError: false } con...
a3523b4d7ccb98e0e1204a4dc299a0af237a074b
TypeScript
nevincoco/vscode-extension
/src/snyk/configuration.ts
2.546875
3
import { URL } from 'url'; import * as vscode from 'vscode'; import { IDE_NAME } from './constants/general'; import { ADVANCED_ADVANCED_CODE_ENABLED_SETTING, ADVANCED_ADVANCED_MODE_SETTING, CONFIGURATION_IDENTIFIER, TOKEN_SETTING, YES_CRASH_REPORT_SETTING, YES_TELEMETRY_SETTING, YES_WELCOME_NOTIFICATION_S...
2c2541da01ce09d20e01265b67e3c9e6e796ed4b
TypeScript
sebasakd86/ts-bc
/02-DataTypes/core.ts
3.84375
4
//TS wont check nor provide support for this kind of declaration const tsDoesntCare: object = { name: "pablo", age: 700, }; //Creates a concrete obj that TS provides support to and checks for errors. //Its not a good practice, it's better to use TS type inference const specializedPerson: { name: string; ...
c140c6267faa77c65d8c13be19a793fc0efa032a
TypeScript
bolucat/Archive
/unlock-music/src/decrypt/ximalaya.ts
2.546875
3
import { parseBlob as metaParseBlob } from 'music-metadata-browser'; import { AudioMimeType, SniffAudioExt, GetArrayBuffer, GetMetaFromFile } from './utils'; import { DecryptResult } from '@/decrypt/entity'; const HandlerMap: Map<string, (data: Uint8Array) => Uint8Array> = new Map([ ['x2m', ProcessX2M], ['x3m', Pr...
4f329b4cbcbb7a3cceeae829f4b8e6d78bca7e42
TypeScript
Financial-Times/dotcom-page-kit
/packages/dotcom-server-handlebars/src/helpers/json.ts
2.5625
3
export default function json(...args) { if (args.length !== 2) { throw Error('Incorrect number of parameters provided') } // The second parameter will always be an instance of HelperOptions const target = args[0] // Do not allow users to output the whole @root context // <https://github.com/Financial-...
ff6efd1c841af076ad246351abd6b41288e02011
TypeScript
thaapasa/simulations
/src/util/Colors.test.ts
2.796875
3
import 'jest'; import { hexByte, rgbColor } from './Colors'; describe('Color utils', () => { it('calculates hex bytes from unit values', () => { expect(hexByte(0)).toBe('00'); expect(hexByte(1)).toBe('FF'); expect(hexByte(0.5)).toBe('80'); expect(hexByte(0.498)).toBe('7F'); expect(hexByte(0.02))....
3567768cc89115c7b4e78db4dad31f000ec23252
TypeScript
ianevangelista/next-portfolio
/utils/about/education-text.ts
2.90625
3
import getDifferenceDates from "./date-difference"; interface Education { study: string; school: string; duration: string; } const vgsStartDate = new Date(2015, 7); const vgsEndDate = new Date(2018, 5); const bachelorStartDate = new Date(2018, 7); const bachelorEndDate = new Date(2021, 5); const masterS...
30a0b7251e714bae81ff56e68b2d750b9214e6e2
TypeScript
jakewitcher/100_Algorithms_Challenge_course
/absoluteValuesSumMinization/absoluteValuesSumMinization.ts
3.609375
4
function absoluteValuesSumMinimization(a: number[]): number { return a.reduce((x: number, y: number) => { const absSumX = a.reduce((b: number, c: number) => { return b + Math.abs(c - x); }, 0); const absSumY = a.reduce((d: number, e: number) => { return d + Math.abs(e...