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 |
|---|---|---|---|---|---|---|
cc8b46ad0fb51317ede105e2da320be650bdc90b | TypeScript | jsonchou/zax-eventbus | /libs/cjs/eventbus.d.ts | 2.5625 | 3 | export declare type EventHandler = (param?: any) => any;
export declare type EventHandlers = EventHandler[];
export declare type EventOptions = {
channel: string;
debug: boolean;
};
export declare type EventSource = {
[name: string]: EventHandlers;
};
export default class EventBus {
channel: string;
... |
666c963bd0914257532d95d7e8a56d72cd0104c5 | TypeScript | alexaaaant/patterns_on_ts | /facade.ts | 3.453125 | 3 | class Subsystem1 {
operation1() {
console.log('sub 1 oper1')
}
operation2() {
console.log('sub 1 oper2')
}
}
class Subsystem2 {
operation1() {
console.log('sub 2 oper1')
}
operation2() {
console.log('sub 2 oper2')
}
}
class Facade {
protected sub1:... |
2b447e6f3483491021ff898004ef8cb70fe7eed0 | TypeScript | SZ559/ToDoItems | /frontend-todoitem/src/app/services/todoitem.service.spec.ts | 2.609375 | 3 | // import { ToDoItem } from 'src/models/todoitem';
// import { ToDoItemService } from "./todoitem.service";
// let httpClientSpy: { get: jasmine.Spy };
// let heroService: ToDoItemService;
// beforeEach(() => {
// // TODO: spy on other methods too
// httpClientSpy = jasmine.createSpyObj('HttpClient', ['get']);
//... |
ca8bfd0087d93c0419cf3a51671b9f81943a0126 | TypeScript | haenah/agari.haseyo-client | /src/MouseTracker.ts | 2.703125 | 3 | import $ from 'jquery';
import { Position } from './types/common.types';
enum MouseTrackerState {
ON,
OFF,
}
class _MouseTracker {
private state: MouseTrackerState = MouseTrackerState.OFF;
/** x, y */
position: Position = { x: 0, y: 0 };
start() {
this.state === MouseTrackerState.OFF &&
$('#game'... |
64e95b67aca95a3976048c5d609b4d42aa86d78a | TypeScript | cyrilleverrier/pgtest | /tests/integration/query.ts | 2.515625 | 3 | import * as env from 'env-var';
import pRetry from 'p-retry';
export async function connectedToTimescale() {
console.log("Try to connect ot PostgreSQL...")
var result = await pRetry(async () => {
return await getPostgresVersion();
}, {
retries: 500,
factor: 2,
minTimeout: 20... |
53372d23dd7c0f642e0a78c6af11a026d0690bb4 | TypeScript | oladotunsobande/mini-bank-api | /src/helpers/index.ts | 2.796875 | 3 | import { randomBytes } from 'crypto';
export function throwIfUndefined<T>(x: T | undefined, name?: string): T {
if (x === undefined) {
throw new Error(`${name} must not be undefined`);
}
return x;
}
export function randomizeMongoURL(url: string): string {
return url.replace(
/([^/]\/)([^/][a-zA-Z-_0-9... |
a5d198bfb248eedd2d1200cb819cf755eb21931e | TypeScript | alexmitic/booking-application | /booking-app/src/app/bookings.service.ts | 2.5625 | 3 | import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http';
export class Booking {
constructor(public booking_id: number,
public date: string,
public from: string,
public to: string,
public room: string) {
}
}
export class Pa... |
fd8699c9fbc9a7cc1fe80f9f37fdce02621b4e70 | TypeScript | vsDizzy/leetcode | /test/house-robber.spec.ts | 2.578125 | 3 | import * as assert from 'assert';
import { rob } from '../src/house-robber';
describe('house-robber', () => {
it('should pass standard cases', () => {
assert.equal(rob([1, 2, 3, 1]), 4);
assert.equal(rob([2, 7, 9, 3, 1]), 12);
});
it('should handle special cases', () => {
assert.equal(rob(... |
af683bb809be797aa8125eff36fe43d6c89646c7 | TypeScript | TimVosch/shortcut | /src/web/shortcut.api.ts | 2.796875 | 3 | import { plainToClass } from 'class-transformer';
import { validate } from 'class-validator';
import { Request, Response, Router } from 'express';
import { inject, injectable } from 'inversify';
import { ShortcutNameAlreadyInUseError } from '../application/errors/shortcut-name-already-in-use.error';
import { ShortcutSe... |
eb9f28065ca34cb124ffb0f2c509fe86df5ad260 | TypeScript | IhorPopovskyi/AngularForms | /src/app/custom.validators.ts | 2.6875 | 3 | import {
FormControl,
AbstractControl,
ValidationErrors,
ValidatorFn,
} from '@angular/forms';
export class CustomValidators {
static emailCustomValidator(control: FormControl) {
if (
[
'face@gmail.com',
'qwerty@gmail.com',
'test@gmail.com',
'name@gmail.com',
... |
f1d3efb8d0f0d001ad7644aba838ca53347cbbf4 | TypeScript | Shinpeim/GroovePartner | /src/app/domain/player/ticker.ts | 3.09375 | 3 | import { Subject } from "rxjs"
export class Ticker {
private bpm: number
private playing: boolean
private noteSize: number
public tickEvent: Subject<void>
constructor(initialBpm: number, initialNoteSize: number){
this.bpm = initialBpm
this.noteSize = initialNoteSize
this.p... |
12eac804ffdfb5b8b22e8d8d07dc63fdab14a0f4 | TypeScript | jaspenlind/args-any | /src/types/Option.ts | 3.203125 | 3 | import { StringConvertible } from "string-converter";
import { Operator } from ".";
/**
* Represents a set of arguments describing a critera
* @example
* const serverInSweden: Option = {
* key: "location",
* operator: Operator.Eq,
* value: "Sweden"
* }
*/
export interface Option extends StringConvertible {
... |
646470eb7815685bcc84f63011e92f9ba3d8199b | TypeScript | dakir08/resf | /src/test/message.spec.ts | 2.921875 | 3 | import { message } from '../message';
import { HttpCode } from '../data/httpCode';
/**
* test 1:
* A simple data
*/
test('A simple data', () => {
const result = message()
.addData('id', 1)
.toOutput(200);
const actual = {
errors: {
technicalErrors: null,
clientMessage: null,
httpCo... |
afea0821b3b3752b5c0f759cdf6aa1b5ebb3d1ba | TypeScript | plantdata-jr/plantdata-sdk-docs | /versions/5.6.3/@plantdata/sdk/src/container/panel-box/panel-box.d.ts | 2.6875 | 3 | /// <reference types="jquery" />
import { PdComponent, PdComponentSettings } from '../../core/component';
import { PdSelector } from '../../common/common';
/**
* 盒子容器组件配置
*/
export interface PdPanelBoxSettings extends PdComponentSettings {
/**
* 盒子主体内容
*/
body?: PdSelector;
/**
* 是否允许关闭
... |
2b1b76051d05d36b99733debf83d35e9f3dac96a | TypeScript | yichang8421/leetcode | /844. Backspace-String-Compare/844. Backspace-String-Compare.ts | 3.6875 | 4 | function backspaceCompare(s: string, t: string): boolean {
let SDelCount: number = 0, TDelCount: number = 0;
let i = s.length - 1, j = t.length - 1;
while (!(i < 0) || !(j < 0)) {
/* 寻找待比较元素的位置。
遇到“#”,则计数器加一。
遇到非“#”,则看计数器是否不为0:
若计数器>0,则向前跳一位同时计数器减一,以此表示删除元素。
... |
9f944ccedaed269b89a965de6a66dccc1f162fb6 | TypeScript | TalissonJunior/coffee | /src/extensions/database-extension.ts | 2.515625 | 3 | import { GluegunToolbox } from 'gluegun'
import * as _ from 'lodash'
import * as mysql from 'mysql'
import { ConnectionString } from '../models/connection-string'
module.exports = (toolbox: GluegunToolbox) => {
const {} = toolbox
toolbox.database = {
validateConnection: validateConnection
}
function _che... |
7ce744c10696e20aaf7de3efe0608c45b1d4e5d8 | TypeScript | stemey/feature-hub | /packages/dom/src/feature-app-container.ts | 2.78125 | 3 | import {
FeatureAppDefinition,
FeatureAppManager,
FeatureAppScope,
Logger
} from '@feature-hub/core';
import {LitElement, html, property} from 'lit-element';
import {TemplateResult} from 'lit-html';
/**
* A DOM Feature App allows the use of any frontend technology such as Vue.js,
* React, or Angular.
*/
exp... |
338d4abb73935f5f9777eaedc83bd2efca0f1065 | TypeScript | gsoft-inc/sg-orbit | /packages/components/src/shared/src/size.ts | 3.28125 | 3 | export type Size = "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "inherit";
export function normalizeSize<T extends Size>(size?: T) {
return size || "md";
}
export type SizeAdapter<T extends Size> = Partial<Record<Size, T>>;
export function createSizeAdapter<T extends Size>(adapter: ... |
9b9e4e9a1b8e0dbd1175be433412360cebef6635 | TypeScript | hernanpatronc/sistema-pcya | /src/app/notify/notify.service.ts | 2.515625 | 3 | import { Injectable } from '@angular/core';
@Injectable()
export class NotifyService {
constructor() { }
notificationList = [];
marginTop = 0;
newNotification = (type : string, text : string) => {
this.marginTop += 80;
const newNotification = {
text : text,
type : type,
marginTop :... |
ace9d3723eacf83c24265bafd7e5876f61a130d7 | TypeScript | ng-docs/material2 | /src/lib/select/select-animations.ts | 2.578125 | 3 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {
animate,
AnimationTriggerMetadata,
state,
style,
transition,
trigger,
} from '@angular/animation... |
f785da9caf3a060366ac0489439c40038e2dd279 | TypeScript | karihei/BeamQuest | /app/beamQuest/listener/entity.ts | 2.6875 | 3 | /// <reference path="../../../typings/tsd.d.ts" />
import UserStore = require('../store/userStore');
declare var EntitiesStore:any;
/**
* @fileoverview Entityの状態が変化した時などなどを扱う
*/
class Entity {
private static instance_:Entity;
public static getInstance():Entity {
if (Entity.instance_ === undefined)... |
e8972f7cfcaa2ca7c6b33a88160e43a993a2d60f | TypeScript | GAMS-Organization/GAMS-Repository | /packages/api/src/Application/Handlers/Area/StoreAreaHandler.ts | 2.515625 | 3 | import IAreaRepository from '../../../Domain/Interfaces/IAreaRepository';
import ISectorRepository from '../../../Domain/Interfaces/ISectorRepository';
import { inject, injectable } from 'inversify';
import { INTERFACES } from '../../../Infrastructure/DI/interfaces.types';
import Area from '../../../Domain/Entities/Are... |
a869bf50522fbfe4d76bf629e09e3c4cccd2d4ec | TypeScript | sadewole/NestJS-1.0 | /src/user/user.controller.ts | 2.515625 | 3 | import {
Controller,
Get,
Post,
Delete,
Body,
Param,
UsePipes,
UseGuards,
UnauthorizedException,
HttpException,
HttpStatus
} from '@nestjs/common';
import { CreateUserDto } from './dto/create-user.dto';
import { User } from './interfaces/user.interface';
import { UserService } from './user.service... |
823afda9c2ddbc67a1d30dc07af2fbba79032ce0 | TypeScript | forrestbicker/InertiaSimulator | /src/Math/DynamicVector.ts | 2.765625 | 3 | import { PhysicsBody } from "../PhysicsObjects/PhysicsBody";
import { Vector } from "./Vector";
/** a vector that changes magnitude and direction depending on the body state and time */
export interface DynamicVector {
at(body: PhysicsBody, time: number): Vector;
getName(): string;
} |
b755156dcb46613d15fc38c6028fe7483ab2073b | TypeScript | lucbouchard1/poker-public | /src/path.ts | 2.859375 | 3 | export const ROOM_PATH_PREFIX = "/game/"
export function getRoomPath(roomId: string) {
return ROOM_PATH_PREFIX + roomId
}
export function isRoomPath(path: string): boolean {
return path.length > 6 && path.slice(0, 6) == ROOM_PATH_PREFIX
}
export function getRoomId(path: string): string | undefined {
if (... |
b64b3b0236c6418b170d0e6d778ee33795d2adcc | TypeScript | lilchim/wbt-api | /model/auth.ts | 2.609375 | 3 | import { v4 as uuidv4 } from 'uuid';
export enum Roles {
OFFICER = 'OFFICER',
MEMBER = 'MEMBER'
}
export interface User {
_id: string;
token: string;
name: string;
role: string;
organization: string;
discordTag?: string;
lastLogin: number;
}
export const generateAuthModel = ({ req... |
78afaa5b70461aef7396957435141fd2fb8783ef | TypeScript | Rareloop/ionic-typeorm | /projects/ionic-typeorm/src/lib/services/db-service.ts | 2.53125 | 3 | import { BaseEntity, FindManyOptions } from 'typeorm';
export interface IDBService<T extends BaseEntity> {
/** Fetch the entity with id */
fetch(id: any): Promise<T | null>;
/** Fetch all entities */
all(options?: FindManyOptions): Promise<T[]>;
/** Remove the list of entities */
remove(en... |
4067bc316de411519700e256a154d65d8ee3a6f1 | TypeScript | deepkit/deepkit-framework | /packages/orm/src/database-adapter.ts | 2.6875 | 3 | /*
* Deepkit Framework
* Copyright (C) 2021 Deepkit UG, Marc J. Schmidt
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the MIT License.
*
* You should have received a copy of the MIT License along with this program.
*/
import { OrmEntity } from './type.js';
imp... |
8e5becf3d0fbf15f6c1580774916fcb1804aa788 | TypeScript | iimog/tidy | /packages/tidy/src/tally.ts | 3.078125 | 3 | import { summarize } from './summarize';
import { n } from './summary/n';
import { sum } from './summary/sum';
import { TidyFn } from './types';
type TallyOptions = {
readonly name?: string;
readonly wt?: string;
};
type TallyOutput<Options extends TallyOptions> = Options['name'] extends string
? { [K in Option... |
5343d7263b8793d0c4641dccde313cf0521b2e96 | TypeScript | Rjpdude/redux-pods | /__tests__/unit/reducer.test.ts | 3 | 3 | import pod, {
PodProperties,
PodReducer,
PodMethods,
ProxiedAction,
INTERNAL_ACTION_TYPES
} from '../../src'
describe('[unit] reducer class', () => {
test('instantiates function producer super class', () => {
expect(typeof new PodReducer({ initialState: '' }).getBoundFunc()).toBe(
'function'
... |
7f1f9f3629fb6f8baf50422fd9b8eb8011d86c28 | TypeScript | DavidFeldhoff/al-codeactions | /src/extension/Entities/alVariable.ts | 3.171875 | 3 | export class ALVariable {
public name: string | undefined;
public type: string;
public isLocal: boolean = false;
public isVar: boolean = false;
public canBeVar: boolean = false;
public procedure: string | undefined;
public memberAttributes: string[] = [];
public isResultParameter: boolea... |
4113227d3886f150bef37efb24ac5b909cdd0ac9 | TypeScript | PerryHuan9/react-ts | /src/testTs/variable.ts | 3.9375 | 4 |
export default function testVariable(): void {
let bool: boolean = true;
let num: number = 188;
let num2: number = 0xff;
const str: string = `hello word ${bool}`;
const arr: number[] = [12,34,45,65];
const arr2: Array<string> = ['hello', 'word']
const tuple: [String, Number] = ['',12]
enum Color {Red, ... |
36c7a3dd669f252ea450766d18a4698187e268ae | TypeScript | apollographql/apollo-ios | /Sources/ApolloCodegenLib/Frontend/JavaScript/src/utilities/apolloCodegenSchemaExtension.ts | 2.5625 | 3 | import { DirectiveDefinitionNode, DocumentNode, Kind, NameNode, StringValueNode, concatAST } from "graphql";
export const directive_apollo_client_ios_localCacheMutation: DirectiveDefinitionNode = {
kind: Kind.DIRECTIVE_DEFINITION,
description: stringNode("A directive used by the Apollo iOS client to annotate opera... |
033c97e069a44b34510f4acaf51a20730ab1cb85 | TypeScript | CyberFlameGO/Maru | /src/Connection.ts | 2.78125 | 3 | /**
* Copyright (c) 2020 August
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, di... |
5ddc9d594214b63fd547b3a90756a51e71b11e88 | TypeScript | senwong/type-challenges | /src/459-medium-flatten.ts | 3.25 | 3 | type Flatten<T> = T extends [infer F, ...infer R] ? F extends any[] ? [...Flatten<F>, ...Flatten<R>] : [F, ...Flatten<R>] : [];
type flatten = Flatten<[1, 2, [3, 4], [[[5]]]]> // [1, 2, 3, 4, 5] |
de28020a2f69ceca139da59c5601d672a58758f5 | TypeScript | navikom/dashboard | /src/api/index.ts | 2.78125 | 3 | import MainApi from "api/MainApi/Api";
import { ErrorHandler } from "utils/ErrorHandler";
export enum Apis {
Main,
}
export function api(type: Apis) {
if (type === Apis.Main) {
return new MainApi();
}
throw new ErrorHandler('There is not Api type provided');
}
|
8b3be98812457916333298a7b7a01a4bd25edda4 | TypeScript | dzearing/new-merge-styles-proto | /src/styled/css.ts | 2.96875 | 3 | import { getStyleElement } from "./getStyleElement";
import { parseSelectors } from "./parseSelectors";
const _rules: {
[key: string]: {
[key: string]: {
[key: string]: string;
};
};
} = {};
export function css(rulesString) {
const classNames = [];
const selectors = parseSelectors(rulesString);
... |
b9a6239004d96c1a8fb5b0c2f90fecc5e37043a6 | TypeScript | yushunwang123/DesignPattern | /Visitor/Visitor.ts | 4.34375 | 4 | abstract class AbstractElement {
// 定义业务逻辑
public abstract doSomething() : void;
// 允许谁来访问
public abstract accept (visitor : Visitor) : void;
}
class ConcreteElement1 extends AbstractElement{
public doSomething() : void {
console.log('ConcreteElement1执行的业务逻辑');
}
public accept(visi... |
dfd14c6b04c8b049aa9c74563c679faef61c33da | TypeScript | icebob/fakerator | /fakerator.d.ts | 2.890625 | 3 | declare module 'fakerator' {
export interface RandomStringOptions {
min?: number;
max?: number;
}
export type TimesOptions = RandomStringOptions;
export interface CountryAndCode {
code: string;
name: string;
}
export interface LatitudeAndLongitude {
la... |
265fb6409081a9f5c758c3751de79dad2e80f237 | TypeScript | w960603/cat-mall-server | /server/public/resFunc.ts | 2.6875 | 3 | import {statusCode} from '../config/statusCode'
import * as interf from '../interfaces/publicInterfaces'
import {Request, Response, NextFunction} from 'express'
// 成功的响应
export const success = (data: object, res: Response, msg?:string):void => {
const temp:interf.IResponse = {
code: statusCode.SUCCESS.code... |
e8e3c9275bd90c5e9337519118ca76a712b76ea1 | TypeScript | cdnjs/cdnjs | /ajax/libs/react-dnd/14.0.1/types/types/monitors.d.ts | 2.875 | 3 | import { Identifier, Unsubscribe } from 'dnd-core';
export interface XYCoord {
x: number;
y: number;
}
export interface HandlerManager {
receiveHandlerId: (handlerId: Identifier | null) => void;
getHandlerId: () => Identifier | null;
}
export interface DragSourceMonitor<DragObject = unknown, DropResult ... |
4ff9d06636010d07240222cb8d1bc0a4355709f0 | TypeScript | cmwendwa/vscode-resjson | /src/lib/diagnostics/comma-validator.ts | 2.734375 | 3 | import * as vscode from "vscode";
import { BaseDiagnosticsValidation } from "./base-diagnostic-validator";
import { isCommaMissing } from '../utils/comma-missing';
import { Strings } from '../../resources/res-strings';
import { DiagnosticCodes } from '../constants/general';
import { Regexes } from '../constants/regexe... |
9c678ce6a8da92a2db0fe9ef1122701d26371647 | TypeScript | re2005/angular-login-app | /src/app/services/auth/auth.service.ts | 2.65625 | 3 | import {Injectable} from '@angular/core';
import {IUser} from '../../interfaces/user';
import {BehaviorSubject, Observable} from 'rxjs';
@Injectable()
export class AuthService {
private usersArray = new BehaviorSubject<IUser[]>(this.getUsers());
getToken(): string {
return localStorage.getItem('token... |
95e801d6a7e195815a8cf0255b9af5df4607f4d7 | TypeScript | benmvp/bart-salmon | /_scripts/gen-station-routes-data.ts | 2.8125 | 3 | import zipObject from 'lodash/zipObject'
import mapValues from 'lodash/mapValues'
import keyBy from 'lodash/keyBy'
import sum from 'lodash/sum'
import startOfWeek from 'date-fns/startOfWeek'
import endOfWeek from 'date-fns/endOfWeek'
import addDays from 'date-fns/addDays'
import formatDate from 'date-fns/format'
import... |
520f73b69fd4560564ec74a8a6e1cba0d07cdbad | TypeScript | CBSM-Finance/rx-designer | /electron/log.ts | 2.765625 | 3 | import * as chalk from 'chalk';
const logger = console.log;
const ctx = new chalk.Instance({ level: 3 });
const toString = (args: any[]) => args.map(arg => typeof arg === 'object' ? JSON.stringify(arg) : arg.toString());
type logLevels = 'error' | 'notify' | 'warn';
export const log: { [level in logLevels]: (...args: ... |
c0c537700ccfd2002a5565608d2837d8a13eec75 | TypeScript | valpr/adventofcode-2020 | /src/day25/part01.ts | 3.265625 | 3 | import { readFileSync } from 'fs';
let [cardPublicKey, doorPublicKey] = readFileSync('./input.txt', 'utf-8').split('\r\n').map(x => parseInt(x));
/*
Loop Size is unknown
Assuming subjectNumber for each key is always 7?...
*/
const searchingTransform = (subjectNumber: number, publicKey: number) => {
let value =1;
... |
6c0a48385fba1bfe0907864ac6eb8cecc4f13162 | TypeScript | PauloHSOliveira/estudos-ts | /src/AULA06-tuples-type/aula06.ts | 3.703125 | 4 | // tuple
const dadosCliente: readonly [number, string] = [1, 'Luiz']; // Apenas leitura - Imutável
const dadosCliente2: [number, string, string] = [1, 'Luiz', 'Paulo'];
const dadosCliente3: [number, string, string?] = [1, 'Luiz'];
const dadosCliente4: [number, string, ...string[]] = [1, 'Luiz'];
console.log(dadosClien... |
952886fa9a3cb0a18c669d6eeaf2a7bba1cf224c | TypeScript | NilsHolger/typescriptdesignpatterns | /src/app/designpatterns/facade.ts | 3.53125 | 4 | class Technology1 {
public function1() : void {
console.log("function1 of technology1");
}
}
class Technology2 {
public function2() : void {
console.log("function2 of technology2");
}
}
class Technology3 {
public function3() : void {
console.log("function3 of technology3");
... |
f3da7f6bc6f4272edf71f235adffb4213545b1bc | TypeScript | witsawa-corporation/assignment-backend-2020 | /app/middlewares/errorHandler.ts | 2.59375 | 3 | import express from 'express'
function errorHandler(
err: Error,
req: express.Request,
res: express.Response,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
next: express.NextFunction,
): void {
const errMessage: string = err.message
const status: number = +errMessage.substring(0, 3) || 50... |
61d86fb800b0a9b4fc1616cd8e0ced7cc98d323d | TypeScript | ozawa940/portfolio | /src/store/common/CommonReducer.ts | 2.71875 | 3 | import {createSlice} from "@reduxjs/toolkit";
export type CommonStateType = {
showErrorFlg: boolean,
errorTitle: string,
errorMsg: string,
}
const initialState: CommonStateType = {
showErrorFlg: false,
errorTitle: "",
errorMsg: ""
}
export const CommonSlice = createSlice({
name: "common",
initialSta... |
991453f49065bd20b0e30e64cdc921c47eed9f8b | TypeScript | NoelDeMartin/kinko | /resources/js/models/Collection.ts | 2.921875 | 3 | export interface CollectionJson {
name: string;
}
export default class Collection {
public static fromJson(json: CollectionJson): Collection {
return new Collection(json);
}
public readonly name: string;
constructor(json: CollectionJson) {
this.name = json.name;
}
}
|
ae976cf9161db3a5971bed2e392d38f09466f8a4 | TypeScript | qogoist/Prima_BulletHell | /Game/Config.ts | 2.625 | 3 | namespace Game {
export interface Config {
map: Map;
colors: string[];
player: Player;
standardProjectile: StandardProjectile;
spawner: Spawner;
smallEnemy: SmallEnemy;
}
export interface Map {
size: number;
color: string;
camera: num... |
7e3486f9d4786504cb0357ac18102b8ea0ef1f13 | TypeScript | priwatm/favelagroup | /src/stores/security-store.ts | 2.5625 | 3 | import {action, makeObservable, observable} from "mobx";
import {User} from "src/types/models";
import {anonymous} from 'src/constants/security'
export class SecurityStore {
@observable
user: User = anonymous;
@observable
error: string = '';
constructor() {
makeObservable(this)
}
... |
a02655da94fefcfc9ddd0fca05451751c23fd1c4 | TypeScript | AlphaLupine/Moosic | /src/commands/music/pause.ts | 2.625 | 3 | import { Command } from 'discord-akairo';
import { Message } from 'discord.js';
import { Player } from 'erela.js';
export default class PauseCommand extends Command {
constructor() {
super('pause', {
aliases: ['pause'],
description: {
content: 'Pauses the current tra... |
7e6dc6f4fed04d9f3bbc9078b8e3b50451a26a2c | TypeScript | andrwj/vscode-markdown-scripture | /src/ScriptureReferenceProvider.ts | 2.96875 | 3 | import * as vscode from "vscode";
function rangeToString(range: vscode.Range): string {
return `${range.start.line}:${range.start.character}-${range.end.line}:${range.end.character}`;
}
export class ScriptureReferenceProvider implements vscode.ReferenceProvider {
/**
* Provide a set of project-wide references ... |
6392725e1ef57b0e11376d097bff05fbaaabe5cd | TypeScript | green-fox-academy/salfayanna | /week-01/day-03/draw-diagonal.ts | 3.53125 | 4 | 'use strict';
export { };
// Write a program that draws a
// square like this:
//
// %%%%%
// %% %
// % % %
// % %%
// % %
// %%%%%
//
// The square should have as many lines as lineCount is
let lineCount: number = 6;
let empty = " "
let fill = '%'
for (let row = 0; row < lineCount; row++) {
if (row === 0 || r... |
33d3ae88d2d09d095a86136b4e6f611e9f9b4900 | TypeScript | sebasdb2111/mm_chat_api | /src/apps/mmc/controllers/psychic/PsychicDeactivateController.ts | 2.5625 | 3 | import {Request, Response} from 'express';
import * as httpStatus from 'http-status';
import Controller from '../Controller';
import PsychicDeactivate from '../../../../contexts/mmc/psychics/application/PsychicDeactivate';
import PsychicDeactivateDto fr... |
dc56027c464f5e69b15b7421d5d5d513ef85bf8d | TypeScript | frysztak/markdown-to-quill-delta | /test/transform.test.ts | 2.765625 | 3 | import fs from "fs";
import path from "path";
import { fileURLToPath } from 'url';
import markdownToDelta from "../src/markdownToDelta";
import Op from "quill-delta/dist/Op";
interface Test {
name: string;
ops: Op[];
markdown: string;
}
describe("Remark-Delta Transformer", () => {
const isDirectory = (name: s... |
da89ac649fe8e425603fb7d14f165bc61869fb2a | TypeScript | carlaofernandesedu/frontbase | /angularbase7/iniciando-angular2-mais/src/app/employee.service.ts | 2.78125 | 3 | import { Injectable } from '@angular/core';
export interface Employee{
name:string,
salary:number
}
@Injectable({
providedIn: 'root'
})
export class EmployeeService {
employees: Employee[] = [];
constructor() { }
addEmployee(emp:Employee)
{
this.employees.push(emp);
}
}
|
fa55a31b024df2900b6a1f9f26a185c232bde630 | TypeScript | msrikanth508/weather-app | /src/api/index.test.ts | 2.71875 | 3 | import { fetchWeatherData } from './index';
import mockData from '../mockData';
const mockFetch = (fn) => {
window.fetch = fn;
};
describe('fetchWeatherData', () => {
beforeEach(() => {
jest.clearAllMocks();
});
it('should call fetch fn', async () => {
const mockFn = jest.fn();
mockFn.mockResolve... |
88d43d3bdd08c2a4a5a9f69d761a6782e5296440 | TypeScript | samsoft00/subtitle-and-translator | /src/Utils/Emittery.ts | 2.65625 | 3 | import { EventEmitter2 } from 'eventemitter2';
const eventEmitter = new EventEmitter2();
export enum EventType {
SendEmail = 'SendEmail',
}
interface IEvent {
payload: any;
type: EventType;
}
export const LengooEmitter = {
emit(event: IEvent) {
eventEmitter.emit(`lengoo:${event.type}`, event.payload);
... |
d01f1f656c96567957dc515689e2420667ab8acb | TypeScript | poppinss/youch | /index.d.ts | 2.671875 | 3 | declare module "youch" {
interface YouchOptionsContract {
/**
* Number of lines to be displayed above the error
* in the stack trace.
*/
preLines?: number;
/**
* Number of lines to be displayed below the error
* in the stack trace.
*/
postLines?: number;
}
class Yo... |
bfb2f3196655a3320a9315fa38a9c26d8a441140 | TypeScript | vitaly-redkin/Wonderschool-task-list | /src/model/BaseEntity.ts | 3.140625 | 3 | /**
* Base class for task and group entities.
*/
export class BaseEntity<TId> {
/**
* Constructor.
*
* @param id Entity ID
*/
constructor(public readonly id: TId) {
}
}
|
39e7be0619fe5461e2f807349a8a79773fec53a3 | TypeScript | jeonjonghyeok/reputation-service | /src/utils/server/createNewTwitterAccount.ts | 2.53125 | 3 | import TwitterAccount from "src/models/web2Accounts/twitter/TwitterAccount.model";
import {
ITwitterAccount,
ITwitterAccountDocument,
} from "src/models/web2Accounts/twitter/TwitterAccount.types";
import { Web2Providers } from "src/models/web2Accounts/Web2Account.types";
export const createTwitterAccountObject = (... |
e5f19f84ae14ab10ceb802a59543d9617ed41030 | TypeScript | PhilippMi/schnoin | /src/server/eventBus.ts | 2.734375 | 3 | import {Event, EventMap, EventType} from "../shared/Event";
import {GameModel} from "./GameModel";
import {v4 as uuid} from 'uuid';
interface Listener {
game?: GameModel
eventType?: EventType
callback: (payload: any, game: GameModel) => void
}
let listeners: Listener[] = [];
export const eventBus = {
... |
e12629cd5ef8d0a62ba64f5c7bb6406a152cc636 | TypeScript | kjirou/tilto | /src/box.ts | 2.5625 | 3 | import * as stripAnsi from 'strip-ansi';
import {
Borders,
placeBorders,
validateMatrixWithBorders,
} from './border';
import {
Element,
ElementBody,
ElementSymbol,
Matrix,
SymbolRuler,
createElementBody,
createMatrix,
createMatrixFromText,
cropMatrix,
getHeight,
getWidth,
matrixToRectang... |
15ddd2ed2477bde76074f2cf19a073517efab0e8 | TypeScript | danielearwicker/bidi-mobx | /src/project.ts | 2.6875 | 3 | import * as React from "react";
import { observer } from "mobx-react";
export function project<Model, View>(projection: (model: Model) => View) {
return {
render<ExtraProps>(
render: (props: ExtraProps & { model: Model } & { view: View }) => JSX.Element
): React.ComponentClass<ExtraPro... |
b8ba21a41c809b7a78f9c893136e2de1bef5e9af | TypeScript | zeevbritz/homework | /84/weatherApp/src/app/shared/weather.service.ts | 2.59375 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { map } from 'rxjs/operators';
import { Observable } from 'rxjs';
import { Weather } from './weather';
interface WeatherData {
name: string;
main: { temp: number };
weather: [{ description: string, icon: string ... |
85c2f7909dae5ca197b0a4fca0ae3dd97065b3cc | TypeScript | tsriram/astro | /packages/astro/src/transitions/index.ts | 2.703125 | 3 | import type { TransitionAnimationPair, TransitionDirectionalAnimations } from '../@types/astro';
const EASE_IN_OUT_QUART = 'cubic-bezier(0.76, 0, 0.24, 1)';
export function slide({
duration,
}: {
duration?: string | number;
} = {}): TransitionDirectionalAnimations {
return {
forwards: {
old: [
{
name... |
a5f6cfe7190b1164b1b9b897f99e05e7029eb233 | TypeScript | emclaug2/react-showcase-demo | /src/redux/reducers/app.ts | 2.9375 | 3 | import { AppState } from '../../__types__';
import {
OPEN_DRAWER,
CLOSE_DRAWER,
TOGGLE_DRAWER,
LIGHT_THEME,
DARK_THEME,
TOGGLE_THEME,
DIR_LTR,
DIR_RTL,
TOGGLE_DIR,
} from '../actions';
const initialAppState: AppState = {
theme: 'light',
direction: 'ltr',
drawerOpen: fals... |
f44fb59c26edb1d4088736e6006b6dcde70ea348 | TypeScript | AronGomu/toche | /src/app/classes/card.ts | 2.5625 | 3 | export class Card {
idInt: number;
colorString: string;
factionString: string;
nameString: string;
levelInt: number;
manacostString: string;
typeStringArray: string[];
archetypeStringArray: string[];
subtypeStringArray: string[];
attackInt: number;
powerInt: number;
insta... |
64a6f7efb621bbbe5c7f68ff64706e0e43c51f09 | TypeScript | NguyenDytrich/NellieCat_2.0 | /server/src/Bot.ts | 2.609375 | 3 | import Discord from 'discord.js';
import { ServerConfig } from './index';
const bot = new Discord.Client();
bot.commands = new Discord.Collection();
const prefix = '$';
const ping = {
name: 'ping',
description: 'Ping!',
execute(message, args) {
message.channel.send('Pong.');
},
};
const rules = {
name... |
47264fa80daf971c4a13c2e78b186f6eb7384844 | TypeScript | DefinitelyTyped/DefinitelyTyped | /types/lzma-native/lzma-native-tests.ts | 2.6875 | 3 | import * as fs from "fs";
import * as lzma from "lzma-native";
const compressor = lzma.createCompressor();
const input = fs.createReadStream("tsconfig.json");
const output = fs.createWriteStream("tsconfig.json.xz");
input.pipe(compressor).pipe(output);
lzma.compress("Banana", undefined, result => {
console.log(r... |
cf5ce94982b871591b4238c1cc0fe776a040d8ca | TypeScript | nunof07/space-patrol | /src/random/RandomInt.ts | 2.875 | 3 | import { Scalar } from '@src/core/Scalar';
import * as Random from 'random-js';
export class RandomInt implements Scalar<number> {
private readonly engine: Random.Engine;
private readonly min: number;
private readonly max: number;
constructor(engine: Random.Engine, min: number, max: number) {
... |
d622003c4a43c1b1e7ea6b316e7fcf33d48a7277 | TypeScript | arturobarbaro/pruebasAngular | /redux-app/src/app/contador/contador.reducer.ts | 2.734375 | 3 | import * as fromContador from './contador.actions';
export function contadorReducer( state: number = 10, action: fromContador.actions) {
switch( action.type ) {
case fromContador.INCREMENTAR:
return state +1;
case fromContador.DECREMENTAR:
return state -1;
case fromContador.MULTIPLIC... |
18124069d1ecaeefcad4c780c3cc748018faa37b | TypeScript | rapr04/ADALTest | /src/app/main/employee/model/employee.ts | 3.015625 | 3 | export interface IEmployee{
id: number;
name:string;
function:string;
}
export class Employee implements IEmployee
{
id: number;
name:string;
function:string;
constructor(obj?: Employee){
if(obj){
Object.assign(this,obj);
}
}
} |
49e19c957e6a91b3eccf72779ca3830da1e15b52 | TypeScript | yohnwolfs/iceball-client | /www/src/gameobject/Ball.ts | 2.546875 | 3 |
const BallAttr = {
width: 74,
height: 74,
imgWidth: 90,
imgHeight: 90,
velocity: 6,
weight: 2.2
}
/**
* 比赛球类0
*/
class Ball extends BaseBall {
// 摩擦力
private _friction: number = 0.01;
// 旋转方向 -1:逆时针 1:顺时针 0:不旋转
private _roDirection: number = 0;
// 方向同步辅助值
private _dir... |
c8efd3b51b1dedc63f2bc22c0547a3843c0ae88f | TypeScript | aaronheath/afl-2016 | /src/app/services/match-summary.ts | 3.125 | 3 | import { Injectable } from '@angular/core';
import { Match, MatchItem, ModelWhereAttrs } from '../models/index';
/**
* Interface(s)
*/
export interface SummaryOfMatches {
goals: number;
behinds: number;
totalPoints: number;
accuracy: number;
highestScore: MatchItem[];
lowestScore: MatchItem... |
905efaf67c27a8cb40029fee0888a4033a0f20f2 | TypeScript | zephyrJS/typescript-practice | /EnumDemo/EnumDemo.ts | 3.015625 | 3 | // 数字枚举,可设置初始化值
enum Directory {
Up=1,
Down,
Left,
Right
}
// 字符串枚举
enum DirectoryString {
Up = 'Up',
Down = 'Down',
Left = 'Left',
Right = 'Right'
}
// Heterogeneous Enum
enum HeterogeneousEnum {
Up = 1,
Down = 'Down'
}
enum E { X }
enum E1 { X, Y, Z } |
f1eabb6ff79dcf1e04c7164c309252e4e2a9c971 | TypeScript | wan54/datahub | /datahub-web/@datahub/metadata-types/addon/constants/entity/dataset/compliance-field-types.ts | 2.78125 | 3 | /**
* Defines the string values that are allowed for a classification
* @export
* @namespace Dataset
* @enum {string}
*/
export enum Classification {
Confidential = 'CONFIDENTIAL',
LimitedDistribution = 'LIMITED_DISTRIBUTION',
HighlyConfidential = 'HIGHLY_CONFIDENTIAL',
Internal = 'GENERAL',
Public = 'PU... |
6053c2879182708903b924222ab9da3c5afc4831 | TypeScript | wahello/wigfrid | /src/clarity-angular/wigfrid/core/src/util/lang/is-number.ts | 2.5625 | 3 |
export function isNumber(value: any): boolean {
return typeof (value) == 'number';
}
|
e82ab4ddc135d17ef517e83b06bcb7f9b50d98f7 | TypeScript | Flariumapp/backend-node | /src/routes/search/index.ts | 2.5625 | 3 | import express, { Request, Response, NextFunction } from 'express';
import { Location } from '../../models/location';
import { Company } from '../../models/company';
import Fuse from 'fuse.js';
const Router = express.Router();
Router.get('/api/search', async (req: Request, res: Response, next: NextFunction) => {
... |
b78d87d32fc1b076fd5f071b0117318465708049 | TypeScript | hexgraphix/day2 | /src/app/app.component.ts | 3.328125 | 3 | import { Component, OnInit } from '@angular/core';
class Greeting {
message: string;
constructor(message: string){
this.message = message;
}
greet(){
return "Hello, " + this.message;
}
}
class Animal{
name: string;
constructor(animalName: string){
this.name = animalName;
}
move(dista... |
ec446d10a94f71f4d1f039eae3de3a5bc8f16261 | TypeScript | WepILoK/react-pizza | /src/store/ducks/pizzas/reducer.ts | 2.640625 | 3 | import produce, {Draft} from "immer";
import {EnumSortByOrder, EnumSortByType, IPizzasState} from "./contracts/state";
import {ActionsType, IActions} from "./contracts/actionTypes";
const initialState: IPizzasState = {
items: [],
isLoaded: false,
category: null,
sortBy: {
type: EnumSortByType.P... |
1ed0e643958117e84caab141b1423bc393b52aa6 | TypeScript | nthnluu/bouncer-web | /src/util/auth/auth_helpers.test.ts | 3.09375 | 3 | import {AuthService, User, UserRole} from "./auth_helpers";
class TestUser implements User {
email: string;
image: string;
name: string;
role: UserRole;
constructor(email: string, image: string, name: string, role: UserRole) {
this.email = email;
this.image = image;
this.na... |
dbbdd6e81919929b37a20ef6c523ad7abc9cdaf6 | TypeScript | cryptokrok/mancala.bawo_standalone | /src/js/Utility.ts | 2.859375 | 3 | /*
* bawo.zone - <a href="https://bawo.zone">https://bawo.zone</a>
* <a href="https://github.com/fumba/bawo.zone">https://github.com/fumba/bawo.zone</a>
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for ad... |
7410969c6bccd34aa2423d947c3aafa5febfe8f5 | TypeScript | hipek146/ZTI-myFilms-fe | /src/app/interfaces/User.ts | 2.625 | 3 | export interface User {
login: string;
password?: any;
name: string;
surname: string;
role: 'USER' | 'ADMIN';
}
|
e61725f1ed912190c2ceea8564a0f07f5c92a94c | TypeScript | a7urag/node-express-mysql-typescript-api-boilerplate | /src/services/user.service.test.ts | 2.578125 | 3 | import * as typeorm from 'typeorm';
import UserService from './user.service';
import { mockRepository } from '../tests/unit/dbMock';
import { User } from '../entities/user/user.entity';
import { verifyHash } from '../utilities/encryptionUtils';
describe('User service', () => {
test('getUserById with existing user',... |
7f699597aa94ceca7c71c61e2d8a26e22ea32d69 | TypeScript | srdjan/glitched-clob | /server/orderid.ts | 2.890625 | 3 | import { IOrderId, Ticker, Side } from './model'
class OrderId {
static idSequence = 0
static next (ticker: Ticker, side: Side): string {
let uid = OrderId.idSequence++
return `${ticker}.${side}.${uid}`
}
static fromString (id: string): IOrderId {
let idFields = id.split('.')
try {
re... |
c1ddca754a42dd92f8b1c48e48b769a5f2f135b1 | TypeScript | WonderPanda/schematics | /src/utils/module-metadata.declarator.ts | 2.921875 | 3 | import { DeclarationOptions } from './module.declarator';
export class ModuleMetadataDeclarator {
private METADATA_REGEXP: RegExp = /@Module\(([\s\S]*?)\)/;
constructor() {}
public declare(content: string, options: DeclarationOptions): string {
const metadata: any = this.extract(content);
return conten... |
cebc8fa9d2aea61ace6f599194ee497d48667204 | TypeScript | ctymcom/store-ban-thuoc | /src/base/error.ts | 2.703125 | 3 | import dotenv from "dotenv";
import express from "express";
// import Raven from 'raven';
// import { config } from '..';
dotenv.config();
// let sentry: Raven.Client;
// if (config.enableSentry) {
// if (!process.env.SENTRY_CONNECTSTRING) throw new Error('Missing config SENTRY_CONNECTSTRING');
// sentry = Raven... |
9bf84414b2b1519ffddfff6f0ad04a5936eb3582 | TypeScript | anthoDevWeb/Mon-agence-immo | /src/app/services/properties.service.ts | 2.609375 | 3 | import { Injectable } from '@angular/core';
import {Observable, Subject} from 'rxjs';
import {Property} from '../interfaces/property';
import * as firebase from 'firebase';
@Injectable({
providedIn: 'root'
})
export class PropertiesService {
properties: Property[] = [];
propertiesSubject = new Subject<Property... |
4cd46c82d6c9a56fe70af1688f8e61f7c7ace70b | TypeScript | codaxy/cxjs | /packages/cx/src/widgets/form/TextField.d.ts | 3.140625 | 3 | import * as Cx from "../../core";
import { Instance } from "../../ui/Instance";
import { FieldProps } from "./Field";
export interface TextFieldProps extends FieldProps {
/**
* Set to `true` to hide the clear button. It can be used interchangeably with the `showClear` property.
* Default value is `true`.
... |
e6f5c5f8f9045b5c6e647852aeb01c251ba39ec0 | TypeScript | MaxLarue/moonshot | /src/common/components/CircleBodyComponent.ts | 2.796875 | 3 | import * as tags from "../tags"
import Entity from '~/general/Entity';
import BodyComponent, { BodyOption } from './BodyComponent';
import RendererComponent from './RendererComponent';
export interface CircleBodyComponentOptions extends BodyOption {
radius: number,
offsetX: number,
offsetY: number,
disabled?: ... |
8f02b02ae18d6ae1265ff4418b67972b149d5eee | TypeScript | jason1105/org | /src/app/cts/measure/org/common/org-management-missionService.service.ts | 2.578125 | 3 | import {Injectable} from "@angular/core";
import {Subject, Observable, Observer, Subscription} from "rxjs";
/**
* Created by lv-wei on 2017-06-01.
*/
@Injectable()
export class MissionService {
// Observable string sources
private missionAnnouncedSource = new Subject<any>();
private missionConfirmedSource = new... |
6348532ffee93558cc2f443651c81e07f7e38deb | TypeScript | jcollins-axway/amplify-choreo-async | /item-id-aggregation/main.ts | 2.515625 | 3 | import * as ace from '@axway/ace-sdk';
import * as ByteBuffer from 'bytebuffer';
import {SpanContext} from 'opentracing';
let businessMessageProcessor: ace.MessageProcessorInterface = function(
spanCtx: SpanContext,
bMsgs: Array<ace.BusinessMessage>,
clientRelay: ace.MessageProducer
): Error | null {
//this simula... |
7dde9ab9ee218c293c5e50721313f826a9aa174a | TypeScript | ericlobdell/ExercismTS | /ExerecismTS/src/gradeschool.ts | 3.015625 | 3 |
class School {
constructor(private db = {}) { }
add( student: string, grade : number ) {
if (this.db[grade])
this.db[grade].push(student);
else
this.db[grade] = [student];
this.db[grade].sort();
}
grade( grade: number) {
return this.db[grade... |
564f4d8b2874a00834b30a23cd90984c019bc1c0 | TypeScript | interledgerjs/interledgerjs | /packages/ilp-spsp-payout/src/lib/Logger.ts | 2.875 | 3 | export interface Logger {
debug: LogMethod
info: LogMethod
warn: LogMethod
error: LogMethod
}
/* eslint-disable @typescript-eslint/no-explicit-any */
type LogMethod = (message: string, ...optionalParams: any[]) => void
export const defaultLogger = { debug: noop, info: noop, warn: noop, error: noop }
/* eslin... |
6b5079fd5b274803e51c4088045f13c8cf7add47 | TypeScript | Torphage/EasyDoc | /src/languages/python/syntax.ts | 2.796875 | 3 | /**
* Implementation of Python
*/
/**
* EasyDoc.
*/
import { ISyntaxVariable } from "../../interfaces";
import { WorkShop } from "../workshop";
import { PythonParse } from "./parse";
/**
* Python, extends WorkShop.
*
* @export
* @class Python
* @extends {WorkShop}
*/
export class Python extends WorkShop {
... |
b34196d8f106d174ad0f024c27260bd25faf22f8 | TypeScript | gksander/react-native-turbo-styles | /lib/colorStringToRgb.ts | 2.890625 | 3 | import { rgbStringToRgb } from "./rgbStringToRgb";
import { hexToRgb } from "./hexToRgb";
const RgbRegExp = /rgb\(/;
export const colorStringToRgb = (val: string) => {
if (RgbRegExp.test(val)) {
return rgbStringToRgb(val);
} else {
return hexToRgb(val);
}
};
|