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 |
|---|---|---|---|---|---|---|
1bd263c250a943620f400a7de1f54f2d646d67f7 | TypeScript | mysticatea/bre | /test/utils/get-data-view.ts | 2.59375 | 3 | import assert from "assert"
import { defineObjectRecord, getDataView } from "../../src/index"
describe("getDataView", () => {
it("should return DataView object.", () => {
const TestRecord = defineObjectRecord("TestRecord", {
a: "int8",
b: "int8",
})
const buffer = Bu... |
470f5e31f62b697a63b940bc1c750338db06f9b3 | TypeScript | Marissa99/GIS-SoSe-2021 | /2.3DomEvents/script2.ts | 3.09375 | 3 |
namespace Aufgabe2_3 {
//Aufgabe 3
//a)Startsteite.html und Waffel.html Datei hart gecodet und style.css
//b) Daten in der data.ts (canvas) und style.css
//--> da die verschiedenen Auswahlmöglichkeiten in canvas gespeichert werden, ist die Anzahl variabel
//c) script2.ts Datei
//Ich weiß das... |
41a681094899167bb8dbc72687c06f33d4ca0eb0 | TypeScript | arthurgehrke/shopify-clean-microservice | /src/data/usecases/client-get-products.spec.ts | 2.75 | 3 | import { ClientGetProducts } from '@/data/usecases/client-get-products';
import {
HttpClient,
HttpRequest,
HttpResponse,
HttpStatusCode
} from '@/data/protocols/http/http-client';
// import { ProductModel } from '@/domain/models/product';
// import { mockClientGetProducts } from '@/data/tests/mocks/client-get-p... |
ebb8a22f91322d532ecdf6008f706d0b18cb58d6 | TypeScript | massimocode/Pizza-website | /back-end/payment-gateways/factory.ts | 2.578125 | 3 | import { IRequest } from "../router/router-utils";
import PayPal, { IsPayPalEnabled } from "./paypal";
import BarclaysEPDQ, { IsBarclaysEPDQEnabled } from "./barclays-epdq";
import { PaymentGateway } from "./interfaces";
import Cash from "./cash";
import { PlaceOrderRequest, PaymentMethod } from "../../shared/dtos";
im... |
6d5b9d91ccfa2c2a18213d5d1053c6add144f1fe | TypeScript | whthT/deno-graphql-quickstart | /tests/cases/libUcwords.test.ts | 2.625 | 3 | import ucwords from "../../src/lib/ucwords.ts";
import {assertEquals} from "https://deno.land/std@0.92.0/testing/asserts.ts";
Deno.test("libUcwords works", () => {
const str = "musa kurt";
assertEquals(ucwords(str), "Musa Kurt");
});
Deno.test("libUcwords works with no string", () => {
const str = "";
assert... |
b76bef372e3824e838fbb1e98d9483bf3c85e6bb | TypeScript | bakuzan/ayaka | /lib/createListeners.ts | 2.53125 | 3 | const createListeners =
(t: string, f: EventListenerOrEventListenerObject) =>
(el: HTMLElement | Document = document) => ({
listen: () => el.addEventListener(t, f),
remove: () => el.removeEventListener(t, f)
});
export default createListeners;
|
15ee836a479d1e42953320ba78024330f83b2138 | TypeScript | vitorKogawa/backend_hackatran | /src/controllers/PerguntaController.ts | 2.515625 | 3 | import { Request, Response } from 'express'
import { getRepository } from 'typeorm'
import { Perguntas } from '../database/entity/Perguntas'
class PerguntaController {
async store(request: Request, response: Response){
const repository = getRepository(Perguntas)
const {
texto_pergunta,
... |
ee2b1ff84c3769d0167dd16a2b3bc816acb2916c | TypeScript | AllenFang/node-commander-pattern | /src/commandHandler/base.ts | 2.703125 | 3 | import * as EventEmitter from 'events';
import { injectable, decorate } from 'inversify';
type Handler = <T>(t: T) => void;
decorate(injectable(), EventEmitter);
@injectable()
class Base extends EventEmitter {
on(name: string, handler: Handler): this {
return this.addListener(name, handler);
}
}
export defa... |
d86f555ac8c309d0dc4bda908ebe84c53426c221 | TypeScript | tedchoward/advent-of-code-2018 | /src/10/interactive-visual.ts | 2.9375 | 3 | import readline from 'readline';
import { parseInput } from './parse-input';
import { Grid } from './grid';
function question(rl: readline.Interface, prompt: string): Promise<string> {
return new Promise((res, rej) => {
try {
rl.question(prompt, answer => {
res(answer);
});
} catch (err) ... |
26e0eeacb0099b19ba324e79ebd90325cfeba82d | TypeScript | DeveloperFromUkraine/car-info-app | /src/components/filter/actions.ts | 2.65625 | 3 | import { Dispatch } from "redux";
import {
IActionGETFilters,
IActionSETSelectedFilters,
IFilterData,
ISetFilterData
} from "./types";
import { fetchColor, fetchManufacturers } from '../../api/filter-api/fetchFilters';
import { GET_FILTERS, SET_SELECTED_FILTERS } from '../../constants/actions';
export ... |
3b825e8fd1eb36d870797c54bf67446fc737a9f8 | TypeScript | Samour/js-playground | /src/sudoku/board/service.ts | 2.734375 | 3 | import { Store } from 'redux';
import { SudokuState, SudokuCell } from './model';
import {
clearBoardEvent,
resetGameEvent,
focusCellEvent,
setCellValueEvent,
setCellFixedEvent,
lockAllValuesEvent,
setNoteModeEvent,
addCellPossibleEvent,
removeCellPossibleEvent,
setBoardStateEvent,
} from './event... |
e1f580993782a68750e4546184c49a953d7d6892 | TypeScript | Miczeq22/brainflash-api | /src/core/decks/deck/rules/user-should-assessed-deck.rule.ts | 2.6875 | 3 | import { BusinessRule } from '@core/shared/business-rule';
import { UniqueEntityID } from '@core/shared/unique-entity-id';
export interface DeckRateChecker {
isRatedByUser(userId: UniqueEntityID, deckId: UniqueEntityID): Promise<boolean>;
}
export class UserShouldAssessedDeckRule extends BusinessRule {
message = ... |
c67db202628a38b5d566e2606574ed1f82d36b4d | TypeScript | johnwschneider96/Project2 | /AndreStuff/P2/src/app/PostModel.ts | 2.71875 | 3 | //postid, content, numoflikes, useremail
export class Posting{
postid: number;
content: string;
numoflikes: number;
useremail: string;
constructor(postid: number = 0, content: string = '',
numoflikes: number = 0, useremail: string = ''){
this.postid = postid;
this.content = con... |
393924cee9c31d713d3aad805e8110d088a871b2 | TypeScript | jeiea/autopilot-deno | /autopilot_deno/utils/wmic_data_parser.ts | 2.546875 | 3 | // Copyright 2020-present Divy Srivastava and friends. All rights reserved. MIT license.
function parse(yml: string) {
let arr = yml.split("\n");
let obj: any[] = [];
arr.forEach((element) => {
obj.push(element.split(":")[1]);
});
return obj;
}
export default function parseMonitorsWin(
info: string,
)... |
a8082e7b364b082d8c0d2a1bbeb1bcc0ec405e5f | TypeScript | djoepramono/ads-checkout-system | /src/services/adService.spec.ts | 3.03125 | 3 | import { getAdPriceFromSource, Ad, Advertisement } from './adService';
describe('getAdPriceFromSource', () => {
it('gets the first available price', () => {
const ad = Ad.PREMIUM;
const availableAds: Advertisement[] = [
{ ad: Ad.PREMIUM, name: 'Premium Level', description: 'Best in class with all known... |
85f905d9b3fa1a5d2c7a4e97c17cb5d01ccb8941 | TypeScript | dubanzl/e-evolution-prueba | /api/controllers/index.controller.ts | 2.546875 | 3 | import { Request, Response } from 'express'; // eslint-disable-line no-unused-vars
import { ObjectId } from 'mongodb';
import TaskModel from '../models/task.model';
class IndexController {
public async getTasks(req: Request, res: Response) {
const task: any = await TaskModel.getTasks(req.params.userId);
res.json(... |
4f08f95b3238d1b3c4eb4b963e1587e647a2e96a | TypeScript | damiankoper/pipg | /src/core/models/Sokrates.model.ts | 2.578125 | 3 | import { Vector, Body, Engine } from "matter-js";
import * as PIXI from "pixi.js";
import AnimatedSprite from "./base/AnimatedSprite";
enum CharacterState {
Idle,
MovingLeft,
MovingRight,
}
export default class Sokrates extends AnimatedSprite {
private runSprite: PIXI.AnimatedSprite;
private idleSprite: PIX... |
2dd001dec8f61bb57c4ded7db2cd10d5e93060c8 | TypeScript | isaac-allef/e-terapias | /back-end/tests/presentation/controllers/Login.spec.ts | 2.59375 | 3 | import { LoginController } from '../../../src/presentation/controllers/LoginController';
import { MissingParamError } from '../../../src/presentation/erros/missingParamError';
import { HttpRequest } from '../../../src/presentation/protocols/http';
import AuthenticationService from '../../../src/core/services/Authentica... |
a7b09517d0adefa7cc4d086bce7f9d28109d5333 | TypeScript | pictasses/beluga-v2-api-server | /app/model/user/update_last_activity_date.ts | 2.59375 | 3 | import { ModelRuntimeError } from "../error"
import mongoose from "mongoose"
import * as vs from "../../validation"
import { get as get_user } from "../user/get"
export const ErrorCodes = {
InvalidUserId: "invalid_user_id",
InvalidDate: "invalid_date",
}
type Argument = {
user_id: mongoose.Types.ObjectId
... |
440bc7edd92de51a36c9531664fc0ed2ef9910ef | TypeScript | bernzdevo/SampleFiles | /SampleApp/src/app/pipes/filter.pipe.ts | 2.6875 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'filter'
})
export class FilterPipe implements PipeTransform {
transform(value: any[], args?: string, filterBy?: string): any {
if (!args) { return value; }
args = args.toLowerCase();
return value.filter(prod => {
if (filterBy ... |
04370964aeb16e4b7a12c08395594a826d945242 | TypeScript | callstack/linaria | /packages/babel/src/transform/generators/processEntrypoint.ts | 2.765625 | 3 | import { isAborted } from '../actions/AbortError';
import type { ITransformResult } from '../actions/types';
import type { IProcessEntrypointAction, SyncScenarioForAction } from '../types';
/**
* The first stage of processing an entrypoint.
* This stage is responsible for:
* - scheduling the explodeReexports action... |
7785476f5ccf6bcb240b3ff39c31328b70ab2c77 | TypeScript | nonoroazoro/typescript-react-boilerplate | /src/utils/fp.ts | 3.515625 | 4 | export type ArityFunction = (...args: any) => any;
export type UnaryFunction = (arg: any) => any;
export function compose(...fns: [...unary: UnaryFunction[], arity: ArityFunction])
{
if (fns.length === 0)
{
throw new Error("compose requires at least one argument");
}
const fn = fns.pop() as Ari... |
31c7ef5cfa8c433372cfdeb7161bd77dba4b78cc | TypeScript | rike422/kirinuki-core | /src/scraper/browser/create-dom.ts | 2.78125 | 3 | import { isString } from '../../util';
export function createDom(
node: string | HTMLElement,
root?: string
): HTMLElement | Document | Element {
const target: HTMLElement | Document = isString(node) ? parseDom(node) : node;
if (root == undefined) {
return target;
}
const selectRoot = target.querySele... |
c9006c7db6c288d44fb84aaf4658f3c3b7c91a9e | TypeScript | vima91/SmartChurch | /SmartChurch.Angular/src/app/errors-handler/errors-handler.ts | 2.515625 | 3 | import { Injectable, ErrorHandler, Injector } from '@angular/core';
import { HttpErrorResponse } from '@angular/common/http';
import { ToastrService } from 'ngx-toastr';
import { Router } from '@angular/router';
@Injectable()
export class ErrorsHandler implements ErrorHandler {
// Because the ErrorHandler is created... |
6505c85b379537c4b78ddf24d84a37cc90c2cfb5 | TypeScript | aerophile/pigi | /packages/watch-eth/src/models/event-filter.ts | 3.015625 | 3 | import { hash } from '../utils'
export interface EventFilterOptions {
event: string
indexed?: { [key: string]: any }
}
/**
* Represents an event filter.
*/
export class EventFilter {
public options: EventFilterOptions
constructor(options: EventFilterOptions) {
this.options = options
}
/**
* @re... |
5b12ec4f118aa742ffa9da72825405c7476f18be | TypeScript | chaveshigor/nlwValoriza | /src/services/CreateComplimentService.ts | 2.828125 | 3 | import { getCustomRepository, Repository } from "typeorm"
import { User } from "../entities/User"
import { ComplimentRepositories } from "../repositories/ComplimentRepositories"
import { UserRepositories } from "../repositories/UserRepositories"
import { TagRepositories } from "../repositories/TagRepositories"
import {... |
774eee2aaf3d195e3d3d649f60619358a1b52bf2 | TypeScript | NakedObjectsGroup/NakedObjectsFramework | /Client/nakedobjects-client/services/src/mask.service.ts | 2.640625 | 3 | import { CurrencyPipe, DecimalPipe } from '@angular/common';
import { Injectable } from '@angular/core';
import * as Ro from '@nakedobjects/restful-objects';
import forEach from 'lodash-es/forEach';
import { DateTime } from 'luxon';
import { ConfigService } from './config.service';
import { defaultDateFormat, defaultS... |
7bfa2f1c5555566d1629a10b3ddd3792c57d7b90 | TypeScript | webern-unibas-ch/awg-app | /src/app/shared/toast/toast.service.spec.ts | 2.578125 | 3 | import { Component, TemplateRef, ViewChild } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { Toast, ToastService } from './toast.service';
// Mock component to get templateRef
@Component({
template: ` <ng-template #template><h1>Test template</h1></ng-template> `,
})
class MockTempl... |
60cac70b004e392f8264500cf4e74765d04a8335 | TypeScript | jhonkoan110/qpd-learn | /Тема5/todolist/src/redux/tasks/reducer.ts | 3.078125 | 3 | import { CategoryType } from '../categories/reducer';
import {
ADD_TASK,
DELETE_TASK,
EDIT_TASK,
SET_TASKS,
TASKS_IS_LOADING,
TASKS_INCREMENT_ID,
DELETE_CATEGORY_ID,
} from './actionTypes';
export interface ITask {
id: number;
title: string;
description: string;
... |
dd67c9bebcb7925f08d98d726bfba54820a465c8 | TypeScript | wwwK/node-hariko | /src/hariko-parser/structure/http-request.ts | 2.671875 | 3 | import { ProtagonistHttpRequest } from 'protagonist'
import { HttpTransaction } from './http-transaction'
export type HttpRequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS'
export class HttpRequest {
constructor(
public readonly http_transaction: HttpTransaction,
public method: HttpRequestMethod,... |
e9c35844fb6c0880006b2fcf170cbc9b4ae33fb5 | TypeScript | giraffesyo/dynamic-form-generator | /lib/reviveJSON.ts | 3.03125 | 3 | import { DateTime } from 'luxon'
import type { TJSONValue } from '../typings'
// convert strings to dates ( used by JSON.parse() )
const JSONReviver = (key: string, value: TJSONValue) => {
if (typeof value !== 'string') return value
const ISODateTime = DateTime.fromISO(value)
const SQLDateTime = DateTime.fromSQ... |
3c18228740458046d6bad8a0e5d524a7e23d2145 | TypeScript | gustavo-hillesheim/proxer | /server/src/websocket_server.ts | 2.921875 | 3 | import { websocket } from "./dependencies.ts";
const { WebSocketServer } = websocket;
export function startWebsocketServer({ port = 10001 }): WebSocketServerAdapter {
const server = new WebSocketServer(port);
server.on("connection", handleClientConnection);
console.log(`Started WebSocket server at port: ${port}... |
5a1b787071534cc3d751df14099de8a632a5786b | TypeScript | Messiviski/push-notifications-firebase | /src/useCases/sendNotifications/SendNotificationsUseCase.ts | 2.578125 | 3 | import * as admin from "firebase-admin";
import { inject, injectable } from "tsyringe";
import { INotificationsRepository } from "../../repositories/INotificationsRepository";
interface INotificationMessage {
tokens: string[];
data: {
title: string;
body: string;
};
}
@injectable()
class SendNotificatio... |
b46d0565ed0c5e8bd1d96dd26aeca97176122e3e | TypeScript | KellyLMaud/TSOS-2015 | /source/host/cpu.ts | 2.671875 | 3 | ///<reference path="../globals.ts" />
/* ------------
CPU.ts
Requires global.ts.
Routines for the host CPU simulation, NOT for the OS itself.
In this manner, it's A LITTLE BIT like a hypervisor,
in that the Document environment inside a browser is the "bare metal" (so to speak) for which we write code
that hosts... |
330a9320743abe76d911e4bd37fa694dc1da6dc3 | TypeScript | M1ST4KE/giphy-react-native-sdk | /src/GiphyContent.ts | 2.71875 | 3 | import { GiphyContentRequest, GiphyContentRequestType, GiphyMediaType } from './native/types'
export type GiphyContentSearchOptions = {
searchQuery: string
mediaType?: GiphyMediaType
}
export type GiphyContentTrendingOptions = {
mediaType?: GiphyMediaType
}
export type GiphyContentAnimateOptions = {
searchQu... |
1e72817593048b2711c0b9f8be4e13060ec79111 | TypeScript | dpayonk/payonk-jama | /src/app/models/AccountProfile.ts | 2.875 | 3 | import { ISerializableObject, SerializationMixin, Logger } from 'payonkjs';
class AccountProfile extends SerializationMixin implements ISerializableObject {
key: string = "";
createdAt: string = "";
emailAddress: string = ""; // need to define default to implement fillFromJSON
currentRole: string = "";... |
3c9c5053bb865a97dcc49b544264b85618606893 | TypeScript | ferrumnet/totp-lambda | /src/server/SecureKeyValueStore.ts | 2.625 | 3 | import {SecretHanlder} from './SecretsHandler';
import {KmsCryptor} from "aws-lambda-helper";
import { SecretInterface } from './Types';
export class SecureKeyValueStore {
constructor(
private secretsHandler: SecretHanlder,
private cryptor: KmsCryptor,
) {
}
__name__(): string { re... |
6b9e8a6eb0bd216970e82572ce10881cb8036070 | TypeScript | project-cemetery/pick-by-lang | /lib/pickByLang.ts | 2.96875 | 3 | import isPlainObject from 'lodash.isplainobject'
import mapValues from 'lodash.mapvalues'
import { isEmpty } from './helpers/isEmpty'
import { isString } from './helpers/isString'
export const pickByLang = (lang: string, content?: any) => {
const checkString = (v: any) => isString(v) && v === lang
const checkArra... |
5fcb604fdec3b73421d85b1a6e079c832dde3506 | TypeScript | mohism-framework/utils | /src/libs/logs/console-log.ts | 2.609375 | 3 | import { blue, grey, yellow, red } from 'colors';
import rp from '../rightpad';
import dayjs from 'dayjs';
const stringify = (input: any): string => {
return (typeof input === 'string' ? input : JSON.stringify(input));
};
const LEVEL_MAP: { [key: string]: number } = {
debug: 0,
info: 1,
warn: 2,
error: 3,
... |
d24c819a0d427176e396fc15f588a12c0b5929c8 | TypeScript | iota-pi/crossangles | /src/state/Events.spec.ts | 2.921875 | 3 | import { getAutoSelectedEvents, getEvents, getEventId } from './Events';
import { CourseMap, CourseId, CourseData } from './Course';
import { ClassTime } from './Stream';
describe('getEventId', () => {
it('gives expected result', () => {
const course: CourseData = {
code: 'RING1379',
name: 'Ring The... |
1ce738b5045ff6ca8fcdbc0e919bde18615d6596 | TypeScript | kouji-dev/auth-boilerplate | /client/src/features/auth/auth.slice.ts | 2.609375 | 3 | import { AsyncThunkPayloadCreator, createAsyncThunk, createSlice, PayloadAction } from '@reduxjs/toolkit';
import { RootState } from '../../config/store';
import API from '../../api'
type UserType = {
username: string;
lastName: string;
firstName: string;
email: string;
}
interface authState {
user:... |
7027e55ad4935ba3b5381c210d320c0d8731dbd7 | TypeScript | Erick2280/spoticards-discord-bot | /spoticards-bot/commands/sendcards.ts | 2.734375 | 3 | import { Message } from 'discord.js';
import { Server } from '../../spoticards/server';
import * as interfaceUtils from '../interface-utils';
import { ClassicGame } from '../../spoticards/game-types/classic-game';
export const data = {
name: 'sendcards',
aliases: ['sendmydeck', 'mydeck', 'mycards'],
descri... |
a65c679f4486df66e234122a0f1864e5d5582834 | TypeScript | echappee/FranceServ | /FranceServ/store/geolocalisation.ts | 2.84375 | 3 | import { GetterTree, MutationTree } from 'vuex'
// ici ce sont les datas globales
export const state = () => ({
geolocalisation: '' as any,
})
export type RootState = ReturnType<typeof state>
// getters ceux qu'on recupere
export const getters: GetterTree<RootState, RootState> = {
getGeolocalisation: (state) => ... |
33553e2d3212f3d9b9fe6ca0852fa8b5b5ab8f80 | TypeScript | Marcelo8173/E-learning_server | /src/controller/LessonController.ts | 2.75 | 3 | import {Request,Response} from 'express';
import { getRepository } from 'typeorm';
import Lesson from '../model/LessonModel';
import Courser from '../model/CourserModel';
class LessonController{
public async indexLesson(request: Request, response: Response):Promise<Response> {
try {
const ... |
d9289f36a6c8e708f9f0bc89bccbe8bf1ea955ab | TypeScript | d4rkr00t/opaline | /packages/core/commands/compiler/__tests__/commands-parser.test.ts | 2.765625 | 3 | import test from "ava";
import * as path from "path";
import {
parseCommands,
getCommandJSDoc,
getMetaFromJSDoc,
verify$InputsType,
} from "../commands-parser";
import { ProjectInfo } from "../project-info";
test("parseCommands should be able to parse jsdoc from a command file", async (t) => {
let project = ... |
039a56e65cf312c59dcbaab97a7ee2ad1bd40af5 | TypeScript | datavisyn/tdp_core | /dist/base/rest.d.ts | 2.546875 | 3 | import { IDTypeLike } from 'visyn_core/idtype';
import { IRow, IServerColumn } from 'visyn_core/base';
import { IScoreRow } from './interfaces';
/**
* Describes the properties returned for each database connector
*/
export interface IDatabaseDesc {
/**
* name of the db connector (defined for a connector in ... |
6ecd3636fbb82bd2eef0c02f6668dc3ad872581c | TypeScript | HearTao/typei18n | /src/types.ts | 3.078125 | 3 | export type YamlNode = string | number | { [v: string]: YamlNode }
export const enum ArgKind {
literal = 'literal',
param = 'param'
}
export interface LiteralArg {
kind: ArgKind.literal
value: string
}
export interface ParamArg {
kind: ArgKind.param
name: string
}
export type ArgType = LiteralArg | Para... |
881d66e0d1677b0d88d2bbfe7ad6b18a88a9a0b4 | TypeScript | canrozanes/turnouter-api | /src/utils/get-winner.ts | 3.1875 | 3 | const getWinner = (votes: string[]): { winner: string; count: number } => {
const counts: { [key: string]: number } = {}
votes.forEach((vote) => {
if (!(vote in counts)) {
counts[vote] = 1
} else {
counts[vote] += 1
}
})
let maxCount = 0
let winner: string
const entries = Object.ent... |
b55ac6299e8225856031b7b0f777e9419bbda9c7 | TypeScript | diroussel/orgtomate-js | /src/org.ts | 2.59375 | 3 | #!/usr/bin/env node
/** vim: set syntax=typescript tabstop=2 softtabstop=2 shiftwidth=2 expandtab smarttab : */
/**
* A command-line interface as a replacement for, or supplement to, the AWS CLI
* that is not only faster than the AWS CLI, but also allows the execution of operations
* in multiple AWS Accounts and Re... |
bdd09879e0c0b6bc86e956b94e8917443005a804 | TypeScript | Iru89/geometric-app | /src/redux/types/profileTypes.ts | 2.59375 | 3 | import {Action} from "redux";
import {IProfile} from "../../types";
export const PROFILE_REQUEST = 'PROFILE_REQUEST';
export const PROFILE_SUCCESS = 'PROFILE_SUCCESS';
export const PROFILE_ERROR = 'PROFILE_ERROR';
export interface IProfileRequest extends Action{
type: typeof PROFILE_REQUEST,
isFetching: boole... |
a59fab6a87c66a60cb41e2c933215a9b08b7bffe | TypeScript | Dtrust/social_network | /frontend/src/store/ducks/post/reducer.ts | 2.671875 | 3 | import produce, {Draft} from "immer";
import {PostState} from "./contracts/state";
import {PostActions} from "./actions/actionCreators";
import { PostActionsType } from "./actions/actionTypes";
import { LoadingStatus } from "../../types";
const initialPostState: PostState = {
data: undefined,
loadingState: Lo... |
203310e0c7fcf3418ed863d4aa689cd4fff72642 | TypeScript | dchesterton/nasa-image-and-video-library | /src/store/asset/reducer.ts | 2.578125 | 3 | import { Reducer } from "redux";
import {
AssetActionTypes,
AssetState,
FETCH_MANIFEST_REQUEST,
FETCH_MANIFEST_SUCCESS,
FETCH_MANIFEST_ERROR,
DISPLAY_ASSET,
CLOSE_ASSET
} from "./types";
import { RequestStatus } from "../../types";
export const initialState: AssetState = {};
export const a... |
9a9aac765a1001ea06a620803f1035a9ec04dbaa | TypeScript | coffmanjrp/ts-double-heart-click | /src/ts/main.ts | 2.84375 | 3 | const loveMe = document.querySelector('.loveMe') as HTMLDivElement;
const times = document.querySelector('#times') as HTMLDivElement;
let clickTime = 0;
let timesClicked = 0;
const createHeart = (e: MouseEvent) => {
const heart = document.createElement('i');
heart.classList.add('fas');
heart.classList.add('fa-h... |
a6fbc58e8a27b8f22585b142807e6dd503d400cd | TypeScript | bve/telegraf-inline-menu | /source/buttons/align.test.ts | 3.0625 | 3 | import test from 'ava'
import {getRowsOfButtons, maximumButtonsPerPage} from './align'
function generateCharArray(charA: string, charZ: string): string[] {
// https://stackoverflow.com/questions/24597634/how-to-generate-an-array-of-alphabet-in-jquery/24597663#24597663
const a = []
let i = charA.charCodeAt(0)
... |
d8d0dcc1d277924b47e9a45df9ae2495728963d0 | TypeScript | Yokotes/loop-frontend | /back/src/dtos/userDto.ts | 2.703125 | 3 | class UserDto {
name: string;
password: string;
img: string;
role: string;
groupAliases: string[];
constructor(
name: string,
password: string,
img: string,
role: string,
groupAliases: string[]
)
{
this.name = name;
this.password = password;
this.img = img;
this.rol... |
028eb30ae14b66cee4afe4d7f4fe1ceca933bc50 | TypeScript | mosfiqurRahmanJsd/typescript-basic | /first.ts | 3.640625 | 4 | let age: number;
age = 50;
let club: string = 'Real Madrid';
const isFamous: boolean = false;
let famous: boolean;
function add (num1: any, num2: number | string){
return num1 + num2;
}
add(3, 76);
add('Adam', 'Sand');
add(3, 'Someone');
function doubleItAndConsole(num: number): void {
const r... |
ab81be70d9ddb70ff05f901808dabff20d5bb0bd | TypeScript | sergiosanchezs/Recursion-Store | /server/src/utils/capitalizeWords.ts | 2.65625 | 3 | const capitalizeWords = (word: string) => {
return word.replace(/\b\w/g, char => char.toUpperCase());
};
export default capitalizeWords;
|
8c0ad8ed9d58615e5e5f8daf88cab604bc0a417a | TypeScript | sirJiggles/angular-2 | /app/components/hero-details/index.ts | 2.640625 | 3 | import {Component, OnInit, Output, EventEmitter} from 'angular2/core';
import {NgForm} from 'angular2/common';
import {RouteParams} from 'angular2/router';
import {HeroesService} from '../../services/heroes/index';
import {Hero} from '../../interfaces/hero/index';
@Component({
selector: 'hero-details',
inputs: ['h... |
2e07ffb204cdaf228f008e751343440015e2ef81 | TypeScript | webdevproformation/angular-3wa-oct21 | /jour1Reprise/src/app/start/verifLogin.ts | 3.03125 | 3 | // dans le dossier src/app/start/ verifLogin.ts
import { AbstractControl, ValidationErrors } from "@angular/forms";
export class VerifLogin{
static neContientPasDePoint(control : AbstractControl) : ValidationErrors | null{
// la condition est vérifiée (si la chaine de caractère contient le symbole .)
... |
a9f4505deee0e98d98afbb32d735a1dd5f1ad070 | TypeScript | hlhNicola/CICD | /src/features/Intake/reducer.ts | 2.515625 | 3 | import { createSlice, PayloadAction } from 'redux-starter-kit';
export interface intakeState {
data:any,
calorie: number
}
const initialState:intakeState = {
data:[],
calorie: 0
};
const slice = createSlice({
name: 'intake',
initialState,
reducers: {
addItem: (state, action: PayloadAction<any>) => ... |
9981f6e98286f3a857594826a774bad3087c190b | TypeScript | MarquisF/react-redux-ts-boilerplate | /src/reducers/index.ts | 2.671875 | 3 | import { combineReducers } from 'redux';
import ActionTypes from 'actions/ActionTypes';
import documents from './documents';
import { CompositionState } from 'store/ApplicationState';
interface ReducerItem {
stateKey: string;
initialState: CompositionState;
reducerFunctions: any;
}
interface Compos... |
2021a6e410d5883c3bac80efbd50d899689b465f | TypeScript | CommunitySolidServer/CommunitySolidServer | /src/identity/interaction/email-password/storage/AccountStore.ts | 3.21875 | 3 | /**
* Options that can be set on an account.
*/
export interface AccountSettings {
/**
* If this account can be used to identify as the corresponding WebID in the IDP.
*/
useIdp: boolean;
/**
* The base URL of the pod associated with this account, if there is one.
*/
podBaseUrl?: string;
/**
... |
d2630cdb14e4518d42c3e2af7d990f7ac2de904d | TypeScript | dxprog/pigeon | /src/interfaces/IResponse.ts | 2.578125 | 3 | export interface IResponse {
xhr: XMLHttpRequest;
httpStatus?: number;
response?: any;
error?: any;
}
export type IResponseFn = () => IResponse; |
875d41840b51cd48f26768f53dd1a18b048caeb2 | TypeScript | hiphil2000/pixi-practices | /src/objects/polygon.ts | 2.75 | 3 | import { IHitArea, Polygon, RenderTexture } from "pixi.js";
import BaseObject, { IBaseObjectConfig } from "./object";
export interface IPolygonObjectConfig extends IBaseObjectConfig {
points: Array<number>;
}
export default class PloygonObject extends BaseObject {
constructor(config: IPolygonObjectConfig) {
super... |
0883392bfca3acac11fa20119263b0e845602b55 | TypeScript | InSeong-So/IT-Note | /chapter06-디자인패턴/javascript/ES6/bridge/typescript/bridge.ts | 3.453125 | 3 | import { Logger } from '../../logger';
//Refined Abstraction
export class CircleShape {
x: number;
y: number;
radius: number;
drawingApi: DrawingAPI;
constructor(x: number, y: number, radius: number, drawingApi: DrawingAPI) {
this.x = x;
this.y = y;
this.radius = radius;
this.drawingApi = dra... |
882743394772b459f3048a5a7fbfd1857ebffefe | TypeScript | orionjs/orionjs | /packages/graphql/src/resolversSchemas/getField.test.ts | 2.8125 | 3 | import {Prop, TypedModel} from '@orion-js/typed-model'
import getField from './getField'
describe('Field serialization', () => {
it('should return a valid serialization of the field', async () => {
const schema = {
name: {
type: String,
a: '1234'
}
}
const result = await getFi... |
97e14b5d1ee59ef940a3c028b8ac9088bf35d112 | TypeScript | ivor06/WebRTCHub | /client/src/containers/App/actions.ts | 2.640625 | 3 | import {USER_LOGIN_SUCCESS, USER_LOGOUT_SUCCESS} from "./actionTypes";
import {loginToken as loginTokenUser, logout as logoutUser} from "../../services/user.service";
const actionCreatorMapObject = {
loginToken,
logout
};
export {
actionCreatorMapObject
}
function loginSuccess(user) {
return {type: U... |
9387054681d578f68b0ea8d472597338c5c2e6d3 | TypeScript | rainder/koa-basic-auth | /index.ts | 2.65625 | 3 | 'use strict';
import { createHash } from 'crypto';
import { Context } from 'koa';
export namespace KoaBasicAuth {
export interface Credentials {
[user: string]: string;
}
export interface Options {
hashingAlgorithm: string;
}
export function middleware(credentials: Credentials, options?: Options) ... |
e1f834e8e8ae8bc8bc44e05b4017be95c3391d6b | TypeScript | BHatGuy/DasProjekt | /client/Background.ts | 2.78125 | 3 | import { Game } from "./Game";
export class Background {
protected imgSea: CanvasImageSource;
protected imgClouds: CanvasImageSource;
protected game: Game;
protected canvas: HTMLCanvasElement;
overlay: HTMLDivElement;
protected xfactor: number;
protected yfactor: number;
private offset... |
b930cdc380e17a3f19fdbe910e1b9087a84645b7 | TypeScript | zwliew/std-algo | /lib/linkedList/linkedList.ts | 3.875 | 4 | import { List } from "./list";
class Node<T> {
next: Node<T> | null | undefined;
prev: Node<T> | null | undefined;
item: T | null;
constructor(
item: T | null,
prev: Node<T> | null | undefined,
next: Node<T> | null | undefined
) {
this.item = item;
this.next = next;
this.prev = prev;... |
d4f28c40eaadf7fb2f30e2d449f454d7f0520d64 | TypeScript | madhavaxisrooms/billing-old | /src/app/shared/services/toaster.service.ts | 2.6875 | 3 | import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/Rx';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
@Injectable()
export class ToasterService {
/**
* Creating a behaviour subject to broadcast to toaster details
*
* @private
* @memberof Toas... |
f9e6a21d8d93974fb6efadb697865fa5ade91434 | TypeScript | AmelineA/PokeApi | /src/app/api.service.ts | 2.5625 | 3 | import { Injectable } from '@angular/core';
import{ HttpClient } from '@angular/common/http';
import { Pokemon } from './pokemon';
@Injectable({
providedIn: 'root'
})
export class ApiService {
apiUrl: string = "https://pokeapi.co/api/v2/";
constructor(private http: HttpClient) { }
//récupère les infos d'un... |
f9bf6cc7baecf3e9e2488a68fe8302b3474d214c | TypeScript | tutous/lessons | /typescript/lessons-rxjs/src/transformers/columns.ts | 3.140625 | 3 | export { };
import { Observable, OperatorFunction } from 'rxjs';
import { finalize } from "rxjs/operators";
interface Person {
foreName: string;
name: string;
}
interface Column {
index: number;
}
interface ForeNameColumn extends Column {
foreName: string;
}
interface NameColumn extends C... |
551399bb867000e832fc6bf20ba182ba91e08011 | TypeScript | AlexanderFromEarth/calconut | /src/calculation/functions/factory.ts | 3.046875 | 3 | import {Operation} from '../classes/operation';
import {Return} from '../classes/return';
import {Command} from '../interfaces/command';
/**
* Factory for Operation
* @param command Command that must be interpreted in future
* @returns Operation with provided command
*/
export const createOperation = <T>(command: ... |
6239669d306804f99332fe35a7b72f4717397c93 | TypeScript | AndyDecker/fhir-ts | /packages/fhir-types/src/R4/OperationOutcome.ts | 2.828125 | 3 | /**
* OperationOutcome Module
*/
import * as primitives from "@tangdrew/primitives";
import * as t from "io-ts";
import { CodeableConcept } from "./CodeableConcept";
import { Element } from "./Element";
import { Extension } from "./Extension";
import { Meta } from "./Meta";
import { Narrative } from "./Narrative";
i... |
f85947547cc5290f9c447ae4ae949b107b131728 | TypeScript | dang1412/ccex-api | /src/exchanges/bitfinex/websocket/bitfinex-websocket-old.ts | 2.640625 | 3 | import { ExchangeWebsocket, SocketFactory } from '../../exchange-websocket.abstract';
import { ReplaySubject, Observable } from 'rxjs';
import { wsEndpoint } from '../bitfinex-common';
export class BitfinexWebsocket extends ExchangeWebsocket<WebsocketSubscribe | WebsocketUnSubscribe, WebsocketResponse | WebsocketData>... |
7b4e8391c9d5b337ea38b074c32f3a612da644ad | TypeScript | alekbobgd/smartthings-cli | /packages/lib/src/basic-io.ts | 2.53125 | 3 | import { CLIError } from '@oclif/errors'
import { flags } from '@oclif/command'
import { buildInputProcessor } from './input-builder'
import { IOFormat } from './io-util'
import { itemTableFormatter, listTableFormatter, writeOutput } from './output'
import { buildOutputFormatter } from './output-builder'
import { Smar... |
bf55e804660b2907c088fb771f4a30dcbadac6fe | TypeScript | roaldpalaya/COMP397_A3 | /Scripts/objects/bread.ts | 2.703125 | 3 | //Roald Palaya 300714999
//Last updated 11/24/2016
module objects {
export class Bread extends objects.GameObject {
private _move : objects.Vector2;
private _speed : number;
private _counter : number;
// public variables
public name:string;
public width:number;
... |
b3979789ecc0a4daf38d3a3efbab8364ee9e7fb0 | TypeScript | tpikh/natural-events | /client/src/actions/events.ts | 2.6875 | 3 | import { AnyAction, Dispatch } from "redux";
import { FilterData, updateFilters } from "./filters";
import { REQUEST_DETAIL, RECEIVE_DETAIL, RECEIVE_EVENTS, REQUEST_EVENTS, RECEIVE_EVENTS_FAILED } from "../constants/actionTypes";
const serviceUrl = process.env.REACT_APP_API_URL;
const appendParams = (url: URL, filter... |
eeced312c0b424c9340e5a4703f315ecfbeeb2e3 | TypeScript | jasdevsidhu12/FeedService | /packages/angularDesign/src/trend_design/reducer/FIReducer.ts | 2.75 | 3 | import {
ADD_NEW_COMMENT,
ADD_NEW_FEED,
LOAD_INITIAL_FEED,
LOADING_COMPONENTS
} from '../api/FIUtils';
export interface IAppState {
feed: Array<any>;
isContentLoading: boolean
};
const initialState = { feed: [{}], isContentLoading: true };
export default function feedItemReducer(state: IAppSta... |
fca8bb6b3a26d785fe3bd18250f8060cebbb0a3f | TypeScript | FabianLauer/tsh | /src/ast/PrecedenceExpr.ts | 3.25 | 3 | import { assertAstNodeParam } from './utils/assert'
import Expr from './Expr'
/**
* Used to wrap expressions (that includes all kinds of operations) when they need to be
* evaluated with precedence over other expressions, just like parens in source code.
* Type parameter `TExpr` can be used to specify the wrapped e... |
0eb8711344ee9cf9085b131b03122bf0a31eb9d8 | TypeScript | paolotiu/blog_client | /src/functions/api.ts | 2.53125 | 3 | const url = 'https://blog-api-pt.herokuapp.com';
export const fetchAllBlogs = async () => {
const blogs = await fetch(url + '/blogs');
return blogs.json();
};
export const fetchBlogByID = async (id: string) => {
const blog = await fetch(url + '/blogs/' + id);
return blog.json();
};
export const postC... |
f71ec347d2f43649f29e0f6127759e7a8e8c5f6f | TypeScript | achung3071/booktogether-server | /src/__test__/controllers/review.test.ts | 2.5625 | 3 | import app from "../../../app";
import bcrypt from "bcrypt";
import Book from "../../models/Book";
import Curation from "../../models/Curation";
import Review from "../../models/Review";
import User from "../../models/User";
import request from "supertest";
import { Document, Types } from "mongoose";
describe("Reviews... |
3b7fbdd69f6e7e24fd8f06e7f40bc89382c08bf5 | TypeScript | sergzaligin359/learn-typescript | /src/components/Learn/arrays.ts | 3.359375 | 3 | export default () => {
// Массив
type A = (number | string)[];
const arr: A = [1, 2, 'hi'];
console.log('arr', arr);
// Кортеж
// Может содержать необязательный элемент [number, string?]
const cortege: [number, string] = [1, 'string'];
console.log('cortege', cortege);
// Перечисления
enum G {
... |
212b414a1710d8c1c185a3a6d76d3a7d6eecbab7 | TypeScript | validatorjs/validator-deno | /src/lib/isEthereumAddress.ts | 2.640625 | 3 | const eth: RegExp = /^(0x)[0-9a-f]{40}$/i;
export default function isEthereumAddress(str: string): boolean {
return eth.test(str);
}
|
254802ef1a5c2f2b02ea629c4211c3242ebebbbb | TypeScript | cindy-alvarado/angular-pro-src | /50-resolves/app/mail/containers/mail-folder/mail-folder.component.ts | 2.578125 | 3 | import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Mail } from '../../models/mail.interface';
import { Observable } from 'rxjs/Observable';
// pluck operator
import 'rxjs/add/operator/pluck';
@Component({
selector: 'mail-folder',
styleUrls: ['mail-folder.compone... |
e15f57a022b800c1a05728696bda0fc79ab20308 | TypeScript | acolytec3/permasnap-client | /src/providers/ArweaveProvider.ts | 2.6875 | 3 | import { JWKInterface } from 'arweave/web/lib/wallet'
import { IPsnapPhoto } from '../redux/reducers'
let Arweave
if(process.env.NODE_ENV === "test"){ Arweave = require('arweave/node') }
else{ Arweave = require('arweave/web').default } //hack for node-based testing to work
const HOST = process.env.REACT_APP_ARW... |
96c24c22e9c43ecaf7cd2c16e994001aeb6a2265 | TypeScript | jaryno/TypeScript-Design-Patterns | /src/behavioural/chain-of-responsibility/index.ts | 2.734375 | 3 | import Handler from "./Handler";
import CivilianVehicleHandler from "./CivilianVehicleHandler";
import FiretruckHandler from "./FiretruckHandler";
import AmbulanceHandler from "./AmbulanceHandler";
import PoliceSUVHandler from "./PoliceSUVHandler";
let civilianHandler = new CivilianVehicleHandler();
let firetruckHandl... |
0a8609c8d900d482ed8a0138443eddaff5f95154 | TypeScript | graemebrooks/waffl-archive-api | /src/services/statsheet/teamBrandingProvider.ts | 2.5625 | 3 | interface teamBranding {
logoUrl: string;
colors: {
primary: string;
secondary: string;
};
}
export function getTeamBranding(teamName: string): teamBranding {
switch (teamName) {
case 'Cartels':
return {
logoUrl: 'https://i.imgur.com/lIRYULG.png',
colors: {
primary: '#ee8a10',
secondary:... |
df995aa411628080bfbe38bdb97e61de9271fec8 | TypeScript | whitesky0109/GOST-MSM | /src/MangaDownloader.ts | 2.578125 | 3 | import "reflect-metadata";
import {Service} from "typedi";
import * as http from "http";
import * as https from "https";
import * as fs from "fs";
import {Transform} from 'stream';
const archiver = require('archiver');
// child process
@Service()
class MangaDownloader {
downloadBasePath: string = "download";
... |
53ab9dc0ebfdf4fe8639c8c82fce0b22653a5c87 | TypeScript | nvgiang2212/html_add_project | /src/app/model/task.ts | 2.578125 | 3 | export interface Task {
title: string;
status: boolean;
deadline: Date;
description: string;
}
|
5f592d8b913937d5188a3e84f3ffe659362873aa | TypeScript | thewindsword/stardust-ui-react | /build/gulp/tasks/stats.ts | 2.515625 | 3 | import * as fs from 'fs'
import { task, parallel, series } from 'gulp'
import * as _ from 'lodash'
import * as webpack from 'webpack'
import * as stableStringify from 'json-stable-stringify-without-jsonify'
import config from '../../../config'
const g = require('gulp-load-plugins')()
const { paths } = config
const { ... |
27dfbad0c629b51c30627a89d79cd464bfaebae3 | TypeScript | sunyanzhe/ts-demo | /类/protected.ts | 3.53125 | 4 | interface AInter {
a: string;
b: string;
}
class AA implements AInter {
protected constructor(public a: string, public b: string) {
this.a = a;
this.b = b
}
}
interface BInter extends AA {
c?: string;
[m: string]: any;
}
class BB extends AA implements BInter{
public c: string
constructor(a: str... |
e69325371fbe13ee386368aabb39b758aa93bef7 | TypeScript | alissonsouzaac/Ent.RITS | /Cliente/Helpers/response.ts | 2.734375 | 3 | export class Response {
code: string;
name: string;
message: string;
constructor(code: string, name: string, message: string) {
this.code = code;
this.name = name;
this.message = message;
}
}
|
04bd1047f8151335722b633bcc8701efa2c17f2c | TypeScript | MyAeroCode/PS-TypeScript-Programmers | /lessons/43164/solution.ts | 3.578125 | 4 | export function solution(tickets: string[][]): string[] {
//
// 목적지를 사전순으로 정렬하고,
// 차례차례로 isConnected[startAirport]에 push한다.
const isConnected = {} as { [key: string]: string[] };
tickets
.sort((a, b) => (a[1] < b[1] ? -1 : +1))
.forEach(([srt, end]) => {
if (isCo... |
f7726968ea48398683d173432240d0fbc795ccea | TypeScript | amagovpt/admin-monitor-suite | /src/app/models/user.ts | 2.78125 | 3 | interface IUser {
UserId: number;
Email: string;
Type: string;
Register_Date: Date;
Last_Login: Date;
}
export class User implements IUser {
UserId: number;
Email: string;
Type: string;
Register_Date: Date;
Last_Login: Date;
constructor(UserId: number, Email: string, Type: string,... |
00fb0c072839bae9e6764c637427d401b5753d81 | TypeScript | rimmugygr/Angular | /TypeScript/MultiMath/scoreboard.ts | 2.953125 | 3 | // import {Result} from "./result";
class Scoreboard {
private results: Result[] = [];
addResults(newResult: Result): void {
this.results.push(newResult);
}
updateScoreboard():void {
console.log(this.results);
let output: string = "<h2>Scoreboard</h2>\n";
for (let resu... |
24786748e75004feb3a46c0b4d2f0dbca47bf5eb | TypeScript | stuckupfool/def-ntf | /src/stores/CharacterStore.ts | 2.734375 | 3 | import {
action,
computed,
makeObservable,
observable,
runInAction,
} from "mobx";
import React from "react";
import fetch from "../Util/Fetch";
import * as _ from "lodash";
export interface CharacterResultItem {
id: string;
name: string;
status: "Alive" | "Dead" | "unknown";
species: string;
type: string;
... |
5e965b7dd60af20afbb556a9d870fbec21c12df3 | TypeScript | HealthML/StyleGAN2-Hypotheses-Explorer | /client/src/logic/tools/blobURL.ts | 3.03125 | 3 | export class BlobURLFake {
readonly url: string =
'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"/>';
increaseUses(_: number = 1) {}
decreaseUses(_: number = 1) {}
}
export class BlobURL extends BlobURLFake {
readonly url: string;
constructor(blob: Blob, private uses = 0) {
super();
... |
8faccf2c0d1d63f0676dd3523a34a18360c2b839 | TypeScript | xendke/bulma-native | /src/elements/Text/Text.styles.ts | 2.515625 | 3 | import { StyleSheet } from 'react-native';
import { getColor } from '../../theme/color';
import { getTextSize, getTextWeight } from '../../theme/text';
import { Theme } from '../../theme';
const createStyles = (
{
alignment,
color,
size,
transform,
weight,
}: {
alignment: TextAlignment;
... |