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
4384877ba35bcdf76d1b687bed19db9ffb529f66
TypeScript
Pasakinskas/book-app
/src/services/bookService.ts
2.84375
3
import { BookModel, Book } from "../models/bookModel"; export class BookService { async getAllBooks(limit: number = 0, skip: number = 0): Promise<Book[]> { return BookModel.find() .limit(limit) .skip(skip) } async getBookById(id: string) { const book = await BookMod...
9926f96fbce2329a5f18a810b10415e75c3e8678
TypeScript
michal93cz/NativeTalk-webClient
/src/app/services/notice.service.ts
2.515625
3
import { Injectable } from '@angular/core'; import { Headers, Http } from '@angular/http'; import 'rxjs/add/operator/toPromise'; import { Notice } from '../models/notice'; @Injectable() export class NoticeService { private headers = new Headers({'Authorization': 'Bearer EAAF0TQETtIUBAKXf7vgsjdBTgwu8wbKXvRoKzOZ...
214f10bc93f316ae7de819a33779b075dd74548d
TypeScript
youzan/zent
/packages/zent/src/utils/isPromise.ts
3.53125
4
/** * Test whether an object looks like a promise * * @export * @param {any} obj * @returns {bool} */ export default function isPromise<T = unknown>(obj: any): obj is Promise<T> { return ( !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function' ); }
24b333dd19e46e229297007cb3b0a92e44a25a51
TypeScript
suarezgary/ng4-table
/src/pipes/sorting-table.pipe.ts
3.109375
3
import { Pipe, PipeTransform } from '@angular/core'; /* * Sort Table for Parameter and Way * Takes two argument, the parameter to sort and the way (1 (asc) or -1 (desc)) * Usage: * ObjectArray | sortingTable:init:fin * Example: * {{ [{},{},{}] | sortingTable:"lastname":1}} * result: * [{},{}] */ @Pipe({na...
71e0bc21cf0c4e631bb7651411ff238becc3dd94
TypeScript
Vizzuality/marxan-cloud
/api/apps/api/src/modules/specification/application/specification-input.ts
2.515625
3
import { SpecificationOperation } from '@marxan/specification'; import { Equals, IsArray, IsBoolean, IsDefined, IsNumber, IsOptional, IsString, IsUUID, ValidateNested, } from 'class-validator'; import { FeatureConfigCopy, FeatureConfigSplit, FeatureConfigStratification, } from '../domain'; expo...
4204ed9193b7e15f0db908de1bd69d07b9915699
TypeScript
kleva-j/react-use
/tests/useUpsert.test.ts
3.125
3
import { act, renderHook } from '@testing-library/react-hooks'; import useUpsert from '../src/useUpsert'; interface TestItem { id: string; text: string; } const testItems: TestItem[] = [ { id: '1', text: '1' }, { id: '2', text: '2' }, ]; const itemsAreEqual = (a: TestItem, b: TestItem) => { return a.id ===...
58163f6cb3e5d95952a00db904b916f58cc88ba4
TypeScript
bensw/DefinitelyTyped
/transducers-js/transducers-js-tests.ts
3.5625
4
// tests taken from https://github.com/cognitect-labs/transducers-js import * as t from 'transducers-js'; import * as _ from "lodash"; var map = t.map, filter = t.filter, comp = t.comp, into = t.into; // basic usage function inc(n: number) { return n + 1; }; function isEven(n: number) { return n ...
5369ca1802a3cfe7af890cce65eb2c1ace030bd6
TypeScript
zulqar-abbas/nuces-circle
/src/app/services/reddit-api.service.ts
2.765625
3
import { Injectable } from '@angular/core'; import { Observable, of, throwError } from 'rxjs'; import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; import { catchError, tap, map } from 'rxjs/operators'; const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' ...
a223cf93a0b9622de148d1f8583e04be14d9853e
TypeScript
manish336514/AngularTrainingProject
/src/app/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.css"] }) export class DemoComponent implements OnInit { message; vegetables; //or message:string constructor() {} ngOnInit() { console.log("ngOn...
b84ff28480f8c4c42c04528b42abe3ad79d23add
TypeScript
adityamachiraju3/B200251-javascript
/typescript-demo2/datatypes-demo.ts
3.328125
3
let nums:number[] = [10,12,45,14,26,55,35,17,0,6]; nums.sort(numSort); function numSort(a:number, b:number){ if(a>b){ return 1; }else if(b>a){ return -1; }else{ return 0; } } console.log(nums);
ffcb0f4f91a5d6c3979553532c8af49cd8d1fe94
TypeScript
paulswartz/dotcom
/apps/site/assets/ts/helpers/fetch.ts
3.28125
3
export type fetchAction = // @ts-ignore should add a generic here | { type: "FETCH_COMPLETE"; payload: any } // eslint-disable-line | { type: "FETCH_ERROR" } | { type: "FETCH_STARTED" }; export interface State { // @ts-ignore should add a generic data: any | null; // eslint-disable-line isLoading: boolea...
cf02c8095772549452799f9ba78cff720a41f6a0
TypeScript
gongbaodd/algorithm_study
/src/btree/is_after_order.ts
3.765625
4
// 二元查找树,左节点<root<右节点 export function isAfterOrder( arr: number[], start: number, end: number ): boolean { const root = arr[end]; let i = start; let j; while (i < end) { if (arr[i] > root) { break; } i += 1; } j = i; while (j < end) { if (arr[j] < root) { return false; ...
597c7793cfffcf512c41f7d15abfdaef788852c2
TypeScript
stonek4/hitmewithten
/hmwt_app/src/tester/tester.ts
2.515625
3
import { inject, LogManager } from 'aurelia-framework'; import { Router } from 'aurelia-router'; import { CssAnimator } from 'aurelia-animator-css'; import { Card } from '../card'; import { Trophies } from '../trophies/trophies'; import { Globals } from '../globals'; const logger = LogManager.getLogger('tester'); @in...
54a4fe89879ecf4b0f28d505ca398544e20636f3
TypeScript
denniskempin/vscode-include-fixer
/src/extension.ts
2.703125
3
'use strict'; import * as vscode from 'vscode'; import * as cp from 'child_process'; import * as path from 'path'; // clang-include-fixer output format (the bits that we use) type HeaderInfo = { QualifiedName: string, Header: string }; type CIFHeaders = { HeaderInfos: HeaderInfo[]; } // Call clang-include-fixer...
779fb50efa8dfa9c808ce8497e49cbaca332b6df
TypeScript
orliin/mathsteps
/lib/src/simplifyExpression/basicsSearch/index.ts
3.0625
3
/** * Performs simpifications that are more basic and overaching like (...)^0 => 1 * These are always the first simplifications that are attempted. * */ import { TreeSearch } from "../../TreeSearch"; import { rearrangeCoefficient } from "./rearrangeCoefficient"; import { convertMixedNumberToImproperFraction } from...
7fdf060ba8e935d504936773b1fd86bedecfd02d
TypeScript
Jameskmonger/adventofcode
/src/2019/Day 8/imageDecoder.ts
3.390625
3
export interface ILayer { bytes: number[]; } export interface IImage { width: number; height: number; layers: ILayer[]; } export class ImageDecoder { /** * Constructs an instance of image decoder for a give strem * @param imageStream image stream * @param layerWidth layer width * @param layerHei...
ce718e30e0400e18f0c08e1e8682c2d93e13b474
TypeScript
mcnguyen/type-plus
/src/array/Concat.spec.ts
2.953125
3
import { Concat, Equal, isType } from '..' test('concat array', () => { type A = Concat<string[], boolean[]> isType.t<Equal<Array<string | boolean>, A>>() }) test('concat tuples', () => { type A = Concat<[1, 2, 3], [4, 5]> isType.t<Equal<[1, 2, 3, 4, 5], A>>() }) test('concat array to tuple', () => { type ...
69e10f4915b1eb73157b7f21cc960dfcda419a97
TypeScript
codenamesimon/developers_day_slackbot
/src/slack.ts
2.6875
3
import * as https from 'https' import * as querystring from 'querystring' import { Secrets } from './secrets.js' import { logger } from './logger.js'; /** * Class for sending requests to slack */ export class Slack { /** * Sends application/json request to slack * @param data Data to send in payload ...
7befc0e1931600c8dfa57707149e7590e8419b14
TypeScript
tiyodev/-Flights-API-
/src/api/v1/controllers/auth.controller.ts
2.96875
3
import { Request, Response } from 'express'; import { SeedUsers } from '../user/user.seed'; import { HttpStatus } from '../common/error/http_code'; import HttpError from '../common/error/http_error'; import Logger from '../logger/logger'; import { ErrorCode } from '../common/error/error_code'; import { myGenerateJwt } ...
01265444b80d094851447f5a1131d77d6d7d5c0a
TypeScript
ULL-ESIT-INF-DSI-2021/ull-esit-inf-dsi-20-21-prct07-menu-datamodel-grupo-k
/src/plates/dessert.ts
2.828125
3
import {Aliment} from "../aliment/aliment"; import {Plate} from "./plate"; /** * Clase para representar un postre */ export class Dessert extends Plate { /** * Constructor de la clase Dessert * @param name Nombre del postre * @param ingredients Ingredientes del postre */ constructor(name: string, ...
bf52d8c47e2dc7b295d893c01964593a57af7394
TypeScript
vetradar/dynadump
/src/export_all_tables.ts
2.6875
3
import { ExportTable } from './export_table'; export type ExportDynamoDBOptions = { AWS: any; ignore: string[]; path: string; }; export class ExportDynamoDB { _AWS: any; _path: string; _toIgnore: string[]; constructor(options: ExportDynamoDBOptions) { this._AWS = options.AWS; this._path = optio...
c4660a5b01851c0ab5dd267482ae50e797cfcbdb
TypeScript
Wellington19/nlw1-ecoleta
/frontend/src/components/Input/masks.ts
2.6875
3
export function maskCep(e: React.FormEvent<HTMLInputElement>) { e.currentTarget.maxLength = 9; let value = e.currentTarget.value; value = value.replace(/\D/g, ''); value = value.replace(/^(\d{5})(\d)/, '$1-$2'); e.currentTarget.value = value; return e; } export function maskPhone(e: React.FormEvent<HTMLIn...
297ac745d0b2adf341afd7c8658e504c0cc6b102
TypeScript
thiagorm28/crud-gazin
/server/developers/middleware/developers.middleware.ts
2.671875
3
import express from 'express'; import developerService from '../services/developers.service'; class DevelopersMiddleware { // Facilitando a extração do id do desenvolvedor async extractDeveloperId( req: express.Request, res: express.Response, next: express.NextFunction ) { ...
e214cf743a98d8cbd50fc7e69187d64d5b528b66
TypeScript
quantumsheep/reservation-avaibility-service
/src/api/reservations.api.ts
2.703125
3
import axios from 'axios' import moment from 'moment' import api from '../api' const url = process.env.API_URL export interface IReservation { reservationStart: string reservationEnd: string } export interface IReservations { reservations?: IReservation[] error?: string } export async function get(date: st...
074402eccc463367295bf355e0f38449d00ca45f
TypeScript
PetarShopov/My-Organizer
/src/app/tasks/task.ts
2.8125
3
export interface ITask { _id: string; content: string; } export class Task implements ITask { _id: string; content: string; constructor( content: string, ) { this.content = content; } }
eeb730c591c58f610dd1b38dd556f09e329f3fa4
TypeScript
mohamedelgarnaoui/FleetManagementAngular
/src/app/services/auth.service.ts
2.625
3
import { Injectable } from '@angular/core'; import {HttpClient} from '@angular/common/http'; import {BehaviorSubject, Observable } from 'rxjs'; import {User} from '../model/user.model'; import {tap} from 'rxjs/operators'; export interface AuthResponseData { accessToken: string; } @Injectable({ providedIn: 'root' ...
76f9997b1cf35f3d99df23d122266f2ecc1f0c68
TypeScript
rostgoat/ea-blog-api
/src/comment/comment.entity.ts
2.578125
3
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, BeforeInsert, JoinColumn, } from 'typeorm' import { Post } from '../post/post.entity' import { User } from '../user/user.entity' import { v4 as uuid } from 'uuid' /** * Comments Entity */ @Entity('comments') export class Comment { @PrimaryGen...
4b150d145725e333cd66fdf5d28064634ecdfad1
TypeScript
frandefreitas/nossaslojas2.0
/entity/Loja.ts
2.5625
3
import {Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn} from "typeorm"; import {Cidade} from "./Cidade"; @Entity() export class Loja{ @PrimaryGeneratedColumn() id: number; @Column() endereco: string; @Column() telefone: string; @Column() cnpj: string; @Colu...
f2055f5db8c138154f6960a03c7280631606901d
TypeScript
PradaZD/mooc_TS
/typescript/枚举.ts
3
3
//枚举 enum Status { OFFLINE, ONLINE, DELETE, } // console.log(Status.OFFLINE); // console.log(Status.ONLINE); // console.log(Status.DELETE); // const Status={ // OFFLINE:0, // ONLINE:1, // DELETE:2, // }
b63568161ac16e8aadbe89f29c9d08e26af56bd3
TypeScript
mitsuyoshi-yamazaki/AntOS
/src/v8/process/application_process/economy_process.ts
2.5625
3
import { Process, ProcessExecutionOrder, ProcessExecutionPriority, ProcessExecutionSpec, ProcessId, ProcessState } from "../process" import { ProcessType, ProcessTypeConverter } from "../process_type" import { Application } from "../application/application_process" import { LaunchMessageObserver } from "../message_obse...
63044ba517e6d071813c766f9d6b2dd290d9d7a9
TypeScript
yoyo930021/vc2c
/src/plugins/vue-class-component/object/Prop.ts
2.515625
3
import { ASTConverter, ASTResultKind, ReferenceKind } from '../../types' import type ts from 'typescript' export const convertObjProps: ASTConverter<ts.PropertyAssignment> = (node, options) => { if (node.name.getText() === 'props') { const tsModule = options.typescript const attributes = (tsModule.isArrayLit...
431432d151ad36c2f9dbd97f358895b86e7b0bc5
TypeScript
Anapher/Drinctet
/web/src/core/parsing/card-parser-factory.ts
2.71875
3
import { CardParser } from "./card-parser"; /** a factory that creates the right parser for a card type */ export interface CardParserFactory { createParser(cardType: string) : CardParser | undefined; }
4ee559c77b257c93d88e241e139f0b7ce0c78fc6
TypeScript
Ta1265/tubesock
/server/index.ts
2.671875
3
/* eslint-disable @typescript-eslint/no-var-requires */ import axios from 'axios'; import express from 'express'; import bodyParser from 'body-parser'; import YouTubeGetID from './youTubeUrlParser'; require('dotenv').config(); const app = express(); const server = require('http').createServer(app); const io = require...
2c96acd3e44d8153f67586831b8acffc8c97147b
TypeScript
VictorNevola/next-project-student
/resources/cookies.ts
2.71875
3
import ms from 'ms'; export const setCookie = (nameCookies: string, valueCookie: string, expireDate: string) => { const time = ms(expireDate) / 1000; document.cookie = `${nameCookies}=${valueCookie}; max-age=${time}; path=/; Secure;`; return true; } export const captureCookie = (nameCookie: string | undef...
cd058a7916dbe1f5ad432367d0e4ac2c744d5175
TypeScript
snakamura/mvc_rx
/7/mvc/index.ts
3.296875
3
class Model { constructor(values: number[] = []) { this._values = values; } get values() { return [...this._values]; } get sum() { return this._values.reduce((sum, value) => sum + value, 0); } addValue(value: number): Model { return new Model([...this._valu...
b756f14b5d8b6a2a6bb79f48815c764feec7a5c8
TypeScript
dera-/houkai-sensou
/src/repository/model/GamePlayerRepository.ts
2.96875
3
import {GamePlayerModel} from "../../model/GamePlayerModel"; import {GamePlayerStateType} from "../../type/GamePlayerStateType"; import {GameTeamType} from "../../type/GameTeamType"; g.game.vars.players = {}; export const getPlayer = (playerId: string): GamePlayerModel|null => { const player = g.game.vars.players[pl...
33c245194d4052f59340b822a373f81e9f84063f
TypeScript
DBotThePony/DBotTheDiscordBot
/lib/SteamID.ts
2.71875
3
// // Copyright (C) 2017 DBot // // Licensed under the Apache License, Version 2.0 (the "License") // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
fc7d4398653a398ebceb030e8895060c3698f849
TypeScript
Molsbee/rdbs-ui-prototype
/frontend/src/main/api/ActionLogAPI.ts
2.546875
3
import * as moment from "moment"; import Moment = moment.Moment; declare var atlas: any; export class ActionLog { timestamp: Moment; message: string; details: string; user: string; constructor(data: any) { this.timestamp = moment.utc(data.timeStamp).local(); this.message = data.me...
4fbbfb7fdba5dde54a52a799461c94070fbbb974
TypeScript
romanepifanov/flexible-calendar
/src/setting/languages.ts
3.03125
3
import { Language, Languages } from "../models/language.model"; const en: Language = { month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], monthShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'D...
9402ee092600f45cea197a188c581f4381b8548e
TypeScript
news-catalyst/presspass-frontend
/src/store/clients/actions.ts
2.90625
3
import { UPSERT_CLIENT, Client, UPSERT_CLIENTS, DELETE_CLIENT, DeleteClientAction, UpsertClientAction, UpsertClientsAction } from "./types"; export function upsertClient(client: Client): UpsertClientAction { return { type: UPSERT_CLIENT, client: client }; } // This action is necessary becaus...
2441f6aa349774762cdfe8a4a0551a10955a6108
TypeScript
deandreee/electron_ml_nn_research
/src/strat/rescale.ts
2.984375
3
import * as statslite from "stats-lite"; // https://stats.stackexchange.com/questions/70801/how-to-normalize-data-to-0-1-range // newvalue= (max'-min')/(max-min)*(value-max)+max' // min' to max' => new export const rescale = (value: number, min: number, max: number): number => { const newMin = -1; const newMax = 1...
7435ec4c1126c568d6d0d747469c50393636e058
TypeScript
teshimafu/redux_calculator_sample
/src/modules/CalculatorContainer.ts
3.09375
3
import { OPT, Calculator } from "src/services/CalculatorService"; const INPUT_NUMBER = "INPUT_NUMBER"; const OPERATION = "OPERATION"; const EQUAL = "EQUAL"; const RESET = "RESET"; const onNumClick = (number: number) => ({ type: INPUT_NUMBER, number }); const onOperationClick = (opt: OPT) => ({ type: OPERATION,...
d28feefe804ff7690429aae20535b2c8803559f7
TypeScript
DylanYang0523/node-pg-migrate
/test/indexes-test.ts
2.640625
3
import { expect } from 'chai' import * as Indexes from '../src/operations/indexes' import { options1, options2 } from './utils' type CreateIndexParams = Parameters<ReturnType<typeof Indexes.createIndex>> describe('lib/operations/indexes', () => { describe('.create', () => { it('check schema not included in inde...
ca24b6c6421e626acaad42a7c1879a28640af3cb
TypeScript
skwidz/jobber-library
/src/interfaces/BookInterface.ts
3.21875
3
export interface Book { title: any; author: string, genre: string, synopsis: string, // id: number; // avalible: boolean; // signed_out_to: string; } export interface AdditionalBookInfo{ subtitle: string, description: string, imageLink: string, } export function createBook(config: Book): { title: string, ...
5beea212b79ba506c2202b69f915ef11dc9ddfc5
TypeScript
reecewbourgeois/CMPS401_Language_Presentation_Code
/source/TLoop.ts
3.5625
4
/* * Test Loops: while, for, and nested loops. * Program-ID: TSub.ts * Author: Kwentin Ransom * OS: Ubuntu 20.04 * Compiler: TSC * Note: * The following instructions are used to * edit, compile, and run this program * $nano TLoop.ts * $tsc TLoop.ts * $node TLoop.js */ //setting numeric ...
1b1dabc5a1fde1617a20547025175a9d22968aae
TypeScript
NormanFrieman/storiesbook
/backend/src/commands/tools/encrypt.ts
2.65625
3
import bcrypt from 'bcrypt'; import { ResponseFunction } from '../../protocols'; export const encrypt = async (password: string): Promise<ResponseFunction> => { const hash: string = await bcrypt.hash(password, 10); if(!hash){ const response: ResponseFunction = { sucess: false, ...
84520820bef4a312229b2bec701a0cd104530225
TypeScript
koshevy/codegena
/libs/definitions/oas3/src/types/request.ts
2.765625
3
import { HasRef } from '@codegena/definitions/aspects'; import { HasContent } from './has-content'; /** * Request Body Object. Describes a single request body. * @see https://swagger.io/specification/#requestBodyObject */ export interface Request extends HasRef, HasContent { /** * A brief description of th...
a7bad6590098dc26b0e11b3e12be160c78c50e36
TypeScript
liridonRama/ts-web-framework-task
/src/models/ApiSync.ts
2.625
3
import axios, { AxiosPromise } from "axios" import { nanoid } from "nanoid"; import { HasId } from "../interfaces/HasId" export class ApiSync<T extends HasId> { constructor(private rootUrl: string) { } fetch = (id: string): AxiosPromise => { return axios.get(`${this.rootUrl}/users/${id}`); } save = (dat...
589a689734fbe2d86d9ed17d5da4f7a9dc2f10f8
TypeScript
adriancarriger/experiments
/algorithms/2/src/permutations/string.ts
3.203125
3
export function permutations(input: string, output = '', set = new Set()) { if (!input) { set.add(output); } input.split('').forEach((letter, index) => { permutations(input.slice(0, index) + input.slice(index + 1), output + letter, set); }); return set; }
d820e93cb5208794920b158c80e159eea4dcad90
TypeScript
dmyxs/react-ts-jira
/src/hooks/use-documentTitle.ts
3.171875
3
import { useRef, useEffect } from "react" // 版本一:最简单的写法 // export const useDocumentTitle = (title: string) => { // useEffect(() => { // document.title = title // }, [title]) // } // 版本二:保留第一次的title // isUnmount 是否卸载 export const useDocumentTitle = (title: string, isUnmount: boolean = true) => { ...
861d8c331acdbf168888adf93fe9f5d37e8e228a
TypeScript
Drane/surfwatch-mess
/api/surfwatch-old/src/models/location.model.ts
2.65625
3
import {property, model} from '@loopback/repository'; @model() export class Location { @property({required: true}) latitude: number; @property({required: true}) longitude: number; constructor(latitude: number, longitude: number) { this.latitude = latitude; this.longitude = longitude; } }
2db580567238c75c0b70994f2a307c6229d057ed
TypeScript
DenMantm/personal-blog-page
/app/common/array-utility-service.ts
3.078125
3
import { Injectable } from '@angular/core'; @Injectable() export class ArrayUtilityService{ snippetElements:any snippetTemplate:any constructor() { } // addNewElement(item,itemList){ // } addNewSnippet(itemList){ //adding item to the array and passing item length console.lo...
dfa31dd1df33c22ede3e4451aa4663d82b0c52a3
TypeScript
wlf-io/chip-project
/src/designer/chip/Pin.ts
3.09375
3
import { PinData } from "../../common/interfaces/source.interfaces" class Pin { private _chip: string; private _output: boolean; private _name: string; public get id(): string { return `${this.chip}_${this.output}_${this.name}`; } public static Factory(chip: string = "", output: bool...
9a08fc928147ac272c12f12d9fb236fdac77c754
TypeScript
rostacik/CodeCon2014TSSamples
/CodeConTSSamples/09-Classes/file5.ts
3.1875
3
class Employee { private _fullName: string; get fullName(): string { return this._fullName; } set fullName(newName: string) { this._fullName = newName + " was supplied"; } }
b17d9ad164fed58cdaeae56105e5cde1f2bfbac9
TypeScript
doubco/world
/src/index.ts
2.5625
3
import { Translation, TranslationKey, TranslationContext, TranslationLocale, Translations, WorldFormatter, WorldOnLocaleChange, WorldFetch, WorldConfig, TranslationOptions, } from "./types"; import { isObject, isString, isArray } from "@doubco/wtf"; export class World { initializedLocales: Array...
6f7286c7316a4c91177ef5a5e273aad5d880a3fd
TypeScript
bradgarropy/adobe-rules
/src/statement.ts
3.140625
3
import {Data} from "." import {Condition, evaluateCondition} from "./condition" type Combinator = "and" | "or" type Statement = { combinator: Combinator conditions: Array<Condition | Statement> } const isStatement = (rule: Statement | Condition): boolean => { const statement = rule as Statement if (...
6719ae35271a090f9303c4fd0617b61ecd9ccd08
TypeScript
Electromasta/eastmarchescom
/src/app/nav/model/subsection.model.ts
2.90625
3
export class Subsection { public header: string; public text: string; public list: Array<Subsection>; constructor(header: string, text: string, list?: Array<Subsection>) { this.header = header; this.text = text; this.list = list; } }
71e9e898ef78a6b106931ee8a94c52a2375e6ecf
TypeScript
yangxin1994/every-color-picker
/src/alpha-controller.ts
2.59375
3
import { BaseElementController } from './base-element'; import { Color } from './colors'; import { RANGE_STYLE, ALPHA_BG } from './common'; export class AlphaController extends BaseElementController { constructor(e: HTMLElement) { super(e); this.root.innerHTML = ` <style> ${RANGE_STYLE} :host...
7136dd66ce51b8f5f63b035a03eff7ba57ceb6a0
TypeScript
lizzzp1/tslint-microsoft-contrib
/src/informativeDocsRule.ts
2.875
3
import * as Lint from 'tslint'; import * as ts from 'typescript'; import { getApparentJsDoc, getNodeName } from './utils/NodeDocs'; import { ExtendedMetadata } from './utils/ExtendedMetadata'; const defaultUselessWords = ['a', 'an', 'of', 'our', 'the']; const defaultAliases: { [i: string]: string[] } = { a: ['an...
654bab8941d1a00107ed58192e2955d2af1d09a6
TypeScript
samwaters/WebAssembly
/src/app/store/wasm.store.ts
2.75
3
import { createAction, createSlice, PayloadAction } from '@reduxjs/toolkit' export enum WASMStates { NOT_LOADED = "not_loaded", LOADING = "loading", LOADED = "loaded" } export interface WASMState { addition: WASMStates prime: WASMStates } const initialState: WASMState = { addition: WASMStates.NOT_LOADED, prim...
fd7a62884ef48b87e77f131ab54f218cca3844ef
TypeScript
marianbret/dashboard
/src/auth/auth.controller.ts
2.578125
3
import { Controller, Get, UseGuards, Req, Res, Post, Body } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; import { AuthService } from './auth.service'; import { User } from './auth.entity'; @Controller('auth') export class AuthController { constructor(private readonly authService: AuthServi...
06165db59ce95f0a90afb4812b41c81590b3f532
TypeScript
kopenkinda/fun
/prolog-problems/src/03-logic-and-codes/04-gray-code.ts
3.5625
4
// An n-bit Gray code is a sequence of n-bit strings constructed // according to certain rules. For example, // n = 1: C(1) = ['0','1']. // n = 2: C(2) = ['00','01','11','10']. // n = 3: C(3) = ['000','001','011','010','110','111','101','100']. // Find out the construction rules and write a predicate wi...
2031cb0a18e1aba48c89bb4efba94e7ed1f25861
TypeScript
jryx0/vscode-sqlite
/tests/unit/sqlite/resultSetParser.test.ts
2.640625
3
import { ResultSetParser } from '../../../src/sqlite/resultSetParser'; describe("ResultSetParser Tests", function () { test("should build resultset if chunks are valid", function() { let resultSetParser = new ResultSetParser(); resultSetParser.push("SELECT * FROM company;\n\"h1\" \"h"); re...
5500f7a810739e94cf5807282afc0851f58d381f
TypeScript
GoogleCloudPlatform/testgrid
/web/src/APIClient.ts
2.53125
3
import { ListDashboardsResponse, ListDashboardGroupsResponse, } from './gen/pb/api/v1/data.js'; export interface APIClient { getDashboards(): Array<String>; getDashboardGroups(): Array<String>; } export class APIClientImpl implements APIClient { host: String = 'testgrid-data.k8s.io'; public getDashboards...
b2ad5a7923537c53516e96ee274391b8d9367de7
TypeScript
acarrara/clash-of-lords
/app/pieces/world/Coordinates.ts
3.171875
3
import {Objects} from '../commons/Objects'; export class Coordinates { private _x:number; private _y:number; private xDimension:number; private yDimension:number; public constructor(x:number, y:number) { this._x = x; this._y = y; } public get x():number { return t...
44d8a36bef0751779596db3ce89263921c78abde
TypeScript
haproxyhq/frontend
/app/models/toast.model.ts
2.734375
3
export class ToastModel { content: string; style: string; timeout: number; htmlAllowed: boolean; constructor(content: string, style: string = '', timeout: number = 3000, htmlAllowed: boolean = true) { this.content = content; this.style = style; this.timeout = timeout; this.htmlAllowed = htmlA...
cf9d38eda23d5ad94a0ea72204e8cdde1168170d
TypeScript
cdcalderon/SpotifyTypescriptNodeApi
/server/spotify/base-request.ts
2.703125
3
export class Request { host: any; port: any; scheme: any; queryParameters: any; bodyParameters: any; headers: any; path: any; constructor(builder: any) { if (!builder) { throw new Error('No builder supplied to constructor'); } this.host = builder.ho...
59988293ce52df4ed4457c698bebe2cd30e50e17
TypeScript
baptistemanson/webgpu-samples
/src/examples/fractalCube.ts
2.625
3
import { mat4, vec3 } from "gl-matrix"; import { cubeVertexArray, cubeVertexSize, cubeColorOffset, cubeUVOffset, cubePositionOffset, } from "../cube"; import glslangModule from "../glslang"; import { updateBufferData } from "../helpers"; /** * This demo renders a cube into a cube, into a cube. * * In orde...
b74b0a65daddb16d5d53fd353653e27b0f1f21f5
TypeScript
NervJS/nerv-server
/src/index.ts
2.78125
3
// tslint:disable-next-line:max-line-length import { isVNode, isVText, isWidget, isStateLess, isString, isNumber, isFunction, isNullOrUndef, isArray, isInvalid } from './is' import { encodeEntities, isVoidElements, escapeText, getCssPropertyName, isUnitlessNumber, assign } from './utils'...
ba63749bda07e2215444837f9e4f9360b3cb48c0
TypeScript
grndctrl/next-world-builder
/src/utilities/GeometryGenerators.ts
2.9375
3
import * as THREE from 'three'; import { mergeBufferGeometries } from 'three-stdlib'; import * as GeometryUtilities from '@utilities/GeometryUtilities'; /** * Check each side, generate a segmented face if there is no neighbour. * Returns null when all sides have neighbours. * * @param {number} blockSize * @param...
ca5321297e0a56e6c3ffa10d4b142d1df534d989
TypeScript
r2magarcia/restpkm
/src/services/DigimonsService.ts
2.984375
3
import { DigimonI } from "../interfaces/DigimonInterfaces"; import { MonsterTypeI } from "../interfaces/MonsterTypeI"; const db = require('../db/Digimons.json'); module DigimonsService { export function getAll(): Array<DigimonI> { const digimons: Array<DigimonI> = db; return digimons } exp...
6313c19a0599bcbd2a200b014efbc251a23e8a73
TypeScript
crazywook/class101-quiz
/vehicles/Vehicle.ts
3.5
4
import {Wheel} from "./components/Wheel"; import {VehicleType} from "./types"; export class Vehicle<T = VehicleType> { readonly type: T; private readonly wheels: Wheel[]; private readonly numberOfWheels: number; // bigger than -1 private fuel: number; // 0~100 constructor(type: T, numberOfWheels: number, w...
10c6776f2581c7ab58d59be597d044d16befb9fa
TypeScript
K-REBO/autoGoogleForm
/msg/mod.ts
2.796875
3
const delete_pass = "asdfjkl;123"; let memory:Array<any> = new Array(); addEventListener("fetch", (event)=> { event.respondWith(handleRequest(event.request)); }); async function handleRequest(request: Request) { if(request.method == "GET") { return new Response(JSON.stringify( { "result": memory, } ),...
89f456f59f6c76605065e107b4a8d370189f4f95
TypeScript
Pucek9/multiplayerGameEngine
/src/client/UserInterface/PlayersList.ts
2.71875
3
import { compareBy } from '../../shared/helpers'; import PlayerListModel from '../interfaces/PlayerListModel'; declare const playerListPanel: HTMLDivElement; declare const playersList: HTMLUListElement; export default class PlayerListComponent { constructor() {} show() { playerListPanel.style.display = 'bloc...
faa9b5c147ab9e2877be02e561d8e3431a3a3ddd
TypeScript
JRiyaz/angular-basics
/src/app/components/routing/reactive-forms/reactive-forms.component.ts
2.59375
3
import { Component, OnInit } from '@angular/core'; import { AbstractControl, FormArray, FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; import { CustomEmailValidator } from 'src/app/classes/custom-email-validator'; @Component({ selector: 'app-reactive-forms', templateUrl: './reactive-forms...
c9c098e5f644551b680c29eb0d67d552a99a3a56
TypeScript
Voya100/VoyaCode
/src/app/projects/chess/chess-settings.service.ts
2.96875
3
import { Injectable } from '@angular/core'; @Injectable() export class ChessSettingsService { readonly boardSize: number = 8; positions: string[]; whiteComputer: boolean = false; blackComputer: boolean = true; boardReversed: boolean = false; // Contains tile positions on the board interface // boardTi...
794486843125b9a2927f709fd5e30ed877111630
TypeScript
staltz/xstream
/src/extra/sampleCombine.ts
2.96875
3
import {InternalListener, Operator, Stream} from '../index'; export interface SampleCombineSignature { (): <T>(s: Stream<T>) => Stream<[T]>; <T1>(s1: Stream<T1>): <T>(s: Stream<T>) => Stream<[T, T1]>; <T1, T2>( s1: Stream<T1>, s2: Stream<T2>): <T>(s: Stream<T>) => Stream<[T, T1, T2]>; <T1, T2, T3>( ...
d2b5290a176211918041613388b448e11e265c3b
TypeScript
carlosjmarin/ts-sandbox
/main.ts
2.734375
3
let a: number; let b: boolean; let c: string; let d: any; let e: number[] = [1, 2, 3]; let f: any[] = [1,true, 'a', false]; const CarLambo = 0; const CarFerrari = 1; const CarTesla = 2; enum Car { Lambo = 0, Ferrari = 1, Tesla = 2 };
a861b11a9f937103974cdfd3c59494221355ffe9
TypeScript
wedev-siqr/siqr-server
/src/controllers/membership.controller.ts
2.515625
3
import { status } from 'server/reply'; import { Context } from 'server/typings/common'; import { Membership, MembershipAttributes } from '../models'; export const getMemberships = async (ctx: Context) => { ctx.log.info('Starting getMemberships'); const memberships = await Membership.findAll(); ctx.log.info('Fin...
48fae27b0150b8e553a0a9d0976eb9622d6830de
TypeScript
TwanvandenBor/twans_chess_game
/src/helpers/DamBoardHelper.ts
2.96875
3
import { DamStone } from "@/model/DamStone"; import { BoardCoordinate } from "@/model/BoardCoordinate"; import { DamStoneCoordinate } from "@/model/DamStoneCoordinate"; export class DamBoardHelper { getNumberOfTilesPerBoardRow(): number { return 8; } getBoardCoordinateFromXAndY(x: number, y: number): BoardCoordi...
a6665de7a1bf3cd1fa2929432c2fc75bb3527a1d
TypeScript
GBichon/Planificador-Dron-Angular-4-
/drone-app/src/app/services/geojson.services/geojson.coordinate.searcher.service.ts
3.171875
3
declare var turf: any; export class GeoJson_Coordinate_Searcher_Service { constructor(){} /** * Search for the coordinate that is further to the west and further to the * south from the given array of coordinates * @param coordinates An array of coordinates * @return [ return = {} ] * ...
2e3a61a1f6e69ea186f384b44a514afc35e6a8a6
TypeScript
design-automation/mobius-external-grader
/src/core/inline/_conversion.ts
2.875
3
import { getArrDepth2 } from '@assets/libs/util/arrs'; export function radToDeg(rad: number|number[]): number|number[] { if (Array.isArray(rad)) { return rad.map(a_rad => radToDeg(a_rad)) as number[]; } return rad * (180 / Math.PI); } export function degToRad(deg: number|number[]): number|number[] { if (Ar...
2695b34710500d7e4855587e645df755220f2f3c
TypeScript
codeuniversity/ppp-profile-peeker
/src/contexts/ShortTermStoreContext.ts
2.828125
3
import React from "react"; export type ShortTermValue = number | string | object; export interface ShortTermStore { [key: string]: ShortTermValue; } export interface ShortTermStoreValue { shortTermStore: ShortTermStore; setShortTermValue: (key: string, value: ShortTermValue, timeToLive: number, setIn?: number)...
4450795f359538a9ff6ee20c9ce905af831f7851
TypeScript
Maniae/ld44-your-life-is-currency
/src/entities/banker.ts
2.75
3
import { Point } from "../math"; import { Entity, ColliderType } from "./entity"; export class Banker implements Entity { position: Point; velocity: Point; acceleration = 1; friction = 0.7; maxSpeed = 5; width = 32; height = 48; colliderType: ColliderType = "rect"; dead = false; stealDelay = 1000; lastSteal...
b38d66e118943399a0d489e31931502c33f3fd99
TypeScript
x4AEKx/vanilla-tests
/src/03/03.test.ts
2.90625
3
import {CityType} from "./../02/02"; import {addMoneyToBudget, repairHouse, toFireStaff, toHireStaff} from "./03"; let city: CityType; beforeEach(() => { city = { title: "New Your", houses: [ { buildAt: 2012, repaired: false, address: { number: 100, street: ...
8f185f9777ab4ab99c8eac50647238efd1b2f6b6
TypeScript
Aaron-K-T-Berry/ubuy-poc
/backend/src/model/order/orders.model.ts
2.671875
3
import mongoose, { Document } from "mongoose"; enum StatusTypes { packing = "packing", delivering = "delivering", complete = "complete" } export interface Order { userId: string; items: { itemId: string; quantity: number; branchId: string; }[]; billingAddress: string; deliveryAddress: string; orderTime...
caf5f148cbce0698f61da96a9ba625fe682c632b
TypeScript
dmitry-egorov/storia
/app/scripts/tools/utils/ScopeObservable.ts
2.828125
3
module Rx { export class ScopeObservable<T> implements IObservable<T> { constructor(private $scope: ng.IScope, private observable: IObservable<T>) {} subscribe(observer: Observer<T>): IDisposable; subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: (...
b2618093f6c4ddf643c38ae60015d0571e2083c8
TypeScript
ace-study-group/assignment-itsfs
/petstore-client/src/app/services/pet.service.ts
2.5625
3
import { Injectable } from '@angular/core'; import { Pet } from '../model/pet'; import { Observable, of } from 'rxjs'; import { Subject } from 'rxjs/Subject'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { catchError, tap } from 'rxjs/operators'; import { environment } from '../../environment...
d6aefa73aaa2e6f37e7c9c47b688a9a4de437152
TypeScript
whiskyjs/selection-menu
/app/inject/scripts/components/SelectionMenu.ts
2.625
3
import actions from "@common/actions"; export class SelectionMenu { protected static readonly CURSOR_WIDTH = 20; protected static readonly MARGIN_Y = 8; protected static readonly MARGIN_X = 8; protected static readonly containerTemplate = ` <link rel="stylesheet" type="text/css" href=%inject.css%>...
511fadf93a9626fb64598d59b2a0bdc68e512e78
TypeScript
securenative/securenative-node-agent
/src/rules/rule.ts
2.703125
3
interface RuleInterception { module: string; method: string; processor: string; } interface RuleData { key: string; value: string; } export default interface Rule { name: string; data: RuleData; interception: RuleInterception }
e212b962226ba3dda8cbeb8fd371e635cc32967c
TypeScript
EvgenyMuryshkin/dsp-playground
/src/lib/assign.ts
3.171875
3
import deepmerge from "deepmerge"; // https://stackoverflow.com/questions/41980195/recursive-partialt-in-typescript-2-1 export type RecursivePartial<T> = { [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P]; }; export class Assign { ...
3464d50d43500997e9cdc4749f1913d82616414d
TypeScript
Kirtika22/Kir
/sample/src/app/employee-list/employee-list.component.ts
2.515625
3
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-employee-list', template: ` `, styleUrls: ['./employee-list.component.css'] }) export class EmployeeListComponent implements OnInit { constructor() { } ngOnInit() { } onSubmit(recvalue: any){ console.log(recvalue); ...
812a6429fd1d6ebd8ae24eab8e7d935962d20b27
TypeScript
snowcoders/sortier
/src/utilities/string-utils.ts
2.96875
3
export class StringUtils { public static getBlankLineLocations(string: string, rangeStart = 0, rangeEnd: number = string.length) { const regex = /\n\s*\n/gim; let result: null | RegExpExecArray; const contextBarrierIndices: number[] = []; while ((result = regex.exec(string))) { if (rangeStart < ...
1c8f1f197b9bae6937380b07c5fe8f7707ed1855
TypeScript
Lil-C0der/filmo_server
/libs/db/src/models/post.model.ts
2.640625
3
import { ModelOptions, prop } from '@typegoose/typegoose'; // 回复楼层 需要有用户 id 和回复内容 export interface IReply { userId: string; username: string; replyAt: string; content: string; } // 帖子 @ModelOptions({ schemaOptions: { timestamps: true } }) export class Post { @prop() public title: string; @prop() pub...
ca17f6b0412996c714184a2f17b02394e02d8347
TypeScript
Diplomatiq/crypto-random
/test/specs/uniformDistribution.test.ts
2.921875
3
import { expect } from 'chai'; import { RandomGenerator } from '../../src/randomGenerator'; import { ChiSquaredTest } from '../utils/chiSquaredTest'; import { windowMock } from '../utils/windowMock'; describe('Generated values should follow a uniform distribution', (): void => { // Setting unique = true would not ...
6c49b4bf8edf56f8780242e80e356d2b1bca9f55
TypeScript
fizk/cpu
/test/lexer.test.ts
2.953125
3
import { assertEquals } from "https://deno.land/std@0.90.0/testing/asserts.ts"; import Lexer, {TOKENS} from '../src/parser/Lexer.ts'; Deno.test("LEXER - line begins with comment", () => { const tokens = new Lexer(` ; This is a comment `).parse(); assertEquals(tokens, []); }); Deno.test("LEXER - ma...
68580a356156d4ca20fc23a59706de486939834f
TypeScript
tooploox/thanksy-client-elm
/src/emoji.ts
2.671875
3
import { DateTime } from "luxon" const emojiRegex = require("emoji-regex")() const emojilib = require("emojilib") const twemoji = require("twemoji").default const Text = (caption: string): TextChunk => ({ type: "text", caption }) const Nickname = (caption: string): TextChunk => ({ type: "nickname", caption: caption =...
109af7ef3a6a3c4c97493aec3f2db0161cb92be2
TypeScript
akshaynair319/infinite-canvas
/src/areas/infinity/point-at-infinity.ts
3
3
import { SubsetOfLineAtInfinity } from "./subset-of-line-at-infinity"; import { Point } from "../../geometry/point"; import { Area } from "../area"; import { Ray } from "../line/ray"; import { LineSegmentAtInfinity } from "./line-segment-at-infinity"; import { TwoOppositePointsOnLineAtInfinity } from "./two-opposite-po...
801184320d4f264ec7b4477be0e624b578b54c52
TypeScript
larryaubstore/faucon-millenium
/src/components/faucon/eventLoop.ts
2.59375
3
import { Game } from './game'; import { Faucon } from './faucon'; import { Storage } from '@ionic/storage'; import * as debug from 'debug'; import * as rafLoop from 'raf-loop'; const log = debug('eventLoop'); export class EventLoop { game: Game = null; originalHorizontalIndex: number = 0; ...
a2b107cf4327c087a97431a63a87332fae065f46
TypeScript
yihongang/graphics-experiments
/particles2/vector.ts
3.71875
4
class Vec2 { x: number y: number constructor(x: number = 0, y: number = 0) { this.x = x this.y = y } clone(): Vec2 { return new Vec2(this.x, this.y) } // Non-mutating operations plus(other: Vec2): Vec2 { return new Vec2(this.x + other.x, this.y + other.y) } minus(other...