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
1f11f1865d65e1246e2824cabaa87da73c55247c
TypeScript
KelvinMitaki/Fullstack-GraphQL-Typescript
/Schema/Mutation.ts
2.515625
3
import { Request } from "express"; import bcrypt from "bcrypt"; import { GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLString } from "graphql"; import { User } from "../model/User"; import { UserType } from "./User"; declare module "express-session" { export interface Session { user?: { email: s...
42121e69e3fbf00b02ec2839e76c53f0db691f37
TypeScript
pamplonafala/tstl
/src/std/base/containers/_ListContainer.ts
3.234375
3
/// <reference path="../../API.ts" /> /// <reference path="Container.ts" /> namespace std.base { /** * @hidden */ export abstract class _ListContainer<T, BidirectionalIterator extends _ListIteratorBase<T>> extends Container<T> implements IDequeContainer<T> { /** * @hidden */ private begin_: Bidi...
744df27a0e6eddb7003e9ca84b90af9ba39e5d9f
TypeScript
mister-what/ex-patterns
/test/flowStructures/suppose.test.ts
2.921875
3
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-expressions */ /* eslint-disable indent */ /* eslint-disable func-call-spacing */ /* eslint-disable no-spaced-func */ /* eslint-disable no-unexpected-multiline */ /* eslint-disable arrow-parens */ /* eslint-disable operator-linebreak */ import { expect } ...
47952a0be895776d1c3027096e99b3e8e9fadeaf
TypeScript
dmarquez83/ecommerce
/src/modules/files/images.service.ts
2.921875
3
const sharp = require('sharp'); export class ImageServices { /** * Compress image JPEG or JPG, change quality 40% and reduce 40% pixels * @param file Image to compress */ async compressJPEGorJPG(file: any) { const metaData = await sharp(file.buffer) .metadata(); ...
e11a08de1740a0e417aa280251a04b4b428de744
TypeScript
PepVal/drawing-app
/src/index.ts
2.734375
3
import express from "express"; import path from "path"; import nanoid from "nanoid"; import { Room, Player, GameState, CurrentTurn } from "./types"; var start_game = require("./gameLoop.ts"); const app = express(); //Listen on port 3000 let server = app.listen(process.env.PORT || 3000); console.log("Listening on port...
2b3c3a3be63a910fb3fbd039806b79c85ab372df
TypeScript
hanuz06/Miscellaneous
/ts-kata/roman-numerals.ts
3.609375
4
function solution(roman: string): number { // complete the solution by transforming the // string roman numeral into an integer interface romanNumbers { [key: string]: number; } let result: number = 0; const romanNumbers: romanNumbers = { I: 1, V: 5, X: 10, L: 50, C: 100, ...
5e59ee4a31c3347f373f35b4f70693474d7a3f25
TypeScript
Kunstmaan/snipsonian
/packages/snipsonian-core/src/url/appendUrlParamIfNotAlready.ts
2.78125
3
import appendUrlParam, { encodeParamName, IAppendUrlParamInput } from './appendUrlParam'; export default function appendUrlParamIfNotAlready({ url, paramName, paramValue, }: IAppendUrlParamInput): string { if (doesUrlContainParam({ url, paramName })) { return url; } return appendUrlPar...
9c0d471f784953cf3ff848f82f0d5305f90f48e0
TypeScript
diegocastreje/Restaurante
/restaurante-app/src/app/mesas/mesa/mesa.ts
2.515625
3
import { MesaProductos } from './mesa-productos'; export class Mesa { id: number; fecha: string; productos: MesaProductos[] = []; total: number; calcularTotal(): number{ this.total = 0; this.productos.forEach((item: MesaProductos) =>{ this.total += item.calcularImporte(); }); return th...
ce8c85b84595e86382e86848042edbb8c43231ac
TypeScript
Ollererr/redux-model
/packages/core/src/utils/shallowEqual.ts
3.421875
3
const own = Object.prototype.hasOwnProperty; const str = Object.prototype.toString; const equal = (x: any, y: any) => { if (x === y) { return x !== 0 || y !== 0 || 1 / x === 1 / y; } // NaN !== NaN return x !== x && y !== y; }; export const shallowEqual = (objA: any, objB: any) => { if (equal(objA, obj...
4f8c10a66f3bb04a7e83776bf56850f7bd995615
TypeScript
taurus-77/rarible-lazymint
/src/lazy-mint/domain.ts
2.578125
3
type Part = { account: string value: string } type ERC721LazyMint = { "@type": "ERC721", contract: string, tokenId: string, uri: string, creators: Part[], royalties: Part[], signatures: string[] } type ERC1155LazyMint = { "@type": "ERC1155", contract: string, tokenId: string, uri: string, creators: Part[...
eb0f4e7186ebcc8aba1efc999795c609bc96a8a3
TypeScript
savewhatyoulove/d2s
/src/d2/stash.ts
2.734375
3
import * as types from "./types"; import { BitWriter } from "../binary/bitwriter"; import * as items from "./items"; import { enhanceItems } from "./attribute_enhancer"; import { BitReader } from "../binary/bitreader"; const defaultConfig = { extendedStash: false, } as types.IConfig; export async function read( b...
8b4ebf44fd9f6f076a34644b7099073a56f42c27
TypeScript
IsraelGomes/ProjetoRedeSocial
/Projeto/src/app/usuario.service.ts
2.625
3
import { Injectable } from '@angular/core'; import { delay } from 'q'; import { HttpClient } from '@angular/common/http'; import { Usuario } from './usuario'; import { Observable } from 'rxjs/Observable'; @Injectable() export class UsuarioService { static logado = false; static usuarioLogado: Usuario; apiUsuari...
7aecd3edb14fbd4c7d6a1d47b29ec4714327eef3
TypeScript
Ahryman40k/typescript-fhir-types
/src/R4/Resource/RTTI_BodyStructure.ts
2.734375
3
import * as t from 'io-ts'; import { RTTI_id } from '../Scalar/RTTI_id'; import { RTTI_Meta, IMeta } from './RTTI_Meta'; import { RTTI_uri } from '../Scalar/RTTI_uri'; import { RTTI_Element, IElement } from './RTTI_Element'; import { RTTI_code } from '../Scalar/RTTI_code'; import { RTTI_Narrative, INarrative } from './...
a29dd1703948483c52aa505be1588e6ac79730db
TypeScript
wr719152280/re
/src/store/reducers/loadding.ts
2.75
3
import { DefaultRootState } from "react-redux" import { CHANGELOADINGAction } from "../action" import { CHANGE_LOADING } from "../const"; export interface IInitState extends DefaultRootState{ loading:boolean } const initState = { loading:false } export default (state:IInitState = initState,ac...
d62eb7e5a2d6bf3347611d9249c6ea7387db9a3d
TypeScript
NJVIRANI/startfireweb
/src/main/webapp/app/entities/award-type/award-type.reducer.ts
2.640625
3
import axios from 'axios'; import { ICrudGetAction, ICrudGetAllAction, ICrudPutAction, ICrudDeleteAction } from 'react-jhipster'; import { cleanEntity } from 'app/shared/util/entity-utils'; import { REQUEST, SUCCESS, FAILURE } from 'app/shared/reducers/action-type.util'; import { IAwardType, defaultValue } from 'app/...
45cb4312a910f540a4e4eb7b547cc0f283e06f96
TypeScript
alibaba/hooks
/packages/hooks/src/useGetState/__tests__/index.test.ts
2.609375
3
import { act, renderHook } from '@testing-library/react'; import useGetState from '../index'; describe('useGetState', () => { const setUp = <T>(initialValue: T) => renderHook(() => { const [state, setState, getState] = useGetState<T>(initialValue); return { state, setState, ge...
fcf20c806895f5c494f3a91f80f4299c98007a95
TypeScript
green-fox-academy/vis0rka
/week-04/day-3/pirates.ts
3.46875
3
class Pirate { name: string; intoxicates: number; constructor(name: string, intoxicates: number = 0) { this.name = name; this.intoxicates = intoxicates; } drinkSomeRum(rums: number): void { this.intoxicates += rums; } howsItGoingMate(): void { if (this.intoxicates < 4) { console.log(...
76ae704c5a0f38a4eeebc93766672f84403ab31f
TypeScript
boosteel/hancomee
/web-resources/lib/core/component/focusBtn.ts
3.140625
3
/* * 버튼과 인풋을 일원화시킨다. */ type Handler = (input: HTMLInputElement, btn: HTMLButtonElement) => void export function focusBtn(input: HTMLInputElement, btn: HTMLButtonElement, handler: {focus: Handler, blur: Handler}) { let temp = false; input.addEventListener('focusin', () => { handler.focus(input...
a3d5c9c23af5456a1be5ebacbbc448407b5a1ca9
TypeScript
orsilarssen/EmeseEeva
/week-04/day-4/string1.ts
3.796875
4
export { } // Given a string, compute recursively (no loops) a new string where all the // lowercase 'x' chars have been changed to 'y' chars. function replaceXtoY(characters: string, charX: string, charY: string):string { if (characters.indexOf(charX) === -1) { return characters; } else { ...
385f2fa046e8a6ca83c970cd6e70a41a40e7cccd
TypeScript
thomas-lowry/themer
/src/scripts/applyTheme.ts
2.625
3
//imports import { hasChildren } from "./hasChildren"; import { hasFillStyles } from "./hasFillStyles"; import { hasStrokeStyle } from "./hasStrokeStyle"; import { hasEffects } from "./hasEffects"; //variables we will use to apply the right type of styles let colorStyles = false; let textStyles = false; let effectStyl...
403cc65a22d6ae67a030f5b6ea216f940d5db1b1
TypeScript
rodrigopaixao/api-ui-data-model
/src/app/models/traceable.model.ts
2.78125
3
import { Exclude } from 'class-transformer'; export abstract class Traceable { @Exclude() protected isNewStatus: boolean; @Exclude() protected isUpdatedStatus: boolean; get isNew() { return this.isNewStatus; } get isUpdated() { return this.isUpdatedStatus; } setAsNew() { this.isNewSt...
f3a72893a4e3b53beacd9dec3851f4ad3150ce96
TypeScript
pathakvivek7865/node-practices
/jwt-authentication/src/security/jwt.ts
2.84375
3
import * as jwt from "jsonwebtoken"; import { User } from "../entity/User"; import { v4 as uuidv4 } from "uuid"; import { RefreshToken } from "../entity/RefreshToken"; import * as moment from "moment"; import { Database } from "../database"; export class JWT { //specify a secret key for jwt generateion private st...
eeea32f4c9ff5682b8873469176cb355cc912db8
TypeScript
soumyamishra89/github-analyser
/frontend/src/__tests__/redux/reducers/testReduxReducers.ts
2.5625
3
import reducers from '../../../redux/reducers'; import { ReduxActionType, LoggedStatus } from "../../../types"; import mockData from '../../../__mock__/mockData.json'; describe("Test redux reducers", () => { describe("loggedStatusReducer", () => { it("loggedStatusReducer Logged in", () => { ...
ec166ed2d1864313c16d1da7247142d8f90d60b6
TypeScript
TitechMeister/growi
/packages/app/src/server/service/page-operation.ts
2.640625
3
import { pagePathUtils } from '@growi/core'; import PageOperation from '~/server/models/page-operation'; const { isEitherOfPathAreaOverlap, isPathAreaOverlap, isTrashPage } = pagePathUtils; class PageOperationService { crowi: any; constructor(crowi) { this.crowi = crowi; } // TODO: Remove this code wh...
4948687695fd1f287094d5a6eb2a7cb94f9ea07d
TypeScript
Dihcar-76/TP-Blog2-Angular-OpenCLassrooms-
/src/app/services/post.service.ts
2.875
3
import { Subject } from 'rxjs/Subject'; import { Post } from '../models/post.model'; export class PostService { postsSubject = new Subject<any[]>(); private posts: Array<object> = [ { title: 'mon premier post', content: 'blablaqui?', loveIt: 5, postcreatedAt: new Date() }, { ...
9afc6114fe89faca61ce25aa55c6df63b00b6c3d
TypeScript
tylerthecoder/friend-graph
/src/components/actions/action-types/rm-node/rm-node.test.ts
2.625
3
import { getNodeIds } from "../../../../testing/helpers"; import { eventDiff } from "../../../../testing/test-data"; import { emptyGraphState, moveToNextEvent, moveToPrevEvent, } from "../../../events/functions"; import { applyActionAndUpdate, cleanupEventDiffs, IAction, } from "../../functions"; import { I...
bbcc7cf4efe5abbb45bc5d2ba2eb323146c5c9cb
TypeScript
PRNDcompany/canvas-object
/src/graphics/DisplayObject.ts
2.984375
3
import FastVector from 'fast-vector'; export interface DisplayObjectBasicOptions { alpha?: number; color?: string; scale?: number; rotation?: number; } export interface DisplayObjectOptions extends DisplayObjectBasicOptions { position?: FastVector; } export class DisplayObject { public position: FastVect...
4acf147b89633246e7105a12f265096146d62e27
TypeScript
aermolinskaya/nine-mens-morris-game-server
/sources/server/game/game.ts
2.78125
3
import WebSocket from 'ws'; import { onError } from './on-error.js'; import type { AnyClientMessage, AnyServerMessage, GameStartedMessage, GameAbortedMessage, } from '../../common/messages.js'; import type { Color } from '../../common/color.js'; import type { PlayerState } from '../../common/playerState.js'; impo...
cbe4ca9dcbb3dd46bd5e27eb16e0f4f86a913329
TypeScript
lumio/dockery
/src/lib/docker/checkIfImageExists.ts
2.78125
3
import runCommand from '../runCommand'; const checkIfImageExists = async ( tag: string, cwd: string, failIfExists: boolean = true, ): Promise<string | false> => { let result; try { result = await runCommand('docker', ['images'], cwd, true); } catch (e) { result = e; } if (result.exitCode) { ...
4be0333f9a071621d11f885fd077c4e338d27d07
TypeScript
IvoKroon/PRG08-Week3-oefening2
/dev/washing.ts
2.578125
3
class Washing extends Behavior{ constructor(jibby:Jibby){ super(jibby); } performBehavior() : void{ console.log("Washing"); this.jibby.div.style.backgroundImage = "url('images/washing.png')"; // this.div.style.backgroundImage = "url('images/washing.png')"; } update()...
d3d67f9d754769937ece3158227ba1063ff25549
TypeScript
2muchcoffeecom/invoice-app-api
/src/modules/shared/errors/parse-error.interceptor.ts
2.59375
3
import { HttpException, Injectable, ExecutionContext, CallHandler, NestInterceptor } from '@nestjs/common'; import { Observable, throwError } from 'rxjs'; import { catchError } from 'rxjs/operators'; import { ParsedError } from './parsed-error'; @Injectable() export class ParseErrorInterceptor implements NestInterce...
50dd9e196e795b6d28cfab50ac81375afe6afbd9
TypeScript
smashdevcode/the-latest-on-typescript-2016
/demos/promises/index.ts
3.421875
3
'use strict'; function f() { return new Promise<string>((resolve, reject) => { resolve('Original value'); // reject(new Error('Something went wrong!')); }); } f().then(value => { console.log(value); return 'New value 1'; }).catch(error => { console.log('Oh oh!'); throw error; }).then(value => { ...
94eece16a956bfe0ad836b3d1a3ec55d2ecc5cee
TypeScript
DawnLck/umi-plugin-extensions
/types/chromeManifest/TTSEngine.d.ts
2.625
3
declare namespace chromeManifest { export interface TTSEngine { voices?: Voice[]; } export interface Voice { voice_name: string; lang: string; event_types?: EventType[]; } type EventType = /** * The engine has started speaking the utterance. */ | 'start' /** * A wo...
86a9a7c3df2ec57311f2893e1146bb54b27cfc59
TypeScript
LiskHQ/lisk-sdk
/elements/lisk-codec/src/utils/default_value.ts
2.59375
3
/* * Copyright © 2020 Lisk Foundation * * See the LICENSE file at the top-level directory of this distribution * for licensing information. * * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, * no part of this software, including this file, may be copied, modified, * propagated...
a6906410fb589bf8ff9c3d10b3ff3746a6970920
TypeScript
daangemist/superplug
/src/package/reader.ts
2.609375
3
import fs from 'fs'; import { promisify } from 'util'; import { Package } from './types'; const readFile = promisify(fs.readFile); export default async function read(path: string): Promise<Package> { const contents = await readFile(path); return JSON.parse(contents.toLocaleString()) as Package; } module.exports =...
b90cd8bc53be8a405a7b12215e4e2bdf8d2d5ead
TypeScript
arthurvenicio/CursoTs
/src/A0042-es2020-operators/index.ts
4.09375
4
// Encadeamento opcional e Operador de coalescência nula // Encadeamento opcional = ? // ex: documento.data?.toDateString() // Operador de coalescência nula = Checar se o valor recebido no lado esquerdo é um não valor : null e undefined // ex: documento.data?.toDateString() ?? 'Não existe data' // quando não tiver exe...
d27c4f99ca730abefb3e172c153e3c3c532dc2c8
TypeScript
iloveivyxuan/vectorious
/src/core/subtract.spec.ts
3.1875
3
import { deepStrictEqual, throws, } from 'assert'; import v = require('..'); describe('(v) subtract', () => { it('should return empty vector if subtracting two empty vectors', () => { const x: v = v.array(); const y: v = v.array(); deepStrictEqual(v.array(), x.subtract(y)); }); it('should thro...
515bfbc48676b86a2aefea3ab946e9ad68b37698
TypeScript
EitanElbaz/json-2-yup
/src/tests/types/number/typeError.test.ts
2.765625
3
import { NumberSchema, ValidationError } from 'yup'; import to from 'await-to-js'; import { NumberTypeSchema } from 'src/types'; import { toYup } from 'src/toYup'; const errorMsg = 'Has to be a number'; const schema: NumberTypeSchema = { type: 'number', strict: true, required: true, errors: { t...
38f09a401d77b9d9ec9c7a491bcd4fc954886953
TypeScript
tkddn204/cra-template-rightpair
/template/src/Components/Theme/themeSlice.ts
2.796875
3
import { createSlice, CaseReducer, SliceCaseReducers } from '@reduxjs/toolkit' export type ThemeState = 'default' | 'dark' type SliceName = 'theme' interface CaseReducers extends SliceCaseReducers<ThemeState> { changeThemeMode: CaseReducer<ThemeState> } const themeSlice = createSlice<ThemeState, CaseReducers, Slic...
55a4b8d805b07b07471465af5bbb1a7cb81734f6
TypeScript
theednaffattack/create-project
/src/templates/project-templates/backend/src/modules/user/edit-user-info.ts
2.75
3
import { Arg, Resolver, Mutation, UseMiddleware, Ctx } from "type-graphql"; import { User } from "../../entity/User"; import { EditUserInput } from "./register/edit-user-input"; import { isAuth } from "../middleware/isAuth"; import { loggerMiddleware } from "../middleware/logger"; import { MyContext } from "../../type...
778b407cd3cc9cd3bbadd3b8de8c009b688612ab
TypeScript
spitfiremunguia/viaro_nodeks
/src/controllers/account.controller.ts
2.5625
3
import { Account } from '../models/Account'; import {AccountService} from '../services/account.service'; import {AuthService}from '../services/auth.service'; import {CustomError} from '../models/CustomError'; const objectidRegex=/^(?=[a-f\d]{24}$)(\d+[a-f]|[a-f]+\d)/i; export class AccountController { private acc...
1d41a7f78daecca7812438ed9c350006891108f8
TypeScript
ManuSquall/TypeScript-Website-Localizations
/docs/playground/zh/TypeScript/Primitives/Unknown and Never.ts
4.21875
4
// Unknown // Unknown is one of those types that once it clicks, you // can find quite a lot of uses for it. It acts like a sibling // to the any type. Where any allows for ambiguity - unknown // requires specifics. // 封装 JSON 解析器是一个不错的例子,JSON 数据可以以多种不同的形式出现, // 并且 JSON 解析器函数的作者并不知道数据的形状。而调用解析函数的人应该知道。 const jsonPar...
25100c6a35e6926ebe7dab60e224f5bee7b7edf9
TypeScript
Carloss-Jr/Projeto_Db
/src/controllers/ClienteController.ts
2.71875
3
import { Request, Response} from 'express' import { getConnection, getCustomRepository } from 'typeorm' import { Cliente } from '../entities/Cliente' import { ClienteTelefone } from '../entities/ClienteTelefone' import { ClienteRepository } from '../repositores/ClienteRepository' class ClienteController { async cre...
3b798ef29137191889c6010f30e99b6672284df6
TypeScript
swc-project/swc
/crates/swc_bundler/tests/.cache/deno/a001e0eaeb21f32126184e530076160ecf8f0dcd.ts
3.1875
3
// Loaded from https://deno.land/x/cliffy@v0.18.0/flags/normalize.ts /** * Normalize command line arguments. * @param args Command line arguments e.g: `Deno.args` */ export function normalize(args: string[]) { const normalized = []; let inLiteral = false; for (const arg of args) { if (inLiteral) { ...
b2a82605b2a02b02e68d6ad678d55e1063d5e754
TypeScript
eugenioenko/interpreter
/src/token.ts
3.1875
3
export enum TokenType { // Parser Tokens Eof, Panic, Lambda, // Single Character Tokens Ampersand, AtSign, Caret, Comma, Dollar, Dot, Hash, LeftBrace, LeftBracket, LeftParen, Percent, Pipe, RightBrace, RightBracket, RightParen, Semicol...
ebfc5a3eb1d55b5780516a4f22d0f4026e1091ce
TypeScript
Xamian/easy-template-x
/dist/misc.d.ts
2.734375
3
export type Binary = Blob | Buffer | ArrayBuffer; export enum MimeType { Png = 'image/png', Jpeg = 'image/jpeg', Gif = 'image/gif', Bmp = 'image/bmp', Svg = 'image/svg+xml' } export interface IMap<T> { [key: string]: T; } export interface Constructor<T> { new(...args: any[]): T; }
d5d3f7ddf158260a2b737613534980c07170e39b
TypeScript
udecode/plate
/packages/test-utils/src/createDataTransfer.ts
2.96875
3
export type DataTransferDataType = 'text/plain' | 'text/html' | string; export type DataTransferDataMap = Map<DataTransferDataType, unknown>; export const createDataTransfer = (dataMap: DataTransferDataMap = new Map()) => ({ getData: (type: string) => dataMap.get(type) ?? '', setData: (type: string, value: ...
cbde4c6bf96a36b9a8ea347290f94c9ab7122580
TypeScript
Ulrikop/cucumber-7
/src/index.ts
2.734375
3
import { DataTable } from '@cucumber/cucumber'; import type { IParameterTypeDefinition } from '@cucumber/cucumber/lib/support_code_library_builder/types'; export function parseSomething(parser: DataTable) { return parser.rows; } /** * Will be later used `defineParameterType(timeParameterType)`. */ export const ti...
5eb147948294d6bc19adc0a54bdb3af2d7ef84b8
TypeScript
zougui1/drawings
/packages/drawer/src/V2/utils/segment.ts
2.921875
3
import { Position } from '../commands'; const rePathSeparation = /[ ,\n]+/g; export const parseSegment = (segment: string): [Position, ...number[]] => { const [command, ...numberStrings] = segment .replace(rePathSeparation, ' ') .split(' '); const position = command.toUpperCase() === command ? Positio...
b571d9d54e33bb4d862280334cfc801b5b0a5e24
TypeScript
petkoxray/JavaScript-Data-Structures-and-Algorithms-Book
/Chapter 5 Lists/LinkedList.ts
3.859375
4
class LinkedList<T> { private head: null | ListNode<T>; private count: number; constructor() { this.head = null; this.count = 0; } AddLast(value: T): void { if (this.head === null) { this.head = new ListNode<T>(value); } else { let currentNod...
4f452418647820ba536e60cbc1993d7e06477039
TypeScript
JosifV/ChemApp
/server/src/controllers/utils/seeder.ts
3.328125
3
import { shufleArr } from "./shufleArr" export const seeder = (): string[] => { let arrToReturn: string[] = [] let arrOfEls: string[] = shufleArr(["H", "O", "C"]) for (let n = 0; n < 15000; n++) { if (n % 2 === 0) arrToReturn.push(arrOfEls[0]) else if (n % 3 === 0) arrToReturn.push(arrOfEl...
b9443220a0cdf012b4227af84aec448777e11d8f
TypeScript
VertaAI/modeldb
/webapp/client/src/shared/routes/makeRoute.ts
2.59375
3
import qs from 'query-string'; import { matchPath, generatePath } from 'react-router'; import * as PathBuilder from './pathBuilder'; type AllowedUserType = 'unauthorized' | 'authorized' | 'any'; export interface IRouteSettings< Params, QueryParams extends Record<any, any> | undefined = undefined > { getPath: (...
7a5043eacb8ba5308361584c9468692fbfc15b84
TypeScript
vinukumar-vs/angular-event-generator
/src/app/factory/event-factory.service.ts
3.09375
3
import { AppEvents } from '../interfaces/app-events'; import { ErrorEventService } from '../services/error-event.service'; export class EventFactoryService { constructor() { } /** * Library/Application will call this method to generate specific event based on condition where they want to generate the event...
05f6ce0fc3353c47ddf7137419e60ecaebc8db6f
TypeScript
fengzhicool163/Sibo
/src/lobbySrc/practical/components/LobbyTabelPageBox.ts
2.765625
3
module lobby.component{ /** 游戏房间牌桌列表页面盒子 */ export class LobbyTabelPageBox extends common.component.UIBox{ public bindObj : ui.lobbyUI.Boxs.LobbyTabelPageBoxUI; protected barPool : util.PoolView; protected curShowTableBar : Array<LobbyTableBarBox>; protected initComponents()...
a379958efecadf547e3eb3acd138f36fec5a9fcd
TypeScript
aesy/geem
/src/scripts/Systems/RenderSystem.ts
2.609375
3
import { Object3D, Scene, WebGLRenderer, VSMShadowMap, } from 'three'; import { Entity } from '../Entities/Entity'; import { EntityRemoved } from '../Event/EntityRemoved'; import { Game } from '../Game/Game'; import { System } from './System'; export class RenderSystem extends System { public reado...
7f5b1d7ff2b1d8c4764925f9075c5e9eb731ce82
TypeScript
mateogalic112/next-ts-ecommerce
/pages/api/auth/me.ts
2.546875
3
import axios, { AxiosError, AxiosResponse } from 'axios'; import cookie from 'cookie'; import type { NextApiRequest, NextApiResponse } from 'next'; import { API_URL } from '../../../config'; import { User } from '../../../models/User'; export default async (req: NextApiRequest, res: NextApiResponse) => { if (req.me...
203e6fc7abdb5be1aca3e17744f010767dcb9cce
TypeScript
pinyin/tslint
/ts/onlyImportFromIndexRule.ts
2.625
3
import {assume, Maybe, notExisting} from '@pinyin/maybe' import * as path from 'path' import * as tslint from 'tslint' import * as ts from 'typescript' export class OnlyImportFromIndexRule extends tslint.Rules.TypedRule { static metadata: tslint.IRuleMetadata = { ruleName: 'only-import-from-index', ...
e0aefaff9a37a5a71b31e345c4e6ec47504d0843
TypeScript
FallOutChonny/next-gql-hnpwa
/apollo/hn-data-api.ts
2.53125
3
import firebase from 'firebase/app' import { HN_API_URL, HN_API_VERSION } from './config' import type { NewsItems } from './news-items' let api: firebase.database.Reference if (!firebase.apps.length) { firebase.initializeApp({ databaseURL: HN_API_URL }) } if (!(process as any).browser) { require('firebase/databa...
50ded2ff5677023c586fd596dca16f9322148890
TypeScript
rakhmax/ts-express-graphql-template
/src/graphql/resolvers/user.ts
2.59375
3
import bcrypt from 'bcrypt'; import { AuthenticationError, ValidationError ,UserInputError } from 'apollo-server-express' import jwt from 'jsonwebtoken'; import { User } from '../../models/User'; interface IUser { userId: String firstname: String lastname: String username: String email: String password: St...
f4e59c39cb62738ed639bf210488e4a682a5d290
TypeScript
glad/watchnext-rn
/src/domain/throwables/ContentFailedToLoadThrowable.ts
2.625
3
import {BaseThrowable} from './BaseThrowable'; export class ContentFailedToLoadThrowable extends BaseThrowable { constructor(message?: string) { super('ContentFailedToLoadThrowable', message || 'Content failed to load'); } }
602cb9877d552604df10921d24ff1d2831430316
TypeScript
hellochar/mito
/src/math/poissonDisc.ts
3.046875
3
import { Vector2 } from "three"; // https://github.com/beaugunderson/poisson-disc-sampler/blob/master/poisson-disc-sampler.js export function poissonDisc({ width = 1, height = 1, radius = 0.1, max = 1000, initialSample = undefined as [number, number] | undefined, rng = Math.random, }): Vector2[] { // max...
7ae23d28686316f0e0491955e3e43f07056173fc
TypeScript
tiago-jv0/design-patterns-ts
/Adapter/Adapter.ts
3.71875
4
interface ITarget { request(): string; } class Target implements ITarget { public request(): string { return 'Target: The default target\'s behavior.'; } } class Adaptee { public specificRequest(): string { return '.eetpadA eht fo roivaheb laicepS'; } } class Adapter implements ITarget { constructor(privat...
92569c8315f45df422afcb680ee587ef86f4b1ed
TypeScript
yb50110/yunhaseo-ng
/src/app/project/design/yunhaseo.ts
2.8125
3
export const Yunhaseo: yunhaseo[] = [ { category: 'design', mainImageUrl: 'yunhaseo/yunhaseo-desktop.png', mainImageSize: 'contain', title: 'Personal Branding', year: '2017', company: 'Personal Project', role: 'Graphic Designer', url: '', conte...
fed48cc9d011a20a8282df03b6875e08d3dc81ee
TypeScript
nrwl/nx
/packages/webpack/src/executors/dev-server/lib/serve-path.ts
2.921875
3
import type { NormalizedWebpackExecutorOptions } from '../../webpack/schema'; export function buildServePath( browserOptions: NormalizedWebpackExecutorOptions ) { let servePath = _findDefaultServePath(browserOptions.baseHref, browserOptions.deployUrl) || '/'; if (servePath.endsWith('/')) { servePath ...
604fe55e954cf95a91cd8c4b6f3de3531d2d2014
TypeScript
maknifirasing/Clinisys
/src/models/Rigime.ts
2.65625
3
export class Rigime{ private _designation: string; constructor() { } getdesignation(): string { return this._designation; } setdesignation(value: string) { this._designation = value; } }
045a2e741311adb00fffb365edaaf6f30911ed35
TypeScript
47ng/env-alias
/src/index.ts
2.890625
3
export interface Options { prefix: string } export interface Alias { sourceName: string destName: string } const defaultOptions: Options = { prefix: 'ENV_ALIAS_' } // -- /** * @internal Exported for tests only */ export const _extractAliasingDeclarations = ( env: NodeJS.ProcessEnv, options: Options ):...
705140810cbedfae0748c1e81d9d8739b4a403db
TypeScript
andykais/ink-cpu-usage-example
/src/hooks/use-memory.ts
2.921875
3
import * as os from 'os' import { useState } from 'react' const useMemoryUsage = () => { const [state, setState] = useState({ total: 0, used: 0, percent: 0 }) const setMemory = () => { const total = os.totalmem() / 1e9 const used = total - os.freemem() / 1e9 const percent = (used / total) * 100 set...
8d408bd59b5c6bd0d6c794ed4b74273ee74b06d7
TypeScript
GongT/baobao
/@idlebox/common/src/function/asyncCallbackList.ts
3.5
4
import { nameFunction } from './functionName'; export interface MyAsyncCallback<Argument extends unknown[]> { displayName?: string; (...param: Argument): Promise<void | undefined | boolean> | void | undefined | boolean; } /** * like CallbackList, but async */ export class AsyncCallbackList<Argument extends unkno...
124a414819c93f2835b520237b6c338bba10ce1d
TypeScript
DomThePorcupine/worldpoo.ps
/frontend/utils/modules/Api.ts
2.953125
3
import axios, { AxiosInstance } from 'axios'; /** * Namespace module that handles API requests */ class Api { endpoint: string; transport: AxiosInstance constructor() { // Use location.host for testing // this.endpoint = (location.host.indexOf('xyz') >= 0) ? 'https://api.worldpoops.xyz/v...
d2a3a6815a4d6b84e439a00f707b0934cdf9189c
TypeScript
irfatku2/todo-list-learning
/src/app/pages/todo/services/todo.api.service.ts
2.875
3
import { Injectable } from "@angular/core"; import { Observable, of } from "rxjs"; import { Todo } from "../models/todo"; const TODOS: Todo[] = [ { id: 1, title: "Buy milk", completed: false }, { id: 2, title: "Timesheet", completed: false }, { id: 3, title: "Joker", completed: false }, ]; @Injectable() e...
8c46aed0b369d740a14a1a0311e3d3e94a68e7d2
TypeScript
SteffTek/WerwolfDC
/src/commands/cmd_pool.ts
2.671875
3
import {Command} from "./command"; import Discord = require("discord.js"); import {constants} from '../utils/const'; import {GuildGameManager} from "../server/guild"; import {MainIndex} from "../../index"; import {User} from "../game/user"; import {Game, GamePhase} from "../game/game"; export class cmd_pool extends Co...
e6871f086ce0514eb560a5b59fd09934198345b8
TypeScript
ms314006/Chat_Room-With-React
/src/class/Message.ts
2.703125
3
import uuidv1 from 'uuid/v1'; import { IMessage } from "../interface/IMessage"; class Message implements IMessage { id: string = uuidv1(); sendTime: string; name: string; message: string; constructor(sendTime: string, name: string, message: string) { this.sendTime = sendTime; this.name = name; ...
2643ff3d536c16efaf85835ab3aa7cf48e6295b0
TypeScript
Sarafa2n/technopark_db
/src/forum/forum-model.ts
2.84375
3
import { Model } from "../base-model/model"; export interface IForum { id?: number, title: string, user: string, slug: string, posts?: number, threads?: number } export class ModelForum extends Model<IForum> { constructor(attrs: IForum = null) { super(attrs); const default...
f1e9d4cd4b9e7f6e4b8c1049eed35ef172748edb
TypeScript
mark146/nameless-fullstack-boilerplate
/apps/backend/src/rest/routes/api/cars.ts
2.578125
3
import type { RouteOptions } from 'fastify'; import { addCar, deleteCar, getCars, getSingleCar, updateCar, } from '../../controllers/carsController'; import { CarDocument, CarData } from '../../../models/schema/Car.json'; const tags = ['cars']; const params = { id: { type: 'string', }, }; const getC...
d364695629eefc83a9df7203924de46cc37db911
TypeScript
TrueRegin/i-learned-bezier-curves
/src/main.ts
2.9375
3
import { Vector2D, cubicBezier } from './bezier'; const canvas = document.querySelector('canvas#canvas') as HTMLCanvasElement; let ctx: CanvasRenderingContext2D; const controlPoints: [Vector2D, Vector2D, Vector2D, Vector2D] = [ [20, window.innerHeight], [20, 20], [window.innerWidth - 20, 20], [window.in...
0c5900673931ad090f9f78cf6689bafe81a82983
TypeScript
metapages/asman.io
/.cloudseed/deno/git/getGitSha.ts
3.015625
3
/** * Print the git SHA (if you can find it out) to stdout * Arguments: * --short=<count> (default 8 if set) * The universal env var key for this value is DOCKER_TAG * So if that value is found in the env vars, just use it */ import { parse } from "https://deno.land/std/flags/mod.ts"; import { getGitSha } from...
b7eb8d69d8b4d027d81bbd58eb384238d9ba8855
TypeScript
abstractor97/EgretExample
/GuildExample/src/guide/GuideMask.ts
3.078125
3
/** * 新手指引的遮罩 * @author chenkai * @since 2017/7/4 * * 在不需遮罩的矩形区域四周,创建4个半透明rect。 * * example: * 在(100,100)位置,显示200x50的可点击区域 * GuideMask.getInstance().show(100,100,200, 50, this); * GuideMask.getInstance().hide(); */ class GuideMask extends eui.Group{ /**颜色 */ public color:number = 0x000000; /**透明度 */ pu...
6f5e0cb6c22670e6217f95360c0bc06a4a392b54
TypeScript
SagnikPradhan/Lily
/src/modules/bot/library/utils/multipart.ts
3.4375
3
// Types and Interfaces type ValidValues = boolean | number | string | ValidValues[]; type MultipartValidObjType = Record<string, ValidValues | Record<string, ValidValues>> ; interface FileInterface { file: Buffer; fileName: string; } /** * Multipart Data */ export default class Multipart { public readonly ...
d56fdb89ec5c2f2f806319f4bf8806972b3de73a
TypeScript
khiemnd777/project_resume_client
/src/_stdio/shared/components/meta-tag/meta-tag.ts
2.875
3
const createMetaTags = (tags: {}[], type: string) => { tags.forEach((element: {}, index: number) => { const attribute = Object.keys(element)[0]; const content = (element['content'] as string) || ''; const existedTag = document.querySelector(`meta[${attribute}='${element[attribute]}']`) as HTMLMetaElement;...
841a7f6acadfb32c680ced224bf6527ecf626c7c
TypeScript
MHekert/nestjs-graphql
/src/modules/profiles/repositories/profiles.repository.ts
2.515625
3
import { EntityRepository, Repository } from 'typeorm'; import { Profile } from '../entities/profile.entity'; @EntityRepository(Profile) export class ProfilesRepository extends Repository<Profile> { createProfile(username: string, bio: string): Promise<Profile> { return this.create({ username, bio, ...
ab9ae58f9889217101045263d417399b3cc4250e
TypeScript
thewrath/Black
/src/core/System.js
2.921875
3
import { MessageDispatcher } from "../messages/MessageDispatcher"; /** * Base class for custom systems. System is used to listen scene changes. * * @cat core * @extends black-engine~MessageDispatcher */ export class System extends MessageDispatcher { constructor() { super(); } /** * Called when engi...
23351f73df0991a46e82410ebf5295347200efa1
TypeScript
aldringutierrez/sic
/Auth0-Aeg/src/app/pipes/marcas.pipe.ts
2.578125
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'marcas' }) export class MarcasPipe implements PipeTransform { transform(codigo: number): string { if(codigo==1){ return "Intel"; } if(codigo==2){ return "Amd"; } if(codigo==3){ return "Mac"; } return ...
e164cae526bd924a4e028ecc0301297d61551081
TypeScript
MDLeide/screeps
/cashew/src/lib/creep/CreepControllerRepository.ts
2.828125
3
import { CreepController } from "./CreepController"; export class CreepControllerRepository { public static register(controllerType: CreepControllerType, loadDelegate: (memory: CreepControllerMemory) => CreepController) { this.delegates[controllerType] = loadDelegate; } public static load(memory: ...
ca9129a89dc94cfed7bd5fbb2ae4e74acc2c0fe6
TypeScript
rtlocman/js
/Labs/Lab2/lab2/src/app/notes/notes.component.ts
2.640625
3
import { Component, OnInit } from '@angular/core'; import 'rxjs/add/operator/toPromise'; import {HttpClient} from '@angular/common/http'; import {Observable} from 'rxjs/Observable'; @Component({ selector: 'notes', templateUrl: './notes.component.html', styleUrls: ['./notes.component.css'] }) export class Notes...
3c1de55bc5b6494450cb17ac5f2dc4685be8ccc1
TypeScript
FishOrBear/csg.ts
/src/api/primitives3d-api.ts
3.015625
3
import { CSG } from "../core/CSG"; import { fromPolygons } from "../core/CSGFactories"; import { defaultShared, Polygon, Shared } from "../core/math/Polygon3"; import { Vector3D } from "../core/math/Vector3"; import { Vertex3D } from "../core/math/Vertex3"; import { rotate_extrude } from "./ops-extrusions"; import { sc...
c1dd8fa27b80506a0c06e327b26ad0a50f1ccb38
TypeScript
Vinci-da-Gama/a4_bindings
/src/app.convertstyle.ts
2.546875
3
import { Component } from '@angular/core'; import { ExchangeRateService } from './services/ExchangeRate.Service'; @Component({ selector: 'converter-with-style', providers: [ExchangeRateService], template: ` L30: <span>class binding - [class.error]="..."<span> <br /> Convert: <input type="number" [(ng...
25dccc3bf381e3c613c255edff4fd05a1c8554e3
TypeScript
YuraGB/Task
/src/app/Service/app.service.ts
2.625
3
import { Injectable } from '@angular/core'; import { data } from './data'; @Injectable() export class AppService { constructor() { } getAllGoods() { return data.goods; } get(name) { return this.getAllGoods().filter( (element: any) => { if (element.type === name) { return element; } ...
a03f14a62a67b00c1eac76e8a92858fd94c476c5
TypeScript
iiuni/projektzapisy
/zapisy/apps/enrollment/timetable/assets/store/filters.ts
2.640625
3
// Module filters implements the registration and current state of course // filters. import { every, invokeMap, values } from "lodash"; import { CourseInfo } from "./courses"; export interface Filter { visible(c: CourseInfo): boolean; } interface State { filters: { [id: string]: Filter }; } const state: State =...
c5accc59de23934c0b832783a97071bf87bb2bd6
TypeScript
flood-io/element
/packages/core/src/page/conditions/URLCondition.ts
2.8125
3
import { Condition } from '../Condition' import { Frame } from 'playwright' export class URLCondition extends Condition { constructor(desc: string, public url: string, public partial: boolean = false) { super(desc) } toString() { return `waiting for URL to equal "${this.url}"` } public async waitFor(frame: ...
f82784f8b93c6eb2339213fb2979f6471ccf4351
TypeScript
marcos514/Laboratorio_3
/27_4/ajax.ts
2.65625
3
function validarUsuario():void { let nombre=<HTMLInputElement>document.getElementById("txtUsuario"); let pass=<HTMLInputElement>document.getElementById("txtPass"); if(nombre.value!="" && pass.value!="") { let peticion=new XMLHttpRequest(); peticion.open("GET","validar.php?nombre="...
c8ea7cab0a861f70a52a8529c116ca3bdd1b38ba
TypeScript
kingdavid6336/MyCrypto
/src/services/FeatureFlagProvider.test.ts
2.546875
3
import { act, renderHook } from '@testing-library/react-hooks'; import { FEATURE_FLAGS } from '@config'; import { FeatureFlagProvider, useFeatureFlags } from './FeatureFlagProvider'; const renderUseFeatureFlags = () => { return renderHook(() => useFeatureFlags(), { wrapper: FeatureFlagProvider }); }; describe('us...
f4b39193661b29f6deca5efc82e20de5a707b333
TypeScript
andrasferenczi/next-env-runtime
/packages/node/src/functionality.ts
2.546875
3
export const doSomething = (value: string): string => { return `some ${value.toUpperCase()} thing`; };
238b669dd69a2c7e026b724ca876a3f968470b69
TypeScript
p18a/codechallenge2021
/src/hooks/useTripData.ts
3.015625
3
import { useMemo } from 'react'; import { Consumption, Distance, Duration, FuelUnit, Velocity } from '../types'; export interface TripData { readonly t: Duration; readonly fuelUsed: FuelUnit; } function tripDuration(v: Velocity, d: Distance): Duration { return d / v; } function fuelUsed(v: Velocity, d: Distanc...
2e3fbb5347aa1f75475ae7ec9a284ca76c8ddfbd
TypeScript
dtjohnson/typeshield
/src/guards/is-equatable.ts
3.171875
3
import { Equatable, Guard } from '../types'; import { hasInterface } from './has-interface'; import { isFunction } from './is-function'; /** * @ignore */ const guard = hasInterface<Equatable>('Equatable', { equals: isFunction, }); /** * Guard that tests if the value implements the [[Equatable]] interface * @p...
4965912ce9eb9422536bbac7e9a4f4a61fd02aaf
TypeScript
SamuelKasper/Prima-Endabgabe
/EndabgabeCode/Sounds.ts
2.59375
3
namespace Dodge { import f = FudgeCore; export enum SoundList { collectCoin, settingTrap } export class Sounds { private music: f.Audio; private coin: f.Audio; private cmpBackgroundMusic: f.ComponentAudio; private cmpCoinSound: f.ComponentAudio; public constructo...
9c0a3bf0f9443c144a61676a376d6f2fddd54118
TypeScript
green-fox-academy/KornelKovats
/week-02/day-02/Data_Sctructure/shopping-list.ts
3.21875
3
let list: string[]= ['Eggs', 'milk', 'fish', 'apples', 'bread', 'chicken']; let dowehavemilk: boolean = false; let dowehavebananas: boolean = false list.forEach(function (value, index, array) { if (value=="milk"){ dowehavemilk= true; } if (value=="bananas"){ dowehavebananas= true; } ...
5a3c74354775c31f75cbd3ce5c40fd77d1994143
TypeScript
Lixuan-Qiu/theBuzz
/web/ts/Login.ts
3.078125
3
/** * Login encapsulates all of the code for the form for adding an entry */ class Login { /** * The name of the DOM entry associated with Login */ public static readonly NAME = "Login"; /** * Track if the Singleton has been initialized */ private static isInit = false; /*...
af7400438111f186865fbf7f8306b313e1415cb0
TypeScript
ngld/knossos
/packages/front/src/lib/twirp-helpers.ts
2.546875
3
import { TwirpErrorCode } from '@protobuf-ts/twirp-transport'; import { alert } from './alert'; export function presentTwirpError(code: string | TwirpErrorCode): void { if (typeof code === 'string') { code = parseInt(code, 10) as TwirpErrorCode; } switch (code) { case TwirpErrorCode.cancelled: case ...
26d4a00baf8c9de63df10094482b616c1cb2534d
TypeScript
forabi/sirriyah
/src/client/store/middleware/encryption.ts
2.53125
3
import { Store, Dispatch, Middleware } from 'redux'; import { updateMessage, sendFailed, sendEncryptedMessage, keyPairGenereated, keyPairGenereationFailed, } from '../../actions'; import { getPrivateKey } from '../reducer'; import { isActionOfType } from '../utils'; import { encrypt, decrypt, generateKeyP...
6f9c1d4298d38d400c15dd51eea6eccb006decc4
TypeScript
chiamtc/udemy-angular4
/more-angular-material/src/app/training/training.reducer.ts
2.828125
3
import {Action, createFeatureSelector, createSelector} from '@ngrx/store'; import {SET_AVAILABLE_TRAININGS, SET_FINISHED_TRAININGS, START_TRAINING, STOP_TRAINING} from "./training.action"; import {Exercise} from "./exercise.model"; import * as fromRoot from '../app.reducer'; import { TrainingAction, StopTraining, ...