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 |
|---|---|---|---|---|---|---|
2f8c1b67d2e8535bf6ec66c361fbd59c9000c77a | TypeScript | heritiermwalila/demo-rc-app | /src/hooks/useAuth.ts | 2.859375 | 3 | import React from 'react';
import { loginSchema, registerSchema } from '../utils/validation';
export interface IRegisterUser {
firstname: string;
lastname: string;
email: string;
password: string;
website?: string;
company?: string;
}
export interface IUser {
_id: number;
firstname: string;
lastnam... |
b8b7244a0bd34febaad5cacab466dcfec09aacb1 | TypeScript | Indaym/Web-Indaym | /src/app/threed-viewer/player.viewer.ts | 2.546875 | 3 | /**
* Created by nicolas on 13/04/17.
*/
import {
Mesh,
MeshBasicMaterial,
Geometry,
PlaneBufferGeometry,
BackSide,
Vector3,
} from 'three';
import { SceneViewer } from './scene.viewer';
import { RulesInterface } from '../components/editor/preview/rulesInterface';
export clas... |
61ee17be70a5eb37e6560aa145713889e9fd429b | TypeScript | roybailey/neo4j-graph-loader | /src/graph/neo4j-util.ts | 2.59375 | 3 | "use strict";
import {QueryResult} from "neo4j-driver";
import neo4j from "neo4j-driver";
import logger from "../util/logger";
const neo4jUrl = (process.env.NEO4J_URL || "bolt://localhost:7687");
const neo4jUsername = (process.env.NEO4J_USERNAME || "neo4j");
const neo4jPassword = (process.env.NEO4J_PASSWORD || "neo4j"... |
4908685150c545955971dd05c8b90266dac48f1b | TypeScript | ccllab/just-kanban | /src/server/controllers/providers/AppAuthProvider.ts | 2.609375 | 3 | import * as express from 'express';
import AuthError from "../../services/exceptions/AuthError";
import {IAuthService} from "../../services";
import {ILogger} from "../../utils";
import {inject, injectable} from "inversify";
import {interfaces} from 'inversify-express-utils';
import {Principal} from "./Principal";
impo... |
36ba8775ff42f9595557a5db60e4009a5653219d | TypeScript | katafrakt/loremaster | /src/template/index.ts | 3.0625 | 3 | import Markdown from './markdown';
class Template {
render(source: string): string {
source = this.renderLinks(source);
source = this.renderMarkdown(source);
source = this.renderDetails(source);
return source;
}
private renderMarkdown(source: string): string {
const renderer = new Markdown()... |
82984025a92e449177572bd8c16fbd4722feb243 | TypeScript | ToxicToast/Twitch | /apps/audit/src/app/domain/aggregates/app.domain.ts | 2.53125 | 3 | import { AggregateRoot } from '@nestjs/cqrs';
import { Nullable } from '@twitch/shared';
import { AnemicApp } from '../models/app.model';
export class AppDomain extends AggregateRoot {
constructor(
private readonly id: string,
private readonly channel: string,
private readonly username: string,
priv... |
27ba22b1fd1d89cf0f1b80d721c4ba014355ba1a | TypeScript | burdiuz/js-deferred-data-access | /packages/deferred-data-access/resource/src/resource.ts | 2.8125 | 3 | import { IdOwner } from '@actualwave/deferred-data-access/utils';
import { ResourcePool } from './resource-pool';
export class Resource extends IdOwner {
constructor(
public readonly pool: ResourcePool,
public readonly type: string
) {
super();
}
toObject(): ResourceObject {
return { id: this.... |
97351c06546ba5c8fec55e16600a6ad6a63f8903 | TypeScript | iamlazy-dev/app | /packages/core/src/product-database/presentation/ProductState.ts | 2.796875 | 3 | import { Product } from '../domain/Model';
export interface CommonProductState {
id: string;
product: Product | null;
}
export interface LoadingProductState {
kind: 'Loading';
}
export interface LoadedProductState {
kind: 'Loaded';
product: Product;
}
export interface ErrorProductState {
kind: 'Error';
... |
b7d89f3c302a80fdc520e324d6260414e765223e | TypeScript | gsbelarus/gdmn | /packages/gdmn-nlp/src/morphology/rusAdjectivesData.ts | 2.765625 | 3 | import { RusAdjectiveInterface, RusAdjectiveCategory } from './types';
export const rusAdjectives: RusAdjectiveInterface[] = [
// абрикосовый
{
stem: 'абрикосов',
stem1: '',
stem2: '',
category: RusAdjectiveCategory.Rel,
declensionZ: '1a'
},
// самый
{
stem: 'сам',
stem1: '',
... |
ef76021318391cd7bfc54c95c914c23542f89cff | TypeScript | Mr-shadow/lab | /ts-004/libs/src/index.ts | 2.515625 | 3 |
export function post(url:string, data:{[key:string]:string}):void
{
}
export class ImageHelper
{
public static toBase64(img:HTMLImageElement):string
{
return null;
}
public static fromBase64(str:string):HTMLImageElement
{
return null;
}
}
export class Image
{
public co... |
582377189c5755206c4da0ebfaa2045bee5e9c28 | TypeScript | MindXL/koishi | /packages/koishi-utils/tests/time.spec.ts | 2.828125 | 3 | import { Time } from 'koishi-utils'
import { expect } from 'chai'
import { install, InstalledClock } from '@sinonjs/fake-timers'
describe('Time Manipulations', () => {
let clock: InstalledClock
const date = new Date(2020, 3, 1, 1, 30)
const now = date.valueOf()
before(() => {
clock = install({ now })
}... |
ae1e7d3688245d71895e8ea279cde8f04f02e1d6 | TypeScript | danielsh28/actuali-front | /src/store/reducers/AppHeightReducer.ts | 2.6875 | 3 | import {
USER_NOT_LOGGED,
USER_LOGGED,
AppHeight,
LogUserActions,
ILogState,
} from "../types";
export const appHeightReducer = (
state: ILogState = { height: AppHeight.LANDING, isLogin: false },
action: LogUserActions
) => {
switch (action.type) {
case USER_LOGGED:
state = {
...state... |
cb5d98e44d8a8497a826066d890f485f10ffd803 | TypeScript | mcountryman/geotab-rx | /src/models/deferral_info.ts | 2.75 | 3 | /* eslint-disable @typescript-eslint/no-empty-interface */
import { DutyStatusDeferralType } from "./duty_status_deferral_type";
/**
* RestInfo.
*
* @deprecated
*/
export interface IDeferralInfo {
/**
* Gets or sets a value indicating whether the day two log required. Tells the driver
* if they are requir... |
464f7dbe1c2cfa2ec78ab1a614ee5d70f5ebde52 | TypeScript | JassiSidhu/Comp397-Game | /Comp397-Game/Scripts/objects/button.ts | 2.6875 | 3 | /// <reference path="../managers/assets.ts" />
module objects {
//BUTTON CLASS..........
export class Button extends createjs.Bitmap {
//CONSTRUCTOR.........
constructor(imageString: string, x: number, y: number, centered: boolean) {
super(imageString);
this.regX = thi... |
c67df8353cce804afcfbc45c3ff0e035af2cd5e9 | TypeScript | malekylik/angular-mentoring | /src/app/store/actions/courses.actions.ts | 2.6875 | 3 | import { Course } from 'src/app/modules/course/models/course.model';
import { CoursesReqParams } from 'src/app/modules/course/models/courses-req-params';
import { ActionPayload } from 'src/app/modules/course/models/action-payload';
import { CoursesDeletePayload } from 'src/app/models/courses-delete-action-payload';
ex... |
a9d281b64932279404653f02e0ceccb218c013d1 | TypeScript | ywarezk/angular-advanced-by | /ng-workspace/projects/redux-tutorial/src/app/actions/hello.actions.ts | 2.640625 | 3 | import { Action } from '@ngrx/store';
export enum HelloActionTypes {
SetMessage = '[Hello] Set Message',
}
export class SetMessage implements Action {
readonly type = HelloActionTypes.SetMessage;
constructor(public message : string) {}
}
export type HelloActions = SetMessage;
|
acc603b5c0db5cd81bc02ad5c367ead7c227a01c | TypeScript | patrickmichalina/typescript-monads | /src/reader/reader.spec.ts | 3.1875 | 3 | import { reader } from './reader.factory'
import { IReader } from './reader.interface'
describe('reader', () => {
it('should of', () => {
const greet = reader<string, string>(ctx => ctx + '_HelloA')
const greet2 = greet.of(ctx => ctx + '_HelloB')
expect(greet.run('Test')).toEqual('Test_HelloA')
expe... |
668287cbb0ec2dcc798babb952bd6c55daf0ed8d | TypeScript | DefinitelyTyped/DefinitelyTyped | /types/use-global-hook/use-global-hook-tests.ts | 3.265625 | 3 | import Immer from "immer";
import useStore, { InitializerFunction, Options, Store } from "use-global-hook";
interface stateType {
value: string;
}
type setFunc = (value: string) => void;
interface associatedActionsType {
setValue: setFunc;
}
const initializer: InitializerFunction<stateType, associatedAction... |
02b2057d5fa9bc9395333e53d74e95ed9764bb41 | TypeScript | samwaters/nChat | /server/messages/text.message.ts | 2.921875 | 3 | import {IMessage, MessageTypes} from './message.interface';
export class TextMessage implements IMessage {
private _message:string;
private _from:string;
constructor(from:string, message:string) {
this._from = from;
this._message = message;
}
public asString() {
return JSON.stringify({
ty... |
e5e881670466e3df562f73e7451faac6cdeb4629 | TypeScript | SachinBargal11/Midas | /web-ui/src/models/user.ts | 2.6875 | 3 | import { Record } from 'immutable';
import moment from 'moment';
import { Address } from './address';
import { Contact } from './contact';
import { UserType } from './enums/user-type';
import { Gender } from './enums/Gender';
const UserRecord = Record({
id: 0,
name: '',
userType: UserType.Owner,
accoun... |
d1b3a28d8cac7b19ab4b77be7c90ff34e500a3dc | TypeScript | allanfenx/pulser | /src/controller/CategoryController.ts | 2.890625 | 3 | import { Request, Response } from "express";
import { getRepository } from "typeorm";
import Category from "../models/Category";
import slugify from "slugify";
import CategoryView from "../view/CategoryView";
class CategoryController {
async index(request: Request, response: Response) {
const categories ... |
8a3bee0a22137055484c40402261c7ba9ddb2e66 | TypeScript | Bastianus/Case_BPM3 | /Frontend/src/app/Componenten/Bestand toevoegen/bestand-toevoegen.component.ts | 2.625 | 3 | import { Component, OnInit } from '@angular/core';
import { CursusService } from 'src/app/Services/cursus.service';
import { Cursus } from '../../Models/Cursus'
import { CursusParserService } from '../../Services/cursus-parser.service';
@Component({
selector: 'app-bestand-toevoegen',
templateUrl: './bestand-toevoe... |
c579a3cb742b55147bcb0574b1b3856d6f09bcd8 | TypeScript | cyberabis/ng-training | /marks-form/src/app/user.service.ts | 2.796875 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class UserService {
//Shared attribute
userName: string;
//Initialize data
constructor(public http: HttpClient){
//this.userName = 'Anonymous User';
http.get('https:... |
454da7b79c5f072d77f97b01a7c3f2297b77f072 | TypeScript | hhy5277/miniprogram-adapter | /src/XMLHttpRequest.ts | 2.5625 | 3 | import EventTarget from "./EventTarget";
declare let my: any;
const _requestHeader = new Map();
const _responseHeader = new Map();
const _requestTask = new Map();
const contentTypes = {
json: "application/json",
text: "application/text",
arraybuffer: "application/octet-stream"
};
function _triggerEvent(type, ev... |
b71cac001772551f40238ca030459abb4b7d54d4 | TypeScript | wepyjs/wepy-templates | /templates/todolist/template/src/common/lib/stringOperation.ts | 3.078125 | 3 | export class String {
private static readonly regexNumber = /{(\d+(:\w*)?)}/g;
private static readonly regexObject = /{(\w+(:\w*)?)}/g;
public static Empty: string = '';
public static IsNullOrWhiteSpace(value: string): boolean {
try {
if (value == null || value == 'undefined')
... |
5125dbaace379174a28db2badef79c5e636101ee | TypeScript | NiyazNz/ng-favicon | /projects/ng-favicon/src/lib/color.utils.spec.ts | 2.640625 | 3 | import {ColorUtils, RgbColor} from './color.utils';
const color: RgbColor = {
red: parseInt('cc', 16),
green: parseInt('ff', 16),
blue: parseInt('33', 16),
alpha: parseInt('ff', 16),
};
describe('ColorUtils', () => {
it('should convert hex', () => {
expect(ColorUtils.hexToRgba('#ccff33')... |
9b01b65f94548a994c1b58543a3012cd72300374 | TypeScript | island-is/island.is | /libs/judicial-system/message/src/lib/test/random.ts | 3.3125 | 3 | // eslint-disable-next-line @typescript-eslint/ban-types
export function randomEnum<T extends {}>(anEnum: T): T[keyof T] {
const enumValues = (Object.keys(anEnum) as unknown) as T[keyof T][]
const randomIndex = Math.floor(Math.random() * enumValues.length)
const randomEnumValue = enumValues[randomIndex]
return ... |
748afde7b6f5f9d6e9a1d6fd27b0f279e3bd8795 | TypeScript | jereef/mmRTLS | /ctrlSrv/app/src/streams/markers/types.ts | 2.734375 | 3 | import type { Beacon } from '$src/interfaces/beacon.interface';
import type { NavDevice } from '$src/interfaces/nav-device.interface';
export enum MarkerType {
BEACON = 'BEACON',
NAVDEV = 'NAVDEV',
DEFAULT = 'DEFAULT'
}
export interface Marker {
id: string;
type: MarkerType;
icon?: string;
x: number;
y: numbe... |
590f4e02d73c7c768c8df0cc32008263f16db7f2 | TypeScript | ismaelalvesgit/angular4-loja | /src/app/carrinho.service.ts | 2.90625 | 3 | import { Carrinho } from './shared/carrinho.model';
import { Oferta } from './shared/ofertas.model';
export class CarrinhoService{
public items: Carrinho[] = []
constructor(){}
public exibirItems(): Carrinho[] {
return this.items
}
public itemsCarrinho(oferta: Oferta)... |
f835ae717c7fd5e4181af1627215498d6a8bc02e | TypeScript | yckao/kubernetes-models-ts | /utils/read-input/src/read.ts | 2.5625 | 3 | import getStdin from "get-stdin";
import { readFile } from "fs";
import { promisify } from "util";
import { httpGet } from "./http";
const readFileAsync = promisify(readFile);
const urlRegex = /^https?:\/\//;
export async function readInput(path: string): Promise<string> {
if (path === "-") {
return getStdin();... |
7994fc473ed29243b4767b15b3f8771b73b54939 | TypeScript | Antekirta/tabulas | /server/router/REST/collections.ts | 2.515625 | 3 | import express from 'express'
import {modelsManager} from "../../../db/utils/models-manager";
import {ISchema} from "../../../db/interfaces/mongoose";
import {QUERY_PARAMS} from "../../../shared/registry/QUERY_PARAMS";
export interface ICollectionRoute {
modelPrettyName: string
urlParam: string
}
export const... |
b59a4df690119da4bef52db78ccd700cf7deba18 | TypeScript | IamRajatBadjatya/Angular-Boilerplate | /src/app/reacitve-form-assignment/validatePassword.validator.ts | 2.609375 | 3 | import { AbstractControl, ValidationErrors } from '@angular/forms';
export class ValidatePassword{
static validateOldPassword(control: AbstractControl): Promise<ValidationErrors | null> {
return new Promise(
(resolve,reject) => {
setTimeout(()=>{
if(control.value !== "r... |
8689b51ffbb876b8decc313b6c67c5945024b911 | TypeScript | sharifbubuka/course-data-structures-and-algorithms | /tests/data-structures/linear/stack/stack.test.ts | 3.625 | 4 | import ArrayStack from "../../../../src/data-structures/linear/stack/array-implementation-of-stack";
import SinglyLinkedListStack from "../../../../src/data-structures/linear/stack/singly-linked-list-implementation-of-stack";
describe('Stack Tests', () => {
let arrayStack: ArrayStack;
let singlyLinkedListStack... |
17f569740b05cff3810babec27626270cdd4e3ca | TypeScript | SethDavenport/ng2-redux | /src/components/sub-store.spec.ts | 2.65625 | 3 | import { NgZone } from '@angular/core';
import { async } from '@angular/core/testing'
import { NgRedux } from './ng-redux';
class MockNgZone { run = fn => fn() }
describe('Substore', () => {
const defaultReducer = (state, action) => state;
const ngRedux = new NgRedux(new MockNgZone() as NgZone);
ngRedux.configu... |
7170bcbf87c0557fc883b8c3a997425121053904 | TypeScript | NemoTravel/flights.search.widget | /src/__tests__/utils.spec.ts | 2.640625 | 3 | import { getAltLayout, encodeURLParams } from '../utils';
/* global describe */
/* global it */
/* global expect */
describe('utils', () => {
describe('getAltLayout', () => {
it('should return `vjcrdf` when `москва` passed', () => {
expect(getAltLayout('москва')).toBe('vjcrdf');
});
it('should return `москв... |
3127385f99b2b2c04fb7d2a917c42d618c8c0af4 | TypeScript | rob-myers/rob-myers.github.io | /model/geom/vector.model.ts | 3.46875 | 3 | export class Vector {
constructor(
public x = 0,
public y = 0,
) {}
add(other: VectorJson) {
this.x += other.x;
this.y += other.y;
return this;
}
public get angle() {
return Math.atan2(this.y, this.x);
}
static average(vectors: Vector[]) {
return vectors.length
? ve... |
9855ad3b0d87a0b14b73081caedc3c08f01d2a55 | TypeScript | thirdslipper/JenkinsBuild | /week4master/TypeScript/Bank/main.ts | 2.9375 | 3 | import { User } from './user';
import { Account } from './account';
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
var users = [
new User('rorr', 'pass'),
new User('jamarius', 'pass'),
new User('seth', 'notpass'),
n... |
b7a68bcf154024d7b8732e79d8a22589dc982eaf | TypeScript | alexeiskachykhin/fxaudio | /sources/components/effects/overdrive/overdriveCircuit.ts | 2.59375 | 3 | /// <reference path="../../../_references.ts" />
namespace FXAudio {
'use strict';
export class OverdriveCircuit extends Circuit {
private _waveShaperNode: WaveShaperNode;
private _lowPassFilterNode: BiquadFilterNode;
private _gainNode: GainNode;
private _drive: number;
... |
7c358e674d580f63c3bb3f61af4f31273a306a6b | TypeScript | seanadipose/mediashare | /apps/mediashare/src/state/modules/media-items/index.ts | 2.53125 | 3 | import { createAsyncThunk, createReducer } from '@reduxjs/toolkit';
import { makeEnum } from '../../core/factory';
import * as reducers from '../../core/reducers';
import { ApiService } from '../../apis';
import { CreateMediaItemDto, UpdateMediaItemDto } from '../../../api';
const MEDIA_ITEM_ACTIONS = ['GET_MEDIA_I... |
2695ba475c3dbe166511dd3c9272e4a36b40689c | TypeScript | AnastasiiaReida/html5_css3 | /src/validator-selector.ts | 2.71875 | 3 | /// <reference path="validator-strategies.ts" />
namespace Validation {
export class ValidatorSelector {
private static validators: { [id: string]: Validation.ValidationStrategy } = {}
static initialize() {
ValidatorSelector.validators["required"] = new RequiresValidator();
... |
91fc2bc7a55866fa309346727abeef9fe5ca1bf0 | TypeScript | Heiyuan/firing_balls | /assets/src/common/localStorage/LocalStorage.ts | 2.8125 | 3 | import SingletonClass from "../base/SingletonClass";
export class LocalStorage extends SingletonClass {
public static ins() {
return super.ins() as LocalStorage
}
private _game_key = 'nonstop_balls_tt_'
public setLocal(key: string, value) {
try {
if (typeof value == 'obj... |
0edcc3b4ea6543fbeafd126da22d9217adcf3539 | TypeScript | gungorbudak/composer | /src/app/auth/model/auth-credentials.ts | 2.765625 | 3 | import { User } from "../../../../electron/src/sbg-api-client/interfaces/user";
import { UserPlatformIdentifier } from "./user-platform-identifier";
interface PlatformEntry {
name: string;
shortName: string;
platformURL: string;
}
export class AuthCredentials implements UserPlatformIdentifier {
stati... |
dfe5da1d0e26a8f97064a0b9d5d29d945af07973 | TypeScript | liuxinglu/wuziqi | /src/app/qipan/model/DataHandler.ts | 2.640625 | 3 | module app {
export class DataHandler{
public constructor() {
}
public sendMessageToServer(vd:Object) {
let tempvd = lxl.Tool.copyObject(vd);
let o:Object = {action:'publicMessage', data:tempvd};
lxl.Tool.callJS("sendMsg", o);
}
/**
* 由老师端设置用户列表 然后学生端通过getUserList获取
*/
public setUserList(a... |
adcaa913d22b936d34e7ea03ad4e419c1557332b | TypeScript | mattiash/purple-tape | /lib/xunit.ts | 2.96875 | 3 | import { PurpleTapeTest } from './purple-tape-test'
export type TestEntryResult = {
name: string
durationMs: number
assertions: number
status: 'success' | 'failed' | 'error' | 'skipped'
message: string | undefined // Details for failed or error status
}
export type TestReport = {
name: string
... |
a40d9738f4425fbc82b92177b90c749a0cc9004b | TypeScript | hokimcuc0202/kintone-ui-component | /src/js/Text/__tests__/setValue.test.ts | 2.796875 | 3 | /* eslint-disable @typescript-eslint/no-empty-function */
import '@testing-library/jest-dom/extend-expect';
import Text from '../index';
const messages = {
INVALID_ARGUMENT: 'Error: invalid function arguments'
};
describe('[JS] Text', () => {
beforeEach(() => {
jest.spyOn(console, 'error');
// @ts-ignore
... |
95eebd717302e5dea999b8ccfc5015f0cd8ae7e4 | TypeScript | pongo/xpepisode_fuse | /src/Scorer.ts | 3.375 | 3 | export default class Scorer {
private itsThrows: number[] = Array(21);
private itsCurrentThrow: number = 0;
private ball: number = 0;
addThrow(pins: number): void {
this.itsThrows[this.itsCurrentThrow] = pins;
this.itsCurrentThrow += 1;
}
scoreForFrame(theFrame: number): number {
this.ball = 0... |
6e18cb91cca8f6ecefff1d0173762e9f2c3be29b | TypeScript | asfernandes/node-firebird-drivers | /packages/node-firebird-driver/src/lib/impl/date-time.ts | 2.75 | 3 | /*******************************************************************************
The MIT License (MIT)
Copyright (c) 2013-2016 Hajime Nakagami
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 with... |
ecb516a5d0ed085c11125c9c6a6d29554fd43f8c | TypeScript | pascalwhoop/steak-web | /src/app/administration/admin-day-offers-card/admin-day-offers-card.component.ts | 2.59375 | 3 | import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {Offer} from '../../shared/model/Offer';
import {EditMode, STANDARD_DESCRIPTIONS, STANDARD_TIMES} from '../../core/util/util.service';
import {OfferFormDialogComponent} from '../offer-form-dialog/offer-form-dialog.component';
import {M... |
0ae541ab822c17e9667c7bbf6f29afbcf17c407d | TypeScript | firmoholanda/studying | /turing.com/validParentheses.ts | 4.15625 | 4 | // given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
// An input string is valid if:
// Open brackets must be closed by the same type of brackets.
// Open brackets must be closed in the correct order.
//
//
// Example 1:
// Input: s = "()"
// Out... |
2efd04b6291dc54c2dc56fdf582a72f24be67b1e | TypeScript | indifferentghost/milo | /src/EventEmitter.ts | 3.015625 | 3 | import UnorderedMap from "./#{target}/UnorderedMap";
import IUnorderedMap from "./IUnorderedMap";
import { EventListenerCallback } from "./types";
interface EventConnection {
listener: EventListenerCallback;
once: true;
};
type EventConnectionType = EventConnection | EventListenerCallback;
export default cla... |
8541115a4782a0d4960fbaa682a133858c4567ab | TypeScript | RaulROR/angular-e4ss | /src/app/gservice.service.ts | 2.515625 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class GserviceService {
constructor(private cliente:HttpClient) { };
get(nombreLibro:String){
console.log('Criterio de busqueda:'+nombreLibro);
const volumes: object[] = [];
con... |
4dc22ec62bc92fc30c39c37c78344cb31dd77017 | TypeScript | jeremytrigano/codewars-typescript | /findTheParityOutlier/findTheParityOutlier.sol.ts | 3.28125 | 3 | export function findOutlier(integers: number[]): number {
if (integers.slice(0, 3).filter((i) => i % 2 !== 0).length > 1) {
return integers.find((v) => v % 2 === 0) || 0;
} else {
return integers.find((v) => v % 2 !== 0) || 0;
}
}
|
64885b07d8200a4f8c84917b042143ba60665478 | TypeScript | Chandehehe/fermenter-app | /service/api/src/persistence/fermentation-table.ts | 2.578125 | 3 | import { Fermentation, FermentationModel } from '../domain';
import { postgresClient } from './postgres-db';
const tableName = 'fermentations';
export const FermentationTable = {
create: async (userId: Fermentation['userId'], params: Partial<Fermentation>): Promise<void> => {
const { name, active, targetTempera... |
1ab889af2759530995426f8333a167761996a663 | TypeScript | RichardMViGEM/angular-json-schema-form-layout | /src/app/change-information/change-information.component.ts | 2.59375 | 3 | import { Component, Input, OnInit } from '@angular/core';
@Component({
selector: 'app-change-information',
templateUrl: './change-information.component.html',
styleUrls: ['./change-information.component.css']
})
/**
* use this component in any other component of the app
* pass boolean values to indicate which... |
3ce93ce2635db4fdb7a68fbb64bcc1276d13893c | TypeScript | ZhouZhiW/egret-game-library | /egret_h5/egret_消除/src/data/MapControl.ts | 2.890625 | 3 | class MapControl {
public constructor() {
}
/**
* 创建全地图元素
*/
public createElementAllMap(){
this.createAllMap();
}
/**
* 创建全部地图元素
* 游戏开始时调用
*/
public createAllMap(){
let len:number = GameData.MaxColumn * GameData.MaxRow;
let type:string = "";
let haveLink:boolean =true;
let id:number =0;
l... |
29f1823a49383db0172a999ed3bdfe49255b9264 | TypeScript | vanessanova/EIA2 | /Aufgabe5/skier.ts | 3.140625 | 3 |
namespace Aufgabe5 {
export class Skier{ //export macht klassen ber datei hinweg grenzen nutzbar
x: number;
y: number;
colorHead: string;
colorBody: string;
constructor () { //constructor nimmt infos entgegen, so kann beim konstru... |
60ee6c16d989d03688c83e112093c6815a9aa779 | TypeScript | adrianhunter/essence | /src/tests/parser.ts | 2.921875 | 3 | import { lex } from '../lexer'
import { parse } from '../parser'
describe('Parser', () => {
describe('Expressions', () => {
it('should parse identifiers', () => {
let input = `identifier`
let output = [{
nodeType: 'Identifier',
content: 'identifier',
position: {
line: 1,
column: 1,
}... |
def3374d6922b959f744f6f26add0a2ff73661b6 | TypeScript | itsbth/webgl2-term | /src/TermWriter.ts | 3.015625 | 3 | import runes = require("runes");
import GlTerminal from "./GlTerminal";
type Color = [number, number, number, number];
export default class TermWriter {
private fg: Color = [1, 1, 1, 1];
private bg: Color = [0, 0, 0, 0];
private col: number;
private row: number;
private pendingFlush: boolean = false;
constr... |
b6e7a90c8425ffeb7c599183286095e3d86fb696 | TypeScript | rsuite/rsuite | /src/utils/useClickOutside.ts | 2.96875 | 3 | import { useEffect, useRef } from 'react';
export interface UseClickOutsideOptions {
enabled?: boolean;
isOutside: (event: MouseEvent) => boolean;
handle: (event: MouseEvent) => void;
}
export default function useClickOutside({
enabled = true,
isOutside,
handle
}: UseClickOutsideOptions) {
const isOutsi... |
392934c374ad95d4e2183e07e3a33c8a95be0f01 | TypeScript | ayeressian/db-viewer-component | /src/types/column.ts | 2.6875 | 3 | import Table from "../table";
export interface Fk {
table: Table;
column: ColumnNoneFk;
}
export interface ColumnNoneFk {
name: string;
elem?: HTMLTableRowElement;
pk?: boolean;
uq?: boolean;
nn?: boolean;
type: string;
}
export interface ColumnFk extends Omit<ColumnNoneFk, "type"> {
fk?: Fk;
}
ex... |
b89f74c7fccb2f75f2318fabde61d1d06c836c4d | TypeScript | alexandraveres7/Tic-Tac-Toe | /src/app/square/square.component.ts | 2.640625 | 3 | import { Component, Input} from '@angular/core';
@Component({
selector: 'app-square',
template: `
<button nbButton *ngIf="!value" [disabled]="!!playGame">{{ value }} </button>
<button id="myX" nbButton hero status="success" *ngIf="value == 'X'" [disabled]="!!playGame">{{ value }} </button>
<button id="myY... |
a137bfd7a57f34e143ade9aece6b3a9f2ae871f3 | TypeScript | andresgutgon/instagram-graph-api-lib | /src/main/Constants.ts | 2.609375 | 3 | /**
* Class containing Constants used throughout the project.
*
* @author Tiago Grosso <tiagogrosso99@gmail.com>
* @since 0.1.0
*/
export class Constants {
/**
* The URL of the api.
*/
static readonly API_URL: string = 'https://graph.facebook.com';
}
|
ab0f424906c830ba89cd8dcead01621ebec853ae | TypeScript | kgolezardi/Performance-Review-Web | /src/shared/hooks/useSortBy.ts | 3.328125 | 3 | import { useState } from 'react';
type Order = 'asc' | 'desc';
function descendingComparator<T>(a: T, b: T, orderBy: keyof T) {
if (b[orderBy] < a[orderBy]) {
return -1;
}
if (b[orderBy] > a[orderBy]) {
return 1;
}
return 0;
}
export function getComparator<Key extends keyof any>(
order: Order,
... |
41dd10aecf1630b5f48b8402527c4dfd1055938f | TypeScript | Z-HNAN/taro-redux-saga-seed | /src/pages/index/reducer.js | 2.890625 | 3 | const INITIAL_STATE = {
num: 0
}
export default function counter (state = INITIAL_STATE, action) {
switch (action.type) {
case 'ADD':
return {
...state,
num: state.num + 1
}
case 'MINUS':
return {
...state,
num: state.num - 1
}
default:
... |
72c02048a2072ae27c18da3b0dcbc9b03ccf7f54 | TypeScript | mickaelvieira/webcam-demo | /src/editor/download.ts | 2.5625 | 3 | export default class Download {
filename = "download.png";
button: HTMLAnchorElement;
constructor(button: HTMLAnchorElement) {
this.button = button;
this.button.download = this.filename;
}
update(data: string): void {
this.button.href = data;
}
}
|
66c2c1e830832a8a85d3327d6f6f212f5c412588 | TypeScript | test-belbina/test_belbina | /src/store/blocks/reducer.ts | 2.6875 | 3 | import { Map } from "immutable";
import { ActionTypesInfer } from "src/store/actionTypes";
import * as types from "./types";
import * as actions from "./actions";
import Block from "src/models/block";
export type TStoreBlock = Map<Block["id"], Block>;
const reducer = (state: TStoreBlock = Map(), action: ActionTypesIn... |
d20a10700e21402bfcbf44fab81eb397b0d0d432 | TypeScript | tomek401273/webshop | /src/app/model/directory-titles.ts | 2.625 | 3 | export class DirectoryTitles {
private _titles: String[];
constructor() {
}
get titles(): String[] {
return this._titles;
}
set titles(value: String[]) {
this._titles = value;
}
}
|
cfc002567cbde423f14ca8708126437cd0ebb7bd | TypeScript | plusxp/nstarter-ts-express | /template/src/utils/utils.common.ts | 2.6875 | 3 | export class CommonUtils {
public static getName() {
return;
}
public static async sleep (timeMs: number) {
return new Promise((r) => setTimeout(r, timeMs));
}
}
|
9e12d7760cd974e2a20338aee97016801b479af9 | TypeScript | ethanfann/leetcode | /src/70/70.test.ts | 2.734375 | 3 | import climbStairs from './70'
test('expects 0 stairs to return 1', () => {
expect(climbStairs(0)).toEqual(1)
})
test('expects 1 stair to return 1', () => {
expect(climbStairs(1)).toEqual(1)
})
test('expects 2 stairs to return 2', () => {
expect(climbStairs(2)).toEqual(2)
})
test('expects 3 stairs to return 3... |
07ddb5f589a3a31e15b0cc6f758dbdf1e17e82cf | TypeScript | meacer/deasciifier | /src/typescript/benchmark/cleanup.ts | 3.375 | 3 | // Cleans up Turkish text.
//
// Skips characters that are not Latin or Turkish and drops certain characters
// such as combining dot above.
import * as deasciifier from '../deasciifier'
import * as fs from "fs";
import * as process from "process"
if (process.argv.length <= 2) {
throw "Usage: cleanup <input_file> <... |
c32102f7d9688a845836af29cf276c8ccce9b2eb | TypeScript | wilsonmoraes/Yaeeh-Utils | /TypeScript/validators.ts | 3.140625 | 3 | private validarCPF(cpf: string) {
cpf = cpf.replace(/[^\d]+/g, '');
if (cpf == '') {
return false;
}
let CPFinvalidosConhecidos = {
'00000000000': true,
'11111111111': true,
'22222222222': true,
'33333333333': true,
... |
9518e1bbb32c89356d69d4b8c5dc4078047ca48c | TypeScript | theredhead/formatByteSize | /tests/formatByteSize.simple.test.ts | 2.84375 | 3 | /** @format */
import { formatByteSize } from "../src/formatByteSize";
describe("formatByteSize", () => {
it("can handle some known values", () => {
expect(formatByteSize(100)).toBe("100B");
expect(formatByteSize(1024)).toBe("1KB");
expect(formatByteSize(1024 * 1024 * 1024 * 1.2)).toBe("1.20GB");
});... |
ecbbe0929612127f5318002e2228db0f26af4b4f | TypeScript | lbwa/docs-server | /src/generator/base.ts | 2.796875 | 3 | const glob = require('glob')
const path = require('path')
const fs = require('fs')
function createError () {
console.error('[Error]: This function should be implemented by subclass')
}
export = class BaseGenerator {
cwd: string
constructor () {}
/**
* get All markdown files paths
* @return {Promise<voi... |
cf1f7f77085edbb08002feba586d803b4e97dd32 | TypeScript | RioloGiuseppe/byte-serializer | /dist/interfaces/crc.d.ts | 2.875 | 3 | /// <reference types="node" />
import { CrcLength } from './../enums/crcLength';
/**
* Define the interface for CRC algorithm injection
*/
export interface CRC {
compute(data: Array<number>): Buffer;
}
/**
* Define metadata for crc
*/
export interface CRCMetadata {
/**
* Define the position of the firs... |
64869b65db0d2cc684324dc790ad487963dfbe87 | TypeScript | cristianTertuliano/zen-api | /src/core/entity/user/user.entity.ts | 2.546875 | 3 | import { Column, Entity, OneToOne, RelationId, OneToMany, Unique, Index, JoinColumn } from "typeorm";
import {
IsBoolean,
IsEmail,
IsEnum,
IsNotEmpty,
IsOptional,
IsString,
MaxLength,
MinLength,
} from 'class-validator';
import { BaseResourceEntity } from "@core/base/base-entity";
import { Email } from... |
db702ee79dffe8eaf630129b3aae94ce5dc7ad2c | TypeScript | christianhg/match-match | /src/index.ts | 2.578125 | 3 | import { Card } from './game/card';
import { createGame } from './game/game';
import { createImageService } from './game/image-service';
import { getPixabayImages } from './pixabay';
const cardContainer = document.querySelector('#cards')!;
createGame({
imageService: createImageService('match', {
getImages: getP... |
060d0bcf709168b77a8e975d8ccc6a4f0e3ef94f | TypeScript | craciuncezar/visx | /packages/visx-scale/test/createScale.test.ts | 2.984375 | 3 | import { createScale } from '../src';
describe('createScale()', () => {
it('linear', () => {
const scale = createScale({ type: 'linear', domain: [0, 10], range: [2, 4] });
expect(scale(5)).toEqual(3);
});
it('fallbacks to linear if type is not defined', () => {
const scale = createScale({ domain: [0,... |
819b732affdf31d18fedb0d0840fbaabb8dc82b4 | TypeScript | DevRobert/psycollect-ui | /src/model/AuthenticationApi.ts | 2.78125 | 3 | import { apiBaseUri } from "./ApiHelpers";
interface LoginResponse {
token: string
}
export async function login(email: string, password: string): Promise<LoginResponse> {
const requestUri = apiBaseUri + 'login'
const response = await fetch(requestUri, {
method: 'POST',
headers: new Heade... |
ef9763491971f73a5912c9ca7832d4e5c6ae0f9f | TypeScript | Stentroll/AutoFilerTS | /TSclasses/DaySecCalculator.ts | 3.109375 | 3 | class DaySecCalculator {
mainDiv: HTMLDivElement;
secDiv: HTMLDivElement;
dayDiv: HTMLDivElement;
secLabel: HTMLLabelElement;
dayLabel: HTMLLabelElement;;
dayInput: HTMLInputElement;
secInput: HTMLInputElement;
constructor() {
this.mainDiv = document.createElement("div");
... |
1d77efd91ce4221926643e920c3dc1f5c61cfb11 | TypeScript | luomus/laji | /projects/laji/src/app/shared/local-db/local-db.abstract.ts | 2.703125 | 3 | import * as localForage from 'localforage';
import { from as ObservableFrom, Observable, of as ObservableOf } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
export abstract class LocalDb<T> {
protected db: LocalForage;
protected constructor(dbName = 'cache', protected isPlatformBrowser = true) {
... |
b5bf470d7b5ce686ea8e15ac772b8eeff6369bb6 | TypeScript | awhipple/giraphql | /packages/core/test/examples/starwars/schema/droid.ts | 2.609375 | 3 | import Character from './character';
import builder from '../builder';
export default builder.createObjectType('Droid', {
description: 'A mechanical creature in the Star Wars universe.',
implements: [Character],
isType: item => item.type === 'Droid',
shape: t => ({
primaryFunction: t.string({
descrip... |
11680cd1657defec8dc08beb17f79bebc1595d42 | TypeScript | AndreyArthur/park-server | /src/tests/app/adapters/Encrypter.spec.ts | 2.859375 | 3 | import { Encrypter } from '@/application/adapters';
import { randomString } from '@/tests/helpers/generators';
describe('Encrypter Adapter', () => {
// To avoid jest coverage bugs with static methods
it('should create an instance of Encrypter', () => {
const encrypter = new Encrypter();
expect(encrypter).... |
f82740452f18b69b4c7d3512baefccd01d560586 | TypeScript | vladfind/data-knu-v-1 | /client/src/types.ts | 3 | 3 | export interface User {
name: string;
workNumber: string;
mobileNumber: string;
birthday: string;
email: string;
category: string;
location: string;
note: string;
}
export interface Cat {
text: string;
}
type KeysEnum<T> = { [p in keyof Required<T>]: string };
export const engToRusField: KeysEnum<U... |
e6cd546de8e9576256ca98e0913a6624eeb02a0b | TypeScript | zealves/angular7-basic-example | /src/app/customers/customer.model.ts | 2.8125 | 3 | export class Customer {
public name: string
public age: number
public subscriptions = []
constructor(name: string, age: number, subscriptions: any) {
this.name = name
this.age = age
this.subscriptions = subscriptions
}
} |
d4133a9b00b7684b7db29adb42b8e7214bdea34b | TypeScript | coyotte508/mongo-limiter | /index.ts | 2.953125 | 3 | import * as mongoose from "mongoose";
import actionSchema, { ActionLogDocument } from "./src/schema";
import MongoLimiterError from "./src/mongo-limiter-error";
type UserActions = mongoose.Model<ActionLogDocument>;
export interface Limit {
/** Maximum number of times the action can be done */
limit: number;
/**... |
171ca68be778257f89b6340973ce723d56b2b24f | TypeScript | elrafapc/Unit-JUpiter-TypeScript | /spec/ShoppingCartTest.spec.ts | 2.90625 | 3 | import { Book } from "../src/Book";
import { ShoppingCart } from "../src/ShoppingCart";
const cart: ShoppingCart = new ShoppingCart();
describe("Testing Functions From ShoppingCart", () =>{
it("Verifying the count items from cart", () =>{
cart.addBook(new Book("Book1", 10, "1"));
cart.addBook... |
80a8328a280cdb473fd640b61eab077e53522377 | TypeScript | Covisource/covisource-api | /src/validators/categoryValidator.ts | 2.78125 | 3 | import express from "express";
import categoryModel from "../models/categoryModel";
export const newCategoryValidator = async (
req: express.Request,
res: express.Response,
next: express.NextFunction
) => {
const { name, extraParameters } = req.body;
const { user } = req as any;
if (!name) {
return ne... |
9951a6957e42c6b66ae52ab2d40d29b06b5eb4c9 | TypeScript | havelessbemore/dastal | /src/collection/index.ts | 3.140625 | 3 | import { Collection } from './collection';
export * from './collection';
/**
* Check if a value is a {@link Collection}.
*
* @param obj - The value to check.
*
* @returns - `true` if obj is a Collection, `false` otherwise.
*/
export function isCollection(obj: any): obj is Collection<unknown> {
return (
... |
483553e5a44849ea795676c640ba932c95fa1b32 | TypeScript | dudubs/fullstack-template | /src/server/tests/setupTests.ts | 2.671875 | 3 | import { createConnection } from "typeorm";
import { Session } from "../entities/Session";
import { User } from "../entities/User";
import { encryptPassword } from "../utils/encryptPassword";
export const testUser = {
entity: null as null | User,
password: "123",
};
export const testUsersEntities: User[] = [];
b... |
9bcf00e1b6f26c01cb6af0188c81f97c491bb842 | TypeScript | textlint/textlint | /packages/@textlint/types/src/Rule/TextlintRuleOptions.ts | 2.71875 | 3 | /**
* textlint rule option values is object or boolean.
* if this option value is false, disable the rule.
*/
import { TextlintRuleSeverityLevel } from "./TextlintRuleSeverityLevel";
export type TextlintRuleOptions<T extends object = {}> = {
[index: string]: any;
severity?: TextlintRuleSeverityLevel;
} & T;... |
1f4f4acf603a7e36a066bcc7f499d2931c9f6c8f | TypeScript | Tasse00/VisualComDev | /src/components/Editor/Providers/Editor/actions.ts | 2.546875 | 3 | interface ActCreateInstance {
type: 'create-instance';
payload: {
parentId: string;
comId: string;
position?: number; // 插入位置
};
}
interface ActMoveInstnce {
type: 'move-instance';
payload: {
parentId: string;
instanceId: string;
position?: number; // 插入位置
};
}
interface ActDelInsta... |
484a5cde4cbaafc14f8312a998d72638920652ca | TypeScript | MouseLightProject/pipeline-scheduler | /server/data-access/sequelize/project-connectors/adjacentTileStageConnector.ts | 2.515625 | 3 | import {Instance, Model} from "sequelize";
import {generatePipelineCustomTableName, IToProcessTileAttributes, StageTableConnector} from "./stageTableConnector";
export interface IAdjacentTileAttributes {
relative_path: string,
adjacent_relative_path: string;
adjacent_tile_name: string;
}
export interface... |
a10818f949c379236025e74fd43dba7e50ff04c5 | TypeScript | henry-alakazhang/pokemon-autochess | /src/objects/pokemon.object.ts | 2.9375 | 3 | import { Status } from '../core/game.model';
import { Pokemon, pokemonData, PokemonName } from '../core/pokemon.model';
import { generateId, getBaseTexture } from '../helpers';
import { boundRange } from '../math.helpers';
import { Coords, getTurnDelay } from '../scenes/game/combat/combat.helpers';
import { FloatingTex... |
35563daef505c07a111afc2d6635c461ed467813 | TypeScript | robmillersoftware/encounter-manager | /src/networking/p2p/p2pmessage.ts | 3.1875 | 3 | export enum P2PTypes {
MESSAGE,
JOIN,
LEAVE,
BROADCAST,
DISCOVERED,
SYNC,
CONNECTED
}
interface P2PMessageData {
type: P2PTypes,
sourceAddress?: string,
message?: string
}
export class P2PMessage {
public source: string;
public message: string;
public type: P2PTypes;
constructor(data: P2P... |
c4321f51d1f89a36bbf892067be76d67ca8a009e | TypeScript | namtx/reactshop | /src/ProductReducers.ts | 2.84375 | 3 | import { Reducer } from "redux"
import { IProductsState, ProductsActions, ProductsActionTypes } from "./ProductsTypes"
const initialProductsState: IProductsState = {
products: [],
productsLoading: false
}
export const productsReducer: Reducer<IProductsState, ProductsActions> = (state = initialProductsState, actio... |
80a899a8824a72438c360e54c603166f04136be2 | TypeScript | Percegaroli/outboxup | /src/styles/theme.ts | 2.515625 | 3 | const colors = {
primary: '#AC6DDE',
lightGrey:'#F5F5F6',
dark: '#181820'
}
export const theme: ThemeInterface = {
typography: {
colors:{
primary: colors.primary,
light: colors.lightGrey
},
size: {
lg: '4.2rem',
md: '2.6rem',
sm: '1.6rem'
}
},
background: {
... |
64a7a6f667cfce3fb4fbf29626d2120e9b4398c6 | TypeScript | MariaCassandra/angular-basic | /src/app/contact/contact.component.ts | 2.515625 | 3 | import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
@Component({
selector: 'app-contact',
templateUrl: './contact.component.html',
styleUrls: ['./contact.component.css']
})
export class ContactComponent implements OnInit {
contactForm: Fo... |
35e965a73b79640113fadbe97f2479ed15d1a27f | TypeScript | vundev/Snake | /src/view/layout/SpriteSheet.ts | 2.765625 | 3 | ///<reference path="IMovieClip.ts"/>
/**
* Created by Atanas Vasilev at avant.vasilev@gmail.com.
*/
namespace layout {
import MovieClip = PIXI.extras.MovieClip;
import Texture = PIXI.Texture;
export class SpriteSheet extends MovieClip implements IMovieClip {
protected _frames: Array<Frame>... |
20998f78cac6bf71ac598cded0a9f16a86ac0cde | TypeScript | spitfiremunguia/viaro_nodeks | /src/services/auth.service.ts | 2.671875 | 3 | import jsonwebtoken from 'jsonwebtoken';
import {Credentials} from '../models/Credentials'
import {AuthRepository} from '../repositories/auth.repository';
import * as dotenv from 'dotenv';
dotenv.config();
// Sign token
export class AuthService
{
private authRepository:AuthRepository;
constructor(authRepositor... |
cf52c89e27bc839a973f676a30a4548b9ce127af | TypeScript | aga555/chart-api | /src/app/components/chartjs-utils.ts | 2.625 | 3 | // npm install chartjs --save
import * as Chart from 'chart.js';
// npm install chart.piecelabel.js --save
import 'chart.piecelabel.js';
/**
* this is simply used to init our chartjs
*
*/
export function initChart() {
const fontFamily = 'Work Sans, sans-serif';
// set defaults
Chart.defaults.global.defaultFon... |