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
672e754dd27ce40dae61edf7b0f1787d0d3daf2d
TypeScript
chickenLeobar/gymapp
/manzana/src/modules/comments/entitites/Interaction.ts
2.6875
3
import { User } from "./../../../entity/User"; import { BaseEntity, Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn, } from "typeorm"; import { ObjectType, Field, Int, ID } from "type-graphql"; import { InteractionType } from "../types/model"; import { Comment ...
5cd7f10c82042dc4935a9a03fbf9d84a6ca269b1
TypeScript
33mhz/beta
/__tests__/components/Avatar.spec.ts
2.5625
3
import { shallowMount } from '@vue/test-utils' import Avatar from '~/components/atoms/Avatar.vue' describe('Avatar', () => { let opts: { propsData: { avatar: | string | { link: string } size?: number enablePlaceholder?: boolean maxSize?: number | stri...
13ccbd5364ab46d0ae658be57356665f17940f5a
TypeScript
ColquePaxi/nestJS
/src/modules/users/dto/user.dto.ts
2.59375
3
enum Gender { MALE = 'male', FEMALE = 'female', } export class UserDto { readonly name: string; readonly email: string; readonly password: string; readonly gender: Gender; }
2a72a4affab4c70039a55f98a27fe34e81befee6
TypeScript
amacz13/4A-IPS-24hApp
/src/logic/game-flow.ts
2.640625
3
import {Injectable} from '@angular/core'; import 'rxjs/add/operator/map'; import {Question} from "./question"; import {HttpClient} from "@angular/common/http"; import {Quiz} from "./quiz"; @Injectable() export class GameFlow { quizInfo: Quiz; questionsDone: Array<number>; constructor(public http: HttpClient) ...
20c2a792bc7db5ff19125e9076e277760b5a6445
TypeScript
MattAgn/react-native-testing-library
/src/__tests__/config.test.ts
2.546875
3
import { getConfig, configure, resetToDefaults } from '../config'; beforeEach(() => { resetToDefaults(); }); test('getConfig() returns existing configuration', () => { expect(getConfig().asyncUtilTimeout).toEqual(1000); }); test('configure() overrides existing config values', () => { configure({ asyncUtilTimeo...
9738836b624c64c2da1a9687ecfc08ab62bb8ebb
TypeScript
AlexShan2008/lerna-repo
/packages/object-helpers/src/object-helpers.ts
2.8125
3
export class ObjectHelpers { // TODO public static getKeys(obj) { return Object.keys(obj); } public static getValues(obj) { return Object.values(obj); } }
51761e15bab633d1da2f88a2808f8002baafbe11
TypeScript
csiszaralex/Lotto
/src/Content.ts
2.515625
3
import fs from "fs"; import http from "http"; import url from "url"; import Megoldas from "./Megoldas"; export default class Content { public content(req: http.IncomingMessage, res: http.ServerResponse): void { // favicon.ico kérés kiszolgálása: if (req.url === "/favicon.ico") { res.wr...
f58ba65f43066fdb1fdb1f33263be9e56199eaae
TypeScript
Chris3y/carbon
/src/components/flat-table/flat-table-header/flat-table-header.d.ts
2.671875
3
import * as React from "react"; import { PaddingProps } from "styled-system"; import { TableBorderSize } from ".."; export interface FlatTableHeaderProps extends PaddingProps { /** Content alignment */ align?: "left" | "center" | "right"; /** If true sets alternative background color */ alternativeBgColor?: b...
71a9e306e3d08a9d4cc5d82e09987a5db14bc2c2
TypeScript
vijaysinghkadam/algo-viz
/runners/js/builtins/tests/btree.test.ts
2.953125
3
import 'mocha' import expect from 'expect' import instantiateViz from '../src'; const Viz = instantiateViz() describe('Binary Tree', () => { describe('create', () => { it('breadth', () => { const elems = [1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] const btree = Viz.BTree...
536051083245fcd1c8e95a23d6cbf7ab5039c1bf
TypeScript
dsasu1/prahsApp-Customers
/src/app/customers/stores/customer.reducer.ts
2.53125
3
import { createReducer, on } from '@ngrx/store'; import { Customer } from '../models/customer.model'; import { EntityState, EntityAdapter, createEntityAdapter } from '@ngrx/entity'; import { customerActionTypes, customersLoaded } from './customer.action'; export interface CustomerState extends EntityState<Customer> { ...
409e06933d0a7c0f7d18dc1aa80972cc2024d0ac
TypeScript
matudelatower/evenprom-ionic
/src/directives/comment-text.ts
2.546875
3
import { Component, Input } from '@angular/core'; @Component({ selector: 'comment-text', template: '<p [ngClass]="clase" (click)="expandedText();">{{text}}</p>', }) export class CommentText { @Input() text: string ; expanded = false; clase = 'white-space-nowrap'; constructor() { } ...
1f2231b3cd84a0e87e8da3154f89749515ec37df
TypeScript
johngrantuk/sor-test
/src/utils/bignumber.ts
2.65625
3
import { BigNumber } from 'bignumber.js'; BigNumber.config({ EXPONENTIAL_AT: [-100, 100], ROUNDING_MODE: 1, DECIMAL_PLACES: 18, }); export { BigNumber }; export function bnum(val: string | number | BigNumber): BigNumber { return new BigNumber(val.toString()); } export function scale(input: BigNumber,...
b7657ca21ce956b510af8107e95ce3085492a009
TypeScript
clownShewz/Pomodoro
/src/app/task/models/task.ts
3.359375
3
export class task{ taskId : number; taskName :string; taskStartTime : any; taskEndTime : any; timeSpent : any; completed : boolean; constructor(name:string){ this.taskName = name; this.completed = false; this.setTaskTime('START'); } setTaskTime(type : string...
dd727de36c38b4b5f2459ca6db03466c6271228d
TypeScript
kimkanu/github-readme-solvedac
/src/types/index.ts
2.90625
3
interface Organization { organizationId: number; name: string; type: 'community' | 'university' | 'company' | 'high_school'; rating: number; userCount: number; voteCount: number; solvedCount: number; color: string; } interface Badge { badgeId: string; badgeImageUrl: string; displayName: string; ...
3fee2168957091851dbed2914bd6de4c909a676e
TypeScript
AlexanderDLe/TypeScript_DataStructuresAndAlgorithms
/src/TreeDFS/PathSum3.ts
3.84375
4
/** * 437. Path Sum 3 * * targetSum = 8 * * 2 > 10 > 3 > 5 > 4 * * 2 > 12 > 15 > 20 > 24 * * 2: 1 ^-- In this example, we should know there is a valid path (3 + 5 = 8) * 12: 1 At value 20, a valid path sum exists if there exists on the outerpath, * 15: 1 a sum of 2...
43a3e59d19e887f80a312139895df4d7e5311afe
TypeScript
LeoYulinLi/match-making
/src/app.ts
2.84375
3
import * as io from "socket.io"; import mongoose from "mongoose"; import keys from "./keys/keys"; import User from "./models/User"; const server = io.listen(process.env.PORT || 3000) if (keys.mongoURI) { mongoose .connect(keys.mongoURI, { useNewUrlParser: true }) .then(() => console.log("Connected to MongoD...
3cebf35f677934982b980932f4836c5ae105a01d
TypeScript
RedBlazerFlame/hertzsprung-russell-diagram-WS22-exercise
/scripts/constants.ts
3.0625
3
import { RGBColor, SpectralLetterType, SpectralStringType, uint8 } from "./types"; // Returns an RGB color (copied and pasted from methods.ts to prevent a Reference Error from occuring) const rgb = (r: uint8, g: uint8, b: uint8): RGBColor => ({ r: r, g: g, b: b }); // Maps a spectral letter type to a numb...
4387b0be65d4f14f0d1f004d624ae112ab054499
TypeScript
Pedroh1510/encurtador-url
/src/repositories/implementations/TypeOrmUrlRepository.ts
2.546875
3
import { getConnection } from 'typeorm' import { Urls } from './../../entities/implementations/TypeOrmUrl' import { Url } from './../../entities/Url' import { IUrlRepository } from './../IUrlRepository' export class TypeOrmUrlRepository implements IUrlRepository { async findUrl (smallUrl:string):Promise<Url> { ...
744c31cf16300eb73ca86d334f355c7d8426f3f0
TypeScript
Basuchi/angualr
/basics.ts
3.765625
4
function test(){ var xx:number = 100; var str:string = "ABC"; var b:boolean=false; var x:any=123.4; console.info(typeof(xx)); console.info(typeof(str)); console.info(typeof(b)); console.info(typeof(x)); } //function with arguments function display(aa:number,bb:number){ //return (x+y); console.info(a...
e312659693819871609d7f5fbeabd40db9f77a12
TypeScript
tabithagabeau/PRSAngular
/src/app/model/purchaserequest.ts
2.546875
3
import { User } from './user'; export class PurchaseRequest { Id: number; User: User; UserName: string; Description: string; Justification: string; DateNeeded: Date; DeliveryMode: string; Status: string; Total: number; SubmittedDate: Date; ReasonForRejection: st...
645d2aa3a5317f1a6141e2034992ff4b3ba89a26
TypeScript
kritzware/monzo
/src/http.ts
2.71875
3
import https from "https" import { OutgoingHttpHeaders } from "http" import { ClientOptions } from "./types" const MONZO_BASE_URL = "api.monzo.com" interface QueryParams { [header: string]: string | number } export default class HttpClient { private readonly options: ClientOptions constructor(options: Clien...
92997afe60b9070b8ca855c11287425b4efd2a69
TypeScript
ppjmpd/cyrilla
/src/rulesGenerator.ts
3.046875
3
import { Rules } from './lang/rules'; interface MultiplyOptions { from: string; to: string; onStart?: boolean; onEnd?: boolean; before?: (string | Rules)[]; after?: (string | Rules)[]; } interface CreateOptions { onStart?: boolean; onEnd?: boolean; before?: (string | Rules)[]; beforeVowel?: boolea...
17c1ee738bd2460951e35310630046afd8dcaf05
TypeScript
alexh00/engine
/src/core/ScreenManager.ts
2.75
3
import { EngineEvents } from "./EngineEvents"; import { EventQueue } from "../utils"; import { Screen } from "./Screen"; import { ISize, Settings } from "./Settings"; import { Loader } from "./Loader"; import { Unloader } from "./Unloader"; export interface IScreenMap { [id: string]: typeof Screen } export class...
509115e49648984b2833ad1b36bd4cc21934b595
TypeScript
mar-celohenrique/cdc-nestjs
/src/authors/dto/create-author.dto.ts
2.59375
3
import { IsEmail, IsNotEmpty, MaxLength } from 'class-validator'; import { UniqueValue } from '@/commons/validations/validations'; import { Author } from '../entities/author.entity'; export class CreateAuthorDto { @IsNotEmpty() name: string; @IsNotEmpty() @IsEmail() @UniqueValue({ field: 'email', c...
d9a194d177481ae314b8309c64efbb94488b8a1b
TypeScript
hongjunshi/swagger-typescript
/src/generateHook.ts
2.640625
3
import { getTsType, isAscending, getDefineParam, getParamString, getJsdoc, toPascalCase, getSchemaName, isMatchWholeWord, } from "./utils"; import { ApiAST, SwaggerConfig, TypeAST } from "./types"; import { HOOKS_BEGINNING, DEPRECATED_WARM_MESSAGE } from "./strings"; function generateHook( apis: ApiA...
5745e541f396b790fc7e8ed2cf6511e51fc4c495
TypeScript
mljs/spectra-processing
/src/xy/xyMaxY.ts
2.9375
3
import { DataXY } from 'cheminfo-types'; import { xGetFromToIndex } from '../x/xGetFromToIndex'; import { xyCheck } from './xyCheck'; /** * Finds the max value in a zone * * @param data - Object that contains property x (an ordered increasing array) and y (an array) * @param options - Options * @returns - Max y...
2073169121f985c9c025f08dd1a9670405551a24
TypeScript
gcanti/functional-programming
/src/solutions/Magma01.ts
3.359375
3
/** * Implementare la funzione `fromReadonlyArray` */ import { Magma } from 'fp-ts/Magma' const fromReadonlyArray = <A>(M: Magma<A>) => ( as: ReadonlyArray<readonly [string, A]> ): Readonly<Record<string, A>> => { const out: Record<string, A> = {} for (const [k, a] of as) { if (out.hasOwnProperty(k)) { ...
d142be74dd2879ecfecb27ac5edec26de8e99a71
TypeScript
getbreathelife/prettier-plugin-sort-imports
/tests/StrictGrouping/imports-with-file-level-comments.ts
2.71875
3
//@ts-ignore // I am file top level comments import threeLevelRelativePath from "../../../threeLevelRelativePath"; // I am stick to sameLevelRelativePath import sameLevelRelativePath from "./sameLevelRelativePath"; // I am stick to third party comment import thirdParty from "third-party"; // leading comment import { ...
7a4c2e5175fabfcf20a27d5a64b88f7a44ef1630
TypeScript
clehner/tzprofiles
/dapp/src/helpers/kepler.ts
2.734375
3
import {Kepler, getOrbitId} from 'kepler-sdk'; export const addToKepler = async (kepler: Kepler, orbit: string, ...obj: Array<any>) => { obj.forEach((o) => console.log(o)); if (kepler) { // Get around the error of possibly passing nothing. let f = obj.pop(); if (!f) { throw new Error('Empty array...
c5158b0bc2bbb071a49a57650909dd331423da96
TypeScript
kuukienator/generative-art
/src/sketches/00003/index.ts
2.984375
3
import { ArtWork, ArtWorkOptions } from '../../types/index'; import { getRandomInt } from '../../lib/math'; const artwork = (): ArtWork => { const run = (canvas: HTMLCanvasElement, options: ArtWorkOptions) => { const context = canvas.getContext('2d'); const size = canvas.width; const step = 20; cons...
aae6b894aca405ea0fb7dff26be2306882a4ddd1
TypeScript
aleksandragencheva/edtech-frontend
/src/hooks/usePostRequest.ts
3.1875
3
import axios from 'axios'; import { useEffect, useState } from 'react'; import config from '../config'; import isDev from '../utils/isDev'; export type PostRequestAction<T> = [(data: T) => void, boolean, string?]; /** @description Creates a POST request to the base URI set up in the config file and the endpoint provi...
a7dc47932dbd75d5e5baf5972ff01f04597596ed
TypeScript
lykweb/full_stack
/ts/ts培训资料/ts资料-y/ts-laboratory/6.泛型.ts
4.375
4
//=========泛型=========== //泛型就是解决 类 接口 方法的复用性、以及对不特定数据类型的支持 interface Lengthwise { length: number; } function identity<T extends Lengthwise>(arg: T): T { console.log("👴", arg.length); return arg; // return "🌶"; } const str = "typescript学习"; const result = identity<string>(str); console.log(result); //====...
9a148cc097f6e31ebd36e07667c57dfa5062b910
TypeScript
arnaud420/drawmadaire-front
/src/hooks/usePlayer.ts
2.515625
3
import React, { useContext, useEffect, useState } from 'react'; import { Game, Player } from '../models/GameModel'; import { Action } from '../reducers/UserReducer'; import { GameContext } from '../contexts/GameProvider'; import { User } from '../models/UserModel'; import { UserContext } from '../contexts/UserProvider'...
5583889d2f59407faaed8d06b8747ae32b453fc9
TypeScript
green-fox-academy/Miluta1990
/week-01/day-4/print-even.ts
2.546875
3
'use strict'; // Create a program that prints all the even numbers between 0 and 500 for (let i: number = 2; i < 501; i = i +2 ) {console.log(i)};
e0c597a994968d8fcb16f3a8efa272e35917c4e1
TypeScript
hanlindev/resourceful-cancan-sequelize
/lib/resourceful-cancan-sequelize.d.ts
2.75
3
/// <reference types="express" /> import * as express from 'express'; import { IConditionalFilterCreator } from 'resourceful-router'; import * as Cancan from 'cancan'; import { ClassConstructor, InstanceCreator, ModelType, ActionsType, TargetsType, ConditionType } from 'cancan'; export interface AbilityConfig<TP, TT> {...
1925b20fbe2f0f659cf0276fd78731a6c80020bc
TypeScript
Team-W4/MealMasterDashboard
/src/components/Texts/textSizes.ts
2.609375
3
import { variant } from 'styled-system'; enum textSizeEnum { title, h1, h2, large, normal, small, } export type TextSizeKeys = keyof typeof textSizeEnum; export type TextSizeProps = { size?: TextSizeKeys; }; const textSizes = variant({ prop: 'size', variants: { title: { fontSize: 'primer...
84c386149c34baebc6e4e0520565da037793216f
TypeScript
chewtoys/api-1
/app/Main/Db/index.ts
2.71875
3
/** * Класс для работы с БД * @author Nikita Bersenev */ import mysql from "mysql"; const option = { host: process.env.MYSQL_HOST, port: Number(process.env.MYSQL_PORT), user: process.env.MYSQL_USER, password: process.env.MYSQL_PASSWORD, database: process.env.MYSQL_DATABASE, }; const pool = mysq...
6b40677a0f7277a9377cfdd4eac924f95c68bb94
TypeScript
ScriptedAlchemy/storybook
/app/vue/src/client/preview/render.ts
2.546875
3
import dedent from 'ts-dedent'; import Vue from 'vue'; import { RenderContext } from './types'; export const COMPONENT = 'STORYBOOK_COMPONENT'; export const VALUES = 'STORYBOOK_VALUES'; const root = new Vue({ data() { return { [COMPONENT]: undefined, [VALUES]: {}, }; }, render(h) { const...
9eb5a5f42eb97ec0c66538368f236ba838477f21
TypeScript
RedstoneGamez/Pterodactyl.js
/src/lib/models/User.ts
2.71875
3
interface UserOptions { id: number; externalId: any; uuid: string; internalId: string; username: string; email: string; firstName: string; lastName: string; fullName: string; language: string; rootAdmin: boolean; twoFactor: boolean; updatedAt: Date; createdAt: Dat...
0ea8d6a4c32f14038a1c971e0b4f56b6c3cb55f4
TypeScript
RafaelAPB/sidetree
/tests/mocks/MockOperationQueue.ts
2.984375
3
import IOperationQueue from '../../lib/core/versions/latest/interfaces/IOperationQueue'; /** * A mock in-memory operation queue used by the Batch Writer. */ export default class MockOperationQueue implements IOperationQueue { private latestTimestamp = 0; private operations: Map<string, [number, Buffer]> = new Ma...
d00adfdeb879e040eabfead72c6da018c4178e0f
TypeScript
delpillar/COMP2068-MailPilot-Build-2
/COMP2068-MailPilot-Build-2/Scripts/game.ts
2.59375
3
var stage: createjs.Stage; var queue; // game objects var plane: Plane; var island: Island; var clouds = []; var ocean: Ocean; var scoreboard: Scoreboard; // game constants var CLOUD_NUM: number = 3; var PLAYER_LIVES: number = 3; var GAME_FONT = "40px Consolas"; var FONT_COLOUR = "#FFFF00"; // Preload function fu...
df65c1366738614548001de3f43b67019d209201
TypeScript
kations/unikit
/src/util/deepMerge.ts
3.84375
4
interface IIsObject { (item: any): boolean; } interface IObject { [key: string]: any; } interface IDeepMerge { (target: IObject, ...sources: Array<IObject>): IObject; } /** * @description Method to check if an item is an object. Date and Function are considered * an object, so if you need to exclude those, p...
2bb8d1222e879e3a7a1cbe19ae2e2fb28abacce6
TypeScript
PacktPublishing/Hands-on-Web-Development-with-ASP.NET-Core-and-Angular-7
/Section 2/ex 2.1/ClientApp/src/app/models/repository.ts
2.59375
3
import { Movie } from "./movie.model"; import { HttpClient } from '@angular/common/http'; import { Inject, Injectable } from '@angular/core'; const moviesUrl = "/api/movies"; @Injectable() export class Repository { public movie: Movie; constructor(private http: HttpClient, @Inject('BASE_URL') baseUrl: string) {...
ab3c9b876abafa45ecdd189d88a26f266ecc4c50
TypeScript
Pinenam/AstarPathfinding
/src/Point.ts
3.21875
3
//Point定义为一个用来记录方格关键信息的类 export default class Point { public xIndex:number;//方格的x坐标 public yIndex:number;//方格的y坐标 public F:number=0;//A*算法的F值,默认值为0 public G:number=0;//A*算法的G值,默认值为0 public H:number=0;//A*算法的H值,默认值为0 public parentPoint:Point=null;//Point的父节点,默认值为null public isObstacle:...
725272df22648a89bb8b305d6174fc05b2213587
TypeScript
singhong137/CocosCreatorDataStructuresAlgorithms
/assets/Script/test/TreeTest.ts
3.109375
3
import { BinarySearchTree, AVLTree, RedBlackTree } from "../data_structures/Tree"; const { ccclass, property } = cc._decorator; @ccclass export default class TreeTest extends cc.Component { start(){ console.log('TreeTest---'); // const tree = new BinarySearchTree(); // const tree = new AV...
d04d03d22ec88e32c932e8d12aeb73dde754612f
TypeScript
Siteimprove/alfa
/packages/alfa-result/test/result.spec.ts
3.1875
3
import { test } from "@siteimprove/alfa-test"; import { Err } from "../src/err"; import { Ok } from "../src/ok"; import { Result } from "../src/result"; const n: Result<number, string> = Ok.of(1); const err: Result<number, string> = Err.of("error"); test("#map() applies a function to an ok value", (t) => { t.deepE...
1702242d35e4e131576e86b032726408cc495de3
TypeScript
onura/capturetheether
/test/lotteries/predicttheblockhash.ts
2.625
3
import { ethers } from "hardhat"; import { Signer } from "ethers"; import { expect } from "chai"; // 0x23a6A169e879809457D8A5857Fe61D004aff6717 function delay(ms: number) { return new Promise( resolve => setTimeout(resolve, ms) ); } describe("predicttheblockhash", function() { it("Should solve the predict th...
6818a08721a0f7d6bac251adab186d5f6fa6935f
TypeScript
vishwakarma02/infiniteScroll
/src/app/pipes/date-ago.pipe.ts
2.953125
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'dateAgo', pure: true }) export class DateAgoPipe implements PipeTransform { transform(value: any, args?: any): string { let counter, str = ''; if (value) { const seconds = Math.floor((+new Date() - +new Date(value)) / 1000); ...
95d86d4ea076a4f022f92c4a0e6e6d1b29154da7
TypeScript
RichardOtvos/reactant
/packages/reactant-module/src/core/spawnMiddlewares.ts
2.640625
3
import { applyMiddleware, Middleware, Store } from 'redux'; import { PluginModule } from './plugin'; import { storeKey } from '../constants'; /** * ## Description * Compose and spawn middlewares for Redux. * * ## Example * * ```ts * import logger from 'redux-logger'; * * @injectable() * class Foo {} * * co...
b16a048acfcbd52ac73099aa427653fda8b2b72c
TypeScript
hrdyjan1/notify-deprecated
/constants/helpers/basic.ts
2.796875
3
function noop() {} function isDefined<T>(x: T | undefined | null): x is T { return !(typeof x === 'undefined' || x === null); } function isNotDefined<T>(x: T | undefined | null): x is undefined | null { return !isDefined(x); } function isString(x: unknown): x is string { return typeof x === 'string'; } export...
31d3377a34e4d36b32e6b2261bb5ce0d30953406
TypeScript
thx/rap2-delos
/src/models/bo/organization.ts
2.546875
3
import { Table, Column, Model, HasMany, AutoIncrement, PrimaryKey, AllowNull, DataType, Default, BelongsTo, BelongsToMany, ForeignKey, AfterCreate } from 'sequelize-typescript' import { User, Repository, OrganizationsMembers, Logger } from '../' @Table({ paranoid: true, freezeTableName: false, timestamps: true }) expo...
5c8cd40bbdbe06bc1cadb953487644b5f9392387
TypeScript
MaximilianoMoreno/wit-be
/lib/core/utils/utils.service.ts
3.265625
3
import * as moment from 'moment'; import { Types } from 'mongoose'; import { UTIL_CONSTANTS } from './utils.constants'; export class UtilsService { /** * Method used to clean all undefined, null or empty attributes inside the received object recursively. * * @param {Object} object * @returns {Object} ...
466a3e248818fb6426a1c74a2c71841fe6011b16
TypeScript
fewer/fewer2
/src/querybuilder.ts
2.796875
3
import { getStaticMeta, Model } from './model'; import { getConnection } from './connect'; import { ModelInstance } from './modelinstance'; import { ALL_FIELDS, ColumnTypes, CreateSelectionSet, MODEL_INSTANCE_META, } from './types'; import { Columns } from './columns'; enum ResultCount { MANY = 'MANY', SINGLE = ...
7a1145fc5281772f84b7ea5e637ffdd971ff20c6
TypeScript
tomwanzek/d3-v4-definitelytyped
/src/d3-scale-chromatic/index.d.ts
2.671875
3
// Type definitions for D3JS d3-scale-chromatic module 1.0.2 // Project: https://github.com/d3/d3-scale-chromatic/ // Definitions by: Hugues Stefanski <https://github.com/Ledragon>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov> // Definitions: https://github.com/Definitel...
b8d748116a460b8d4767e3b31dbd96a6f6a6d5ec
TypeScript
BlasmethiaN/TODO-svelte
/src/lib/immutableStore.ts
2.796875
3
//! useless piece of CRAP import { writable, Writable } from 'svelte/store' import { produce } from 'immer' export type WritableImmutable<TData> = Writable<TData> & { update: (fn: (value: TData) => TData | void) => void } const writableImmutable = <TData>(value: TData): WritableImmutable<TData> => { const writable...
b87750811815ddae0dc31025b806d9ebff94030c
TypeScript
taisiusyut/taisiusyut
/packages/server/src/modules/book/dto/get-books.dto.ts
2.515625
3
import { Exclude, Transform } from 'class-transformer'; import { IsEnum, IsOptional, IsString, IsMongoId } from 'class-validator'; import { Category, Schema$Book, Param$GetBooks, BookStatus } from '@/typings'; import { QueryDto } from '@/utils/mongoose'; import { IsBookName } from './'; class Excluded extends QueryD...
8b5d0f9fd12918b4a47e9b9a0629c63a318b7c57
TypeScript
keystonejs/keystone
/tests/api-tests/fields/types/fixtures/float/non-null/test-fixtures.ts
2.578125
3
import { float } from '@keystone-6/core/fields'; export const name = 'Float with isNullable: false'; export const typeFunction = (x: any) => float({ ...x, db: { ...x?.db, isNullable: false } }); export const exampleValue = () => 6.28; export const exampleValue2 = () => 6.283; export const supportsUnique = true; export...
af77ebc402da5475671605bc32c4545d986ecb12
TypeScript
villagestyle/react-tool-web
/src/store/tabs/reducer.ts
2.6875
3
import { Reducer } from "redux"; import { toggle, add, remove } from "./methods"; export const initialState: State[] = [ { path: "/m/home", name: "首页", active: true } ]; export interface State { path: string; name: string; active: boolean; } export const tabsReducer: Reducer<State[]> = ( stat...
7eee5d8f94502e50eaee271ef0aaf3881fb8be7f
TypeScript
MuriloFuza/Next-Level-Week
/nlw-4/src/services/ClassificationService.ts
2.703125
3
import { getCustomRepository } from "typeorm"; import { UsersRepository } from "../repositories/UsersRepository"; import { SurveysUsersRepository } from "../repositories/SurveysUsersRepository"; class Classification { async execute(id: string) { let media = 0; const usersRepository = getCustomRepository(Use...
27f0cf14acd9a1b74e8b618dc9780f1229006173
TypeScript
arturcarvalho/denodash
/src/object/pick.ts
2.859375
3
export const pick = ( obj: Record<string | number, any>, props: Array<string | number>, ): Record<string | number, any> => { const newObj: Record<string | number, any> = {}; for (let prop of props) { if (obj[prop] !== undefined) { newObj[prop] = obj[prop]; } } return newObj; }; export default...
67b0ab056bb16bae15d385c3e9a4aaca624df42d
TypeScript
elie29/angular-fundamentals-seed
/app/passengers/components/passenger-form/passenger-form.component.ts
2.515625
3
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { NgForm } from '@angular/forms'; import { Baggage, Passenger } from '../../models/passenger.interface'; @Component({ selector: 'passenger-form', styleUrls: ['passenger-form.component.scss'], template: ` <form #form="ngForm" (ngS...
bcbfa5326057e33fc6b8c3547f2186f1d3845947
TypeScript
pfalzergbr/vtm-dice-ts-react
/src/diceEngine/generateRoll.ts
2.765625
3
import { DiceMap, DiceType, Dice, } from './diceTypes'; import {generateRandomDice} from './diceUtils' export const generateRoll = ( diceNum: number, diceMap: DiceMap, type: DiceType ): Dice[] => { const rollArray: Dice[] = []; for (let i = 0; i < diceNum; i++) { const rolledDice = generateRandomD...
79884b85351527f68a2e808d3356b140a14a4f0c
TypeScript
AdreeUA/interviewT
/src/ducks/users.ts
2.671875
3
import { createAction, createReducer } from 'redux-act' import axios from 'axios' import { ReduxThunkCb } from '../store/types' export const REDUCER = 'USERS' const NS = `${REDUCER}__` export interface UserState { thumbnail: string fullName: string email: string phone: string } export interface UsersState { ...
4c9ef407cbce796c2b0916d6224bf974c0d90f7d
TypeScript
tBlabs/RaspberryPi.RemoteIO
/src/Services/Logger/ConsoleOutput.ts
2.65625
3
import 'reflect-metadata'; import { injectable } from "inversify"; import { ILoggerOutput } from './ILoggerOutput'; @injectable() export class ConsoleOutput implements ILoggerOutput { private timeSinceLastLog: number = -1; public Print(str): void { if (str === '') { console.log...
f0c642a6131d03ef7e6ec09b539b40a8332f8a17
TypeScript
fabiendv/Angular-Heroes
/src/app/hero.service.spec.ts
2.515625
3
import { TestBed, inject } from '@angular/core/testing'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; import { HeroService } from './hero.service'; import { HttpClientModule } from '@angular/common/http'; import { HttpClient } from 'selenium-webdriver/http'; import { Me...
1aca7eb239af1efbb8b129ba58dc0b20c597bc76
TypeScript
zhaojianeng25/sceneedit
/mizmain/feijibase/feiji/src/src14lou/core/Encipher.ts
2.828125
3
module core{ export class Encipher{ private PROTO_TEA_C2S:string = "2f651cbf85539c977da645a90cbd6b62"; private PROTO_MD5_KEY:string = "40f09aa5ff525e8cc3a9d16bf1abc3c1"; private xor_key_c2s:number; constructor (){ this.encipher_init(this.PROTO_TEA_C2S); ...
81e61c42261bf76513dba32ceac452b622e08418
TypeScript
liozassa/get-location
/src/models/location.model.ts
2.59375
3
import mongoose, { Document, Schema } from "mongoose"; import mongooseUniqueValidator from "mongoose-unique-validator"; export interface ILocation extends Document { _id: string, user_id: string, date: number, request_id: string, lat: number, lon: number, water: boolean }; var LocationSchema = new Schem...
118fa8fa77e721bc9be8554bd17f3969bddc77aa
TypeScript
janhesters/Ordersome-Waiter-App
/app/redux/reducers/settingsReducer/settingsReducer.test.ts
2.6875
3
import * as generics from '../../actions/generic/generic.actions'; import * as actions from '../../actions/settings/settings.actions'; import settingsReducer from './settingsReducer'; const incomingSetting = 'drinks'; const expected = ['drinks']; describe('settings.reducer', () => { it('should return the initial s...
a8568e8c26210c987fac6471a6b5f8235f247dc6
TypeScript
SakiMuraoka/fairy-online
/src/entities/Participant.ts
2.78125
3
export class Participant { public 'id': string public 'name': string public 'affiliation': string public 'year': string public 'sex': 'M' | 'F' public 'age': number public 'can_drive': boolean public 'note': string constructor() { this.id = '' this.name = '' this.affiliation = '' this.year = '' this....
5b3590c8bbfe89017c01e43057f510aee1262b44
TypeScript
patarapolw/match-brackets
/src/index.ts
3.140625
3
import escapeRegExp from 'escape-string-regexp' export class FindBrackets { static escape = '\\' escapeKey: string regexMap: Record<'start' | 'end', RegExp> /** * * @param start Beginning bracket * @param end Ending bracket * @param options * - [options.escape] Whether to be escape-able. Supp...
bf1090a1a3c4c5ed315c99e5f5e773ec5c510684
TypeScript
stmobo/BasilBot
/web-src/helper.ts
3.1875
3
import $ from 'jquery'; export function addSubelement(elem: JQuery | HTMLElement, elemType: string, opts: Object): JQuery<HTMLElement> { var new_elem = $("<" + elemType + ">", opts); $(elem).append(new_elem); return new_elem; } export function formatTimeSinceEvent(timestamp: number): string { var now...
a64bf06a53da8983bd3fc09d1f11d3f05c6da092
TypeScript
PurnaSahithiAdduri/ChicagoSocialHub
/ChicagoSocialHub/ChicagoSocialHub/frontend/src/app/components/real-time-line-chart/SMA-24hr.ts
2.71875
3
import * as d3 from "d3"; import * as d3Shape from "d3-shape"; import { Charts } from "../../charts"; export class SimpleMovingAverage24hr implements Charts { movingAverageLine24hr: d3Shape.Line<[number, number]>; //Calculate simple moving Average movingAverage = (data, numberOfPoints) => { var dat...
9430c2f3faf924b6a2f8dcab75271c3af79d23f7
TypeScript
annandrosiuk/js-mentoring-program
/back-end/src/types/function.types.ts
2.90625
3
import { Achievement, ActualAchievement, ArchiveItem, Challenge, Status, TaskForToday, Task, } from '@interfaces'; /** * Returns a current task with its status by the challenge id * @param {string} challengeId challengeId - id of current challenge * @param {Challenge[]} challengesList challengesList...
6c45b43bf93ce9813ab4ee85173182c9d66af97d
TypeScript
ExoSuite/ExoRun
/test/tests/http-request-error.test.ts
2.875
3
import { HttpRequestError } from "@exceptions/HttpRequestError" import { GeneralApiProblem, HttpResponse } from "@services/api" const basicProblem: GeneralApiProblem = { kind: HttpResponse.UNAUTHORIZED } const errors = { "email": [ "The email field Is required." ], "password": [ "The password field Is...
3c45375cb20baff7f211ad1937858795c4af4d8e
TypeScript
shuki770/nestjs-template
/src/core/pipes/parse-number.pipe.ts
2.640625
3
import { PipeTransform, Injectable, ArgumentMetadata } from '@nestjs/common'; @Injectable() export class ParseNumberPipe implements PipeTransform { public transform(str: string, metadata: ArgumentMetadata): number | undefined { if (!str) { return undefined; } return parseFloat(str); } }
684b59c05143bc761530e12fd2a225a8101ebd33
TypeScript
snoopy1954/datastorage
/backend/src/routes/music/artist.ts
2.65625
3
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-return */ import express from 'express'; import Artist from '../../models/music/artist'; import { toArtist } from '../../utils/music'; const artistRouter = express.Router(); artistRouter.get('/', async (_req...
f4eabe194e29db92478da8ee6510b581a5d6ffa9
TypeScript
yshiliang/api-core-js
/packages/api-core/src/common/ApiContext.ts
2.859375
3
import { Context } from "koa" import { IApiDescriptor, IParameterDescriptor, IServiceDescriptor } from "../service/types" import * as ApiException from "./ApiException" import { DLogger } from "./DLogger" export interface ApiContextConstructor { new(...args: any[]): ApiContext; } export class ApiContext { /** ...
bb7291273017324838803ea431647cce77ce0048
TypeScript
kesne/advent-of-code-2020
/solutions/5.ts
3.265625
3
function getLocation(str: string) { return str.split("").reduce( ([row, column], el) => { if (el === "F") { return [row.slice(0, row.length / 2), column]; } else if (el === "B") { return [row.slice(row.length / 2), column]; } else if (el === "L") { return [row, column.sli...
cd2fc4dae01d873986ee6439aee8fb9f92e5540b
TypeScript
multitoken/calculator
/src/manager/multitoken/executors/PeriodRebalanceExecutorImpl.ts
2.546875
3
import { ExecuteResult } from '../../../repository/models/ExecuteResult'; import { TokenPriceHistory } from '../../../repository/models/TokenPriceHistory'; import { Multitoken } from '../multitoken/Multitoken'; import { AbstractRebalanceExecutor } from './AbstractRebalanceExecutor'; import { PeriodRebalanceExecutor } f...
cfda7e07e9e480e8cfa6f210b3079de1e0328a2c
TypeScript
mjkaehr/Shelf
/frontend/Shelf/src/app/models/feed.model.ts
2.671875
3
export class Feed { event: string; user: string; timeStamp: Date; userRatedGame: Boolean; game_id: string; rating: Number gameName: string constructor(response: any) { this.event = response.event; this.user = response.user; this.timeStamp = response.time_stamp; ...
2e09774bb5212c79017576d61ec19aa90aaf73c2
TypeScript
tais-nissizaki/coracao-papel-front
/src/app/pipes/formatar-data.pipe.ts
2.65625
3
import { Pipe, PipeTransform } from '@angular/core'; import { DatasService } from '../services/datas.service'; @Pipe({ name: 'FormatarData', }) export class FormatarDataPipe implements PipeTransform { constructor(private datasService: DatasService) { } transform(value: Date | string, attrs?: any): string | unde...
45f759fe33020363b7d647cd1cad67602bf6ccaf
TypeScript
davidkel/chai-fabric
/src/helpers/StateDatabase.ts
2.78125
3
import { Collection, ICollection } from './Collection'; import nano = require('nano'); export class StateDatabase { private db: nano.DatabaseScope; private collections: Map<string, Collection>; constructor(url: string, port: string, login?: {username: string, password: string}) { let connectionP...
7485726ffabfb2b0fae6448d510c74da9e9e5c23
TypeScript
codebysandip/nralcm
/src/lifecycle/exception-handler/IExceptionHandler.ts
2.921875
3
import { HttpContext } from ".."; /** * Interface to implement ExceptionHandler * ExceptionHandler can be use for logging errors. Errors occured in Rest api that not handled * will catch by ExceptionHandler */ export interface IExceptionHandler { /** * Method for handle exception * @param context Htt...
12576c5baea632290301def4eaf9f2e7f39c5a06
TypeScript
dtandersen/screeps
/src/exception.ts
2.53125
3
export class EntityNotFound { message: string; constructor(message: string) { this.message = message; } } export class MemoryUndefined { message: string; constructor(message: string) { this.message = message; } } export class OutOfRange { message: string; constructor...
b86dcbfe8cb19a5be35739ce3cd4a802432cf9e0
TypeScript
podlove/podlove-publisher
/client/src/store/contributors.store.ts
2.546875
3
import { handleActions, createAction } from 'redux-actions' import { PodloveContributor, PodloveGroup, PodloveRole } from '../types/contributors.types'; export type State = { contributors: PodloveContributor[], roles: PodloveRole[], groups: PodloveGroup[] } export const initialState: State = { contributors: [...
07944ec0a5a17551ee9053e674b16f4b733dfce7
TypeScript
thatcosmonaut/love-typescript-definitions
/include/modules/video/love.video.d.ts
2.765625
3
declare namespace love { /** * This module is responsible for decoding, controlling, and streaming video * files. * * * It can't draw the videos, see love.graphics.newVideo and Video objects for * that. * @noSelf * @link [love.video](https://love2d.org/wiki/love.video) ...
9a9d4168fe08f53d8097d207a30618e4e67200e5
TypeScript
ylerjen/classe84.front
/src/app/actions/subscription.actions.ts
2.84375
3
import { Action } from '@ngrx/store'; import { Subscription } from '../models/Subscription'; import { ActionWithPayload } from './app.actions'; /** * This is the type of subscription we want to retrieve * as the store is the same for the EventSubscriptions and * the UserSubscriptions */ export enum SubscriptionTy...
f66631839a622b67c796d14911ebe89c171e9705
TypeScript
1728954833/project-manager
/src/util/project.ts
2.609375
3
import type { Command, Projects, Project } from '../interface' import { readJSON, writeJson } from 'fs-extra' import { configPath } from '../constant/file' export const getProjects = async (): Promise<Projects> => { return readJSON(configPath) } export const saveProject = async ( name: string, project: Project ...
ccd03d46f0ee9a9e07d94a518f27f3e38a968bf1
TypeScript
mpsk/forecast-weather
/src/services/LocationPosition.ts
2.578125
3
import Rest from './Rest'; import {REST} from '../SETTINGS'; export type LatLog = { lat: number; lon: number; } export type LocationInfo = LatLog & { city: string; country: string; } export default class LocationPosition { private _rest: Rest; constructor() { this._rest = new Rest(); } ...
4f7c4be2c32da9deabaa676191c8cb618c137a15
TypeScript
tetsuyaohira/atcoder-typescript
/src/abc167/B-EasyLinearProgramming.ts
3.046875
3
import * as fs from 'fs'; const [a, b, c, k]: number[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')[0].split(' ').map(Number); let ans: number; ans = (a >= k) ? k : a; const kk = (a + b >= k) ? 0 : k - (a + b); ans -= (c >= kk) ? kk : c; console.log(ans);
a60a4af3906e521504b340b1f0540b773850c466
TypeScript
PauloDev13/curso-fullstack-javascript
/src/errors/NoContentException.ts
2.765625
3
import HttpException from './HttpException'; class NoContentException extends HttpException { constructor(id?: string) { let msg = ''; if (id) { msg = `Registro não localizado para o ID: ${id}`; } else { msg = 'Não há registros cadastrados'; } super(404, msg); } } export default ...
06ca17a8beafde85fd34f8feb45a5dabf7fb67f5
TypeScript
tensorflow/tensorboard
/tensorboard/components/tf_utils/utils.ts
2.90625
3
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
636dcc6c35046d200e6615bd855c80904ba8d393
TypeScript
Linya-IronMan/SourceCodeReading-Vue-Next
/vue-next-testCode/proxy.ts
3.171875
3
// interface WeakMap<K extends object, V> { } interface WeakMap<K extends object, V> { delete(key: K): boolean; get(key: K): V | undefined; has(key: K): boolean; set(key: K, value: V): this; } interface WeakMapConstructor { new <K extends object = object, V = any>(entries?: readonly [K, V][] | nul...
ae2b5484a2c3cdb07aec3570f561f7bfa92ce7b9
TypeScript
ahmedsameh148/Task-1
/test.ts
2.984375
3
var fs = require('fs'); var rowData = fs.readFileSync('db.json'); var members = JSON.parse(rowData); class Member{ public firstName:string = ""; public middleName:string = ""; public lastName:string = ""; public fullName:string = ""; public committee:string = ""; public joinDate:Date = new Da...
7b142497746bc22878c80ae23dce9f80f3044456
TypeScript
sourtangie/software-internship-technical-assessment
/luhn.ts
3.296875
3
"use strict"; export function luhnChecker(inputStr: string) { let length: number = inputStr.length; let sum: number = 0; let odd: boolean = false; let currentDigit: number = 0; let divideBy: number = 10; let success: number = 0; let fail: number = 1; for (let i: number = (le...
4f37471a5af573f1c8d71f5e68907316f9eae2ec
TypeScript
LJaks/country-app
/src/redux/actions/country.ts
2.78125
3
import { Dispatch } from 'redux' import { Country, CountryActions, FETCH_COUNTRIES_ERROR, FETCH_COUNTRIES_PENDING, FETCH_COUNTRIES_SUCCESS, } from '../../types' export function fetchCountriesPending() { return { type: FETCH_COUNTRIES_PENDING, } } export function fetchCountriesSuccess(country: Country...
95894ee180bee324dbbbb6bd5641fa9f35a8013d
TypeScript
JayJayDee/TypeGraphQL-TypeORM-Example
/src/configurations/config-loader.ts
2.59375
3
import { config } from 'dotenv'; export const loadConfigurations = async (env: {[key: string]: any}) => { let source: {[key: string]: any} = {}; // if the DOTENV_PATH environment variable exists, load the dotenv file. const dotEnvPath = env['DOTENV_PATH']; if (dotEnvPath) { const parsed = conf...
dd214304745f25b3c50c2f1e73ca26ae8a9eea27
TypeScript
thaihoanganh/vcc-schema
/src/datatype/__tests__/unknown.test.ts
2.546875
3
import { unknown, UnknownType } from "../"; describe("DataType Unknown", () => { const subject = unknown(); it("should have instance of UnknownType", () => { expect(subject).toBeInstanceOf(UnknownType); expect(subject.parser("this value has unknown type")).toEqual( "this value has unknown type" ...
13ecf1b317a9f0bfd30650211f419cffbd13ff80
TypeScript
HeyMilie/angular
/tour-of-heroes/src/app/hero.service.ts
2.515625
3
import { Injectable } from '@angular/core'; import Hero from './types/hero.type'; @Injectable({ providedIn: 'root' }) export class HeroService { heroes: Hero[] = [ { id : 1, name : 'Batman' }, { id : 2, name : 'Superman' }, { id : 3, name : 'Spiderman' } ]; constructor() { } getHeroes() : Her...
f7668a675717718d61f747cc1ddddf2b2abb86b9
TypeScript
Whitecoin-XWC/pen-dashboard
/src/hooks/accounting.ts
2.578125
3
import { LastCashoutActionResponse } from '../penjs' import { useEffect, useState } from 'react' import { Token } from '../models/Token' import { beeDebugApi } from '../services/bee' import { Balance, Settlement, useApiPeerBalances, useApiSettlements } from './apiHooks' interface UseAccountingHook { isLoading: boole...