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
0d5c4e27b1835aa31ed83734b4cd199c9fde847b
TypeScript
gustavofsantos/tsoid
/src/promises/__tests__/either.test.ts
3
3
import { either } from '../../index'; describe('either', () => { const successCallback = jest.fn((n: number) => n + 1); const errorCallback = jest.fn(() => 9); it('Should call the success callback', async () => { const action = () => Promise.resolve(0); const res = await either(successCallback, errorCa...
47f3e4aac114c8cd6524a7f9475c0074a8978221
TypeScript
davidpet/tutorials
/Angular/reactive-form/src/app/forbidden-name-validator.ts
2.875
3
import { AbstractControl, ValidationErrors, ValidatorFn } from "@angular/forms"; /** A name can't match the given regular expression */ // Gets custom object on error(s) and null on success. // You don't need to include it in a module because it's // just a function call. export function forbiddenNameValidator(nameRe:...
6b81b31f259db00c2cf43e52d9db7635de23c507
TypeScript
xmclark/beyondtabletop
/src/app/models/common/base.ts
2.890625
3
export class BtBase { version?: number id: string getProto() { return {} } getLookup() { return {} } constructor(init = {}) { const self = this const proto: any = self.getProto() const lookup = self.getLookup() const randomSecureString = (length = 12) => { let text = '' ...
e748e9455716b8281c65d2efe4f4a211af38ef70
TypeScript
stteper/inn_generator
/src/common/bik_generator.ts
2.9375
3
import BaseGenerator from './generator'; class BikGenerator extends BaseGenerator { generate():string { const coeffs = ['02','06','09','13','16','21','23','31','39','43','48','51','55','59','62','67','72','74']; let midDigits = ''; do { midDigits = this.generateRndStr(2); } while (coeff...
65c184bdc814f7eaf9b003e45b9f8becc67dc5ef
TypeScript
DawnbrandBots/tournament-organizer
/src/Player.ts
3.296875
3
export interface Result { match: string; opponent: string; result?: "w" | "l" | "d"; } /** Class representing a player. */ export class Player { /** * Name of the player. * @type {String} */ private alias: string; /** * Alphanumeric string ID. * @type {String} */ readonly id: string; /** * Valu...
90b07b9118275a9cf962f1b34cafc9a5e35cf71e
TypeScript
NaomiLea/ji-cloud
/frontend/storybook/src/components/core/inputs/textarea-underline.ts
2.828125
3
import {argsToAttrs} from "@utils/attributes"; import "@elements/core/inputs/textarea-underline"; export default { title: "Core / Inputs" } interface Args { label: string, placeholder: string, value: string, width:number, rows:number, } const DEFAULT_ARGS:Args = { label: "hello", plac...
a22e0983c7242fa5048c985e2c2762fc03a6e84c
TypeScript
BryanPan342/awscdk-change-analyzer
/packages/@aws-c2a/engine/lib/model-diffing/entity-matchers/component-properties-matcher.ts
2.703125
3
import { Component, ComponentPropertyValue, PropertyPath, CompleteTransition, Transition } from '@aws-c2a/models'; import { PropertyDiff, PropertyDiffCreator } from '../property-diff'; /** * ComponentPropertyValue similarity evaluator for use with matchEntities. * * Matches ComponentProperties based on their simila...
ad5272cba52f8f9cc2b2f961faee615e9c5c0323
TypeScript
knowit/program.kds.knowit.no
/helpers/time.ts
3.65625
4
class Time { public hours: number public minutes: number public constructor(hours: string = "0", minutes: string = "0") { this.hours = parseInt(hours); this.minutes = parseInt(minutes); } public toString(del: string = "."): string { return ("0" + this.hours).slice(-2) + del...
031eee1cc376e5609e7938707d486b9566ea8220
TypeScript
vitalim4/quize-questions
/src/app/store/questions-actions.ts
2.6875
3
import {Action} from '@ngrx/store'; import {Question} from './models/question.model'; export enum QuestionActions { LOAD_QUESTION = '[Questions] Load Question', LOAD_QUESTION_FAILURE = '[Questions] Load Question Failure', LOAD_QUESTION_SUCCESS = '[Questions] Load Question Success', INIT_STATE = '[Questions] In...
ef151b443f64ee4f48fbfc71d71b20f095f426cf
TypeScript
uniquid/uidcore-js
/src/impl/Bcoin/BcoinCEV/TX/varint.ts
2.90625
3
/**! * * Copyright 2016-2018 Uniquid Inc. or its affiliates. All Rights Reserved. * * License is in the "LICENSE" file accompanying this file. * See the License for the specific language governing permissions and limitations under the License. * */ /** * varint utils from https://github.com/chrisdickin...
9afb6b46a28198bb2abfffbf9b8083854253af1f
TypeScript
rayene-raffa/wunder-fleet
/src/app/store/actions/register.actions.ts
2.53125
3
import { Action } from '@ngrx/store'; import { IPersonalInformation, IAddress, IPaymentInformation, INextOrPreviousStep } from 'src/app/models/registration-information.interface'; export enum ERegisterActions { StartRegister = '[Register] Start', NextOrPreviousStep = '[Register] Move to next or previous s...
8fb0571c5b111a6067cb911b36fb0d7bebc77432
TypeScript
ev3alexli/pxt-maplerobot
/maplerobot.ts
2.890625
3
/** * Use this file to define custom functions and blocks. * Read more at https://makecode.mindstorms.com/blocks/custom */ enum movingSideEnum { LonL = 11, LonR = 12, RonL = 31, RonR = 32 } enum portEnum { LEFT_COLOR = 1, RIGHT_COLOR = 3, MIDDLE_COLOR = 4, GYRO_SENSOR = 2 } enum p...
abea9ce79aa01cd3aa368e6504da887c59efdc18
TypeScript
tridungle/adonis5-cache
/src/TaggableCacheManager.ts
2.640625
3
import { CacheManagerContract, TaggableCacheManagerContract, TaggableStorageContract, TagPayloadContract, } from '@ioc:Adonis/Addons/Adonis5-Cache' import dayjs from 'dayjs' import { flatten } from 'ramda' import { isTaggableStorage, isTagPayloadContract } from './TypeGuards' export default class TaggableCacheMan...
2a884b034dd122e95deff81699a413393f641a70
TypeScript
pitchforkviking/WordPlay
/src/pages/duel/duel.ts
2.828125
3
import { Component } from '@angular/core'; import { Http } from '@angular/http'; import { NavController } from 'ionic-angular'; import { AlertController } from 'ionic-angular'; import { TimerObservable } from 'rxjs/observable/TimerObservable'; import { HomePage } from '../home/home'; import { Player } from '../../mod...
c9fd52d23b8cd8b2d9bfa8b1ae49dd6445aa4031
TypeScript
gaoljie/use-swiper
/src/utils/move.ts
2.78125
3
export default function move<T extends HTMLElement>(options: { slidesPerView: number; slideWidth: number; container: T; animate?: boolean; speed: number; deltaX: number; leftStart: number; rightStart: number; curIndex: number; loop: boolean; }): void { const { slidesPerView, slideWidth, ...
ab5d32be648dfb92c852406aec457c10a2e713f0
TypeScript
FranciscoJavierMartin/ponyracer
/tests/unit/composables/RaceService.spec.ts
2.671875
3
import axios, { AxiosResponse } from 'axios'; import { useRaceService } from '@/composables/RaceService'; import { RaceModel } from '@/models/RaceModel'; describe('useRaceService', () => { test('should list races', async () => { const response = { data: [{ name: 'Paris' }, { name: 'Tokyo' }, { name: 'Lyon' }] } ...
0c78b35f63b7d3eb654c64080afd12068d256c57
TypeScript
veronika-donets/recipe-book-client
/src/modules/recipes/components/Form/constants.ts
2.921875
3
import * as Yup from 'yup'; import { RecipeFormValues } from '../../types'; const FILE_SIZE_MAX = 512000; // 500 kB const FILE_SIZE_MIN = 5120; // 5 kB const SUPPORTED_FORMATS = ['image/jpg', 'image/jpeg', 'image/gif', 'image/png']; export const formInitialValues: RecipeFormValues = { name: '', photo: null, ...
41d4aa5bc3285f7fe47e74218bdeeb26bee2ebd8
TypeScript
kawamataryo/ts-jest-boilerplate
/tests/index.test.ts
2.625
3
import { sum } from "../src/index"; describe("index", () => { describe("sum", () => { test.each([ [1, 2, 3], [100, 20, 120], [10, 35, 45], [-1, 2, 1], [0, 10, 10], ])("calculate %i + %i", (a, b, expected) => { expect(sum(a, b)).toBe(expected); }); }); });
0a4d74aba72d935c60d888e679613df8a6497570
TypeScript
pnxtech/pnxge
/src/State.ts
3.234375
3
import {Utils} from './Utils'; /** * @name State * @description State management */ export class State { private _state: {}; /** * @name constructor * @description state initializer */ constructor() { this._state = {}; } /** * @name state * @description state getter * @return {obje...
205eb66cc2222dce5eadb4a2bfae797fb66fe536
TypeScript
mahertim/UltimateCourses-NGRXStore
/src/products/util/map-to-entities.helper.ts
3.390625
3
interface IdentifiableType { id?: number; } export function mapToEntities<T extends IdentifiableType>( items: T[], entities: { [id: number]: T }, ): { [id: number]: T } { return items.reduce( (theEntities: { [id: number]: T }, t: T) => { return { ...theEntities, [t.id as number]: t, ...
a3df0403a2307d8586371026d6ddc499464657c7
TypeScript
VirtoCommerce/vc-procurement-portal-theme
/ng-app/src/app/modules/alerts/models.ts
2.671875
3
export class Alert { constructor(public type: AlertType, public msg: string, public keepAfterRouteChange = false) { } } export enum AlertType { Success = 'success', Error = 'danger', Info = 'info', Warning = 'warning' } export class IAlertOptions { keepAfterRouteChange?: boolean; dismissTimeout?:...
626ed9d8ce011a1b771038fc974ebfd62827cecd
TypeScript
karolkozak/FlavorSome-web
/src/app/shared/utils/array-utils.ts
3.03125
3
export function inArray<T>(needle: T, haystack: T[]): boolean { return haystack && haystack.indexOf(needle) >= 0; }
4bc1b994b2e20cb85a9d02da03207715843a9757
TypeScript
marygans/office-ui-fabric-react
/packages/migration/src/cli/cli.ts
3.046875
3
interface IParsedCommand { writeResults: boolean; help: boolean; version: string; } const defaultParsedCommand = { writeResults: false, help: false, version: '', }; export class CliParser { public parse(args: string[]): IParsedCommand { if (args.length === 0 || args[0] === '-h' || args[0] === '--hel...
b25e532b2ac2e3b64c75d96e669dd796161c2afc
TypeScript
andoniabedul/ts-blog
/src/routes/post.routes.ts
2.59375
3
import { Request, Response, Router } from 'express'; import PostModel from '../models/post.models'; class Post { public router: Router; constructor(){ this.router = Router(); this.setRoutes(); } async getList(req: Request, res: Response){ const posts = await PostModel...
d9871f7d52d12ac0d676235369e94bb04ed2223e
TypeScript
antopas84/ecommerce
/app/components/cart/cart.component.ts
2.53125
3
import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import {Product} from '../../entities/product.entities'; import {Item} from '../../entities/item.entities'; import {ProductService} from '../../services/product.service' @Component({ moduleId: module.id, templa...
6a5c07d388fc9142956bb7da78e7c3f90c74ef7a
TypeScript
ggpo1/a100
/src/MapCore/Services/ObjectService.ts
2.515625
3
import sort from 'fast-sort'; import bs from 'js-binary-search'; import MapSourceLayer from "../Models/MapSourceLayer"; import StillageItem from "../Models/ArrayItems/StillageItem"; import ObjectItem from "../Models/ArrayItems/ObjectItem"; export default class ObjectService { public getObjectSourceItem(selectedLa...
6cee622e53e3b58ef6d86fdcb0c5189494974a76
TypeScript
NadimAppsCode/SlidingItems
/src/directives/reveal-sliding.directive.ts
2.953125
3
import {AfterViewInit, ContentChild, ContentChildren, Directive, ElementRef, QueryList, Renderer2} from '@angular/core'; import {IonItemOptions, IonItemSliding} from '@ionic/angular'; /** * The data type used to specify the swipe direction of the emulation. */ enum SwipeDirection { toLeft = 0, toRight } /** * ...
156383008e43331b96ac6294b61ad287bc9095b9
TypeScript
mattdsteele/stencil
/src/compiler/entries/entry-modules.ts
2.546875
3
import * as d from '../../declarations'; import { catchError, sortBy } from '@utils'; import { DEFAULT_STYLE_MODE } from '@utils'; import { generateComponentBundles } from './component-bundles'; export function generateEntryModules(config: d.Config, buildCtx: d.BuildCtx) { // figure out how modules and components co...
81e86d9923774370dc40dac2b8917d8b1890afbf
TypeScript
martindavid/flask-nextjs-user-management-example
/client/services/users.ts
2.828125
3
import { Api } from "./api"; import { ApiResponse } from "apisauce"; import { GeneralApiProblem, getGeneralApiProblem } from "./api/api-problem"; import { User } from "./types"; export type GetUsersResult = { kind: "ok"; users: User[] } | GeneralApiProblem; export type GetUserResult = { kind: "ok"; user: User } | Gene...
f9683b94bb0029c98b5561a8948cbc06156df2e5
TypeScript
mnnnaleudes/enqueue
/src/services/Sender.ts
2.515625
3
import amqp = require('amqplib/callback_api'); class Sender { async create(queue: string, msg: string) { amqp.connect('amqp://localhost', function (error0, connection) { if (error0) { throw error0; } connection.createChannel(function (error1, channel) ...
f8aa4497da2d53338c94931ca1be1ebbe445f8cd
TypeScript
CSCI-40500-77100-Spring-2021/project-10__backend
/cdk/src/util/resource.ts
2.515625
3
import AppStage from '../constant/app_stage'; export const resourceName = ( resource: string, stage: AppStage, ) : string => { const base = `${resource}-${stage}`; if (stage !== AppStage.Prod) return `${base}-${process.env.USER}`; return base; }; resourceName('abc', AppStage.Prod);
273c8c4c67d8973198bd3630268a58284f26a06f
TypeScript
tuzmusic/game-of-life
/src/app.ts
3.453125
3
console.log('Hello world!!! blah'); export function testFunc() { return 42; } export interface Cell { isAlive: boolean; row: number; column: number; } export type Board = Cell[][] export class Game { board: Board; constructor(board: Board) { this.board = board; } findCellAt(_row: number, _...
397b7751282b609b2d08899bf7b3bbf0757bd71d
TypeScript
kittylabsbsc/nft-hooks
/src/hooks/useXNFT.ts
2.625
3
import { useContext } from 'react'; import useSWR from 'swr'; import { NFTFetchContext } from '../context/NFTFetchContext'; import { addAuctionInformation } from '../fetcher/TransformFetchResults'; import { getCurrenciesInUse } from '../fetcher/ExtractResultData'; import { XNFTDataType, XNFTMediaDataType } from '../fe...
5f9a859511621d40db13683a0d84da609a65d5ed
TypeScript
Tecnology73/idt-discord-bot
/Util/Random.ts
2.625
3
const random = require('random'); const seedrandom = require('seedrandom'); export const getRandomInstance = () => { random.use(seedrandom( require('crypto').randomBytes(10).toString('hex') )); return random; }; export const getRandomInt = (min: number, max: number) => { return getRandomInstance().int(min...
43401563481566dd32f6eaaefe20f80e8c1649cc
TypeScript
christophgysin/aws-sdk-js-v3
/packages/signature-v4/src/credentialDerivation.spec.ts
2.59375
3
import { Sha256 } from "@aws-crypto/sha256-js"; import { Credentials } from "@aws-sdk/types"; import { toHex } from "@aws-sdk/util-hex-encoding"; import { clearCredentialCache, createScope, getSigningKey } from "./credentialDerivation"; describe("createScope", () => { it("should create a scoped identifier for the c...
1c2efa8dec6fbf18cfe2e823945fde170cbc061b
TypeScript
jasemabeed114/ddd-demo
/src/modules/orders/useCases/bargain/getBargainList/getBargainListUseCase.ts
2.515625
3
import { Either, Result, right, left } from '../../../../../shared/core/Result' import { AppError } from '../../../../../shared/core/AppError' import { UseCase } from '../../../../../shared/core/UseCase' import { Bargain } from '../../../domain/bargain' import { IBargainRepo } from '../../../repos/bargainRepo' imp...
932883851fbd1432b9df2ea7de6c5bd83633424b
TypeScript
JamesPinson/nodebucket
/src/app/shared/models/employee.interface.ts
3.09375
3
/** * Title: employee.interface.ts * Author: Richard Krasso * Modified By: James Pinson * Date: 28 August 2021 * Description: This is our employee interface which is created for reusability. */ //This is our import statements. import { Item } from './item.interface'; //This exports our employee interface which ...
37fef1ec5e0d8cfe4a9318e012b5f456419bc265
TypeScript
nodefluent/kafka-streams
/src/lib/StorageMerger.ts
3.28125
3
/** * static class, that helps with merging * KStorages (e.g. joining two KTables) */ export class StorageMerger { /** * merges the content of multiple storages * if keys have the same name, the later storage * will overwrite the value * @param storages * @returns {Promise.<{State}>} ...
ee0babcb41e2f439781e13d087ff1f7833d22cb4
TypeScript
mddr/taiga-ui
/projects/demo/src/modules/components/input-phone/examples/3/index.ts
2.515625
3
import {default as avatar} from '!!file-loader!../../../../../assets/images/avatar.jpg'; import {Component} from '@angular/core'; import {TUI_DEFAULT_MATCHER, tuiPure} from '@taiga-ui/cdk'; import {combineLatest, merge, Observable, of, Subject} from 'rxjs'; import {map, share, startWith, switchMap, tap} from 'rxjs/oper...
9119fd9089481ae1f035d7f3690a6ba08c26a715
TypeScript
hzjjg/canvas_snow
/src/snow.ts
2.96875
3
import SnowPic from './snow_pic'; /** * 下雪效果 */ export default class Snow { private container: HTMLElement; private options: SnowOptions; private defaultOption: SnowOptions = { container: null, stopWhenVisibilityChange: true, quantity: 5, speed: 5, }; private canvas: HTMLCa...
3d47519ec87d3f7c9729de90b78525fb443ff110
TypeScript
bal3000/React-Redux
/src/redux/actions/author.actions.ts
2.53125
3
import { ThunkAction } from "redux-thunk"; import { Action } from "redux"; import * as authorApi from "../../api/authorApi"; import { AuthorActionTypes, LOAD_AUTHOR_SUCCESS } from "../types/author.types"; import { AppState } from "../configure.store"; import { Author } from "../../models/author.interface"; import { beg...
8043b9c78a3083e2a8a3823dfdbfc8bdd00d7eb3
TypeScript
geostyler/geostyler-data
/index.d.ts
2.96875
3
// Type definitions for GeoStyler Data Models // Project: https://github.com/geostyler/geostyler // Definitions by: Christian Mayer <https://github.com/chrismayer> // Definitions: // TypeScript Version: 3.3.3 import { FeatureCollection, Geometry } from 'geojson'; import { JSONSchema4TypeName } from 'json-schema'; /**...
9dc2bd27a7a614a053c6fb0371d51df8eeea1a98
TypeScript
ViktorSlavov/schematic-component-example
/src/component/schema.ts
2.609375
3
export interface ComponentOptions { // The type of the component (currently, only card) type: string; // The name of the component. name: string; }
45d4900e9906b553bec30ec65cac8275c981a040
TypeScript
CCBaxter84/EU-Books
/src/models/userVerification.ts
2.84375
3
// Import dependencies import { Schema, Document, model, Model } from "mongoose"; import User, { IUser } from "./user"; // Define and export interface derived from mongoose Document export interface IUserVerification extends Document { user: Schema.Types.ObjectId, token: string } // Define schema const userVerifi...
f61522b7c9f47ce2c4c3a8df58756b34a85085b3
TypeScript
2006NodeDev/project-0-ABlanton3
/hitchhiker_reimbursement/src/routers/user-router.ts
2.765625
3
import express, {Request, Response, NextFunction} from 'express' //import {User} from '../models/User' import {authenticationMiddleware} from '../middleware/authentication-middleware' import {authorizationMiddleware} from '../middleware/authorization-middleware' import { getAllUsers, getUserById, updateUser } from '../...
d21b0054c7eb36cb0b30c0b1571a76548b8205b9
TypeScript
andrewphoy/DgtWebSerial
/src/serial.ts
2.703125
3
import MessageReader from "./messageReader"; import * as Utils from "./utils"; import { SerialNumberMessage } from "./messages/serialNumberMessage"; export default class { private _port!: SerialPort; private reader: MessageReader; private _attemptingConnect: boolean = false; private _cbConn...
db1faa9fdda048a22afb26104896a8c83fcb5d79
TypeScript
BuzzDyne/Hacktiv8-assignment06
/src/app/utils/Utils.ts
2.75
3
export function isEmailExistErrorMsg(text: string): boolean { let regex = new RegExp("User with the email '[^']*' already exists") return regex.test(text) }
95f329a39de9320187f78583f6717b9c9b442d3d
TypeScript
ovidubya/weatherapp-vue
/src/api/apixu.ts
2.921875
3
export default class apixu { /** * Fields */ private API_KEY: string; private CURRENT_JSON: string; private FORECAST_JSON: string; private LOCATION: string; constructor(key) { this.API_KEY = key; this.CURRENT_JSON = `${location.protocol}//api.apixu.com/v1/current.json...
940987865774cba11536fc11eae8efd13b141aa9
TypeScript
LorenzHenk/aoc2019
/src/days/day01/calc.ts
3.09375
3
export const calculateFuel = (mass: number) => Math.floor(mass / 3) - 2; export const calculateFuelWithFuel = (mass: number) => { let totalFuel = 0; let currentMass = mass; while (true) { const currentFuel = calculateFuel(currentMass); if (currentFuel <= 0) { break; } totalFuel += currentFu...
276c2c94e3b8f9c0ff682d353faa4a4532f24f9a
TypeScript
techtic-brinda/node-js
/src/shared/validations/IsUserAlreadyExistValidator.ts
2.859375
3
import { ValidatorConstraint, ValidatorConstraintInterface, ValidationArguments, } from 'class-validator'; import { getRepository } from 'typeorm'; import { User } from 'src/modules/entity/user.entity'; /** * Check if user already registerd validator */ @ValidatorConstraint() export class IsUserAlreadyExist im...
4559490d4df9526edb4aa4b84d01658d3527239d
TypeScript
zaknafain/kings-duty
/src/app/events/event.service.ts
2.640625
3
import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; import { TimeEvent, NewcommerArrivingEvent, PeopleMovedEvent, PeopleGoneEvent } from './time-event'; import { TimeEventAction } from './time-event-action'; import { TileService } from '../map/tiles/tile.service'; import { TimeService }...
5f433945af5835ae0b6b70a6c3860af9807ff012
TypeScript
Tatiana-256/back-end-nestjs
/src/roles/roles.controller.ts
2.578125
3
import { Body, Controller, Get, Param, Post } from "@nestjs/common"; import { ApiOperation, ApiResponse, ApiTags } from "@nestjs/swagger"; import { UsersService } from "../users/users.service"; import { User } from "../users/users.model"; import { CreateUserDto } from "../users/dto/create-user.dto"; import { RolesServi...
0d72d811272f74b6ad582a290e6ae748cc155559
TypeScript
google/skia-buildbot
/ct/modules/suggest-input-sk/suggest-input-sk.ts
2.828125
3
/** * @module modules/suggest-input-sk * @description A custom element that implements regex and substring match * suggestions. These are selectable via click or up/down/enter. * * @attr {Boolean} accept-custom-value - Whether users can enter values not listed * in this.options. * * @event value-changed - Any t...
e3f5d25f0bb03621674f6e677048040bb3926bcd
TypeScript
Jblew/firestore-roles-redux-module
/src/module/actions/EpicActions.ts
2.71875
3
// tslint:disable class-name import { ThunkAction } from "../../thunk"; import { ContainingStoreState } from "../ContainingStoreState"; export interface EpicActions { initialize(): ThunkAction<Promise<EpicActions.InitializeAction>, ContainingStoreState>; logout(): ThunkAction<Promise<EpicActions.LogoutAction>,...
425ccdb484f3cbce323304126ce56dfa09910850
TypeScript
kseniasalabaeva/weathercast
/src/utils/index.ts
2.734375
3
export enum City { None = 'Select city', Samara = 'Samara', Togliatty = 'Togliatty', Saratov = 'Saratov', Kazan = 'Kazan', Krasnodar = 'Krasnodar' } export const Coordinates = { [City.None]: { lat: undefined, lon: undefined }, [City.Samara]: { lat: 53.19, lon: 50.10 }, [City.Togliatty]: { lat: 53.50,...
3024fdf5816dc82c62cae984b6a9a5d200b866c9
TypeScript
sorohan/graph-builder
/src/graph/GraphBuilder.ts
3.15625
3
import { AbstractGraphBuilder } from "./AbstractGraphBuilder"; import { Graph } from "./Graph"; import { ElementOrder } from "./ElementOrder"; import { MutableGraph } from "./MutableGraph"; import { ConfigurableMutableGraph } from "./ConfigurableMutableGraph"; /* * Copyright (C) 2016 The Guava Authors * * Licensed ...
2dce964b4c59088519fb215bd164ef56d76def4c
TypeScript
thomastoye/typesaurus
/src/subcollection/index.ts
3.390625
3
import { Ref } from '../ref' import { Collection, collection } from '../collection' /** * The subcollection function type. */ export type Subcollection<RefModel, CollectionModel> = ( ref: Ref<RefModel> | string ) => Collection<CollectionModel> /** * Creates a subcollection function which accepts parent document ...
ea30c70b4b4996adfa12cffe40e7240eccb7d26a
TypeScript
wenyejie/utils
/src/dayStart.ts
2.75
3
/** * 返回一天的开始 * @param date 时间 */ export const dayStart = (date: Date) => { date.setHours(0, 0, 0, 0) return date } export default dayStart
5d3db3634d9e07b2b2b24291a6fef72972320d40
TypeScript
Nietzsche-dev/test
/src/app/services/article.service.ts
2.515625
3
import { Injectable } from '@angular/core'; import {Article} from '../models/article'; import {Observable, throwError} from 'rxjs/index'; import {HttpClient, HttpHeaders} from '@angular/common/http'; import {catchError, retry} from 'rxjs/internal/operators'; @Injectable({ providedIn: 'root' }) export class ArticleSe...
d3a245044eeece56e85e33bba4e8aa2fdc64f6a9
TypeScript
capricorn86/happy-dom
/packages/happy-dom/test/tree-walker/NodeIterator.test.ts
2.84375
3
import Window from '../../src/window/Window.js'; import IWindow from '../../src/window/IWindow.js'; import IDocument from '../../src/nodes/document/IDocument.js'; import NodeFilter from '../../src/tree-walker/NodeFilter.js'; import Element from '../../src/nodes/element/Element.js'; import Comment from '../../src/nodes/...
71ea805d73811bcabe19cf0a727e2dd877086302
TypeScript
feljx/mandelbrot-web
/src/app/throttle.ts
3.03125
3
// Throttle. function throttle(func: Function, limit: number) { // @ts-ignore let inThrottle: NodeJS.Timeout | boolean return function (...args: any[]) { if (!inThrottle) { func(...args) inThrottle = setTimeout(() => (inThrottle = false), limit) } } } export default throttle
c4707d7a7455368b088897bbe02d1a10e6b892d5
TypeScript
nadermedhet148/contract-generator
/backend/src/Infrastructure/HTTP/Controllers/ContractController.ts
2.515625
3
import { createConnection, getConnection } from "typeorm"; import PdfManger from "../../../Domain/Helpers/PdfManger"; import ContractService from "../../../Domain/Services/ContractSerivce"; import { establishConnection } from "../../Database/connection/GetConnection"; import ContractRepository from "../../Database/Repo...
1ecdea460ed0c825a39049854fed97d05f949aca
TypeScript
Loksli17/diploma
/client/src/canvas/shapes/Bezier.ts
2.90625
3
import Shape from "./Shape"; import Point from '../Point'; export default class Bezier extends Shape{ public width: number = 1; constructor(points: Array<Point>, userId: number, color: string, width: number){ super(`Bezier${++Bezier.countNumber}`, userId, color); this.points = points.slice(...
838492b25391e6dbf0a6f7dcf60fa3f305f8912e
TypeScript
marsch/hyperhyperspace-core
/src/crypto/ciphers/JSEncryptRSA.ts
2.5625
3
//import { JSEncrypt } from 'jsencrypt'; import { SHA, SHAImpl } from '../hashing'; import { RSA } from './RSA'; // dummy objects for JSEncrypt let fixNavigator = false; if ((global as any).navigator === undefined) { (global as any).navigator = {appName: 'nodejs'}; fixNavigator = true; } let fixWindow = fal...
7133f786b5fa2790f3a67bee67594ffcae3e91eb
TypeScript
idewindy/yozora
/packages/core-tokenizer/src/types/phrasing-content.ts
2.890625
3
import type { YastNode } from '@yozora/ast' import type { NodeInterval, NodePoint } from '@yozora/character' import type { YastBlockToken } from './token' /** * typeof PhrasingContent */ export const PhrasingContentType = 'phrasingContent' // eslint-disable-next-line @typescript-eslint/no-redeclare export type Phras...
66edb64c15f077c6c7bbf352cb7ff5b9f1560b7d
TypeScript
NetroScript/rezeptinator
/server/ingredient/nutrient.entity.ts
2.546875
3
import { INutrients } from '@common/Model/Ingredient'; import { ApiHideProperty } from '@nestjs/swagger'; import { Exclude } from 'class-transformer'; import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; @Entity('nutrient') export class NutrientEntity implements INutrients { @Exclude() @PrimaryGenerat...
62ad33e3a8bd7275c52ec4ac90e9418ba5b7d4c4
TypeScript
VladThePaler/screeps-typescript-starter
/src/Api/Spawn.Api.ts
2.59375
3
import { SpawnHelper } from "Helpers/SpawnHelper"; import UtilHelper from "Helpers/UtilHelper"; import { domesticRolePriority, militaryRolePriority, remoteRolePriority, ROLE_REMOTE_MINER, ROLE_REMOTE_RESERVER, GROUPED, COLLATED } from "utils/Constants"; import MemoryHelperRoom from "../Helpe...
b5b11812efc6962d4b7b4fde3b1795b5c5a6daf2
TypeScript
getunid/unid-node-wallet-sdk
/src/utils/datetime.ts
3.21875
3
import moment, { Moment } from 'moment' /** */ enum DateTimeTypes { default = 'YYYY-MM-DDTHH:mm:ss[Z]', iso8601 = 'YYYY-MM-DDTHH:mm:ss.SSSSSS[Z]', } /** */ class DateTimeUtils { /** */ private datetime: Date | undefined /** * @param input */ constructor(input: string | undef...
85b765de16256c433271a2f0a60821f439388de6
TypeScript
Vastlaan/ugorala
/admin/validations/index.ts
2.84375
3
export function validateMimeTypeMulter(file, cb) { // Allowed ext const filetypes = /jpeg|jpg|png|gif/; // Check mime const mimetype = filetypes.test(file.mimetype); if (mimetype) { return cb(null, true); } else { cb({ error: "You can upload images only!" }); } }
470e738a972fc3fd13b2a43b580bae205ddd92a0
TypeScript
emrecavunt/prisma-examples
/misc/react-graphql-fullstack/frontend/src/generated/types.ts
2.765625
3
export type Maybe<T> = T | null; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string, String: string, Boolean: boolean, Int: number, Float: number, DateTime: any, }; export type BooleanFilter = { equals?: Maybe<Scalars['Boolean']>, not?: Maybe<Scalar...
dbb4977c77e63ff2259dec335b1e4de46783498b
TypeScript
filimon-danopoulos/wizard-sheet
/src/model/bases/Brewery.ts
2.71875
3
import Character from '../Character' import Base from './Base' export default class Brewery extends Base { public name: string = 'Brewery' public description: string = 'There is still some life left in those old casks, and the warband takes full advantage. All soldiers hired by the warband cost 5gc less than t...
64d6e564f314b6fb087b3d88537d57d729a0e309
TypeScript
o-su/warplanes
/src/components/player.ts
2.921875
3
import { Plane } from "./plane"; import { Projectile } from "./projectile"; import { Point, ProjectileSource } from "../types"; export type PlayerConfiguration = { sprite: HTMLImageElement; width: number; height: number; gunPositions: Point[]; spriteProjectile: HTMLImageElement; }; export class Pl...
1e27f085150e3910a1e0f3b3cd5d78dcf2631175
TypeScript
ravindudiaz/CompInt
/src/app/child/child.component.ts
2.53125
3
import { Component, Input, OnChanges, OnInit, SimpleChanges, EventEmitter, Output } from '@angular/core'; import { InteractionService } from '../interaction.service'; @Component({ selector: 'app-child', templateUrl: './child.component.html', styleUrls: ['./child.component.css'] }) export class ChildComponent im...
117d347b29ede78dbe7390f84a909c0fa3989e2b
TypeScript
kimlimjustin/xplorer
/src/Components/Functions/path/joinPath.ts
3.5625
4
/** * Join multiple path into a string. * @param {string[]} ...args paths * @returns {string} */ const joinPath = (...args: string[]): string => { if (args.length === 0) return '.'; let joined; for (let i = 0; i < args.length; i++) { const arg = args[i]; if (arg.length > 0) { if (joined === undefined) joi...
7d884903d986edd76be4aec5a2cd7046ce11b374
TypeScript
djabraham/vscode-yaml-validation
/server/src/yaml/common.ts
2.71875
3
'use strict'; // Source code is substantially from these repositories // https://github.com/mulesoft-labs/yaml-ast-parser // https://github.com/nodeca/js-yaml export function isNothing(subject) { return (typeof subject === 'undefined') || (null === subject); } export function isObject(subject) { return (typeof s...
6bb996a9a2a8e49f4e68af7c0769afd6d198b909
TypeScript
gameless/babel-forest
/app/octopus.ts
2.71875
3
/// <reference path="../node_modules/phaser/types/phaser.d.ts" /> import * as MatterJS from 'matter-js'; // @ts-ignore: Property 'Matter' does not exist on type 'typeof Matter'. const Matter: typeof MatterJS = Phaser.Physics.Matter.Matter; import * as _ from 'underscore'; import * as color from './color'; import * a...
d58e1dcb7d30f89a9de142977c1d7b74d04ecc35
TypeScript
uu-cubitt/graph
/src/NodeElement.ts
2.953125
3
import {ElementType} from "./ElementType"; import {AbstractElement} from "./AbstractElement"; import {Graph} from "./Graph"; /** * Element representing a true higher-level Node in the graph, see documentation for more information */ export class NodeElement extends AbstractElement { /** * @inheritdoc */ publi...
d170fe06bad5e981cc59c4214a17ef04cdb9d926
TypeScript
MichalKoszalka/front-end-development-ug
/lab6-homework/src/Dog.ts
3.46875
3
import { Breed } from "./Breed"; export class Dog { public startWeight: number; public exp: number; public intelligence: number; constructor(public name: string, public breed: Breed, public weight: number, public height: number) { this.name = name; this.breed = breed; this.weigh...
10642537719cc3b44034f33b2716892f391aa1b8
TypeScript
lineCode/redis-om-node
/spec/functional/core/update-hash.spec.ts
2.703125
3
import { fetchHashKeys, fetchHashFields, keyExists } from '../helpers/redis-helper'; import { HashEntity, AN_ENTITY, createHashEntitySchema, loadTestHash, ANOTHER_ENTITY } from '../helpers/data-helper'; import Client from '../../../lib/client'; import Schema from '../../../lib/schema/schema'; import Repository from '....
a683ac2a6b8b83e8ef291f14cc33dac980284c59
TypeScript
malufell/react-avancado-client
/src/components/Menu/styles.ts
2.609375
3
import styled, { css } from 'styled-components' import media from 'styled-media-query' export const Wrapper = styled.menu` ${({ theme }) => css` display: flex; align-items: center; padding: ${theme.spacings.small} 0; position: relative; //isso é pra logo ficar absoluta em relação ao menu `} ` expo...
7e584bc05171357045a96f0a9f883280a5ff657b
TypeScript
blindmonkey/programming-challenge
/src/renderable/shapes/pixi-rect.ts
3.359375
3
/** * The rendering parameters of a PIXIRect. */ type PIXIRectRenderingParameters = { // The width and height of the rectangle. width: number, height: number, // The radius of the corners, or 0. cornerRadius: number, // The fill color as a number. i.e. 0xFF0000 for red. fillColor: number, ...
de4b33f07144f4d947f62b948a31c3a75491f29f
TypeScript
luccasbarros/LAMA
/src/controller/BandController.ts
2.71875
3
import { Request, Response } from "express"; import { BandInputDTO } from "../model/Band"; import BandBusiness from "../business/BandBusiness"; import BandDatabase from "../data/BandDatabase"; class UserController { public createBand = async (req: Request, res: Response) => { try { const token: string = re...
291d6425e0a59f18486711f1ce617b95f7b627fb
TypeScript
esimpsontheartist/gp-ui
/src/hooks/useOperatorTrades.ts
2.65625
3
import { getTrades, Order, Trade } from 'api/operator' import { useCallback, useEffect, useState } from 'react' import { useNetworkId } from 'state/network' import { Network } from 'types' import { transformTrade } from 'utils' type Params = { owner?: string orderId?: string } type Result = { trades: Trade[] ...
426a6cb6ab429cc62cd95847e593a4cd74d63e89
TypeScript
RedBlazerFlame/conways-game-of-life
/scripts/map-to-grid-converter.ts
2.9375
3
import { CellularAutomatonTypes, String2d } from "./cellular-automaton.js"; import { Grid2d } from "./grid.js"; import { CompositionState, CompositionStateArray } from "./state.js"; import { Vector } from "./vector.js"; export const convertMapToGrid2d = (gridState: CellularAutomatonTypes.State): Grid2d => { let gr...
95504d9ce532f30e664e6470256e5b0de32d0cd2
TypeScript
mhshifat/graphql-faker
/src/Base.ts
2.546875
3
import * as path from "path"; import { log } from "./fake-schema/utils"; export class Base { config: any; log: (...args) => void; constructor(config) { this.config = config; if (this.isEnabled("logging")) { config.log = config.log || log; } this.log = config.log; } error(msg, data?) {...
a3117fb6f87d5ccef3d7682cce1725e65ff5c80a
TypeScript
dkds/assignment-1-auto-club
/frontend/src/app/core/model/car-make.model.ts
3.140625
3
export class CarMake { static fromObject(carMake: any): CarMake { if (!carMake.id || !carMake.name) { throw new Error("Invalid object, needs id and name"); } const obj = new CarMake(carMake.name); obj.id = carMake.id return obj; } id: number = 0; con...
ec4c261a3e07b4d28d9674bdd525c9d07234afe1
TypeScript
awbraunstein/segmented-searchbox
/src/index.ts
3.453125
3
interface LookupValue { color: string; data: string; ignoreCase: boolean; } interface ReverseLookupValue { color: string; text: string; } class Searchbox { private _el: HTMLInputElement; private _lookup: { [text: string]: LookupValue; } = {}; // This is the container that will contain our searchbox...
60985729cfbaf9a00e6a7155088cb8fb48eddf77
TypeScript
Murreey/GuessTheMovieBot
/src/scores/ScoreFlairManager.ts
2.84375
3
import { Logger } from '../Logger' import { RedditBot } from '../RedditBot' import { ScoreManager } from '../types' const thresholds: [number, string][] = [ [1, '#7EFF7B'], [5, '#68B4E7'], [10, '#FFE47B'], [20, '#FFBC7B'], [50, '#7B9BFF'], [100, '#C07BFF'], [200, '#FF7BD0'], [500, '#FF7B85'], [1000, '#FFDA7B'], ...
a7ed05561a7dc188ca84c48b5493de8e7500bec8
TypeScript
tboothman/satisfactory_simulator
/src/frontend/items.ts
3.265625
3
// A thing that goes on the grid import {connect, Conveyor, Input, Merger, Output, Sink, Source, Splitter} from "../index"; export const enum GridItemType { Source = "Source", Sink = "Sink", Merger = "Merger", Splitter = "Splitter" } export class PlaceableItem { public description: string = ""; ...
879b90c97a1ccb7124e2dd9e9d0de1d0c648c729
TypeScript
Muhitori/Shop
/apps/server/src/database/migrations/20201220orderedProduct.migration.ts
2.609375
3
import { MigrationInterface, QueryRunner, Table, TableForeignKey } from 'typeorm' import { User } from '../../entities/user.entity' // eslint-disable-next-line prettier/prettier export class OrderedProductMigration20201220235639 implements MigrationInterface { private tableName = 'OrderedProducts' async up...
fe8662c493ac30d0629021a43fbd6f2082dc23f3
TypeScript
ebagos/typescript
/src/p010.ts
3.84375
4
/* 10以下の素数の和は 2 + 3 + 5 + 7 = 17 である. 200万以下の全ての素数の和を求めよ. */ function makePrimeList(num: number): number[] { let result: number[] = []; if (num < 2) { return result; } let primeList: number[] = []; for (let i: number = 0; i < num + 1; i++) { primeList[i] = i; } primeList[1] ...
5f1c518cedad97564e30a2029307a5c821878d90
TypeScript
ChanScen/cocos-game-framework
/assets/script/game/TColor.ts
2.53125
3
import { FColor } from "../framework/FColor"; const { ccclass, property } = cc._decorator; /** * 颜色工具 * - 不在 onLoad 中执行,因为只有一个颜色配置文件,所以在编辑器中操作保证所见即所得。 * - 如果未来有多个颜色配置文件,则需要同 FText 一样。 */ @ccclass export class TColor extends cc.Component { @property({ tooltip: "颜色字符串" }) private key: string = "none" ...
f2199728c5a5a1f11042a2b51f06b2ee4caa32ee
TypeScript
SuviVappula/tilavarauspalvelu-ui
/ui/modules/util.test.ts
2.734375
3
import { ApplicationEventSchedule, Cell, DAY } from "./types"; import { cellsToApplicationEventSchedules, applicationEventSchedulesToCells, applicationRoundState, } from "./util"; jest.mock("next/config", () => () => ({ serverRuntimeConfig: {}, publicRuntimeConfig: {}, })); const cell = (hour: number, state...
3eee91e5fb19cbe073957b032e330e2897c623e8
TypeScript
mikemountjoy/open-source-design-system
/src/brandColours.ts
2.71875
3
export const colourPalette = { examplePalette: { primary: { main: { hex: "#A42824", RGB: "164,40,36", on: "#FFFFFF", }, light: { hex: "#DA342F", RGB: "218,52,47", on: "#FFFFFF", }, dark: { hex: "#661614", RGB: "102,22,20...
b9173fb088e6a1fe0dab2be827faa0202d4d2dbb
TypeScript
stormherz/vscode-jumpy
/src/jumpy-positions.ts
3.15625
3
export interface JumpyPosition { line: number; character: number; charOffset: number; } export interface JumpyFn { (maxDecorations: number, firstLineNumber: number, lines: string[], regexp: RegExp): JumpyPosition[] } export function jumpyWord(maxDecorations: number, firstLineNumber: number, lines: str...
880c585cfbfcdb96dcf2e1b81635319a0df7ad1f
TypeScript
frenebo/ts_canvas
/client/app/scripts/view/graphicWrappers/edgeWrapper.ts
3.1875
3
import { GraphicWrapper } from "./graphicWrapper.js"; import { PortWrapper } from "./portWrapper.js"; import { VertexWrapper } from "./vertexWrapper.js"; /** Class for containing a graph edge's PIXI graphic */ export class EdgeWrapper extends GraphicWrapper { private static readonly spriteLeftRightPadding = 25; pr...
c355ed67065f46928cdaa753557b68013ade9acf
TypeScript
Kyappy/Tour-of-Heroes
/src/app/components/hero-search/hero-search.component.ts
2.609375
3
import {Component, Input, OnInit} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {debounceTime, distinctUntilChanged, switchMap} from 'rxjs/operators'; import {Subject} from 'rxjs/Subject'; import {HeroService} from '../../services/hero.service'; import {Hero} from '../../supports/hero'; /** ...
0aa3f074090aba7803076515e10036fd3baaebef
TypeScript
pinguet62/indicative-rules
/src/raw/array.ts
3.265625
3
/** * @module indicative-rules */ /* * indicative-rules * * (c) Harminder Virk <virk@adonisjs.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * Returns a boolean telling, if value is an array or not. * * @example * ``` *...
4b385f71c9229aff0a921b469f9a8eb01e05e52a
TypeScript
lpubsppop01/local-note-app
/src/main/directory-utility.ts
2.90625
3
import * as fs from "fs"; import * as path from "path"; export default class DirectoryUtility { static mkdirPSync(dirPath: string) { const tokens = dirPath.split(/\/|\\/); const buf = [] for (let i = 0; i < tokens.length; ++i) { buf.push(tokens[i]); const bufPath = buf.join("/"); ...
dfa15d444302b9b3c4d6c60f1288c9dc25e89175
TypeScript
Aareksio/zombie-net
/src/resolvers/item.resolver.spec.ts
2.734375
3
import 'mocha'; import { expect } from 'chai'; import { ItemResolver } from './item.resolver'; function createFakeItemRepository() { const items = [{ id: 1 }, { id: 2 }]; return { findOne: id => items.find(item => item.id === id), find: () => items } } describe('ItemResolver', () => { let itemResolv...