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
ccaa40dcdc26fe50fce892ae76d5d39249503948
TypeScript
wahello/wigfrid
/src/clarity-angular/core/src/util/string-manipulation/escape-html.d.ts
2.921875
3
/** * Escapes a string by replacing HTML characters as text entities. * * Strings entered by uses should always be escaped before they are displayed * in HTML pages. This ensures page integrity and prevents HTML/javascript * injection attacks. * * @param text Text to escape. * @return An HTML-escaped version of...
332a40ac68e67c385592891d91a9867b76eaa163
TypeScript
IgorsouzaS/Controle-de-hor-rio-para-clinica
/src/models/rule.ts
2.859375
3
export class Rule{ private dateInit; private dateFinish; private timeInit; private timeFinish; private requestTime; private deleted : Boolean; private id : Number; private available : Boolean; private type : String; constructor(){ } public getDateInit(){ retur...
4d35c117ff2bca6fb2c6617fbd2bf994c7e88ba5
TypeScript
green-fox-academy/LeventePoth
/Week-02/Day-4/Centered boxes/center-box-function-ts.ts
3.296875
3
'use strict'; const canvas = document.querySelector('.main-canvas') as HTMLCanvasElement; const ctx = canvas.getContext('2d'); // DO NOT TOUCH THE CODE ABOVE THIS LINE // Create a square drawing function that takes 1 parameter: // The square size // and draws a square of that size to the center of the canvas. // Draw...
c19afd5920866c3236804a30b384595fe611334f
TypeScript
SocialGouv/domifa
/packages/backend/src/users/dto/structure-login.dto.ts
2.515625
3
import { ApiProperty } from "@nestjs/swagger"; import { IsEmail, IsNotEmpty } from "class-validator"; import { IsValidPassword } from "../../_common/decorators"; export class StructureLoginDto { @ApiProperty({ type: String, required: true, }) @IsNotEmpty() @IsEmail() public readonly email!: string; ...
20298776f7295949307abfce6428a6863c7898de
TypeScript
furti/mighty-quest-for-tux
/src/ts/console/ConsoleContent.ts
2.84375
3
import { ConsoleFile } from './ConsoleFile'; import { Executable } from './Executable'; /** * Contains all the files and folders for a console instance. */ export interface ConsoleContent { /** * Markdown String that should be shown on startup. */ welcome?: string; /** * List of Executable...
23df27780bde43ea601787c89ffde97ad022de19
TypeScript
misal99/angular-task-riaadvisory
/src/app/service/common.service.ts
2.53125
3
import { Injectable } from '@angular/core'; @Injectable() export class CommonService { constructor() { } getReadableString(key: string) { return key.split(/(?=[A-Z])/).join(' '); } isListType(data, key: string) { if (typeof (data[key]) !== 'object') { return true; } else { return fa...
8856380b6e8769889d9910d94fc096be38e6f367
TypeScript
10up/component-library
/packages/accordion/index.d.ts
2.5625
3
declare module '@10up/component-accordion' { export interface AccordionElements { link: HTMLAnchorElement, content: HTMLElement, heading: HTMLElement } export type AccordionOptions = { /** * Called after the accordion is initialized on page load. */ onCreate?: () => void, /** * Called when an a...
d8dd8745963801071796a41af20ac35e3c6b360a
TypeScript
ecraig12345/office-ui-fabric-react
/packages/react-components/react-utilities/src/utils/shouldPreventDefaultOnKeyDown.ts
2.984375
3
import { Space, Enter } from '@fluentui/keyboard-keys'; import * as React from 'react'; /** * @internal * Checks if the keyboard event should preventDefault() for Enter and Spacebar keys * * Useful for situations where a keydown needs to be transformed to a click event */ export function shouldPreventDefaultOnKey...
3c4406732a371a9eb87bb7d29c3af04e5ca32d0a
TypeScript
ys-ishikawa/typescript-for-javascript-developers
/src/optional-arguments.ts
3.4375
3
export {}; // calcBMI(身長, 体重, console.logで出力するかどうか?) // calcBMI(1.65, 51, true); => 出力 // calcBMI(1.65, 51, false); => 出力しない // calcBMI(1.65, 51); => 出力しない let calcBMI: (height: number, weight: number, printable?: boolean) => number = ( height: number, weight: number, printable?: boolean ): number => { ...
2df7f0abb84dd7c12ed06c99f978d7934fd8a038
TypeScript
Qcumbeer/droids-api
/src/application/service/conversation.service.ts
2.53125
3
import { Conversation } from "../../domain/conversation/conversation"; import { Dependencies } from "../core/dependencies"; export interface ConversationService { getOrCreateConversation(droidId: string): Promise<Conversation>; } export const conversationService = ({ conversationRepository, logger }: Dependencies):...
92dc7d8c58789930090a72fb9ae3146a87e21f28
TypeScript
guicostaarantes/cashbook-server
/src/shared/providers/TemplateProvider/ITemplateProvider.ts
2.515625
3
export interface ITemplateValues { [key: string]: string; } export interface ITemplateProvider { parse(template: string, values: ITemplateValues): Promise<string>; }
349507f7e870ef8fba99a88bd2b835b38440dceb
TypeScript
Wesleyss071299/FotonBooks
/mobile/src/components/Input/styles.ts
2.546875
3
import styled from "styled-components/native"; import { Dimensions } from "react-native"; import { CustomThemeProps } from "../../constants/theme"; const windowWidth = Dimensions.get("window").width; interface InputContainerProps extends CustomThemeProps { isMultiline: boolean; } export const InputContainer = styl...
ed6d0f42b901d741dbdf0b2fe685039264278f65
TypeScript
RawbitDev/Task-Time-Tracking-App
/fwe-app/fwe-api/src/controller/task/task.tracking.controller.ts
2.796875
3
import { Request, Response } from 'express'; import { getRepository, Repository } from 'typeorm'; import { Task } from '../../entity/task.entity'; import { Tracking } from '../../entity/tracking.entity'; import { addElement, removeElement } from '../../util/array.util'; import { validateEntity } from '../../util/v...
3b17888ceec2d42b5733f360c906fd0da068871f
TypeScript
DarrenDanielDay/MeetHere
/src/model/entity/peroid.ts
3.390625
3
export function inrange(id: number) { return 0 <= id && id < 48 && id === Math.ceil(id); } export class TimePiece { public beginTime: string; public endTime: string; constructor(public readonly id: number) { if (!inrange(id)) { throw new Error("period id must be integer in [0,48)")...
1800a5a2d0b99f3278a60c0c42a66ecf02f64222
TypeScript
Mrostcik/WWW
/Quiz_Zad2/test.ts
2.625
3
import { expect } from "chai" import { driver } from "mocha-webdriver"; function sleep(ms: any) { return new Promise(resolve => setTimeout(resolve, ms)); } describe("Test 1", () => { it ('Solving the same quiz twice is impossible', async function() { this.timeout(30000); await driver.get("h...
9e7cdb0de3485c9be84b6c186a0464c03491f375
TypeScript
huxia0ba0/note
/typescript学习/03-类型推断.ts
4.53125
5
// ts可以自动类型推断 let n = 1; // ts会自动推断出n是number类型 n+=3 // 不报错,因为已知类型 let ary = []; // 类型为: any[] ary.push(1, '2', {a: '3'}); let array = [1]; // 内部要有数字, 才能推断出正确类型 arr.push(2); // 自动阅读if条件判断 let numb: number | null = 0.5 > Math.random() ? 1 : null; if(null !== numb){ numb+=3 // ts知道现在n不是null是number } // typeof let...
6c55d3bd819c19fd677d001b65d275ad3807317d
TypeScript
DrBits/schedule_grid
/src/client/app/util/cache.ts
3.25
3
declare type Getter<T> = (ID) => T export default class Cache<ID, T> { private getter: Getter<T>; private cache: {ID: T}; constructor(getter: Getter<T>) { this.getter = getter; this.cache = <{ID: T}>{}; } set: (ID, T) => void = (id, t) => this.cache[id] = t; get: (ID) => T = id => { if (!th...
6d45bfa276527bf04265757f291f7baa2e488bfb
TypeScript
MaximNd/superchat
/shared/ContactDto.ts
2.828125
3
export class ContactDto { readonly id: number; readonly username: string; readonly avatar: string; readonly description: string; readonly isOnline: boolean; readonly socketId: string; constructor( id: number, username: string, avatar: string, description: string, isOnline: boolean, ...
7c322929d7956d461bc54e88510ed58412746d12
TypeScript
rtfb/tarsier
/programs/fib.ts
3.4375
3
let fib = fn(n) { if (n == 1) { return 1; } if (n == 2) { return 1; } return fib(n - 1) + fib(n - 2); } puts(fib(1)); puts(fib(2)); puts(fib(3)); puts(fib(4)); puts(fib(5)); puts(fib(6)); puts(fib(7)); puts(fib(8)); puts(fib(9)); puts(fib(10));
ec53562cdf4912de9958f31f1d0f16e67c4c5749
TypeScript
f0und3r/traderbot
/packages/tg/src/listeners/02-subscribe-id.ts
2.703125
3
import { Listener } from "../types" import logMessage from "../utils/log-message" const onlyNumbersRegExp = /^\d+$/ const listener: Listener = (bot, msg, state, updateState, next) => { const text = msg.text || "" if (state.type === "subscribe-delete" && state.id === null) { if (onlyNumbersRegExp.test(text)) ...
00f0936d507e37a24bc0f5fcd6f122cbf971f4e3
TypeScript
Anuradha2018/Angular
/state/src/app/app.component.ts
2.546875
3
import { Component } from '@angular/core'; import { Hero } from './hero'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { title = 'Hero'; currentHero = new Hero (1, 'Tornado', new Date(1970, 1, 25)); heroImageUrl = '...
a4eb661b9c3d26ac0392a17ebcaf7baa4dce640e
TypeScript
future4code/Danilo-Mourelle
/semana17/Criptografia/src/services/Autorizer.ts
2.734375
3
import * as jwt from 'jsonwebtoken' export class Autorizer { public generateToken(payload: AuthenticationData): string { const token = jwt.sign( payload, process.env.JWT_KEY as string ) return token } public getData(token: string): AuthenticationData { const payload = jwt.verify( ...
6455b694a3432adccf689dd14769b709c7b33049
TypeScript
ti-community-infra/ti-sync-bot
/src/db/entities/ContributorInfo.ts
2.515625
3
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm"; @Entity({ name: "contributor_info" }) export class ContributorInfo { @PrimaryGeneratedColumn({ name: "id" }) id!: number; @Column({ default: null, unique: true }) github!: string; @Column({ default: null }) name!: string; @Column({ type...
82f92f5a50b62bddf1722c675c3063206efd3013
TypeScript
mattcarlotta/SJSITAPP-Website
/api/controllers/dashboard/availability/index.ts
2.53125
3
import type { Request, Response } from "express"; import { Event, Form } from "~models"; import { createDate, createMemberAvailabilityAverage, convertId, getEventCounts, parseSession, sendError, moment } from "~helpers"; /** * Retrieves a members availabilty for a percentage chart. * * @function getAv...
d71347df0e2110dafab277b9fc1c334daa4b6ea9
TypeScript
domuk-k/typed-todo-with-ReactAlike
/src/components/module/UList.ts
2.84375
3
import { Component } from '../../lib/types'; import { createVnode } from '../../lib'; import { ListItem } from '../atom/ListItem'; import type { Todo } from '../../model'; import { compareDate } from '../../utils'; interface IProps { todos: Todo[]; onRemove: () => Promise<void>; onToggle: () => Promise<void>; } ...
734d85d45ec74ce3b98e6b9dd134afc3d803236b
TypeScript
phenomnomnominal/ineeda
/src/ineeda-interceptors.ts
2.90625
3
// Dependencies: import { IneedaInterceptor, IneedaInterceptorFunction, IneedaInterceptorToken } from './ineeda-types'; // Constants: let INTERCEPTORS: Array<IneedaInterceptorFunction<any, keyof any>> = []; let INTERCEPTORS_WITH_TOKEN: Map<IneedaInterceptorToken, Array<IneedaInterceptorFunction<any, keyof any>>> = ne...
6b70e292fff55a2584cbaf1c957b1b2fe0d77b7a
TypeScript
mshahzebedu/NestjsRestApi
/src/student/student.controller.ts
2.515625
3
import { Controller, Get, Post, Put, Delete, Body, Param, UseGuards, } from '@nestjs/common'; import { StudentEntity } from './student.entity'; import { StudentService } from './student.service'; import { AuthGuard } from '@nestjs/passport'; @Controller('student') export class StudentController { con...
da540b33b3c4a704d469c02779420d5da4796197
TypeScript
spraylee/algorithm-learning-practice
/src/main.ts
2.875
3
import { MinHeap } from './articles/11.Heap/Heap' const minHeap = new MinHeap() minHeap.insert(1) minHeap.insert(5) minHeap.insert(0) minHeap.insert(10) minHeap.insert(999) minHeap.insert(-19) minHeap.insert(34) minHeap.insert(1) console.log(minHeap.removeMin()) console.log(minHeap.removeMin()) console.log(minHeap.r...
8a2b686837361816b778422b8d6afb575692ee74
TypeScript
sth-larp/deus-models
/test/models/general.test.ts
2.84375
3
//Тесты для событий общего назначения (для хакеров и т.д.) import { expect } from 'chai'; import { process, printModel } from '../test_helpers'; import { getExampleModel } from '../fixtures/models'; import { getEvents, getRefreshEvent } from '../fixtures/events'; describe('General events: ', () => { it("Add temp...
ebc1a8c0ecb515c111ad960cb192b864f6673a99
TypeScript
ikaem/kmp-client
/src/common/types.ts
2.546875
3
export interface NewCustomerInput { firstName: string; lastName: string; email: string; } export interface CustomerData extends NewCustomerInput { id: string; createdAt: string; updatedAt: string; }
19199d79aab0d5b888b2845d3343da30af6df366
TypeScript
omaroaburto/Curso_Node
/01-javascript/01-callbacks.ts
2.984375
3
const getUsuarioById = (id:number, callback:Function)=>{ const usuario:{id:number, nombre:string} ={ id, nombre: "Omaro", } setTimeout(()=>{ callback(usuario) },1500) } getUsuarioById(10, (usuario:any):void=>{ console.log(usuario.id) console.log(usuario.nombre) });
a19ca0b6ff950c4a47ab5ebabc794c6d10e01170
TypeScript
thisissoon-fm/frontend
/src/app/auth/auth.module.ts
2.515625
3
import { NgModule, ModuleWithProviders, Provider } from '@angular/core'; import { CommonModule } from '@angular/common'; import { OAuthService } from './oauth/oauth.service'; const defaultProviders: Provider[] = [OAuthService]; @NgModule({ imports: [CommonModule], declarations: [] }) export class AuthModule { ...
2a851ea68272fdfc52213cdd358dc806a10e5faa
TypeScript
bryangreen/poker-evaluator
/src/app/shared/Rank.ts
3.53125
4
export interface RankInterface { name: string; code: string; ranking: number; index: number; } export const enum StandardRanks { Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace } export class Rank implements RankInterface { constructor(public name: str...
407be813d57eccc4e88a514f4e4fea633d6bf4e8
TypeScript
ceyhunmavzer/arcelor-mittal-test
/forntend/src/app/core/modules/hourglass/hourglass.component.ts
2.515625
3
import { Component, OnInit } from '@angular/core'; import { FormControl } from '@angular/forms'; import { Hourglass } from '../../models/Hourglass'; import { HourglassResponse } from '../../models/HourGlassResponse'; import { HourGlassService } from '../../services/hourglass.service'; @Component({ selector: 'app-hou...
51f8a1306b5d8b2e00575691ecbc1fc58c7f9f4c
TypeScript
VicenteGMtz/takous-service
/controllers/producto.ts
2.515625
3
import { Request, Response } from "express"; import Producto from "../models/producto"; export const getProductos = async (req: Request, res: Response) => { const productos = await Producto.findAll(); res.json({ productos, }); }; export const getProducto = async (req: Request, res: Response) => { const { ...
adcded736a0734da132493a686c9fd8e423d1196
TypeScript
ZephyrAndMoon/best-utils
/src/isNumber.ts
3.375
3
import { is } from './.helper' /** * isNumber 判断是否是number类型 * @version 1.0.2 * @param val 要判断的变量 * @category isNumber * @example * ``` typescript * isNumber(123) * ``` */ const isNumber = (val: unknown): boolean => { return is(val, 'Number') } export default isNumber
428150d086e724e33d424e054620de0ece022b45
TypeScript
tomByrer/ASWebGLue
/asc.d.ts
3.0625
3
type externref = number; type bool = any; type i8 = any; type i16 = any; type i32 = any; type i64 = any; type f32 = any; type f64 = any; type u8 = any; type u16 = any; type u32 = any; type u64 = any; type usize = any; declare class StaticArray<T> { constructor(x: number) } declare function assert<T>(isTrueish: Text, ...
79fb952e4221316089e17960191dc1ebf4093eda
TypeScript
jepetko/feathersjs-auth-meets-typescript
/src/models/secrets.model.ts
2.703125
3
export interface SecretAttrs { value: string; } /** * instance * Note: id, created_at, updated_at are auto-added by Sequelize */ export interface Secret extends SecretAttrs { id: number; created_at?: Date; updated_at?: Date; }
d17bfee9f88368477ca570990997d072953cc1e6
TypeScript
fredbutters/pluralsight-es6-typescript
/src/js/modules/modules.ts
2.625
3
function doStuff(...stuff: string[]) { stuff.forEach(item => { console.log(item) }); } function complain(...gripes: string[]) { gripes.forEach(gripe => { console.log(gripe); }) } export { doStuff as default, complain };
740d3cca57a57141b151315d482d4e7bfae23cfc
TypeScript
Dapiguabc/iotube-analysis
/src/server/db.ts
2.609375
3
import { IBlockMeta } from "iotex-antenna/lib/rpc-method/types"; import sqlite from "sqlite3"; import { Platform } from "../constant"; export type SortBytime = "year" | "month" | "day" export interface Transaction { acthash: string, type: "inflow" | "outflow", // inflow: tokens flow into iotex; outflow: toke...
addd90c4a9c8f01e9a904f7ae4852dd39fb498df
TypeScript
mcountryman/geotab-rx
/src/models/key.ts
2.8125
3
/* eslint-disable @typescript-eslint/no-empty-interface */ import { IEntity } from "./entity"; import { DriverKeyType } from "./driver_key_type"; import { IDriver } from "./driver"; /** Represent the key used to identify a . */ export interface IKey extends IEntity { /** Gets or sets driver of the driver key. */ d...
88a35b8d4430107b86c0454f60b59c45afdefcdc
TypeScript
gesanchez/animal-kingdom
/src/services/animals.service.ts
2.828125
3
import { Animals } from "../interaces/animals"; import { AnimalsParamsReq } from "../interaces/animals-params.req"; import { AnimalsResponse } from "../interaces/animals.res"; import http from "@/tools/api"; class AnimalsService { /** * getRandom * * @description Method for return a random animal * from ...
295714e33887901cf39208b109dea2d16456dfa2
TypeScript
eliasylanen/no-dep-utils
/src/object/remove.ts
3.03125
3
import { Omit } from '../../types'; export const removeKey = <O extends object, K extends string>( obj: O, keyToRemove: K, ): K extends keyof O ? Omit<O, K> : typeof obj => { return Object.keys(obj).reduce((acc: object, key: string): object => { return key === keyToRemove ? acc : typeof obj[key a...
447e2d59d84bc7ab9cd904e1f52deec2a33b0e82
TypeScript
tgv1975/ng-trichotomy
/projects/ng-trichotomy/src/lib/trichotomy/ng-trichotomy.component.spec.ts
2.640625
3
// tslint:disable:max-line-length import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { NgTrichotomyComponent } from './ng-trichotomy.component'; describe('NgTrichotomyComponent', () => { let component: NgTrichotomyComponent; let fixture: ComponentFixture<NgTrichotomyCompon...
4edea2c2fec34ccede0016427d4c0f4d4d6cb5c5
TypeScript
wwlh200/protobuf-ts
/packages/example-chat-system/server/server.ts
2.515625
3
import * as grpc from '@grpc/grpc-js'; import {RpcError, RpcInputStream, ServerCallContext} from "@protobuf-ts/runtime-rpc"; import {adaptService} from "@protobuf-ts/grpc-backend"; import {IChatService} from "./service-chat.server"; import {ChatEvent, ChatService as ChatServiceType, JoinRequest, PostRequest, PostRespon...
1db10d61ccffbbcfda0a23b94a023c0cbe39763a
TypeScript
AlexWarwick01/SettleBot
/src/handlers/pollHandler.ts
2.796875
3
import { singleton } from "tsyringe"; import { Poll, PollVote } from "../utilities/models"; import { Logger } from "../utilities/logger"; import * as fs from "fs"; const MOD = "pollHandler.ts"; @singleton() export class PollHandler { private poll: Poll; constructor(private logger: Logger) { this.load...
dfde4575d5dd0e99b4c85c6d5a79f7f62784a5a1
TypeScript
sinnerJoe/exchange-app
/src/components/numeric-input/validators.ts
2.828125
3
export function hasInvalidCharacters(value: string) { return !!value.match(/[^0-9,.]/); } export function hasTooManyDecimals(value: string) { const [, decimal] = value.split("."); return !!decimal && decimal.length > 2; } export function hasMultipleDots(value: string) { const val = (value.match(/\.|,/g) || []...
f58ce711a1cc77512f78bc01c5978ad05317c672
TypeScript
Jamilammar/blink-app-test
/src/app/pokemon.service.ts
2.515625
3
import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import { Observable } from 'rxjs'; @Injectable() export class PokemonService { theUrls = []; constructor(private http: Http) {} getPokemon(): Observable<any> { return this.http.get('https://pokeapi.co/api/v2/pokemon/?limit=10'...
3e747b5bab2897f43939a5f483f7078302e092b4
TypeScript
shilangyu/frontend-stack
/src/stores/ConfigStore.ts
2.71875
3
import { Language } from 'locales/strings' import { action, autorun, observable } from 'mobx' class ConfigStore { @observable language: Language = /pl/i.test(window.navigator.language) ? Language.polish : Language.english constructor() { this.load() autorun(this.save) } private save = (): void => windo...
b72171a2c4e989d1520c93b844c1366b827a6ec2
TypeScript
sushiswap/sushiswap
/packages/v2-sdk/src/route.ts
2.78125
3
import { Price, Token, Type as Currency } from '@sushiswap/currency' import invariant from 'tiny-invariant' import { SushiSwapV2Pool } from './SushiSwapV2Pool/SushiSwapV2Pool' export class Route<TInput extends Currency, TOutput extends Currency> { public readonly pairs: SushiSwapV2Pool[] public readonly path: Tok...
f72984727a952cc89a6e866278bab919ea151d9f
TypeScript
mcnguyen/type-plus
/src/math/Digit.ts
3.40625
3
import { Tail } from '../array' import { And } from '../predicates' import { IsPositive } from './IsPositive' import { IsWhole } from './IsWhole' export namespace Digit { export type ToTuple = { [k in number]: any[] } & { 0: [], 1: [1], 2: [1, 1], 3: [1, 1, 1], 4: [1, 1, 1, 1], 5: [1, 1...
03e63545e0c4c3d76026713e5cfe7472629009cc
TypeScript
Lidcer/webgl-snakegame
/src/objects/Drawable.ts
3.15625
3
import { clamp } from '../Utils'; import { Renderer } from '../Renderer'; export interface RGB { r: number; g: number; b: number; } export abstract class Drawable { private readonly maxColourRage = 255; protected r = 0; protected g = 0; protected b = 0; private sizeWi...
04a3d3bcf8b8e45df6ad4c4ebbbb19a563d8eb97
TypeScript
scola84/lib
/test/server/helpers/sql/mssql/database.spec.ts
2.578125
3
import { ConnectionPool } from 'mssql' import { MssqlDatabase } from '../../../../../src/server/helpers/sql/mssql' import type { config } from 'mssql' import { expect } from 'chai' import { sql } from '../../../../../src/server/helpers/sql/tag' describe('MssqlConnection', () => { describe('should', () => { it('c...
9ed60c1611e833203154722e14cc113c34d58f7d
TypeScript
DecentralCardGame/frontend
/src/def-composables/useLastInputEvent.ts
2.765625
3
import { readonly, ref, type Ref } from "vue"; interface Event { which: number } const useLastInputEventInstance = () => { const state: Ref<Event> = ref({which: 0}); const set = (event: Event) => { state.value = event } return { lastInputEvent: readonly(state), setLastInputEvent: set }; } let instanc...
3d65fcb502aaf5a4ab9ec44f21670253215f1342
TypeScript
Dharmarajm/Croon-Android
/src/pipes/home-search/home-search.ts
2.765625
3
import { Pipe, PipeTransform } from '@angular/core'; /** * Generated class for the HomeSearchPipe pipe. * * See https://angular.io/api/core/Pipe for more info on Angular Pipes. */ @Pipe({ name: 'homeSearch', }) export class HomeSearchPipe implements PipeTransform { /** * Takes a value and makes it lowercase...
8f480d2ef7e7bc4238ae8b7a33b7809219089807
TypeScript
ariesxje/ng2-rxjs-tryout
/test/services/TodoService.spec.ts
2.65625
3
/// <reference path="../../app/typings/app.d.ts" /> /// <reference path="../../typings/jasmine/jasmine.d.ts" /> import {TodoService} from "../../app/ts/services/services"; import {Todo} from "../../app/ts/models"; import {RxPipe} from "../../app/ts/util/RxPipe"; describe("TodoService", () => { it("should be able to...
69a0589b56aa72494fb0b9d68a4b5362995cf9fd
TypeScript
igoist/erb-nf
/src/utils/lib/fuzzyMatch2.ts
3.03125
3
import { ListItemInterface } from '@Types'; const pickItem = (titleIndex: string, list: any, i: number) => { let item; item = list[i][titleIndex]; return item; }; const fuzzyMatches = (fuzzy: string, text: string) => { fuzzy = fuzzy.toLowerCase(); text = text.toLowerCase(); let tp = 0; // text position...
710273bc868e69ce1d4ff0b2e1c6b6c8dc6fb798
TypeScript
erolgobel17/site
/src/util/is-phishing-url.ts
2.59375
3
import checkForPhishing from 'eth-phishing-detect'; /** * Determine whether the URL is a phishing URL. * @param url to validate */ export default function isPhishingUrl(url: URL): boolean { return checkForPhishing(url.host); }
e2345575bcb587daecd266decb209eb9332863b0
TypeScript
green-fox-academy/ironkovacs
/week-01/day-4/Booleans.ts
4.125
4
// true, false console.log(true); // Prints true console.log(false); // Prints false // Boolean Operators // Negation console.log(!true); // Prints false console.log(!false); // Prints true // And console.log(true && true); // Prints true console.log(true && false); // Prints false console.log(false && tr...
c8984185474a0a5e6a139737d213917a8427f2c1
TypeScript
lifaon74/observables
/src/operators/shortcuts/arithmetic/$add.ts
3.0625
3
import { TObservableOrValue } from '../types'; import { IFunctionObservable } from '../../../observables/distinct/function-observable/sync/interfaces'; import { FunctionObservable } from '../../../observables/distinct/function-observable/sync/implementation'; import { $observables } from '../primitives/$observables'; ...
0939fcbe5400f82d42aa44eeab57e63394268509
TypeScript
hso-nn/d365-cli
/src/commands/generators/GlobalOptionSet.ts
2.640625
3
import * as shell from 'shelljs'; import {NodeApi} from '../../node/NodeApi/NodeApi'; import fs from 'fs'; export class GlobalOptionSet { private readonly bearer: string; constructor(bearer: string) { this.bearer = bearer; } public async generate(): Promise<void> { console.log(`Genera...
501e1d6153cecb862f426423aa4fd1887a3a25b9
TypeScript
sotaaaaa/nodejs-backend-ts
/src/helps/Resolve.ts
2.828125
3
import { IRequest, IResponse } from '../types/Server'; import Util from './Utils'; import Log from '../providers/Log'; export enum STATUS_CODE { OK = 200, BAD_REQUEST = 400, UNAUTHORIZED = 401, FORBIDDEN = 403, NOT_FOUND = 404, UNSUPPORTED_ACTION = 405, VALIDATION_FAILED = 422, SERVER_ERROR = 500, CR...
22ad1f5926af069fb32ba15f19f4e1bdd13a3f91
TypeScript
11ume/wezi
/packages/get-body/tests/get-body.test.ts
2.625
3
import test from 'ava' import net, { Socket } from 'net' import http, { IncomingMessage, RequestListener, ServerResponse } from 'http' import fetch from 'node-fetch' import testListen from 'test-listen' import fastGetBody from '..' import { InternalError } from 'wezi-error' const listen = (fn: RequestListener) => test...
51e10b54810aa8fe26c5cd02dab980c156dff8e3
TypeScript
maxime-rainville/fetch-travis-data
/src/Filters/OrgFilter.ts
2.921875
3
import { Branch } from '../TravisTypes/Branch'; import { Repository } from '../TravisTypes/Repository'; /** * Provides the information necessary to know which repo and branch on an org should be included */ export interface OrgFilter { name(): string; includeRepo(repo: Repository): boolean; includeBranch(branc...
5945aae9c570aa2df60ee8adfedca636ebcb5bcd
TypeScript
chrisberry4545/seasonal
/packages/shared-frontend-redux/src/current-season/current-season-name.actions.ts
2.734375
3
import { Action } from 'redux'; export interface ISetSelectedSeasonName extends Action { seasonName: string; } export const SET_SELECTED_SEASON_NAME = 'SET_SELECTED_SEASON_NAME'; export function setSelectedSeasonName( seasonName: string ): ISetSelectedSeasonName { return { seasonName, type: SET_SELECTE...
938a4d6377c91d79eda6a14d2aeff4c8d4f079db
TypeScript
yog27ray/mongoToParse
/src/transform/mongo-to-parse-query-base.spec.ts
2.53125
3
import { expect } from 'chai'; import { MongoToParseError, MongoToParseQuery } from '../../server'; import { dropDB } from '../setup'; import { ParseClassExtender } from './mongo-to-parse-query-base'; function parseObjectJSON(results: Array<Parse.Object>): Array<any> { return results.map((each: Parse.Object) => { ...
d9fe60a0f41467ddb190a79f8b3e09efd80d0988
TypeScript
Magnulas/xbimwebui
/src/scene/node.ts
3.40625
3
export abstract class Node { public ID: number; public readonly Type: NodeType = NodeType.NOTDEFINED; public Parent: Node; public Nodes: Node[] = new Array<Node>(); public Hidden: Boolean = false; protected needsRecompile: Boolean = true; protected abstract CompileNode(): void; protec...
c46271c53a19f4885be03098f9f6d69952d2f6b8
TypeScript
fivitti/kiedy-odjade
/src/select-strategies/all-in-radius.ts
2.578125
3
import { Distance } from "./model"; export default function(radius: number) { return function <T extends Distance> (items: T[]): T[] { return items .filter(item => item.distance <= radius); } }
91d7aae1574f757e691c165059ab6ea3a28742c7
TypeScript
andrehideki/consulting-api
/src/test/domain/usecase/activity/GetActivity.test.ts
2.625
3
import { GetActivity } from "@domain/usecase/activity/GetActivity"; import RepositoryFactoryMemory from "@adapter/factory/RepositoryFactoryMemory"; import DataEncriptorBcrypt from "@infra/services/DataEncriptorBcrypt"; describe("Get Activity", () => { let getActivity: GetActivity; beforeEach(() =>{ cons...
1e0f95fae075f78f7d7be2c1c788dd5357e99738
TypeScript
JoshRosenstein/styleaux
/packages/styleaux-styles-base/src/mdn/box-model/height.ts
2.984375
3
import { Config } from '../../types'; import { HeightProperty } from '@styleaux/csstype'; import { style, styler, GetValue } from '@styleaux/core'; const HEIGHT = 'height'; export interface HeightProps<T = HeightProperty> { /** * The **`height`** CSS property specifies the height of an element. By default, the p...
1eaa95b8ac4f784c21065bdbf21946665a3a8e97
TypeScript
noliaki/SaCSS-vol.110
/src/docroot/js/disclosure.ts
2.796875
3
import Vue from 'vue' interface Data { posts: any[] } function nextFrame(cb: () => void): void { window.requestAnimationFrame(() => window.requestAnimationFrame(cb)) } const ThePostsItem = Vue.component('template-posts-item', { template: '#template-posts-item', props: { post: { type: Object, ...
0337012ea73093ccd4f59c4080d04d8cfc2309b0
TypeScript
splitbee/react-notion
/src/types.ts
2.578125
3
/** * * Copyright (c) 2020, Sam Wight * https://github.com/samwightt/chorale-renderer/blob/1e2c1415166e298c1ce72a1a15db927bebf2b5c8/types/notion.ts * * Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice an...
df36da5e3933b796e3dfd75390420db5b3ad8d83
TypeScript
gorillabyte/silverback
/src/core/test/EngineFamilyIntegration.spec.ts
2.546875
3
import chai = require('chai'); import { Engine } from '../Engine'; import { NodeMock, NodeMock2, NewNodeMock } from './Node.stub'; import { Vec2D, Matrix } from './Component.stub'; import { Entity } from '../Entity'; const expect = chai.expect; describe('EngineFamilyIntegration', () => { let engine: Engine; ...
6ff886d4c7bf0acce4f5a648c431ddb55c4568b2
TypeScript
koog1000/vscode-fossil
/src/test/suite/Infrastructure.test.ts
2.65625
3
import * as vscode from 'vscode'; import * as sinon from 'sinon'; import { FossilCWD, FossilError, FossilExecutablePath, FossilStdOut, FossilStdErr, } from '../../fossilExecutable'; import * as assert from 'assert/strict'; import { getExecutable } from './common'; import { after, afterEach, before }...
b8f769eb96e22dbf7af92b7525082c00f7a7cddc
TypeScript
andreirk/CountrySupportContacts
/src/mock.ts
2.65625
3
import { Country, DeployRegion, Me, SupportContact } from "./types"; export const getMe = async () => { return new Promise<Me>((resolve) => { const region = Country.CHINA; // это можно менять setTimeout(() => resolve({ region }), 500); }); }; export const getSupportContacts = async () => { con...
05d3a1fd51fe336c39a0c7d2ed68714ca3985467
TypeScript
index325/Plamvi_Node
/src/modules/Users/repositories/fakes/FakeUserTokensRepository.ts
2.734375
3
import IFindByTokenAndCodeDTO from "@modules/Users/dtos/IFindByTokenAndCodeDTO"; import IGenerateUserTokenDTO from "@modules/Users/dtos/IGenerateUserTokenDTO"; import IUserTokenRepository from "@modules/Users/repositories/IUserTokenRepository"; import UserToken from "../../infra/typeorm/entities/UserToken"; class Fake...
05364b6dde89259d46450ba2a15b0cce31addf08
TypeScript
xeinebiu/typescript_logger
/src/decorator/class-logger.decorator.ts
3.125
3
/** * Options to use for applied class type * * @author xeinebiu */ export interface ClassLoggerOptions { tag: string | undefined; } /** * Injects the given [options] to applied type of a class * * @author xeinebiu */ export function LogClass(options: ClassLoggerOptions) { return function reportableCla...
53d95aabf5fdd02058983adc2982d3a744edf8fe
TypeScript
rainder/jpeg-file-format
/src/tiff-parser/coders/index.ts
3.25
3
import BufferReader from '../../utils/buffer-reader'; export type Coder<T> = { decode: ( reader: BufferReader, numValues: number, valueOrOffset: any, bigEnd: boolean, ) => T[]; encode: ( id: number, value: T[], bigEnd: boolean, ) => Buffer; }; export function createCoder<T>( byt...
e53a7fce52fc7ae641876ee42e3264f285304d41
TypeScript
gheryd/angular_redux_examples
/src/app/pipes/camelize.pipe.ts
3
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'camelize' }) export class CamelizePipe implements PipeTransform { transform(value: string, camelizeFirst: boolean= false): string { const words = value.split(/[\s]+|[\-]+/); let camelized = ''; for (let i = 0; i < words.length; i++) {...
2b8ec55e7ecf3a2efe0f439ae9b56b8f194c0f74
TypeScript
brunoperry/gizmobomba
/engine/core/Vertex.ts
3.203125
3
import Vector3f from "../math/Vector3f"; import Vector2f from "../math/Vector2f"; export default class Vertex { public static SIZE: number = 11; private m_pos: Vector3f; private m_texCoord: Vector2f; private m_normal: Vector3f; private m_tangent: Vector3f; constructor(pos: Vector3f = new Vec...
071c8f71c62028d8a636489a30bd783a29c70c45
TypeScript
mortonprod/react-reviews
/src/factory/objects/reviewTemplate.ts
3.078125
3
/** * This class is inherited by fake and default class. * It describes the bases for all other review type objects. */ export default class ReviewTemplate { private static handlers = [] as any; public date = null as Date; public dislikes = 0; public likes = 0; public message = ""; public na...
c338c56a0d69587a4624f5a3ce0395fe3a21b1d3
TypeScript
gonzacabrera2506/MisApuntesTypescript
/app/app.ts
4.15625
4
//BOOLEAN// let bool: boolean = true; console.log(bool); //NUMBER// let n1: number = 12.9; let n2: number = 1489; console.log(n1, n2); //STRING// let nombre1: string = "esto es un string"; let nombre2: string = 'y esto tambien es un string'; let concatenado: string = `${nombre1} ${nombre2}`; console.log(concatenado); /...
66132ee1f46d7348e4fc88fbe3345e4caffedc4d
TypeScript
AltarnRain/r42ts
/src/SpawnLocations/SevenSixSevenGridProvider.ts
2.953125
3
/** * @preserve Copyright 2019-2021 Onno Invernizzi. * This source code is subject to terms and conditions. * See LICENSE.MD. */ import GameLocation from "../Models/GameLocation"; import dimensionProvider from "../Providers/DimensionProvider"; /** * Module: Provides the locations for enemies t...
13ce270a96f3e1cfbf4ca139f2c0f3272dace82c
TypeScript
tirumaraiselvan/graphql-engine
/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/SelectDatabase/utils.ts
3.328125
3
// returns the correct indefinite article based on the first character of the input string export const indefiniteArticle = (word: string): string => { const vowels = ['a', 'e', 'i', 'o', 'u']; return vowels.includes(word.charAt(0)) ? 'an' : 'a'; };
0c1c51ed292849aef22d973a8a4a4193c7962799
TypeScript
YuriyGorvitovskiy/state-parts
/src/storage/in-memory/table.test.ts
2.59375
3
import { IEntity, IPatch, PatchOp } from "state-glue"; import { Index } from "./index"; import { IRecord } from "./record"; import { Table } from "./table"; const TYPE_USER = "user"; const TYPE_TASK = "task"; const ATTR_ASSIGNEE = "assignee"; const ATTR_DESCRIPTION = "description"; const ATTR_TITLE = "title"; test("T...
591e1d4be071563eb926ff642e71a14608d14a17
TypeScript
leonardfactory/random-nickname-app
/src/generator/RandomNicknamePicker.ts
3.109375
3
import { isNoun } from "./isNoun"; import { italianWords } from "./italianWords"; export class RandomNicknamePicker { nouns!: string[]; private constructor() {} static async prepare() { const picker = new RandomNicknamePicker(); await picker.loadWords(); return picker; } private async loadWord...
6cf603c7890eda63383a164bb79615f643306561
TypeScript
aadrian/highcharts
/ts/Series/Lollipop/LollipopSeries.ts
2.5625
3
/* * * * (c) 2010-2021 Sebastian Bochan, Rafal Sebestjanski * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ 'use strict'; /* * * * Imports * * */ import type LollipopSeriesOptions from './LollipopSeriesOptions'; import Lollip...
032371d4d636aa95e031088fc94630dc909629af
TypeScript
n-hlyustin/itransition-nestjs-test
/src/auth/dto/register-user.dto.ts
2.765625
3
import { IsEmail, IsNotEmpty, Length, IsISO8601 } from 'class-validator'; export class RegisterUserDto { @IsEmail() email: string; @IsNotEmpty() @Length(4, 24) password: string; @IsNotEmpty() @Length(2, 24) firstname: string; @IsNotEmpty() @Length(2, 24) lastname: string; @IsNotEmpty() @I...
19fe4c3792b781569f5667dec71f81f42c30f8f6
TypeScript
vmarshall/bookmark.wtf
/src/pub-sub/browser-pathname.ts
3.109375
3
import {Container} from './topic'; export interface BrowserPathnameInit<TValue> { readonly replace?: boolean; readonly history?: Pick<History, 'pushState' | 'replaceState'>; readonly location?: Pick<Location, 'href' | 'pathname'>; readonly input: (value: TValue) => string; readonly output: (value: string) =>...
d14b0387b20776f20c29ea1f6532bdce9a9eeb79
TypeScript
smonn/custom-ssr-boilerplate
/src/shared/utils/parsePort.ts
2.5625
3
export const DEFAULT_PORT = 3000; export default function parsePort(port?: string): number { if (!port) { return DEFAULT_PORT; } return Number.parseInt(port, 10) || DEFAULT_PORT; }
d9b0f0898cc15d768f802a01bd43c3013f38bea9
TypeScript
ohthehugemanatee/armkit
/packages/schema-generator/lib/schemas-deployment-template.ts
2.515625
3
var github = require('octonode'); require('dotenv').config(); function getRepo(accessToken: string | undefined) { var client = github.client(accessToken); var ghrepo = client.repo('Azure/azure-resource-manager-schemas'); return ghrepo; } function filterVersions(body) { // Only versions that look like ...
44bd728c2138f67968baccc14f31451bb1aebaf0
TypeScript
AlejandroMG1/front_clothesstore
/src/services/cart.service.ts
2.640625
3
import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class CartService { cart:BehaviorSubject<string[]> = new BehaviorSubject<string[]>([]) constructor() { } addToCar(id:string){ let actual = this.cart.value.slice() actual.pus...
86dbc797eddda4174f68cb33f5e67c4e342063c5
TypeScript
strong-roots-capital/session-signal
/src/session-signal.ts
2.859375
3
/** * Session Signal * Emit a signal on conclusion of specified sessions (UTC) */ const EventEmitter = require('events') const schedule = require('node-schedule') import { utcDate } from '@hamroctopus/utc-date' import session from 'market-session' // OPTIMIZE: find a more accurate timer-system const cronEveryMinut...
28c34916e47b0c8d33f743f1e9f5152d7e3afeb1
TypeScript
freetime-development/vscode-cardz
/src/util/mdUtils.ts
2.9375
3
export function findAll(r: RegExp, s: string): RegExpExecArray[] { const res = r.exec(s); if(res) { return [res, ...findAll(r,s)]; } else { return []; } } export function findAllImagePaths(s: string): string[] { const imageRegex = new RegExp(/!\[(.+)\]\((.+)\)/g); return findAll...
71dd906e845d4110fd8d42c1ec705b99784b293a
TypeScript
Fagnermeds/backend-typeorm
/src/services/ImportTransactionsService.ts
2.640625
3
import { Express } from 'express'; import fs from 'fs'; import path from 'path'; import csv from 'csv-parse'; import { getCustomRepository, getRepository, In } from 'typeorm'; import AppError from '../errors/AppError'; import Transaction from '../models/Transaction'; import Category from '../models/Category'; import T...
d743065a4de7b4a10e65ffe4040f80c27a120d1a
TypeScript
balazser/challenge
/src/services/pathFinder.ts
3.171875
3
const findLowestCostNode = (costs: Graph, processed: string[]) => { const knownNodes = Object.keys(costs) const lowestCostNode = knownNodes.reduce( (lowest: string | null, node: string) => { if (lowest === null && !processed.includes(node)) { lowest = node } if (costs[node] < costs[lo...
d7edc273ad85d41c599bdd9cd085565aaca8d50a
TypeScript
edgesider/blankube
/src/cube/Mover.ts
3.125
3
/** * 排队,历史记录 */ import {FaceName} from "@/cube/Face"; import {RubikCube} from "@/cube/RubikCube"; import {ISink} from "@/input/pipe"; export interface IMove { do(cube: RubikCube): Promise<any> } export abstract class TraceableMove implements IMove { abstract do(cube: RubikCube): Promise<any> abstract ...
5ab75f0f6531c7a591d29167c0018c09d62827d3
TypeScript
AssemblyScript/assemblyscript
/src/diagnostics.ts
3.21875
3
/** * @fileoverview Shared diagnostic handling. * @license Apache-2.0 */ import { Source } from "./ast"; import { DiagnosticCode, diagnosticCodeToString } from "./diagnosticMessages.generated"; import { isLineBreak, isWhiteSpace, COLOR_CYAN, COLOR_YELLOW, COLOR_RED, COLOR_MAGENTA, COLOR_RESET,...
d85ca238c82588e7470d3826d68e0cd300c9c7cf
TypeScript
pwahlbom/Coder-Camps---Full-Stack-.NET
/src/CoderCamps_ECMAScript/wwwroot/js/Classes.ts
3.4375
3
class clsProducts1 { name: string; price: number; tax() { return (this.price * 0.08).toFixed(2); } } let objProduct1 = new clsProducts1(); objProduct1.price = 2.33; objProduct1.name = "Apples"; //---------------------------------------------------------------- class clsProducts2 { pub...
aa93c23bc6b600ad4b26b17232453c39a489d5c0
TypeScript
maorleger/simpleSyrup
/client/src/app/serviceModule/httpResult.spec.ts
2.90625
3
//Local folder imports import { HttpResult } from './httpResult'; import { HttpMessage } from './httpMessage'; import { HttpMessageType } from './httpMessageType'; describe('HttpResult', () => { describe("isValid property is calculated correctly", () =>{ it("Returns false when result contains error messages", (...