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 |
|---|---|---|---|---|---|---|
d889f4135b1902f426b1d3a6d00b14b7dbb73d84 | TypeScript | mahmoudsror/backend_user_stories_task | /src/controllers/UsersController.ts | 2.609375 | 3 | import {Request, Response} from 'express';
import UserRepository from '../repositories/UsersRepository';
export class UsersController{
public async create(request:Request, response: Response){
const repo = new UserRepository()
const body = request.body;
console.log("Body", body)
con... |
e232f78a329a61a6c26cf2a11d1274cc5354cd76 | TypeScript | OneWorldHackathon/owm-app | /pledge/functions/src/EntityBase.ts | 2.546875 | 3 | import { FirestoreEntity } from './Repository'
import { validateSync, ValidationError, IsNotEmpty, IsString } from 'class-validator'
export abstract class EntityBase implements FirestoreEntity {
@IsString()
@IsNotEmpty()
private readonly _id: string
constructor(id: string) {
this._id = id
}
id(): st... |
48f1e8c70a2cb0aec7f8392e600070d3d7087e94 | TypeScript | aybarsakgun/b2b-backend | /src/common/utils/resolveAsyncRelation.ts | 2.59375 | 3 | import { Repository } from "typeorm";
export function resolveAsyncRelation<T, K extends keyof T>(
repository: Repository<T>,
relation: K
) {
return async (entity: T) => {
const record = await repository.findOne(entity["id"], {
relations: [relation as string],
withDeleted: true,
});
return... |
3eba99aae764e49248b17f00a303ca1a36076dc8 | TypeScript | danursin/rubiks-cube | /src/types/RubiksCubeObject.ts | 2.671875 | 3 | import { CubeObject } from "./CubeObject";
export class RubiksCubeObject {
public readonly cubeUnitLength: number;
public cubes: CubeObject[];
constructor(cubeUnitLength: number) {
this.cubeUnitLength = cubeUnitLength;
const n = this.cubeUnitLength;
this.cubes = [
new ... |
dedcea3c6a6833e483229eb9253db812d35d2f6b | TypeScript | Dcivan226/my-games | /图形配对/matchCard/src/HeadMc.ts | 2.6875 | 3 | class HeadMc extends egret.Sprite {
private _headImg:egret.Bitmap;
private _headID:number;
private _bg:egret.Shape;
private _state:string="noselected";
private _hideMc:egret.Shape;
public constructor(headImg) {
super();
this._headImg=headImg;
this.create();
}
public set state(value:string){
this._sta... |
5ebd4661e4c39d74b10cd6b78b201bf5b0a9bbc7 | TypeScript | MaximSamusenko/ProtobufRpc | /protobuf-rpc-client/src/ping_pong/proto_client/ServiceClient.ts | 2.5625 | 3 | import { Message, Method, rpc, RPCImplCallback } from "protobufjs";
import { IRequestInfo, ServiceMessage } from "../../proto";
import loggerFor from "../../winston";
import ServiceSubscription from "./ServiceSubscription";
enum WebSocketConnectionState {
"CONNECTING" = WebSocket.CONNECTING,
"OPEN" = WebSocket... |
a4e29a6a1da4bdf0ef19edf62f577f59a87e22fa | TypeScript | ph1p/rp-character-manager | /src/store/inventory.ts | 2.9375 | 3 | import { v4 as uuidv4 } from 'uuid';
import { ignore } from 'mobx-sync';
import { makeAutoObservable } from 'mobx';
import { CharacterStore } from './character';
export class InventoryItem {
name: string = '';
description: string = '';
quantity: number = 0;
weight: number = 0;
id: string = '';
isAttack: b... |
49b37490da3942db0d8a59f1aefe4f3b496606fa | TypeScript | HamdiMegdiche/redspher-calculator | /back/test/helpers.test.ts | 3.4375 | 3 | import { checkExpressionToCompute, computeExpression } from "../src/helpers";
describe("Check expression to compute function", () => {
it("Checks allowing simple numbers", () => {
expect(checkExpressionToCompute("123")).toBe(true);
expect(checkExpressionToCompute("23.45")).toBe(true);
expect(checkExpress... |
478bf3a5edf7839ef144f84b8896696050a11091 | TypeScript | kamibababa/SplitTime | /src/engine/ui/conversation/dsl.ts | 2.8125 | 3 | namespace splitTime.conversation {
export type Condition = true | (() => boolean)
export interface DSL {
say(speaker: Speaker, line: string): void
section(sectionSetup: () => void): SectionChain
do(action: time.MidEventCallback): void
// waitUntil(condition: Condition): void
... |
341438121f84d4a7879961deea846dd5c330c335 | TypeScript | bigro/sal-mane | /src/model/member.ts | 2.828125 | 3 | /**
* メンバー
*/
export class Member {
name:string;
isPlayer:boolean;
constructor(name: string) {
this.name = name;
}
}
|
e069ead9751b6eaa1626c3f49d356bcc598f89ea | TypeScript | DavidDecraene/marchingCubesGL | /src/lib/utils/lvec.ts | 3.046875 | 3 | import { vec3 } from 'gl-matrix';
export const LVecs = {
add: function(result: vec3, target: vec3) {
result[0] += target[0];
result[1] += target[1];
result[2] += target[2];
return result;
},
rescale: function(value: number, fromRange: Array<number>, toRange: Array<number>) {
if (!valu... |
94bcba9fe4f5d5c36989b46a97daeef7252504e5 | TypeScript | skaeneman/CS701-Rich-Internet-Application-Development | /Module_Samples/TypeScript_Examples/Basics/ex09.ts | 2.96875 | 3 | // any
let x: any;
x = "Hello";
console.log(typeof(x));
console.log(x.length);
x = 12;
console.log(typeof(x));
console.log(x.length);
let y: number = 12;
console.log(y.length);
|
c52759ee90a8e5583520265a71af2a98a6c4c74d | TypeScript | jon-grangien/magical-forest-architect | /src/components/MainPlane/subobjects/PlaneEnvObjects.ts | 2.75 | 3 | import * as THREE from 'three'
import { LoadOBJMTL } from '../../../utils/LoadOBJMTL'
export interface IPlaneEnvObjects {
amount: number
posRangeMin: number
posRangeMax: number
waterIsRendering: boolean
calculateHeight: (x: number, y: number) => number
spawnObjects: () => void
}
export interface IObjMtl {... |
5de07033ee716a0f1c45e6979953fe7309c179f0 | TypeScript | Johan-Ortegon-1/404-DinamicOng | /DinamicOng/src/app/auth/register/register-ong/register-ong.component.ts | 2.703125 | 3 | import { Component, Input, OnInit } from '@angular/core';
import { Ong } from 'src/app/models/ong';
import { AuthService } from '../../services/auth.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-register-ong',
templateUrl: './register-ong.component.html',
styleUrls: ['./register... |
065be82ce1965d2bf2f20cbb53c41d483e540034 | TypeScript | sergiubutnarasu/register | /modules/platform/helpers/calculate-today-total.helper.ts | 2.6875 | 3 | import { roundNumber } from "~/modules/common";
import { RegisterEntry } from "~/modules/excel";
export const calculateTodayTotal = (fields: RegisterEntry[]) =>
fields.reduce(
(
{
todayPositive,
todayNegative,
}: { todayPositive: number; todayNegative: number },
{ value }
) ... |
c77be9486f7cb0e563b5b8d312fb18ffc3faea5e | TypeScript | Mobysick/dependabot | /src/http/http-api.ts | 2.734375 | 3 | import axios from 'axios';
// TODO: Fix any.
type GetResponse = {
status: number;
data?: any;
};
export class HttpApi {
static async get(url: string): Promise<GetResponse> {
const response = await axios.get(url);
return { status: response.status, data: response.data };
}
}
|
4fb7531524e7c7d70c25ad28d358fe0ba7ec8699 | TypeScript | Boris6235551/mineVisual | /renderer.ts | 3.1875 | 3 | const Konva = require('konva');
let inRectArr = [];
let layer;
function test() {
// var x: string = '1';
// var y: number;
// console.log( typeof x, typeof y );
// x = 'hello';
// y = 2;
// console.log( typeof x, typeof y );
// x = 'true';
// y = 3;
// console.log( typeof... |
8e884c7ed47700bb6ccb850f76dde7dfdeed2ebd | TypeScript | osuthailand/Goose | /commands/pr.ts | 2.75 | 3 | import * as Discord from 'discord.js';
const config = require('../config/config.json');
// Responsible for sending the #playerreporting embedded message
export async function sendPlayerReportingEmbed(client: Discord.Client, message: Discord.Message, args: string[]) {
try {
if (message.author.id != config.o... |
da3c564d9f81d09182f5c19137f677a31c7391d7 | TypeScript | ssuniltikoo/jtran | /employee.ts | 3.515625 | 4 | var num = 2;
class employee{
private empName:string;
private num=13;
static sval = 10;
constructor(empName:string){
this.empName=empName;
num=-4;
}
public printNum():void{
console.log("global variable"+num);
console.log("local variabl... |
7164198f97c590a34258b744137ea69abfb41273 | TypeScript | EmmaRamirez/Clickopolis | /src/classes/queue.ts | 3.359375 | 3 | export class Queue<T> {
oldestIndex:number = 1;
newestIndex:number = 1;
storage:T[];
size ():number {
return this.newestIndex - this.oldestIndex;
}
enqueue (data:T):void {
this.storage[this.newestIndex] = data;
this.newestIndex++;
}
dequeue ():T {
let oldestIndex:number = this.oldestI... |
8c7541408a5f9d1cb573d12ba612586366259013 | TypeScript | NesibeHatzi/PRIMA-Endabgabe | /FudgeSpaceShooter/Entity.ts | 2.53125 | 3 | namespace FudgeSpaceShooter {
// import ƒ = FudgeCore;
export enum DIRECTION {
UP,
DOWN,
LEFT,
RIGHT,
NEUTRAL
}
export class Entity extends ƒ.Node {
protected maxSpeed: number = 5;
protected speed: ƒ.Vector3;
protected hitbox: ƒ.Mesh;
... |
efa0fd4820988383fef05eaf0521adf93b07b0a1 | TypeScript | Klowar/cdb | /src/cache/index.ts | 2.546875 | 3 | import { logger } from './../globals';
import { getBlockSize } from '../entity/util';
import { Option, TypedIdentifier } from './../parser/types';
import { createTemporaryFile, TemporaryFile } from './../temp/index';
import { Comparator } from '../union/filter/compare/index';
export type Cache = {
data: Map<stri... |
296b1fe07919962b95f969f94e3ed10a20509529 | TypeScript | MasterMoritz/TypoX | /src/app/equation/services/translator.service.ts | 2.71875 | 3 |
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class TranslatorService {
private decimalsign: string;
private greek_letters: string[];
private relations: any;
private constants: any;
private left_brackets: any;
private right_brackets: any;
private leftright_b... |
1b362e9b94b6566622cbb10bc1791f4bba4a79d8 | TypeScript | iwfan/happy-http | /src/core/http_params.ts | 3.109375 | 3 | import { isArray, isDate, isObject, toString } from '../helpers'
export type HttpParamValue = Exclude<
string | string[] | boolean | number | object | Date | RegExp,
null
>
export interface HttpParamsInit {
readonly [param: string]: HttpParamValue
}
export class HttpParams {
static encode(v: string) {
re... |
bb11392fde487139e7cf536aa486cce2b21e361a | TypeScript | sysidos/koatty | /src/util/ValidUtil.ts | 2.671875 | 3 | /**
* @ author: richen
* @ copyright: Copyright (c) - <richenlin(at)gmail.com>
* @ license: MIT
* @ version: 2020-01-02 09:36:59
*/
import helper from "think_lib";
import { plainToClass } from "class-transformer";
import { validate, registerDecorator, ValidationArguments, ValidationOptions, Validator } from "class... |
68dcd0daa8eff93557c378d55fb3e8bc9dcb0481 | TypeScript | tarioto/leetcoding-challenge-december | /tests/06-12-20.test.ts | 2.984375 | 3 | import { connect, Node } from "../problems/06-12-20";
test('connect of [1,2,3,4,5,null,7] to equal [1,#,2,3,#,4,5,7,#]', () => {
const root = new Node(1, new Node(2, new Node(4), new Node(5)), new Node(3, undefined, new Node(7)))
let seven = new Node(7)
let three = new Node(3, undefined, seven)
let five = new ... |
e255f95049a20078f78c94f893844b908e7c745a | TypeScript | kdharani/protractor-ui-reference | /protractor-typescript/pages/ownersPage.ts | 2.890625 | 3 | import FedexBasePage from "./FedexBasePage";
import Owner from "../model/owner";
import Pet from "../model/pet";
const route = 'owners';
const selector = {
ownersTable : {css: '.table.table-striped'},
ownerNameList : {css: '.table-responsive td a'},
petName : {css: '.table.table-striped .dl-horizontal dd:... |
38c6bbd27ab964c3255dd47427508152cf2dceac | TypeScript | EduardoModel/react-typescript-next-setup | /src/styles/styled.d.ts | 2.578125 | 3 | // Disable the eslint rule for a file without the need to change the main config file
/* eslint @typescript-eslint/no-empty-interface: "off" */
import 'styled-components'
import theme from './theme'
// Easy way to define the types of the content of an object
export type Theme = typeof theme
declare module 'styled-com... |
fb262d268c14a16a657c275e95cdee4a2af1b9c4 | TypeScript | hisland/my-learn | /typescript/08.type-compatibility/30.type-extends-any.ts | 4.15625 | 4 | // T extends U ? X : Y
// The type above means when T is assignable to U the type is X, otherwise the type is Y
{
// "yes"
type T01 = number extends any ? 'yes' : 'no'
// "yes"
type T02 = string extends any ? 'yes' : 'no'
// "yes"
type T03 = boolean extends any ? 'yes' : 'no'
// "yes"
type T04 = null ex... |
6335e4674a9ca46984f9b3557e8fa782b188a08c | TypeScript | Alexsey1999/ReactClothesStoreBackend | /src/models/categories.ts | 2.6875 | 3 | import { Schema, Document } from 'mongoose'
export interface ICategory extends Document {
id: Schema.Types.ObjectId
categoryName: string
products: Schema.Types.ObjectId[]
onModel: 'shirt' | 'cap' | 't-shirt' | 'bag' | 'polo'
}
const categorySchema = new Schema({
id: Schema.Types.ObjectId,
categoryName: {
... |
6b051e9f56c2f4dedee1dc0a3123cb08b9360979 | TypeScript | EntropyAu/TactileJS | /examples/workshopPlanner/ts/models/Workshop.ts | 2.921875 | 3 | module WorkshopPlanner {
export class Workshop {
name:KnockoutObservable<String> = ko.observable("");
days:KnockoutObservableArray<Day> = ko.observableArray([]);
constructor(data:any) {
for (let prop in data) {
if (ko.isObservable(this[prop]) && prop !== 'days')
this[prop](data[pr... |
ad59e52de282bcd61603b7b8654c638a981c9561 | TypeScript | mipli/cabalites | /src/containers/PriorityLinkedList.ts | 3.171875 | 3 | import * as array from './array';
import * as utils from './utils';
import {ILinkedListNode, default as LinkedList} from './LinkedList.ts';
export default class PriorityLinkedList<T> extends LinkedList<T> {
private compareFunction: utils.ICompareFunction<T>;
constructor(compareFunction?: utils.ICompareFunction<T... |
58c047166870c46353f958875454054dce3b1dd1 | TypeScript | ohjooyeong/store-2 | /client/src/utils/index.ts | 2.609375 | 3 | export const formatPrice = (price: string | number): string => {
const parsePrice = typeof price === 'string' ? parseInt(price, 10) : price;
return parsePrice.toLocaleString('ko-KR');
};
export const filterId = (id: string): string => {
return `${id.slice(0, 3)}***`;
};
|
6a56208d16a8d4de87bc093cb5fd18cda54fce66 | TypeScript | cardstack/cardstack | /packages/safe-tools-client/app/utils/owner.ts | 2.75 | 3 | import { getOwner } from '@ember/application';
import { assert } from '@ember/debug';
import { Registry } from '@ember/service';
// This file augments Ember's `Owner.lookup` so that it understands services in
// the same way that service injection does.
// This reexport is here because you cannot augment the type of ... |
2179d0b59fedca830874d1dc5d540fab2e2d1b9e | TypeScript | cafesanu/angular-pipes | /src/app/pipes/shorten/shorten.pipe.ts | 2.640625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'shorten'
})
export class ShortenPipe implements PipeTransform {
public transform(value: string, limit?: number): string {
if (limit && value.length > limit) {
return `${value.substr(0, limit)}...`;
}
return value;
}
}
|
79b4fa0ddf82c4222494c4183c20800724a9c407 | TypeScript | trebbettes-screeps/screeps-ai | /src/movement/common/costMatrix.ts | 2.59375 | 3 | import {CREEPS_MOVEMENT_CONFIG} from "../config";
import {isSkRoom} from "./getRoomType";
import {roomHostilityCheck} from "./hostility";
import {isBlocking, isTraversable} from "./roomPosition";
export function getCostMatrix(roomName: string, avoidCreepsIn?: string, opts?: MovementOptions): CostMatrix | boolean {
... |
052660fa76a704dbe45164a7733873334ad91dd5 | TypeScript | KaiPUecker/nodepane-component | /src/components/NodeConnector.ts | 3.03125 | 3 | import { Point } from "../geom/Point";
import { UnitConnector } from "../model/UnitConnector";
export class NodeConnector {
public static RADIUS: number = 6;
public point: Point;
public unitConnector: UnitConnector;
public color: string;
constructor(x: number, y: number, unitConnector: UnitConne... |
e61db483a0866870dfcd891174f9d23b2990935e | TypeScript | dnalborczyk/serverless-offline | /tests/old-unit/authFunctionNameExtractor.test.ts | 2.796875 | 3 | // @ts-nocheck
import authFunctionNameExtractor from '../../src/events/http/authFunctionNameExtractor'
describe('authFunctionNameExtractor', () => {
const dummyLogging = (arrayStore) => (message) => {
arrayStore.push(message)
}
describe('Unsupported auth method', () => {
const unsupportedAuthTest = (au... |
c0dab3708f25c2b2ac40de0d107112d05984d4eb | TypeScript | joeldatabox/mr-meeseeks | /projects/mr-meeseeks/src/lib/sr-utils/logger/sr-logger.ts | 2.78125 | 3 | import {Level, Log, Logger} from "ng2-logger/browser";
import {isEmpty, isString} from "../commons/sr-commons.model";
export class SrLogg {
private readonly _data: SrLoggData;
private readonly _error: SrLoggError;
private readonly _info: SrLoggInfo;
private readonly _warn: SrLoggWarn;
constructor(private va... |
e595e73d9049617df1862cb9185663a9218c1a85 | TypeScript | eliasvargasloyola/nodejs-typeorm-test | /src/index.ts | 2.578125 | 3 | import "reflect-metadata";
import { createConnection, getConnectionOptions } from "typeorm";
import * as express from "express";
import { Request, Response } from "express";
import * as bodyParser from "body-parser";
import Routes from "./routes";
(async () => {
// create express app
const app = express();
app.u... |
a2045ae2a50f0fc963572aebeabd577dd9e76c4b | TypeScript | EdwardIrby/speed-up-psds-build | /packages/util/src/__specs__/pick.spec.ts | 2.8125 | 3 | import { pick } from '../index'
describe('#pick', () => {
it('returns an object', () => {
const obj = { name: 'David Bowie' }
const result = pick(obj, [])
expect(result).toBeInstanceOf(Object)
})
it('picks fields from object', () => {
const obj = {
alias: 'Goblin King',
job: 'singer/... |
a8a2924be81b05d58f2208c3e556af18e35468a7 | TypeScript | renzen/Mean-App | /src/app/event.service.ts | 2.609375 | 3 | import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { catchError, tap } from 'rxjs/operators';
import { MessageService } from './message.service';
@Injectable({
providedIn: 'root'
})
export class EventService {
//... |
ae8f16169dde14b33916fcf63518345876ac7c72 | TypeScript | raychangrhj/mua | /src/app/questions/shared/ngrx/reducers/navigation.reducer.ts | 2.78125 | 3 | import * as NavigationActions from '../actions/navigation.action';
import {
createFeatureSelector,
createSelector
} from '@ngrx/store';
export type Action = NavigationActions.ALL;
export interface NavigationState {
sections: NavigationSectionState[]
}
export interface NavigationSectionState {
id: number;
t... |
1a67922996024a6ce1ba3c1380cbe9c459794a9a | TypeScript | AuxilityKiev/youhire-backend | /server/src/db/entities/addition-value.ts | 2.8125 | 3 | import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from "typeorm"
import Addition from "./addition"
@Entity()
export default class AdditionValue {
@PrimaryGeneratedColumn()
public id: number
@Column({
nullable: true
})
public name: string
@Column({
nu... |
1a8787c419c4ee3efb32f0cbd0e75b6217f8f6a9 | TypeScript | floukeiei/angular-memory-leak-demo | /src/app/sub.component.ts | 2.640625 | 3 | import { Component, OnDestroy } from '@angular/core';
import { BehaviorSubject, Subject } from 'rxjs';
import { DummyService } from './dummy.service';
import { publish, publishBehavior, publishLast, publishReplay, shareReplay, tap, takeUntil } from 'rxjs/operators';
@Component({
selector:'app-sub',
template: 'meg... |
c60d172767d94545445955984b33b6f42c0c1dd6 | TypeScript | kkguan/weapp-base | /typings/wx/lib.wx.component.d.ts | 2.84375 | 3 | /**
* author: alan
* date: 2019.01.09
* version: 1.0.0
*/
declare namespace Component {
interface ComponentInstanceBaseProps<D extends IAnyObject = any> {
properties?: {
type: any,
value?: any,
observer?() : void
}
options?: any
releations?: any
externalClasses?: string[... |
cedbf14f0e73aeed09a756a2507b541969104729 | TypeScript | eric1234463/image-post | /client/application/store/user/actions/loginUser.ts | 2.6875 | 3 | import { IUser } from "../../../../interfaces/api/user";
const LOGIN_USER_REQUEST = "LOGIN_USER_REQUEST";
const LOGIN_USER_SUCCEEDED = "LOGIN_USER_SUCCEEDED";
const LOGIN_USER_FAILED = "LOGIN_USER_FAILED";
export interface LoginUserRequestAction {
type: typeof LOGIN_USER_REQUEST;
payload: IUser
}
export interfac... |
3b0d8a5ab5a58719f9e9622375f95699e6248a5b | TypeScript | AndriiMSN/Test-React-TS | /src/js/components/LocalStorage.ts | 2.734375 | 3 | class LocalStorage {
readonly counter: string = "60"
setUserAndVerification(isUser: boolean, isVerified: boolean) {
localStorage.setItem('log', '' + isUser)
localStorage.setItem('ver', '' + isVerified)
}
setCounterAndDate(counter: string = this.counter) {
localStorage.setItem('... |
76aed739d68aed734c98676925dcf177f5504f87 | TypeScript | jivkopiskov/GamersUnited | /GamersUnited/ClientApp/src/app/posts/votes/votes.component.ts | 2.609375 | 3 | import { Component, Input, OnInit } from '@angular/core';
import { PostsService } from 'src/app/core/posts.service';
import { IVote, VoteType } from '../Interfaces/IVote';
@Component({
selector: 'app-votes',
templateUrl: './votes.component.html',
styleUrls: ['./votes.component.css']
})
export class VotesComponen... |
8f4ac14e68e8ab371cd4aab1affc44b5b987f877 | TypeScript | NavenduDuari/Scaffoldzoi-Inc | /packages/client/src/Containers/App/reducer.ts | 2.671875 | 3 | import { Action, UserDetailsI } from '../../utils/types';
import { ActionTypes, StoreStateI, TokenStatus } from './types';
const INITIAL_STATE: StoreStateI = {
token: '',
tokenStatus: TokenStatus.YetToFetch,
loggedInUser: {} as UserDetailsI,
sellers: [],
};
const appReducer = (state = INITIAL_STATE, action: A... |
30ded10c5a0cd2928629856d8294b1eb5e0a9533 | TypeScript | michaelgriscom/LeaderMode | /src/test/KeyBindingTree.test.ts | 2.890625 | 3 | import { expect } from 'chai';
import { IKeybinding } from '../Configuration';
import { KeybindingTree } from '../KeybindingTree';
suite("keybindingTree Tests", function () {
const letters: string[] = ["a", "b", "c", "d", "e", "f", "g", "h"];
test("empty keybindings", () => {
const keybindingTree = ne... |
391292cfbd63323bade7512bd495e7738f3140a6 | TypeScript | tadakun8/mail-stream | /lambda/module.ts | 2.8125 | 3 | import * as AWS from 'aws-sdk';
import { table } from 'console';
import * as fs from 'fs';
import * as nodemailer from 'nodemailer'
import { Readable } from 'stream'
const stringify = require('csv-stringify/lib/sync')
/**
* S3バケットから指定したオブジェクトをダウンロードする関数
* @param s3 s3クライアント
* @param bucket_name ダウンロードするオブジェクトが格納されて... |
be7710b355f6b9cf20882ef78ec99f95428eeb34 | TypeScript | RavivarmanPerinpanathan/web | /src/app/models/ChatMessage.ts | 2.84375 | 3 | import {User} from "./user";
import {Serialize} from "../interfaces/Serialize";
import {Chat} from "./chat";
export class ChatMessage implements Serialize<ChatMessage> {
public id: number;
public author: User;
public chat: Chat;
public message: string;
public created_at: Date;
public updated_a... |
ff6c9f7680354f3823398f37ceb3920925265e71 | TypeScript | huhn511/iota.js | /packages/crypto/src/utils/arrayHelper.ts | 3.390625 | 3 | // Copyright 2020 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
/**
* Array helper methods.
*/
export class ArrayHelper {
/**
* Are the two array equals.
* @param array1 The first array.
* @param array2 The second array.
* @returns True if the arrays are equal.
*/
public stati... |
9ad9f2bb3d5b5c598d0c9bb4ab76363a66790201 | TypeScript | NTSka/bot | /src/types/data.ts | 2.734375 | 3 | export type User = {
id: string;
username: string;
}
export type List = Array<User>
export type Winners = {
[key: string]: User;
}
export type Storage = {
users: User[];
winners: Winners;
}
export type Top = {
[key: string]: number
}
|
8b99a57bb517da512f4e6d71dd60b9b5179e7fa6 | TypeScript | benrosen/storytoy-cli | /src/functions/read-json-file/read-json-file.ts | 3.40625 | 3 | import { promises as fileSystem } from "fs";
/**
* Parse a JSON file into a generically typed object.
*
* @param {string} path The path to the JSON file.
* @returns {any} The object parsed from the JSON file.
*
* @todo {SHOULD} use generic return type instead of any
*/
export const readJsonFile = async <T>(path... |
088a0e0b761057cd844d22be44b0c70dad7c0d39 | TypeScript | tiagoarodrigues55/github-music-backend | /src/models/Follower.ts | 2.578125 | 3 | import { Model, Sequelize, DataTypes } from 'sequelize'
const sequelize = new Sequelize('postgres://postgres:Tiago2003@localhost:5432/github-music');
class Follower extends Model{
public id!: number
public user_id!: number
public follow_id!: number | null
public readonly createdAt!: Date;
public readonly... |
52918dd28be86961ce3ca17d182759e1c53c1e0a | TypeScript | piku98/url_shortener | /src/models/urls.ts | 2.8125 | 3 | import { Connection, Schema, model, Document } from 'mongoose'
export interface IURL extends Document {
originalURL: string,
uniqueCode: string,
expiry: Date
}
export const URLSchema = new Schema({
originalURL: {
type: String,
required: true,
unique: true,
validate: {
... |
4e07d78aa13a4a3b8b9f8f0a2e3d38c2e744b132 | TypeScript | jroets/simple-location-tracker-poc | /src/app/services/location-watcher.service.ts | 2.734375 | 3 | import { Injectable } from '@angular/core';
import { Geolocation, WatchPositionCallback } from '@capacitor/geolocation';
import { AppStateMonitor } from './app-state-monitor.service';
import * as EventEmitter from 'events';
/**
* This is a singleton location watcher service. It encapsulates a single watcher.
* Con... |
687d215b2caf68bdb595a331deaa02a5b81c8465 | TypeScript | hiNISAL/any-editor | /src/modules/Plug/Dropdown.plug.ts | 2.59375 | 3 | import { $create, $, $on, $show, $hide, hideClick } from '@/helpers/utils';
import { Plug, IPlug } from './Plug';
interface IDropItem {
label: any,
value: any,
title?: string,
};
interface IDetail {
isTarget: boolean,
el: any,
value: string,
label: string,
};
class Dropdown extends Plug {
private dro... |
fab8cb2c0addeed7ac9709c088d56fd5d74a390c | TypeScript | nosahama/nextui | /packages/nextui/src/pagination/styles.ts | 2.9375 | 3 | import { NormalSizes } from '../utils/prop-types';
type PaginationSize = {
font: string;
width: string;
};
export const getPaginationSizes = (size: NormalSizes | number) => {
const sizes: { [key in NormalSizes]: PaginationSize } = {
mini: {
font: '10px',
width: '24px'
},
small: {
f... |
7d547d6d258cb6899389778cad1aa0fb43ae66ee | TypeScript | danielcornock/recovqr-ui | /src/app/core/core-storage/services/storage/storage.service.ts | 2.6875 | 3 | import { Injectable } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class StorageService {
public getItem(key: string): string | null {
return localStorage.getItem(key);
}
public setItem(key: string, payload: string): void {
localStorage.setItem(key, payload);
}
public getObject<... |
d99ef1676faaccd682ff14b5a8816922d95c1a44 | TypeScript | FontoXML/fontoxpath | /src/nodesFactory/INodesFactory.ts | 2.59375 | 3 | import { Document } from '../types/Types';
import ISimpleNodesFactory from './ISimpleNodesFactory';
/**
* Defines the factory methods used in XQuery. Basically equivalent to the Document interface, but
* with the 'createDocument' factory method added.
*
* @public
*/
export default interface INodesFactory extends ... |
7a24429c01dd306937a1d29b69efec016a85c65b | TypeScript | sanchimenea/Todo-App | /backend/src/businessLogic/updateQueries.ts | 2.578125 | 3 | import { TodoUpdateParams } from "../models/TodoUpdateParam";
import { UpdateTodoRequest } from "../requests/UpdateTodoRequest";
export function paramsDoneOrImportant(updatedTodo: UpdateTodoRequest, userId: string, todoId: string) {
const params: TodoUpdateParams = {
Key: {
"userId": userId,
... |
74a6440413d96039948bfb608f1fd13838413ac3 | TypeScript | ovieokeh/contacts | /src/components/helpers.ts | 3.15625 | 3 | import { IContactDetails, IContactList, IGroupedContacts } from '../types'
export const alphabet: string[] = Array.apply(
undefined,
Array(26)
).map((_, y) => String.fromCharCode(y + 65))
export const groupContacts = (contacts: IContactList): IGroupedContacts => {
// to hold the contacts grouped by last name
... |
a048ca6d01cfd4b66b4f899091f02d59acace82c | TypeScript | Maaltijd-Maat/Maaltijd-Maat | /src/app/models/user.model.ts | 2.765625 | 3 | export interface IUser {
readonly id?: string;
readonly color?: string;
firstname: string;
lastname: string;
email: string;
secondEmail: string;
password: string;
avatar: string;
guest: boolean;
allergies: string[];
diets: string[];
}
export class UserModel implements IUser{
readonly id?: strin... |
521cb6e8850e50c6f026865c3c0aa72f2ac61539 | TypeScript | fossabot/kairo | /libs/kairo/src/lib/core/behavior.spec.ts | 2.65625 | 3 | import {
Behavior,
Computation,
computed,
Flag,
lazy,
mutable,
runInTransaction,
} from './behavior';
describe('core/behavior', () => {
const noop = () => {};
function hasFlag(c: any, f: Flag) {
return c['internal'].flags & f;
}
function numOfObserverNodes(c: any) ... |
7ba45cae2462500f051d3f6215bdbec5b04695a6 | TypeScript | john-ko/simple-cache | /tests/fetch.spec.ts | 2.828125 | 3 | import SimpleCache from '../src'
describe('spec (key)', () => {
let simpleCache: SimpleCache
let fakeCallback = () => new Promise((resolve, reject) => resolve('hello'))
beforeEach(() => {
simpleCache = new SimpleCache({})
})
it('creates a new value if it does not exist', async () => {
const value =... |
5fc31de3904321b39a440bec020b5bfa7b3abdb0 | TypeScript | marcozam/os-ecommerce | /src/models/general/empresa.model.ts | 2.546875 | 3 | import { Field } from 'core/decorators';
import { BaseCatalog } from '../base-catalog.model';
export interface IEmpresa {
nombre: any;
}
export class Empresa extends BaseCatalog implements IEmpresa {
@Field('C1') nombre: string;
constructor(key: number, _nombre: string) {
super(key);
this.nombre... |
8eb73626c7eee996e6516230e1c048fc79e89f5a | TypeScript | craby-c/MapboxTest | /src/Module/Models.ts | 2.59375 | 3 | // Input data model
export interface ITripData {
"tripduration": number,
"starttime": string,
"stoptime": string,
"start station id": number,
"start station name": string,
"start station latitude": number,
"start station longitude": number,
"end station id": number,
"end station name... |
f7b59d4b199e68b7260be3b793dd1fe3d35deaad | TypeScript | limlam/smart-home-local | /src/platform/execute.ts | 2.65625 | 3 | /**
* Holds Execute stubs and helpers
*/
/// <reference types="@google/local-home-sdk" />
export const ExecuteStub: typeof smarthome.Execute = {
Response: {
Builder: class {
private requestId: string = '';
private commands: smarthome.IntentFlow.ExecuteResponseCommands[] = [];
public setReques... |
8957e6c0b1ebf19a3f32c58e718c269705f4d9e9 | TypeScript | ikbenignace/angular-ivy-qa3g3s | /src/services/base.service.ts | 2.625 | 3 | import { Injectable, Inject } from '@angular/core';
import { Observable, of } from 'rxjs';
import { HttpClient } from '@angular/common/http';
import { catchError } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class BaseService<T,TList> {
constructor(protected http: HttpClient, @Inject('BASE_... |
9a96eaa4e3181d7bb9c8637995b47e998a4d8116 | TypeScript | maoberlehner/node-sass-magic-importer | /packages/node-sass-magic-importer/src/functions/parse-selector-filters.ts | 2.625 | 3 | import { IParseSelectorFilters } from '../interfaces/IParseSelectorFilters';
import { IProcessRawSelectorFilters } from '../interfaces/IProcessRawSelectorFilters';
import { ISplitSelectorFilter } from '../interfaces/ISplitSelectorFilter';
export function parseSelectorFiltersFactory(
processRawSelectorFilters: IProce... |
4f1a70cdd939101169197f6a3ae591169b94d3e7 | TypeScript | pradnyatawale30/angularjs_training | /angularjs/typescript/manager.ts | 3.890625 | 4 | class Employee {
private eid: number;
private name: string;
private status: boolean;
// ? means optional parameter
// default values will be undefined here..because its a javascript after compilation
constructor(eid?: number, name?: string, status?: boolean) {
this.eid = eid;
... |
3b6b9f0bc2bbc3bf8d8559f0692413c2f9979710 | TypeScript | bart-haasbroek/video-upload | /src/app/store/wordpress/options/options.reducer.ts | 2.875 | 3 | import * as fromOptions from './options.actions';
export interface OptionsState {
options: any;
loaded: boolean;
loading: boolean;
}
export const initialOptionsState: OptionsState = {
options: {},
loaded: false,
loading: false,
};
export function optionsReducer(
state = initialOptionsState,
action: fromOpt... |
a6db7ccd88dede72a77d0626c405a8bb7172eb6a | TypeScript | fishedee/Demo | /typescript/other/src/auto_full_check.ts | 3.828125 | 4 | type Animal = 'dog' | 'cat' | 'fish'
function getAnimalOrdal(input: Animal): number {
// 这样写不好,会漏掉fish的常量
let number = 0
if (input === 'dog') {
number = 1
} else if (input === 'cat') {
number = 2
}
return number
}
function getAnimalOrdal2(input: Animal): number {
// 这样写是最好的... |
a53edbec7469fc481348f7a2c5b95568e97ce1c7 | TypeScript | ParleyHub/Jupiter | /src/auth/auth.ts | 2.703125 | 3 | /* eslint-disable operator-linebreak */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable no-useless-return */
import { Request, Response, NextFunction } from 'express';
import jwt from 'jsonwebtoken';
import { v4 as uuidv4 } from 'uuid';
import redisClient from '../redis';
type GenericObject... |
6d8afe0d8d396951d395e758221ca78f97e1cd0c | TypeScript | Caballerog/blog | /factory-method-pattern/example1/index.ts | 2.859375 | 3 | import { ConcreteCreator1 } from "./concrete-creator1";
import { ConcreteCreator2 } from "./concrete-creator2";
import { Creator } from "./creator";
function client(creator: Creator) {
console.log(`Client: I'm not aware of the creator's class`);
console.log(creator.operation());
}
const concreteCreator1 = new Con... |
9e361aa120787082b426e47e9fff49b1cd27b2d8 | TypeScript | G43riko/GTools | /src/math/simple-mat3.spec.ts | 2.734375 | 3 | import { expect } from "chai";
import "mocha";
import { Mat3 } from "./mat3";
describe("Mat3", () => {
describe("init", () => {
it("Test matrix creation", () => {
const emptyMatrix = [
1, 0, 0,
0, 1, 0,
0, 0, 1,
];
expect(M... |
83b35a91d63a9dd2824136dd257e27000c2a367c | TypeScript | fponticelli/tempo | /tools/docs/scripts/utils/markdown.ts | 2.578125 | 3 | import { Converter } from 'showdown'
import { JSDOM } from 'jsdom'
import fm from 'front-matter'
import { trimChars } from 'tempo-std/lib/strings'
import { highlight } from './highlight'
const converter = new Converter({
parseImgDimensions: true,
strikethrough: true,
tables: true,
tasklists: true
})
const ren... |
a94ae9808a3a143ee193dfeed081f186a0165b51 | TypeScript | joppe/apestaartje | /packages/lib/element/src/element.ts | 2.953125 | 3 | import { ElementConfig } from './ElementConfig';
export function element(config: ElementConfig): HTMLElement {
const [tagName, attributes = {}, children] = config;
const el = document.createElement(tagName);
Object.keys(attributes).forEach((key) => {
el.setAttribute(key, attributes[key]);
});
if (Array... |
becfe7a1bc90f7398915a8a73091cbcd2664e65c | TypeScript | dbslate/dbslate | /src/utils/rand.ts | 2.765625 | 3 | import {random, sample} from 'lodash';
import * as ulid from 'ulid';
import {fillArray} from './array';
export const LOWER_ALPHA_CHARS = 'abcdefghijklmnopqrstuvwxyz'.split('');
export const UPPER_ALPHA_CHARS = LOWER_ALPHA_CHARS.map(c => c.toUpperCase());
export const ALPHA_CHARS = UPPER_ALPHA_CHARS.concat(LOWER_ALPH... |
fdf928cc7b99e55ddeaee7ddc7cc5658d69a5eb8 | TypeScript | ariffadhillah/Game-Gewgly | /src/games/gewgly/objects/Eye/delegates/generator.service.ts | 3.203125 | 3 | import { CoordinateType, ConfigType } from '../schema';
export class Generator {
public static generateEyePointPos( _ : ConfigType, direction: string ) : CoordinateType { // Position of eyes relative to EyeFrame
const { eyesFrame, scale, eyeSpacing } = _;
if( direction != "left" && direction != "righ... |
51e108f4cbb1f2718e9b0779e742e41089c69c31 | TypeScript | zanozbot/mojedelo-virtualni-hekaton-2020-drugi-krog | /src/app/providers/paginator.provider.ts | 2.578125 | 3 | import { MatPaginatorIntl } from '@angular/material/paginator';
/**
* Custom implementation for the Paginator to support Slovenian language
*/
export function PaginatorProvider() {
const paginatorIntl = new MatPaginatorIntl();
paginatorIntl.itemsPerPageLabel = 'Število oddaj na strani:';
paginatorIntl.getRan... |
ff338fcf444d42994ca85d8280270ae268d0bc4f | TypeScript | Adrinalin4ik/world-of-warcraft | /client/src/game/network/webrtc/message.ts | 2.53125 | 3 | import { MessageType } from "./types";
export class Message {
public type: MessageType = MessageType.none;
constructor(type: MessageType) {
this.type = type;
}
} |
36da530b54d8d8bab071908cc844fd7491acec9d | TypeScript | mkazarnovskaya/checkers | /Game/Game/Scripts/checkers/position-hash.ts | 3.046875 | 3 | namespace Checkers {
export class PositionHash<T> {
hashObject: Object;
constructor() {
this.hashObject = new Object();
}
hash(position: Position): string {
let key0 = position.blackPlayer ? "1" : "2";
let key1 = 0;
let key2 = 0;
let key3 = 0;
let index = 0;
for (let row = 0; row < 8; ... |
3dfd73b99ae6bfbeb8abf4357b3c1c067aee8d0f | TypeScript | trojan8518/dragonEgg | /dragonEgg/src/Utils/SoundUtils.ts | 2.65625 | 3 | /**
* 声音播放工具类
* @author zhangrui
*/
class SoundUtils {
/**
* 音频文件集合
*/
private static soundMap: Map<string, egret.Sound>;
private static soundChannelMap: Map<string, egret.SoundChannel>;
/**
* 背景音乐音量
*/
private static _bg_sound_volume: number = 50;
/**
* 音效音量
*/
private static _sound_volume: n... |
94ec7907d305936d3e277a68c6ba2c0d7a0ec2b4 | TypeScript | shahidur1/AngularClassesInForm | /src/app/app.component.ts | 2.75 | 3 | import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'angularclasses';
skill: string[] = ["R10", "R11", "R12"];
address: Address = new Address("Bashbari", "mohammadpur", "... |
aac218d23c00c2e63bf631670dab49fce1b91487 | TypeScript | littletof/drashland_website | /drash/example_code/tutorials/requests/handling_url_query_params/home_resource.ts | 2.640625 | 3 | import { Drash } from "https://deno.land/x/drash/mod.ts";
export default class HomeResource extends Drash.Http.Resource {
static paths = [
"/users"
];
public GET() {
let userId = this.request.getUrlQueryParam("id");
if (!userId) {
throw new Drash.Exceptions.HttpException(
400,
... |
5843f2400b71ea7456ee0d8cb648d8a8c0fe74bf | TypeScript | krasovsky22/aws-sam-example | /src/utils/common/alteration-helpers.ts | 3.0625 | 3 | const NUCLEOTIDE_COMPLIMENTS = {
A: 'T',
T: 'A',
C: 'G',
G: 'C',
};
const complement = (nuc: string): string => {
if (Object.keys(NUCLEOTIDE_COMPLIMENTS).includes(nuc)) {
// @ts-ignore
return NUCLEOTIDE_COMPLIMENTS[nuc];
}
return '';
};
/**
* Get reference and mutated nucleotide taking orientat... |
f178ce51648e9e14a725ac12d1ee6aabecbb3285 | TypeScript | esteban-w/angular-store-app | /src/app/checkout/services/cart.service.ts | 2.546875 | 3 | import { Injectable } from '@angular/core';
import { Product } from '../../catalog/models/product';
import { Cart, CartItem } from '../models/cart';
import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class CartService {
cart: Cart = { items: {}, total: 0};
cartItems$: BehaviorSubj... |
ba306d4e3b3c1ba811312024d53364fb86cbdbdc | TypeScript | muellisa/EIA2 | /Aufgabe5/snow.ts | 3.34375 | 3 | /* Name:Isabell Mller
Matrikel:256034
Datum:19.11.17
Hiermit versichere ich, dass ich diesen Code selbst geschrieben habe. Er wurde nicht kopiert und nicht diktiert. */
namespace Aufgabe5 {
export class Snow {
x: number;
y: number;
color: string;
g: number;
... |
f667610115062d404d7f66430d8387165ecef1b1 | TypeScript | bangbang93/BMCLJS | /src/main/service/game.ts | 2.59375 | 3 | /**
* Created by bangbang93 on 2017/8/14.
*/
'use strict';
import Launcher from '../launcher/launcher';
import { ipcMain } from 'electron';
import {mainWindow} from '../index'
export interface IRunningGame {
name: string,
json: any,
launcher: Launcher,
id: GameIdentify
}
export interface IStartArguments {... |
c02df902a1437cff1db554ddb00a21d412d697bb | TypeScript | Steady5063/steady5063.github.io | /common-ui/dist/common-ui/lib/core/functions/keyBy.d.ts | 3.859375 | 4 | /**
* Creates an object composed of keys generated from the results of running
* each element of `collection` thru `iteratee`. The corresponding value of
* each key is the last element responsible for generating the key. The
* iteratee is invoked with one argument: (value).
*
* @param Array|Object collection The ... |
447647a36141d37cb31f879f1e9587dd31d4b6b2 | TypeScript | Toulix/gestion | /src/ue/ue.graphql.type.ts | 2.59375 | 3 | import { Field, Float, ID, ObjectType } from "@nestjs/graphql";
@ObjectType()
export class Matiere {
@Field(type => ID)
id: string;
@Field({nullable: true})
libelle?: string;
@Field({nullable: true})
abbreviation?: string;
@Field(type => Float, {nullable: true})
enseignemen... |
61668cb83417c9d437c01f1d0f26f86c088a3108 | TypeScript | i-takuya/vscode-twitter | /src/controllers/service.ts | 2.609375 | 3 | import TwitterClient from '../twitter';
import MainController from './controller';
import * as vscode from 'vscode';
export enum LocalServiceEndpoint {
User = 1,
Search,
Image,
Refresh,
Reply,
Retweet,
Like,
Unlike,
Follow,
Unfollow,
Css
}
export class LocalService {
pr... |
14711a92cfcd5ece8843b7ea1bc13aa4982785a8 | TypeScript | leonadler/immutablets | /src/method-not-immutable-error.spec.ts | 3.09375 | 3 | import { expect } from 'chai';
import { MethodNotImmutableError, pathToString } from './method-not-immutable-error';
import { InputMutations } from './function-mutates-input';
describe('MethodNotImmutableError', () => {
const emptyMutations: InputMutations = {
args: { },
this: [ ]
};
cla... |
3c66d9ab7f64a28bb0a77aec110972ab62c0d104 | TypeScript | kgoggin/mindful | /data/notion.ts | 2.609375 | 3 | import { Client } from "@notionhq/client";
import {
Page,
RichTextPropertyValue,
TitlePropertyValue,
DatePropertyValue,
} from "@notionhq/client/build/src/api-types";
import { randomColor } from "./colors";
export const notion = new Client({
auth: process.env.NOTION_TOKEN,
});
export const DATABASE_ID = "70... |
8ab4b6dce5f5b81729c70dc73c3c4d25272405af | TypeScript | MrVhek/todolist | /functions/src/index.ts | 2.65625 | 3 | // // Start writing Firebase Functions
// // https://firebase.google.com/docs/functions/typescript
//
// export const helloWorld = functions.https.onRequest((request, response) => {
// response.send("Hello from Firebase!");
// });
import { Request, Response } from 'express';
const functions = require('firebase-functio... |
9d97e753b97dad82f9bea22142009ebf91673308 | TypeScript | ThijsZijdel/Amsta-ErrorlessLearning | /app/src/app/admin/login/status.service.ts | 2.796875 | 3 | import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import {isBoolean} from "util";
@Injectable()
export class StatusService {
public loggedInStatus:boolean = false;
constructor() { }
/**
* Set the loggedInStatus
*
* @param {boolean} status
* @author... |