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
7acb2d0fadb4132629d3af520f22a5b0bb0a453a
TypeScript
thesayyn/protoc-gen-ts
/src/type.ts
2.671875
3
import * as descriptor from "./compiler/descriptor.js"; import * as ts from "typescript"; import * as op from "./option.js"; const symbolMap: Map<string, string> = new Map(); const dependencyMap: Map<string, ts.Identifier> = new Map(); const mapMap: Map<string, descriptor.DescriptorProto> = new Map(); const enumLeadin...
6ef5b1c72dedc9b76dbe4666250d266b0d15e3bd
TypeScript
nice-digital/wdio-cucumber-steps
/src/support/check/checkFocus.ts
3.109375
3
/** * Check if the given element has the focus * @param {String} selector Element selector * @param {String} falseCase Whether to check if the given element has focus * or not */ export async function checkFocus( selector: string, falseCase: string ): Promise<void> { const el...
1be1bf79ff48b7d29bd5eb95b8ba35f9a9e55559
TypeScript
AnkitPatel1999/medium_clone_api
/src/routes/User.ts
2.703125
3
import { Router } from 'express'; import { getUser, updateUserDetails } from '../controllers/userController'; import { authByToken } from '../middleware/auth'; const route = Router(); route.patch('/', authByToken, async(req, res) => { try { const updatedUser = await updateUserDetails(req.body.user, (...
aa62cbe05c7742a6da8516c5c0818a8b0b575ec0
TypeScript
TheCrether/nodecg-io
/samples/discord-guild-chat/extension/index.ts
2.515625
3
import { NodeCG } from "nodecg/types/server"; import { ServiceProvider } from "nodecg-io-core/extension/types"; import { DiscordServiceClient } from "nodecg-io-discord/extension"; module.exports = function (nodecg: NodeCG) { nodecg.log.info("Sample bundle for discord started"); const discord = (nodecg.extensi...
8b033d7b7782b14699dbcc82314e0b3b18b47ba2
TypeScript
Plasma/csv-to-table
/src/CsvParser.ts
3.515625
4
import CsvColumn from './CsvColumn'; import CsvRecord from './CsvRecord'; /** * Parser that takes a string input and parsers it into a list of CsvRecord's that contain CsvColumn's */ export default class CsvParser { private _text: string; private _separator: string; private _position: number; /** * Initialie ...
e581aa11294c4590e041a565354c5075453716b4
TypeScript
qcamei/saas-h5
/chainStore/code/h5/zmtWeb/src/zmWeb/views/appointment/Pipe/AppointmentStatusPipe.ts
2.921875
3
import {Pipe, PipeTransform} from "@angular/core"; /** * 预约状态 枚举 -->文字 转换管道 * @param status: number */ @Pipe({name: 'appointmentStatusPipe'}) export class AppointmentStatusPipe implements PipeTransform { transform(state: number): string { if (state == 0) { return "未接受"; } else if (state == 1) { ...
7b4998842c63491d649f0b9ed59e39ff8535875c
TypeScript
guysenpai/s-libs
/projects/rxjs-core/src/lib/subscription-manager.ts
3.578125
4
import { Constructor } from '@s-libs/js-core'; import { Observable, Subscription, Unsubscribable } from 'rxjs'; /** * Mixes in {@link SubscriptionManager} as an additional superclass. * * ```ts * class MySubclass extends mixInSubscriptionManager(MyOtherSuperclass) { * subscribeAndManage(observable: Observable<a...
c0ba115fa91b6329e237c5d0bbe6570eb3d5f55f
TypeScript
remyalex/SigmaV2_front
/src/app/administracion/evento/eventorol/services/eventorol.service.ts
2.515625
3
import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable, BehaviorSubject } from 'rxjs'; import { Eventorol } from '../models/eventorol.model'; import { EventorolCriteria } from '../models/eventorol-criteria.model'; import { CollectionResponse } fro...
fd48f9fde18e7d9a2fab0803f1606e19aa55c0ed
TypeScript
Im-Alexandra/angular_project
/src/app/pipes/user-filter.pipe.ts
2.65625
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'userFilter' }) export class UserFilterPipe implements PipeTransform { transform(users: any, term?: any): any { // check if search term is undefined if (term === undefined) return users; // return updated users array return us...
dd09693e8d20682444e9d2f63be8c922a0df2953
TypeScript
leoyoung07/blog
/src/app/util/util.ts
2.828125
3
'use strict'; import moment from 'moment'; export default class Util { static navTo(url: string) { window.open(url, '_blank'); } static getLocalDateTime(utcDateTime: moment.MomentInput) { return moment.utc(utcDateTime).utcOffset(8).format('YYYY-MM-DD HH:mm:ss'); } static colorStr2Array(rgb:...
beb96f2a85fe5139d5668715eb28cbf91d4f1fd6
TypeScript
milky2028/pure-avhc
/public/src/functions/uncamelize.ts
2.6875
3
export default function uncamelize(str: string): string { return str .replace(/([A-Z])/g, ' $1') .replace(/^./, (firstLetter: string) => firstLetter.toUpperCase()); }
626e6ca9121a694c59ebf330545fcd5e9b5e3102
TypeScript
chingloong/hydro-serving-ui
/src/modules/shared/models/runtime-type.model.ts
2.734375
3
export class RuntimeType { public id: string; public name: string; public version: string; public tags: string[]; constructor(props: object = {}) { this.id = props['id'] || ''; this.name = props['name'] || ''; this.version = props['version'] || ''; this.tags = props['tags'] || ['']; } }
503bb8f00a666721234dcf9d11913e82d8658707
TypeScript
southparkstan123/book-store
/app/javascript/src/utils/calculation.ts
3.03125
3
import { SumResult } from '@/type'; export default (numberList: Array<number>, initVal = 0): SumResult => { const string: string = numberList.map((number, index) => { return { sign: (index === 0) ? ((initVal === 0) ? ((number >= 0) ? '' : '-') : ((number >= 0) ? '+' : '-')) : ((number >= 0) ? '+' : '-'), ...
23117d347dc85623c703c48e1a688e244e53d0a5
TypeScript
maldan/denolib-remote-gl
/src/engine/Camera.ts
2.84375
3
import { Matrix2D } from "../../deps.ts"; export class Camera { matrix: Matrix2D = new Matrix2D(); width = 0; height = 0; zoom = 1; rotation = 0; x = 0; y = 0; z = 0; private _toWorldMatrix: Matrix2D = new Matrix2D(); update() { const totalWidth = (2 / this.width) * t...
347af7ed41ecb91f71129787a7e5e5a2a1d26981
TypeScript
grzeznx2/e-commerce
/src/modules/orders/services/ShowOrderService.ts
2.515625
3
import AppError from '@shared/errors/AppError' import { getCustomRepository } from 'typeorm' import Order from '../typeorm/entities/Order' import OrdersRepository from '../typeorm/repositories/OrdersRepository' interface IRequest { id: string } export class ShowOrderService { // funkcja zwraca Promise<Product>, a...
a8aad758c5a3e3eb6a0523286938c840d16138b5
TypeScript
papasani-soft/TypeScript
/ts-hello/main4.ts
2.546875
3
let log=function(message){ console.log(message); } let doLog=(message)=>console.log(message);//with parameter let doLog1=()=>console.log();//without parameters //arrow function or lamda expression
c8262ef5a3755b34f26a6900f1a0d493625ebf4e
TypeScript
biancademaria/tarefasApp
/src/app/services/usuarios.service.ts
2.734375
3
import { Injectable } from '@angular/core'; import { ArmazenamentoService } from './armazenamento.service'; import { Usuario } from '../models/Usuario'; @Injectable({ providedIn: 'root' }) export class UsuariosService { public listaUsuarios = []; constructor(private armazenamentoService: ArmazenamentoService...
25f58896711189ec0dc52642c1c50dbdc39f10c8
TypeScript
lamp04ka1/limit-order-protocol-utils
/src/erc20.facade.ts
2.59375
3
import {ERC20_ABI} from './limit-order-protocol.const'; import {ProviderConnector} from './connector/provider.connector'; export enum Erc20Methods { transferFrom = 'transferFrom', balanceOf = 'balanceOf', } export class Erc20Facade { constructor(private readonly providerConnector: ProviderConnector) {} ...
014640f7ee29300c709318b975b6a25893577609
TypeScript
LucaSaraCzudar/ng9_piperoni
/pipes/pure/sync/date-diff.pipe.ts
3.140625
3
/** * Credit goes to Lewis Fairweather @ JavaScript in Plain English on Medium * Source: https://medium.com/javascript-in-plain-english/6-pure-angular-pipes-for-human-readable-ui-c76b4e6fafa1 * * This pipe returns the difference between the given date, plus formats the difference into a human-readable string. * Ex...
71deee1d3f6c9b8e1e37144c105a8b4c9a440d09
TypeScript
Stradivario/gapi
/packages/cli-builder/src/scalar-object.ts
3.015625
3
import { GraphQLScalarType } from 'graphql'; import { Kind } from 'graphql/language'; function identity(value) { return value; } function ensureObject(value) { if ( typeof value !== 'object' || value === null || Array.isArray(value) ) { throw new TypeError( `JSONObject cannot represent non...
47900ef9f1335451d505bbca73d7348c07710ee4
TypeScript
MaisonnatM/community
/src/providers/CategorySidebar/context.ts
2.65625
3
import { TPublication } from '@src/components/publication/_types' import { noop } from 'lodash' import { createContext } from 'react' export type TTopic = { label: string; url: string } export type TSidebarSection = { title: string type: 'publication' | 'nav' items?: { label: string; url: string }[] publicatio...
9e235475664063f2e61deaff6fb1748b71fad5c9
TypeScript
ingridbanguero/Proyecto---Platzi-Store
/src/app/demo/components/demo/demo.component.ts
2.609375
3
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-demo', templateUrl: './demo.component.html', styleUrls: ['./demo.component.scss'] }) export class DemoComponent implements OnInit { // Siempre tiene el onInit, es una buena practica como inicializacion asi esta vacio title = 'platzi...
5e77f689ef1b2942805b07b7f3c165d0be573cdc
TypeScript
woop/feast-test
/ui/src/parsers/parseIndirectRelationships.ts
2.546875
3
import { FeastRegistryType } from "./feastRegistry"; import { EntityRelation } from "./parseEntityRelationships"; import { FEAST_FCO_TYPES } from "./types"; const parseIndirectRelationships = ( relationships: EntityRelation[], objects: FeastRegistryType ) => { const indirectLinks: EntityRelation[] = []; // On...
76ace03da83f8eab213131646e2c5b3433fa5ac7
TypeScript
empty916/convert-key
/src/utils.ts
2.96875
3
import { KeyMaps } from "./model"; /** * * @param {*} obj */ export function isObj(obj: any): obj is Object { return typeof obj === "object" && obj !== null; } export function isObjArray(data: unknown): data is { [s: string]: any }[] { if (!Array.isArray(data)) { return false; } if (data.every(isObj)) ...
148f630dfe825e01cb9da4f10f55610064fb6964
TypeScript
HLDESENVOLVIMENTOWEB/rentalx
/src/modules/cars/repositories/implementations/CategoriesRepositories.ts
2.875
3
import { Category } from "../../model/category"; import { ICategoriesRepositories, ICategoriesRepositoriesDTO } from "../ICategoriesRepositories"; class CategoriesRepositories implements ICategoriesRepositories { private categories: Category[]; private static INSTANCE: CategoriesRepositories; private ...
cdbb2b40650e305258c92c2824b212c4f8accd88
TypeScript
studiokaiji/sidetree
/lib/core/versions/0.11.0/models/ProtocolParameters.ts
2.734375
3
/** * Defines the list of protocol parameters, intended ONLY to be used within each version of the protocol implementation. */ export default interface ProtocolParameters { /** Hash algorithm in Multihash code in DEC (not in HEX). */ hashAlgorithmInMultihashCode: number; /** Maximum allowed size of anchor file...
c3057f9e773de7e27745b2b366461b75753f4852
TypeScript
robertohengling/diarioDeClasse
/src/dto/curso.ts
2.828125
3
import {Aluno} from './aluno'; import {Aula} from './aula'; export class Curso { constructor ( public id:number = null, public nome:string = '', public descricao:string = '', public alunos:Array<Aluno> = new Array<Aluno>(), public aulas:Array<Aula> = new Array<Aula>() ) { } static fromJson (json:a...
90e99868892b403c86ac49b19bd95ee0fd155b10
TypeScript
miguelplazasr/course-reactive-x
/src/observables/09-from-avanzado.ts
3.5625
4
/** * from : crea observable con la estrucutra de array, promise , iterable, observable */ import { of, from } from 'rxjs'; const observer = { next: val => console.log('next -> ', val ), complete: () => console.log('Completado') }; const srcfrom$ = from( [1,2,3,4,5] ); const srcOf$ = of( ...[1,2,3,4,5] );...
92cae83babb983dca800568f1f45aaa876266fa1
TypeScript
ducbaovn/vdc-test
/nodejs-common/src/services/logger.service.ts
2.703125
3
import * as winston from "winston"; import * as uuid from "uuid"; export class Log { constructor( public time: string, public message: any, public level: string, public context?: any, public url?: string, public path?: string, public correlationId?: string, ) {} } export class LoggerSe...
39f5245a19f3af18f18cc9887d05a03e10b95b50
TypeScript
dgomesbr/aws-secure-environment-accelerator
/src/lib/cdk-accelerator/src/core/accelerator-stack.ts
2.703125
3
import * as cdk from '@aws-cdk/core'; import { AcceleratorNameTagger, AcceleratorProtectedTagger } from '.'; export interface AcceleratorStackProps extends cdk.StackProps { acceleratorName: string; acceleratorPrefix: string; } export class AcceleratorStack extends cdk.Stack { readonly acceleratorName: string; ...
e6084e60c80886c239491238f2bc7cf993087197
TypeScript
1Revenger1/Advent-of-Code-2019
/Solutions/Day 14/src/Index.ts
2.953125
3
import * as fs from 'fs'; import * as chalk from 'chalk'; import { IntCodeinnator, Storage } from './IntCodeinnator'; (async () => { const day : number = 14; console.log("+------------------------------+"); console.log("| " + chalk.blueBright("Advent of Code 2019:") + chalk.green(" Day", day) + " |"); console.log(...
bdbe9b3f6c6a5847d19c21faabf4f6eb7d57f466
TypeScript
giovanidecusati/sample_nwd_store
/src/Clients/store-angular/src/app/domain/cart.ts
2.875
3
import { IShoppingCartModel } from '../models/shoppingCartModel'; import { IShoppingCartItemModel } from '../models/shoppingCartItemModel'; import { IProductModel } from '../models/productModel'; import { CartItem } from './item'; export class Cart implements IShoppingCartModel { itens: IShoppingCartItemModel[] = ne...
7311763df97b1a65227ec557caa6dbafcc14a81a
TypeScript
nenjotsu/freest-api
/src/common/validation.pipe.ts
3.03125
3
import { BadRequestException } from '@nestjs/common'; import { PipeTransform, Injectable, ArgumentMetadata } from '@nestjs/common'; import { validate } from 'class-validator'; import { plainToClass } from 'class-transformer'; interface ReasonType { [type: string]: string; } type MetaType = string | boolean | number...
0b7a17792c6af5849d8b7de702ea7b21de8faa07
TypeScript
CristSuryaTheThird/puzzle-bubble-extreme
/src/Scripts/Object/switchButton.ts
2.78125
3
import * as Phaser from 'phaser' export default class switchButton extends Phaser.GameObjects.Sprite{ private buttonDowned:boolean = false; private label:Phaser.GameObjects.Text; constructor(scene:Phaser.Scene, x:number, y:number, width:number, height:number){ super(scene,x,y,'button2'); th...
3fe0daf4253d3289f5e7361632b07330ae91be8f
TypeScript
craigforneris/mobius-lib-turf
/src/typescript/old/bool.ts
3.59375
4
/** * Turf graphical boolean functions. * http://turfjs.org/docs/ */ /** * */ import * as turf from "@turf/turf"; /** * Finds the difference between two polygons by clipping the second polygon from the first. * * @param {Feature<Polygon|MultiPolygon>} poly1 input Polygon feature * @param {Feature<Polygon|Mul...
97075143e7f1b3671162104fdefae47682953b64
TypeScript
Balint-Jeszenszky/VIAUAL01-webshop-backend
/externalServices/getAvailableCurrencies.ts
2.625
3
import axios from 'axios'; export default async function getAvailableCurrencies(base: string, apiKey: string) { const response = await axios.get(`http://api.exchangeratesapi.io/v1/latest?access_key=${apiKey}`); const basePrice = response.data.rates[base!]; const rebased: { [key: string]: number } = {}; ...
3e1294e5b50f0ad152079a9255a2292a179f86b0
TypeScript
eprincev-egor/model-layer
/lib/EqualStack.ts
3.3125
3
interface IListItem { self: any; other: any; } export default class EqualStack { list: IListItem[]; constructor() { this.list = []; } get(selfValue: any): any { const item = this.list.find((pair) => pair.self === selfValue ); i...
bc0a3c8152cfd83f9312dcb0cc95c957fee37eb0
TypeScript
Yegorich555/webpack-mock-server
/src/versionContainer.ts
3.015625
3
export default class VersionContainer { major: number; minor: number; patch: number; patchSuffix: string; constructor(version: string) { const arr = version.split(/[v.]/g).filter((v) => v !== ""); this.major = Number.parseInt(arr[0], 10); this.minor = Number.parseInt(arr[1], 10); // eslint...
7665e34a144c703b0e0ca4b553aabc22bcce562e
TypeScript
devnup/ts-framework
/dist/types/server/router/router.d.ts
2.75
3
/// <reference types="winston" /> /// <reference types="express" /> import * as express from 'express'; import { LoggerInstance } from 'winston'; export interface ServerRouterOptions { logger?: LoggerInstance; app?: express.Application; path: { controllers?: string; filters?: string; }; ...
d96aefe601cba4c8b241eac7eed9d0445bffce68
TypeScript
zafardev/cnb-pwa
/src/app/modules/cnb-core/services/utils.service.ts
2.671875
3
import { Injectable } from '@angular/core'; @Injectable() export class UtilsService { constructor() { } isLoaded(loading: boolean): boolean { return loading === false; } tabIs(currentTab: string, tab: string): boolean { // Check if current tab is tab name return currentTab === tab; } boolea...
b8fcf71c80580cf7c342dc2e975a15f5b4d6d8c3
TypeScript
rusith/gimbli
/src/utils/cliUtils.ts
2.78125
3
import * as readline from "readline"; export function getRelevantArguments(args: string[]): string[] { if (args == null) { return []; } return args.slice(2); } export async function getConfirmation(question: string): Promise<boolean> { return new Promise<boolean>((resolve) => { if (!question) { ...
70e787fd0a49589c9106ed5c1d92b95c187e6d89
TypeScript
Serhii-Kozik/MC
/server/src/server.ts
2.875
3
/** * For this test task I will keep all the code in one file. * It will be more comfortable to review the code. * In this file I will implement express server endpoint to receive data from checkpoints. * And WebSocket server for broadcasting updates to the Web user interface. * I will use Sqlite3 database to keep...
7687d433635ee0717456faa4a35c00b30c1ef6de
TypeScript
ChrisChrisLoLo/kame-code
/src/logic/game/reducers/playerMovement.ts
3.359375
3
import { isDeepEquality, deepCopy } from "../../utils"; import { DirectionType } from "../objects/Directions"; import { LevelData } from "../objects/LevelData"; import { Position } from "../objects/Postion"; import { TileType } from "../objects/TileType"; export function forwardReducer(state: LevelData): LevelData { ...
a344acb969050d7b2caa8807ac23971fa0024c08
TypeScript
Ergosign/ux-library-generator
/scripts/handlebarsHelpers/styleguideHelpers.ts
2.828125
3
import { merge, cloneDeep } from 'lodash'; import { Converter } from 'showdown'; const converterOptions = { literalMidWordUnderscores: true }; const converter = new Converter(converterOptions); export function registerHandlebarsHelpersStyleguide(Handlebars) { /** * Get a relative path to the root folder of th...
6c72b2e17f0e7ffdc4a334dd90a1b18967247a01
TypeScript
TooTallNate/umbrella
/packages/rstream/test/timeout.ts
2.796875
3
import * as assert from "assert"; import { timeout } from "../src/subs/timeout"; describe("Timeout", () => { it("times out", function (done) { this.timeout(20); timeout(10).subscribe({ error: () => done() }) }); it("times out with error object", function (done) { ...
ac6a94e6496df871a2e7b4d7e97e9d6567172ea1
TypeScript
phil-r/q
/examples/callbacks.ts
3.328125
3
import { queue } from 'https://deno.land/x/q/mod.ts'; // import { queue } from 'https://raw.githubusercontent.com/phil-r/q/v0.0.1/mod.ts'; // import { queue } from '../mod.ts'; let result = 0; const task = (a: number) => { if (a === 4) throw Error('ow no'); return (result += a); }; const q = queue(task, 2); // 2 i...
4ba77fa269e39bfb8d0c1dd6a1c6cbb6833b6598
TypeScript
guynir/fuzzylist
/ui/src/services/ClientAPI.ts
3.109375
3
import axios, {AxiosResponse} from "axios"; const client = axios.create({ baseURL: "/api/v1/", headers: { "Content-Type": "application/json" } }) export interface HeaderResponse { key: string, title?: string, leftToRight?: boolean } export interface EntryResponse { id: number ...
77fd72b44ff60b0306f88c6200ad79752037078e
TypeScript
duhastsoft/alvo-api
/src/api/v1/entity/Category.ts
2.546875
3
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm'; import BaseEntity from './common/BaseEntity'; import Question from './Question'; @Entity() export class Category extends BaseEntity { @PrimaryGeneratedColumn() id: number; @Column() name: string; @Column({ nullable: true }) icon...
b4b823339ad74c8171a0a53978b70d0ae972acbd
TypeScript
plusGo/awsome-wheel
/projects/ngx-template-engine/src/lib/ngx-template-engine.ts
2.796875
3
/** * 关键字正则,用于判断模板中的某一行是否有此类关键字 */ import {NgxTemplateParser} from './ngx-template-parser'; import {NgxTemplateConfigInterface, NgxTemplateDefaultConfig} from './ngx-template-default-config'; import {tagRegBuilder} from './util/tag-reg-builder'; import {NgxTemplateEngineExecutor} from './ngx-template'; export const ...
f3dfb8132acf657f6f4118bc90d02cbdce5408ab
TypeScript
derekhdawson/metronome
/src/actions/metronomeSoundActions.ts
2.5625
3
export const TOGGLE_METRONOME_SOUND_IS_ACTIVE = 'metronomeSound/TOGGLE_METRONOME_SOUND_IS_ACTIVE'; interface ToggleMetronomeSoundIsActiveAction { type: typeof TOGGLE_METRONOME_SOUND_IS_ACTIVE; } export const toggleMetronomeSoundIsActive = (): ToggleMetronomeSoundIsActiveAction => ({ type: TOGGLE_METRONOME_SOU...
2a9f409cace62fe6d4dbb266c68a657fd388a95e
TypeScript
danngo2000/ecommerce
/store/interfaces/LoginPayload.ts
2.515625
3
// import { Customer } from "./Customer"; // import { Cart } from "./Cart"; // export interface LoginPayload { // email: string; // password: string; // captchaToken?: any; // cartToken?: string; // } // export interface GoogleLoginPayload { // googleToken: string; // } // export interface FacebookLoginPaylo...
2b552b085c841e8b26cde91f3ff9e93512b6b233
TypeScript
wexond/darkreader
/src/generators/modify-colors.ts
2.65625
3
import {rgbToHSL, hslToRGB, rgbToString, rgbToHexString, RGBA, HSLA} from '../utils/color'; import {scale} from '../utils/math'; import {applyColorMatrix, createFilterMatrix} from './utils/matrix'; import {FilterConfig} from '../definitions'; const colorModificationCache = new Map<Function, Map<string, string>>(); ex...
acbbc10602b2468a5ec328ae98260bf439deb700
TypeScript
jonashoyer/lucid-cache
/lib/index.d.ts
2.59375
3
import LocalCache, { LocalCacheOptions } from './localCache'; import RedisCache, { RedisCacheOptions } from './redisCache'; import PersistentStorage, { PersistentStorageOptions } from './persistentStorage'; export declare type MaybePromise<T> = T | Promise<T>; export declare type DefaultCacheObject = { id: string; ...
e16b3a4e2513ccaaaaccd95d970b923fa40bd54c
TypeScript
cdbhnd/WeatherBotkit
/framework/framework/states/AskFloatState.ts
2.734375
3
import { State } from '../StateBase'; import { Conversation } from '../ConversationBase'; export class AskFloatState extends State { private text: string; private property: string; constructor(conversation: Conversation, name: string, text: string, property: string) { super(conversation, name); ...
c9de0a19df790729c8ff9ada2851856bfe539248
TypeScript
uwaifo/chingu_solo_journal
/server/src/resolvers/JournalResolver.ts
2.96875
3
import { Resolver, Mutation, Arg, Query, InputType, Field, UseMiddleware } from "type-graphql"; import { Journal } from "../entity/Journal"; import { isAuth } from "../middleware/isAuth"; //import { User } from "../entity/User"; //import { AuthResolver } from "./AuthResolver" @InputType() class JournalIn...
d685ea7c48a31148165a7c6a62088f9743866c8a
TypeScript
tkrkt/activity-bucket
/src/entity/category.ts
3.125
3
import uuid from "uuid/v4"; import { Entity } from "../framework/entity"; import { Identifier } from "../framework/identifier"; export interface CategoryProps { id: Identifier<Category> | string; name: string; description: string; shorthand: string; } export class Category implements CategoryProps, Entity { ...
6db4005b6e1402e27033957d68ade975a87cf93e
TypeScript
HurricaneInteractive/builtin-react
/lib/helpers/helpers.ts
2.78125
3
const basefontsize = 16; /** * * @param {number} size - Target px size * @param {number} [context=16] - Current Context. */ export const calculateEM = (size: number, context: number = basefontsize) => { let em = ((size / context) * 1).toFixed(3); return em + 'em'; };
25a36c9b21d82661aab898bf61b938550b1d1915
TypeScript
ShuAce/eigen
/src/palette/elements/Text/helpers.ts
2.59375
3
import { useTheme } from "palette" import { isThemeV3 } from "palette/Theme" import { TextV3Props } from "." export const useFontFamilyFor = ({ italic, weight, }: { italic: TextV3Props["italic"] weight: TextV3Props["weight"] }) => { const { theme } = useTheme() if (!isThemeV3(theme)) { return "no-font"...
fbf316f40da4756129470d0e17948df8eb138939
TypeScript
dialexa/hapi-inversify-typescript
/src/errors/not-found.ts
2.671875
3
import * as _ from 'lodash'; export default class NotFoundError implements Error { public readonly name: string = 'NotFoundError'; constructor (private attribute: string) { } public get message(): string { return `The provided "${_.startCase(this.attribute)}" does not exist.` } }
fd63e5cd545505160b4092debf64096a519d4d9a
TypeScript
dalca-official/sayabot
/src/App/Commands/Generic/say.Command.ts
2.859375
3
// src > App > Commands > Generic > say.Command.ts import { Command } from '@/App/Structures/Command.Structure' import { Console } from '@/Tools' import { intergralMessageTypes } from '&types/Command' const commandLog = Console('[Command]') class Say extends Command { constructor() { super() this.cmds = '...
e9948232b40f974e09739a026185f6cd39867716
TypeScript
596050/ts-monorepo
/packages/@isomorphic-typescript/ts-monorepo~/source/sync-logic/deep-object-compare.ts
3.328125
3
import ansicolor = require("ansicolor"); type JSONPrimitive = string | number | boolean | null | Object | any[]; export function deepComparison(oldObj: any, newObj: any, keyChain: string): string[] { const oldObjKeys = Object.keys(oldObj); const newObjKeys = Object.keys(newObj); const fields = new Se...
2a082d01c4faf41c8e33a54c25d8bdb429710b55
TypeScript
Tranzact-Network/arbor-web
/src/utils/execute.ts
2.84375
3
import { exec } from 'child_process'; export function executeCommand( command: string, encoding: BufferEncoding = 'utf8' ): Promise<string> { return new Promise((resolve, reject) => { const results: string[] = []; const errors: string[] = []; const child = exec(command); if ...
56d02dcf3564a112569cdc9b40a2b2fa9e617d92
TypeScript
julianls/base-geometry
/src/matrices/matrix.ts
3.09375
3
export class Matrix { public M11: number; public M12: number; public M13: number; public M14: number; public M21: number; public M22: number; public M23: number; public M24: number; public M31: number; public M32: number; public M33: number; public M34: number; public M41: number; public M42...
cef5eea082027aae16159f9998d5317450b5d916
TypeScript
AndrewAdams3/Gamr-Old
/src/app/services/cheat-codes.ts
2.640625
3
import { Injectable } from '@angular/core'; @Injectable() export class CheatCodesService { // Variables cheatCodes= [ ["ArrowUp", "ArrowUp", "ArrowDown", "ArrowDown", "ArrowLeft", "ArrowRight", "ArrowLeft", "ArrowRight", "b", "a"], ["[", "]", "ArrowDown", "l", "2", "ArrowUp", "l", "1", "o", "ArrowUp", "x", "Arro...
96095a9cdb54e2ef082e0d6c62cefe385bc7e7eb
TypeScript
VitalyShalunov/Pit-detection-system-front
/src/requests/fetchFunction.ts
2.625
3
const API_URL = 'http://localhost:8000'; const AUTH_URL = 'https://localhost:44336/api/account'; class HttpError extends Error { httpStatus: number; constructor(message: string, httpStatus: number) { super(message); this.httpStatus = httpStatus; } } const handleResponse = async <T>(respon...
921779d94202d64711f1a6b137fcfcbe666f056e
TypeScript
maudnals/watom
/src/parser.ts
3
3
import { ItemType, TokenType } from './common/enums'; import { Token, AstItemExtended } from './common/types'; import { SEMICOLUMN } from './common/syntax'; // var ast = { // type: 'Program', // body: [ // { // type: 'FunctionDeclaration', // name: 'add', // params: [ // { // ...
df26a0e224d20ba9e7b79e6f73c79e99dbbcdca8
TypeScript
tsivxrev/puregram
/packages/puregram/src/common/structures/location.ts
2.921875
3
import { inspectable } from 'inspectable'; import { TelegramLocation } from '../../interfaces'; /** This object represents a point on the map. */ export class Location { private payload: TelegramLocation; constructor(payload: TelegramLocation) { this.payload = payload; } public get [Symbol.toStringTag](...
3bfdba946f816217b3e9c10e184b2a05ef0b3a4e
TypeScript
Z1R343L/sprites
/tools/deploy/script.ts
2.71875
3
import fs from 'fs'; import nodePath from 'path'; import vm from 'vm'; import * as pathlib from './path.js'; import * as spritedata from '@smogon/sprite-data'; type Op = { type : 'Write', data : string, } | { type : 'Copy', src : string, }; type OpEntry = { type : 'Op', op : Op, dst : st...
71415dc164a761b8fbcdb70b26ec23e90302a363
TypeScript
Goyatuzo/riot-api-typedef
/v4/summoner.d.ts
2.578125
3
export namespace SummonerV4 { export interface SummonerDTO { /** * ID of the summoner icon associated with the summoner. */ profileIconId: number; /** * Summoner name. */ name: number; /** * Encrypted PUUID. Exact length of 78 char...
de331165802b88b2a847521449c51d6177d6b9fd
TypeScript
IronOnet/codebases
/codebases/invisionapp.com(dashboard)/src/hooks/useScroll/index.ts
2.640625
3
import { useState, useRef, RefObject } from 'react' import throttle from '../../helpers/throttle' import useEventListener from '../useEventListener' function getPosition(element: any) { if (!element) { return { x: 0, y: 0 } } const isWindow = element.scrollY != null && element.scrollX != null const x = isW...
cf1e61979b645056d01e4a7354ec3e452e231afa
TypeScript
rgcunha/blockchain
/src/Blockchain.ts
3.078125
3
import Block, { ITransaction } from './Block'; export default class Blockchain { private chain: Block[]; private difficulty = 5; constructor() { this.chain = [this.createInitialBlock()]; } createInitialBlock() { return new Block({ index: 0, timestamp: new Date().toISOString(), ...
a55560bd095a4ded59ef25f920c61e0202f15f16
TypeScript
keepforever/type-graphql-docker-compose
/src/modules/user/register/RegisterInput.ts
3.03125
3
import { Length, IsEmail } from "class-validator"; import { Field, InputType } from "type-graphql"; import { IsEmailAlreadyExist } from "./isEmailAlreadyExist"; @InputType() export class RegisterInput { @Field() @Length(1, 255, {message: "my custom error message for graphql to return in the event this validati...
3692c0e51a984fcf7ce213ff773bb2de3b741112
TypeScript
GermanBluefox/home-assistant-polymer
/src/state/url-sync-mixin.ts
2.515625
3
import { Constructor, LitElement } from "lit-element"; import { HassBaseEl } from "./hass-base-mixin"; import { fireEvent } from "../common/dom/fire_event"; /* tslint:disable:no-console */ const DEBUG = false; export const urlSyncMixin = ( superClass: Constructor<LitElement & HassBaseEl> ) => // Disable this func...
30d912be684a9b198148b9a5da35d4ae6006cd2b
TypeScript
msxiehui/tools
/egret/src/Tools.ts
2.859375
3
/** * 静态工具类 * @Author: msxiehui * @Date: 2020-11-18 17:36 * @Version 1.0 * @description: 不同时期制作和完善的工具类 * @update: 2020-11-18 17:36 */ class Tools { public instance; constructor() { if (!this.instance) { this.instance = new Tools() // console.log("新建Tools") } ...
eb5b61d18959c572f01f398feef9ce871de62fa3
TypeScript
TigreDev/FullStackOpen_Part9_RubenTigre
/Patientor/patientor_backend/index.ts
2.5625
3
import express from 'express'; import cors from 'cors'; import { Diagnosis, NoSSNpatient, Patient } from './types'; import diagnosesService from './services/diagnosesService'; import patientsService from './services/patientsService'; const app = express(); app.use(express.json()); app.use(cors()); const PORT = 3001; ...
49013a75af256ff7e1c86ece8e94617cb8cc13d1
TypeScript
JeroenVanDerLaan/react-example-carousel
/src/js/utility/NumberRange.ts
2.75
3
class NumberRange { public clamp(min: number, max: number, value: number): number { return Math.min(Math.max(value, min), max); } } export default new NumberRange();
afc8a34d117757e60f6180856b9868d1ba27c1eb
TypeScript
roberton/aoc2020ts
/src/day/23.ts
3.203125
3
import CircularList, { Node } from '../lib/CircularList'; export const Day23 = { id: '23', star1, star2 }; function star1 (lines: string[]): string { const game = startGame(lines[0]); // const game = startGame('389125467'); const finalGame = playGame(game, 100); const gameString = makeGameString(finalGa...
590a8f156076d618ba4c161acdd6f5948408471a
TypeScript
sm2774us/Front_End_Study_Notes
/TypeScript/AdvancedDataStructures/linked-list/singly-linked-list.spec.ts
3.453125
3
import { SinglyLinkedList } from './singly-linked-list'; describe('Singly linked list', () => { function genSinglyLinkedListFromArray(array: number[]): SinglyLinkedList<number> { const singlyLinkedList = new SinglyLinkedList<number>(); array.forEach((item) => { singlyLinkedList.insertAtTail(item); ...
09443dd660e0c3bc3772498e9c5a6f06b68d1f0f
TypeScript
Kir-Antipov/mc-publish
/src/utils/actions/action-input.ts
2.625
3
import { runSafely } from "@/utils/async-utils"; import { $i, asArray } from "@/utils/collections"; import { Converter, toType } from "@/utils/convert"; import { getAllEnvironmentVariables, getEnvironmentVariable, setEnvironmentVariable } from "@/utils/environment"; import { QueryString } from "@/utils/net"; import { M...
1ca07013b9f77446ac3ef95333ee3a6d947d3c5e
TypeScript
mmeloni/angularjs-v1
/app/modules/shard/shard.component.ts
2.546875
3
/** * This component represent a single shard element, can be used both inside * a grid or as a standalone component. * To not be confused with the shard detail page. */ import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; import { Shard, ShardType } from './types'; import { ShardStateProvid...
6cc144ede4073d9e393fb2321712096a0b8d4e15
TypeScript
jkutianski/keymapceditor
/src/Utils/classnames.ts
3.15625
3
const hasOwn = {}.hasOwnProperty; export const cns = (...args: any[]) => { let classes = []; for (let i = 0; i < args.length; i++) { var arg = args[i]; if (!arg) { continue; } let argType = typeof arg; if (argType === "string" || argType === "number") { ...
9d6904c83960a320c5e3715987481d5746b70450
TypeScript
NepipenkoIgor/ts261220
/old/types/special.ts
2.875
3
let anyType: any = {}; anyType.a = 1; anyType['n'] = 2; anyType = 1; anyType(); let unkType: unknown = {}; unkType.a = 1; unkType['n'] = 2; unkType = 1; unkType(); let objType: object = {}; objType.a = 1; objType['n'] = 2; objType(); objType = 1; Object.create(objType) let vd: void = undefined; vd = 1; func...
6383b06f5e88ef7062943733f752246a859e3bef
TypeScript
rayshoo/typeScript_Learning
/src/08 class3.ts
4.15625
4
interface Person { name : string; say(message : string) : void; } interface Programmer { writeCode(requirement : string) : string } abstract class Korean implements Person { /* 하위 타입에 구현하는거 떠넘기기 */ public abstract jumin : number; constructor(public name : string) { } say(msg : string) { console...
801386438de7c2e29957b47b4dcaee7a9359ebd4
TypeScript
ramegp/Clases-Backend
/clase-04/Desafio/src/app.ts
3.375
3
const time = (second:number)=> new Promise((resolv,reject)=>{ setTimeout(()=>{resolv(1)},second*1000) }) async function mostrarTexto(str:string,second:number=1,amount:number,callback:()=>void) { let words = str.split(" "); let numberOfWords = amount + words.length; for (const word of words) { ...
6fe03b48f45aec3588900c06c561734719fd338c
TypeScript
heypoom/algorithms-in-typescript
/tests/graph/graph-creation.test.ts
3.09375
3
import {dot} from '~/graph' describe('Graph Creation with dot utility', () => { it('can link to itself', () => { const g = dot`A -> A` expect(g.edgeOf('A')).toStrictEqual(['A']) }) it('can link to itself multiple times without duplicate vertices.', () => { const g = dot`A -> A, A, A, A, A, A` ...
8e4c4deba9d3cb2f40b24ce07c4a10166498f73d
TypeScript
mischnic/screenshot-tester-server
/typings/micro-upload/index.d.ts
2.546875
3
import { IncomingMessage, ServerResponse } from "http"; export interface File {} export interface IncomingMessageFile extends IncomingMessage { files: Array<File>; } type FileRequestHandler = ( req: IncomingMessageFile, res: ServerResponse ) => any; type RequestHandler = (req: IncomingMessage, res: ServerResponse...
0f661029c719dc84c635f3573dd045692a54efd8
TypeScript
deroude/homeradio-cloud
/src/app/store/actions/radio.ts
2.59375
3
import { Action } from '@ngrx/store'; import { Radio } from '../../domain/radio'; export const LOAD = "[Radio] Load"; export const LOAD_SUCCESS = "[Radio] Load successful"; export const LOAD_FAIL = "[Radio] Load failed" export const CLEAR = "[Radio] Clear" export class LoadAction implements Action { readonly type...
b863ff9730ad24e115b654a9b9ede1df8c986a0e
TypeScript
edwinvillota/FrontendTest_1
/src/api/products/getProducts.ts
2.671875
3
import { env } from '@env'; import { Product } from 'ts/models'; interface GetProductsReturnType { error: boolean; message: string; data: Product[] | null; } export default async function getProducts(): Promise<GetProductsReturnType> { try { const response = await fetch(env.PRODUCT_API, { method: 'G...
90347a626bd78c896640e9c357a382351d261184
TypeScript
Gi972/xstate-catalogue
/lib/machines/multi-step-form.machine.ts
2.625
3
import { assign, createMachine } from 'xstate'; export interface MultiStepFormMachineContext { beneficiaryInfo?: BeneficiaryInfo; dateInfo?: DateInfo; errorMessage?: string; } interface BeneficiaryInfo { name: string; amount: number; currency: string; } interface DateInfo { preferredData: string; } ex...
5962f55e25f1024db77e2c2a1994d88ec794c525
TypeScript
sage1991/typescript-complete-guide
/05-web-framework/src/views/CollectionView.ts
2.5625
3
import { Collection } from "../models/Collection"; abstract class CollectionView<T, K> { constructor(private parent: Element, private collection: Collection<T, K>) {} protected abstract renderItem(model: T, parent: Element): void; async render(): Promise<void> { this.parent.innerHTML = ""; const...
8cd1f34786b662c4c0bed38f167fb01774ed9691
TypeScript
chrisoppedal/100AlgorithmsChallenge
/sumOfTwo/sumOfTwo.ts
3.734375
4
export function sumOfTwo(a: number[], b: number[], numToFind: number): boolean { const largerArr = a.length > b.length ? a : b; const smallerArr = largerArr == a ? b : a; const sumArr = []; largerArr.forEach(num => { smallerArr.forEach(innerNum => { sumArr.push(num + innerNum); ...
78f5ae8b32516e17f0b603a0c5d0fd680aaac14e
TypeScript
jonathanrdgracia/typescript-learning-path
/async/promise.ts
3.625
4
class Family{ constructor( public readonly name: string, public readonly castles: string[] ){} } const first = new Family('Name one',['Castle one','Castle two']) const second = new Family('Name two',['Castle second','Castle second two']) const families: Family[] =[first,second] function getCa...
8d6507964e9fefa78055b29c351f1ed801d93140
TypeScript
gadjetboi/VanzAngularEcommerce
/src/app/models/product.model.ts
2.8125
3
export class ProductModel { constructor(name? : string, description? : string, price? : number, imgUrl? : string) { this.name = name; this.description = description; this.price = price; this.imgUrl = imgUrl; } public name: string; public description: string; publ...
21b5f3b397bda569206bd3203553700c0b6769d9
TypeScript
doninialessandro/express-typescript
/src/decorators/controller.ts
2.65625
3
/* eslint-disable @typescript-eslint/ban-types */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import 'reflect-metadata' import { Request, Response, RequestHandler, NextFunction } from 'express' import { Methods, MetadataKeys } from '../enums' import { AppRouter } from '../utils/AppRouter' f...
65e37821ce7da3e8704eaa8ff044adb410723d08
TypeScript
sktanner/Typescript_Demo
/app/03-classes.ts
3.890625
4
//Properties class Person { fName: string; lName: string; } let melody: Person = new Person () melody.fName = "Melody" melody.lName = "Tanner" let someVariableName: Person = new Person() // Methods class PersonTwo { fName: string; lName: string; sayHello(){ console.log("Hello", this....
9f617196f94d51f7dfdde7c2af5fda7179ee53eb
TypeScript
neoclide/rename.nvim
/lib/util/iterator.d.ts
2.875
3
export interface INextIterator<T> { next(): T; previous(): T; } export declare class ArrayIterator<T> implements INextIterator<T> { private items; protected start: number; protected end: number; protected index: number; constructor(items: T[], start?: number, end?: number); first(): T; ...
a64451e2685e632a8ae98ef5324f1966fdee22a0
TypeScript
jkieboom/monaco-auto-import
/src/auto-complete/import-db.ts
3.3125
3
import { Expression } from "../parser"; type Name = string; type Path = string; export interface Import { name: Name; type: Expression; isImportEquals: boolean; } export interface ImportObject extends Import { file: File; } export interface File { path: Path; aliases?: Path[]; imports?: Import[]; } ...
35aea40f06db27020a791a4fc9553a1f8a31b6ce
TypeScript
odessa-yandex-praktikum/crazy-bomber
/src/store/reducers/forumReducer.ts
3.03125
3
import {TMessage, TTopic} from '../../server/controllers/forum'; import {ForumAction, ForumActionTypes, MessagesActionTypes, TopicActionTypes} from '../types/forum'; export type ForumState = { topics: TTopic[]; messages?: TMessage[]; topic?: TTopic; error?: string; }; export const initialState = { ...
6358997f09acec753957aef408863bd84f1a7c73
TypeScript
crocodele/tinycar
/typescript/Tinycar/Ui/Menu.ts
2.84375
3
module Tinycar.Ui { interface IHandlerList { [key:string]:Function; } export class Menu { private clickEvent:number; private handlerList:IHandlerList = {}; private htmlRoot:JQuery; private itemList:Array<Object> = []; private menuVisible:boolean = fal...
a560339a1377eb5b4749e1ef84fea4997986c530
TypeScript
erick-rivas/nodejs-api-reference
/src/support/gens/routes/api/Templates.ts
2.625
3
const CTRL_TEMPLATE = ` import { Request, Response } from "express"; import Sql from "@lt/sources/Sql"; import Res from "@util/http/responses"; import #Model# from "@lt/models/#Model#"; import Generator from "@util/Generator"; class #ClassName# { private sql: Sql; constructor(p: { sql: Sql }) { this.sql ...