Datasets:

blob_id
large_stringlengths
40
40
language
large_stringclasses
1 value
repo_name
large_stringlengths
5
119
path
large_stringlengths
4
271
score
float64
2.52
4.84
int_score
int64
3
5
text
stringlengths
26
4.09M
cf3c5375454703eef311a5e16e75c05afd07abf4
TypeScript
nmalyschkin/machine-map-demo
/src/eventSource.ts
2.921875
3
/** * @param handleNewEvent * @returns {function} cleanup function, to close the event source */ export default (handleNewEvent: (event) => {}) => { const ws = new WebSocket("ws://machinestream.herokuapp.com/api/v1/events/websocket?vsn=2.0.0"); ws.onopen = () => ws.send('["1", "1", "events", "phx_join"...
ca9033e7bfa0cc1264319182d38d31b5a694d1d5
TypeScript
cxwithyxy/tjb
/inject_js_lib/touch_emulator.ts
2.625
3
export = { "touch_emulator_init": () => { // 从别人的库中偷回来的代码 // https://github.com/hammerjs/touchemulator // 能用就行了不是吗 // 还要我搞一堆any包裹起来 // 真的烦为啥别人不用typescript写 var isMultiTouch = false; var multiTouchStartPos: any; var ...
f3280a8fb65f6bbfc377c9a847b73e5c17ac996b
TypeScript
dapriett/media-viewer
/projects/media-viewer/src/lib/annotations/services/tags/tags.services.ts
2.75
3
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { TagItemModel } from '../../models/tag-item.model'; @Injectable() export class TagsServices { public tagItems: {[id: string]: TagItemModel[]}; constructor(private http: HttpCl...
313a83a25fc7f0dd08ef0c03dc62d8622611368a
TypeScript
leipzig/fcs_upbrowse
/reactive/src/scripts/modules/todos/store.ts
3.140625
3
'use strict'; /*! * @version: 1.1.1 * @name: store * * @author: https://themeforest.net/user/flexlayers */ import {Item} from './item'; export default class Store { /** * @type {ItemList} */ private liveItems: Array<Item>; /** * @type {Storage} */ private localStorage: Storage...
592664c73f15c7017f0737e20d82397966a2b718
TypeScript
ynse01/cpu6510
/src/cpu/operations/noop/kil.ts
2.640625
3
import { AddressingMode } from "../../addressing-mode"; import { Processor } from "../../processor"; import { IOperationImplicit } from "../i-operation-implicit"; import { IOperationWithAddress } from "../i-operation-with-address"; import { IOperationWithValue } from "../i-operation-with-value"; /* eslint-disable @typ...
7e1ebce782cf3c109ab2a691443fec2d1c62d280
TypeScript
famo-lsd/pda
/client/src/Scripts/utils/number.ts
2.71875
3
import numeral from 'numeral'; // locales import 'numeral/locales/pt-pt'; import 'numeral/locales/de'; import 'numeral/locales/es-es'; import 'numeral/locales/fr'; window['numeral'] = numeral; export function convertNumeralToJS(number: any) { return !number ? number : number.toString().replace(new RegExp('\\' + ...
06dda67f5cde5fd5be315df72a3b15e76914dacf
TypeScript
hienkhieu/async
/src/main.ts
3.0625
3
import async from 'async'; // async.eachLimit([1, 2, 3, 4, 5], 2, (itemId, callback) => { // setTimeout(() => { // console.log("in with item Id: ", itemId); // }, 10000); // callback(); // }, function (err) { // if (err) { // console.log("err : ", err); // throw err; // } // }); fu...
f676c2b1d30df977e876d5abf2a2128bd2527067
TypeScript
openmusicgame/omgc-core
/src/types/animatable/notes/Wipe.ts
2.609375
3
import { Location, TimeValue } from "@/types/base/typeutil"; import { INote, Note } from "./Note"; export interface Wipe extends INote<"wipe"> { } export class WipeNote extends Note<"wipe"> implements Wipe { kind: "wipe" = "wipe"; constructor(public name: string, public location: Location, public beginTime: ...
0f71a9de184adfc3055e66d67e8fd869e3b1e452
TypeScript
parsehex/hit-scraper
/src/Settings/html/to/sort-type.ts
2.9375
3
import { sectionTitle, label, input, descriptionTitle } from '../_dom'; export default function () { return ` <div class="row"> <div class="column opts"> ${sectionTitle('Sort Type')} <p> ${label('Simple', 'stSim')} ${input('radio', { id: 'stSim', name: 'sortType', value: 'sim', checked: this.so...
ceb020af30a8d08d6f6342483bdabb28a8b4fcba
TypeScript
Manjunath3003/mernStack
/mernStack/strLi.ts
2.890625
3
function strLi(sList:string[]):void{ for(let i:number=0; i<sList.length;i++){ if(sList[i].toUpperCase()=='P'){ console.log(sList[i],i) } } } let sL:string[]=['a','p','c','d','m'] strLi(sL)
1a234b6628619a802bf56504eba68ed8a0516009
TypeScript
edrlab/thorium-reader
/src/utils/tryCatch.ts
2.53125
3
// ==LICENSE-BEGIN== // Copyright 2017 European Digital Reading Lab. All rights reserved. // Licensed to the Readium Foundation under one or more contributor license agreements. // Use of this source code is governed by a BSD-style license // that can be found in the LICENSE file exposed on Github (readium) in the proj...
cc228e135fb881fea6c5f810fba9b646edc011ec
TypeScript
suzukalight/study-styled-components-mixin-csstype-expo
/src/logics/reducers/types.ts
2.765625
3
export interface SerializedError { name?: string; message?: string; code?: string; stack?: string; } export interface PendingAction<ThunkArg> { type: string; payload: undefined; meta: { requestId: string; arg: ThunkArg; }; } export interface FulfilledAction<ThunkArg, PromiseResult> { type: s...
52bc941c4c7341aa3c102a809a1c5da2f43e5d9b
TypeScript
SystemDevelopTraining/oic-sns
/server/front/src/utils/AsyncOnce.ts
3.53125
4
// 同時に一度しか非同期の処理が行われないように保証される // 処理中にもう一つ実行しようとした場合はキャンセルされる export class AsyncOnce { private onceFlags = false; //同時に一度しか実行したくない処理を実行 public async Do<R>(f: () => R) :Promise<R|undefined>{ try { if (this.onceFlags)return; this.onceFlags = true; const result = await f(); this.once...
0d002696ae60a9f9564df7072c2b835eeef001da
TypeScript
fangsmile/page-test-webpack
/src/drawing/Core/Global.ts
2.84375
3
export class MouseInfo { curX: number; curY: number; lastX: number; lastY: number; isCanvas: boolean; constructor(curX: number, curY: number, lastX: number, lastY: number, isCanvas: boolean = false) { this.curX = curX; this.curY = curY; this.lastX = l...
eeb285f2dc9dfc4786b1df252020059939b46448
TypeScript
fahmi-idris/pokedex
/src/utils/__test__/formatter.test.ts
2.734375
3
import { renderPokemonImage, renderPokemonId, capitalize, formatHeight, formatWeight, getAllPokemon, toFeet, } from '../formatter'; import { pokemonDummy } from '../__fixtures__/dummyData'; describe('utils/formatter', () => { describe('renderPokemonImage', () => { test('should render pokemon image ...
74c7462625147919a3fdf569d9baf6d6f0846d89
TypeScript
riggs/binary-structures
/typings/transcode.d.ts
3.015625
3
import 'improved-map'; import { Size } from './serialization'; export declare type Primitive = number | string | ArrayBuffer; export declare type Mapped<T> = Map<string, T>; export declare type Encoded_Map = Mapped<any>; export declare type Encoded_Array = Array<any>; export declare type Encoded = Primitive | Encoded_M...
410240515e9483df5cb0cc19cb3cbf2741a73d04
TypeScript
cowwoc/requirements.js
/src/internal/VariableType.mts
3.84375
4
/** * Describes the type of a variable. */ class VariableType { public static readonly NULL = new VariableType("null"); public static readonly BOOLEAN = new VariableType("boolean"); public static readonly NUMBER = new VariableType("number"); public static readonly BIGINT = new VariableType("bigint"); public stat...
480a8dda19a87863d363539a6f7ef798ee56733c
TypeScript
danigb/smplr
/src/sampler/midi.ts
2.890625
3
function noteNameToMidi(note: string): number | undefined { const REGEX = /^([a-gA-G]?)(#{1,}|b{1,}|)(-?\d+)$/; const m = REGEX.exec(note); if (!m) return; const letter = m[1].toUpperCase(); if (!letter) return; const acc = m[2]; const alt = acc[0] === "b" ? -acc.length : acc.length; const oct = m[3] ?...
9befe2a086a9c0b1afd2d8a5b87ed68e0719eb83
TypeScript
xiaosasori/discord-clone-vite
/src/stores/channel.ts
2.8125
3
import { defineStore } from 'pinia' type ChannelState = { typingUsers: string[] } export const useChannel = defineStore('channel', { state: () => { return { typingUsers: [], } as ChannelState }, actions: { addTyping(username: string) { this.typingUsers.push(username) }, removeT...
39d6abeca2d83161fa3d21c394088720604234a8
TypeScript
jmw5598/grow-system
/_modules/@grow/common/src/lib/utilities/logger.service.ts
3.046875
3
import { LogType } from './log-type.enum'; export class Logger { constructor(public _class: string) {} public debug(message: string): void { this._log(LogType.DEBUG, message); } public warn(message: string): void { this._log(LogType.WARN, message); } public error(message: string): void { thi...
4620b40efd77799a964e71fd42f6519f1420bfe1
TypeScript
Sylvenas/color-transfer
/src/HSL/HSLToRGB.ts
3.1875
3
import { formatHSLAToNum } from '../utils' import { HSL_REG, HSLA_REG } from '../utils/reg' import { isNumeric } from '../utils/type-check' /** * HSL to RGB * @example * (h,s%,l%) => rgb(r,g,b) * (h,s%,l%,a) => rgb(r,g,b,a) * hsl(h,s%,l%) => rgb(r,g,b) * hsla(h,s%,l%,a) => rgb(r,g,b,a) * hsl(h s% l%) => rgb(r,g,...
b7809fa288e634cf5173f0a7546f85e11d431b1d
TypeScript
hookedjs/hookedjs
/src/lib/polyfills/iso/Map.ts
3.546875
4
/** * Extensions for String * * Note: Extending primitive's can be problematic without care. For more info, see * https://stackoverflow.com/questions/8859828/javascript-what-dangers-are-in-extending-array-prototype * * Tips: * 1. for...in will break if you naively extend via Set.propotype.foo = ... * Instead...
c4c5ba3b5d95503d8cc56cf188344cd71a85cb10
TypeScript
aaf1974/AngularLerningSolution
/ClientApp/src/app/samples/timer/timer.component.ts
2.625
3
import { Component } from "@angular/core"; import { timer } from "rxjs"; @Component({ selector: 'app-samples-timer', templateUrl: './timer.component.html' }) export class TimerSampleComponent { //let dateTime = new Date(); startTime: Date = new Date(); endTime: Date = null;//new Date(); /**Пример исп...
fad5ee22848737ba0e9391772f58f27b171f1ad8
TypeScript
greenn-lab/egovframe-msa-edu
/frontend/portal/src/service/Login.ts
2.59375
3
import { ACCESS_TOKEN, AUTH_USER_ID, CLAIM_NAME } from '@constants/env' import axios from 'axios' const JWT_EXPIRED_TIME = 1800000 const LOGIN_SERVICE_URL = `/api/login/user-service` const LOGIN_URL = `/login` const CLIENT_REFRESH_URL = '/api/login/user-service/api/v1/users/token/refresh' export interface ILogin { ...
969cf5c418fe92e2cfe9adc85718d0931ae670c3
TypeScript
wankhede04/basic-math
/src/app/add-numbers/add-numbers.component.ts
2.609375
3
import { Component, OnDestroy } from '@angular/core'; import { BehaviorSubject, Subscription } from 'rxjs'; import { IAdditionValues, ITimeStamps } from '../models/addition'; import { take, tap } from 'rxjs/operators'; @Component({ selector: 'app-add-numbers', templateUrl: './add-numbers.component.html', styleUr...
f3120852615aac80ac9e3a1eb46f7ae22630d8e2
TypeScript
youri333/code-morce
/main.ts
2.828125
3
input.onButtonPressed(Button.A, function () { code_morse = "" + code_morse + "1" }) input.onButtonPressed(Button.B, function () { code_morse = "" + code_morse + "2" }) input.onGesture(Gesture.Shake, function () { basic.showString("" + (morce[CODE.indexOf(code_morse)])) }) let CODE: string[] = [] let morce: ...
e55c1fdc9bfa225e1cc87fc5bf3d908de9b70658
TypeScript
MrBrax/ProjectorRays
/src/DataStream.ts
3.171875
3
/* DataStream */ export class DataStream { static BIG_ENDIAN = false; static LITTLE_ENDIAN = true; position: number; constructor(public buffer: Buffer, public endianness:boolean = DataStream.BIG_ENDIAN) { this.position = 0; } seek(pos: number) { this.position = pos; } skip(n: number) { ...
2b1fc79a595dc196c047f14d82a37ad1674a6b34
TypeScript
NicoFerrero/Laboratorio3-Programacion3
/Laboratorio/Guia Typescript/Ejer03.ts
3.015625
3
function Test(numero: number, cadena?: String): void{ if (cadena) { for (let i = 0; i < numero; i++){ console.log(`${cadena}\n`); } } else { console.log(`${ numero - (numero * 2)}`); } } Test(2, "Como te va");
e6c3dde654c5883e39d1033749b6730145b51707
TypeScript
PBKcore/LayaTS
/src/sear/struct/HashList.ts
3.40625
3
module sear.struct { /** * * * @author pbk */ export class HashList<T> { private _hash: Object = null; private _values: T[] = null; constructor() { this.clear(); } clear(): void { this._hash = {}; this._values =...
abd7da591c47719aaf58d4bd2fe73777ce065691
TypeScript
yanuas123/shopy
/src/ts/plug-modules/load-more.ts
2.578125
3
/* module Load More ---------------- */ export function loadMore(operation: string): void { const loader: HTMLElement = document.getElementById("loader"); const body: HTMLElement = document.body; const style_open: string = "open"; const style_blocked_body: string = "noscroll"; const act_open: string = "open"...
49891d32d7c5d18464f57859053acd23b169ffe5
TypeScript
GustavoOM/IFYouNeed
/server/src/controllers/ReinforcementsController.ts
2.59375
3
import {Request, Response} from "express" import db from "../database/connection" import convertHourToMinutes from "../utils/convertHourToMinutes" export default class ReinforcementController{ // async index(request:Request, response:Response){ // const filters = request.query // // const subject = fi...
39355537a03e0565772d807619c4de5877408636
TypeScript
dioskuroi/koa2-ts-weibo
/src/services/user-relation.ts
2.546875
3
/** * @description 用户关系 service * @author 徐俊 */ import { UserRelation, User } from '../db/models' import { UserList } from '../types' import { formatUserInfo } from './helpers/_format' import { Op } from 'sequelize' /** * 根据被关注用户id获取粉丝列表 * @param followerId 被关注用户id */ export async function listUserByFollowerId(...
6311411b28646df172fa34390402cceadf2b8c6e
TypeScript
v8187/rs-mock
/src/phone-no.ts
2.953125
3
import { xToNum, deepMergeObject, randomItem, randomNum } from '@v8187/rs-utils'; import { ICountry, CONUTRIES_LIST } from './geographic'; export enum EPhoneLength { MIN = 8, MAX = 13 }; export enum EPhoneFormats { PLAIN, GROUP_OF_2 = 2, GROUP_OF_3 = 3, GROUP_OF_4 = 4, GROUP_OF_5 = 5 }; export enum EPhoneSe...
a85156ae562aa4b9b1bc992193c56d05d1a2d2ec
TypeScript
anantmittal/math-json
/src/compute-engine/dictionary/arithmetic.ts
2.6875
3
import type { Dictionary } from '../public'; export const ARITHMETIC_DICTIONARY: Dictionary = { // // Constants // Pi: { domain: 'IrrationalNumber', constant: true, wikidata: 'Q167', value: Math.PI, }, ImaginaryI: { domain: 'ImaginaryNumber', constant: true, wikidata: 'Q193796',...
38a82c1e0596f37edd8e0f8fb988a9d502751a53
TypeScript
AudiusProject/audius-client
/packages/common/src/store/confirmer/reducer.ts
2.5625
3
import { noop } from 'lodash' import { createReducer, ActionType } from 'typesafe-actions' import { ADD_CONFIRMATION_CALL, SET_CONFIRMATION_RESULT, ADD_COMPLETION_CALL, CLEAR_COMPLETE, CLEAR_CONFIRM, INCREMENT_CONFIRM_GROUP_INDEX, SET_OPERATION_SUCCESS_CALL } from './actions' import * as actions from './...
19b1f903a475343446d0b11a5007556aba6d564c
TypeScript
antoniojr0007/desafio_ignite_node07
/src/modules/statements/useCases/transferFunds/TransferFundsController.spec.ts
2.640625
3
import { hash } from 'bcryptjs'; import request from 'supertest'; import { Connection, createConnection } from 'typeorm'; import { v4 as uuidV4 } from 'uuid'; import { app } from '../../../../app'; import { JWTInvalidTokenError } from '../../../../shared/errors/JWTInvalidTokenError'; import { JWTTokenMissingError } fr...
16ac787f1cc69cc112dc7a3c11f89ced20b22b50
TypeScript
dakom/pure3d-typescript
/src/lib/internal/gltf/gltf-parse/Gltf-Parse-File.ts
2.8125
3
import { GLTF_ORIGINAL } from "../../../Types"; import {getJsonFromArrayBuffer} from "../../common/Json"; const getHeader = (aBuffer:ArrayBuffer) => { const dv = new DataView(aBuffer, 0, 12); return { magic: dv.getUint32(0, true), version: dv.getUint32(4, true), length: dv.getUint32(8, true) } } c...
4f458c5e71e81d63567fbd0cc170ef4a49a63317
TypeScript
matt-ramotar/dropbox-reads-api
/src/api/actions/models/Action.ts
2.53125
3
import { DocumentType, prop } from "@typegoose/typegoose"; import { Field, ID, ObjectType } from "type-graphql"; import ActionReaction from "../../actionreactions/models/ActionReaction"; import Book from "../../books/models/Book"; import BookshelfBook from "../../bookshelfbooks/models/BookshelfBook"; import Bookshelf f...
ff261b67e677e98078b7d71e512f192cb3a89cc6
TypeScript
Zhouyuj/recycling
/src/app/shared/services/map/driving.model.ts
2.875
3
import { Map } from './map.model'; export class Driving { policy: DrivingPolicy; // 驾车路线规划策略 extensions: string; // 默认值:base,返回基本地址信息, 当取值为:all,返回DriveStep基本信息+DriveStep详细信息 ferry: number; // 默认为0,表示可以使用轮渡,为1的时候表示不可以使用轮渡 map: Map; // AMap.Map对象, 展现结果的地图实例。当指定此参数后,搜索结果的标注、线路等均会自动添加到此地图上。可选 panel: st...
7ee0f471f7589f92ffa7291c25a9fb5fc5bfe2ed
TypeScript
joonhocho/ts-jutil
/src/func/memoize.ts
3.21875
3
export const memoize = <A extends any[], R>( fn: (...args: A) => R ): ((...args: A) => R) => { let prevArgs: A | null = null; let prevReturn: any = null; return function memoizedFn(this: any, ...args: A): R { let changed = false; if (prevArgs) { const len = args.length; for (let i = 0; i < ...
2554b987d7eac89ac3473d5659323ee83a933a26
TypeScript
rogreyroom/caesar-rot-react
/src/app/features/alphabet/alphabetSlice.ts
2.546875
3
import { createSlice } from '@reduxjs/toolkit'; import { RootState } from '../../store'; import { generateAlphabet } from '../util/generateAlphabet' interface AlphabetState { alphabet: string[] } const initialState: AlphabetState = { alphabet: generateAlphabet() }; export const alphabetSlice = createSlice({ na...
1bb8d1973ec46151ddf6a981cdfee237bbd22b32
TypeScript
i78s/frontend-utils
/src/ts/tab/index.ts
3.203125
3
interface TabOption { index?: number; activeClass?: string; onChange?(content: HTMLDivElement): void; } export default class Tab { private tabs: NodeListOf<HTMLAnchorElement>; private contents: NodeListOf<HTMLDivElement>; option: TabOption; private onSelectHandler: (e: Event) => void; constructor(t...
5fbf228b6223b4fa58553f90969577d2d5b75ccd
TypeScript
lgy87/algo
/tree/TreeNode.ts
3.34375
3
import * as r from "ramda" import * as ra from "ramda-adjunct" const LEFT_PARENTHESIS_WIDTH = 1 const RIGHT_PARENTHESIS_WIDTH = 1 const PARENTHESIS_WIDTH = LEFT_PARENTHESIS_WIDTH + RIGHT_PARENTHESIS_WIDTH export default class TreeNode<T> { constructor(private readonly value?: T) {} static empty = new TreeNode() ...
21797c9731b239ae393fab4648715cc267c7b336
TypeScript
aravindanve/ts-experiments
/complex-inference-2/json-entity.ts
3.1875
3
namespace Entity { export type Descriptor = PrimitiveDescriptor | ArrayDescriptor<UnkeyedContainerDescriptor> | ObjectDescriptor<KeyedContainerDescriptor> export type KeyedContainerDescriptor = { [key: string]: Descriptor } export type UnkeyedContainerDescriptor = { items: Descriptor } export type...
c7c2ddf8dcd1eedc84e40bd6ca62f79df4f59871
TypeScript
bazo/itera_test
/src/types.d.ts
2.796875
3
declare interface Department { id: number; departmentName: string; } declare interface Employee { id: number; name: string; age: number; departmentId: number; startDate: string; endDate: string | null; } declare interface DepartmentsByID { [id: number]: Department; }
b8a55f7ac979b3f52be97b4977edca5442b8c315
TypeScript
djwhatle/mig-ui
/src/app/storage/duck/reducers.ts
2.53125
3
import { Types } from './actions'; import { createReducer } from 'reduxsauce'; import ConnectionState from '../../common/connection_state'; export const INITIAL_STATE = { isFetching: false, isError: false, migStorageList: [], searchTerm: '', connectionState: ConnectionState.Pending, }; export const migStora...
2bcd253c743bf4afeecc89fb4e584842af164faa
TypeScript
WangWenJuan666/hmr-ng6
/src/app/shared/directive/forbidden-name.directive.ts
3.078125
3
import { Directive,HostBinding, } from '@angular/core'; import { AbstractControl, FormGroup, NG_VALIDATORS, ValidationErrors, Validator, ValidatorFn } from '@angular/forms'; // export function forbiddenNameValidator(nameRe: RegExp): ValidatorFn { // return (control: AbstractControl): {[key: string]: any} | null =>...
2349f84ecb4ccd40add8f758c00b002ae35efabb
TypeScript
mwjaworski/rise
/test/service_query_spec.ts
2.984375
3
import 'mocha'; import { assert } from 'chai'; import { ServiceQuery } from '../lib/engine/service_query'; import { IService } from '../lib/components/service'; import { Component, IComponent } from '../lib/engine/component'; import { IMessage } from '../lib/core/types'; import { head, has, includes } from 'lodash'; c...
b8bfd15eb8c225b8a84b35b4026abec0d30b36d9
TypeScript
leonardoquevedox/kombi
/legacy/src/services/file-uploader.service.ts
2.53125
3
/** * @license MIT * @version 1.1.0 * @author M.A.R.S. Labs * @description File upload management service. */ import { Injectable } from "@angular/core"; import { Uploader } from "angular2-http-file-upload"; import { UploadItem } from "angular2-http-file-upload"; @Injectable() export class MarsFileUploaderServi...
8dd7d64ea9f05b7e8a92a1907771892c62c2967c
TypeScript
IMRZ/tw-db
/src/generated/threekingdoms/collections/Mens.ts
2.609375
3
import { CollectionCache, CollectionKey } from "../../../common"; import { BattleEntities } from "./BattleEntities"; import { BattleAnimationsTable } from "./BattleAnimationsTable"; export namespace Mens { export const KEY = new CollectionKey("mens"); export class Entry { private readonly collectionCache: Co...
7962053d74a74eeb1f87a7a1e42565f967229147
TypeScript
yuhenabc/sketchpad
/src/libs/CanvasStatus.ts
2.9375
3
import {Point} from '../d/types' /** * Class CanvasStatus */ export default class CanvasStatus { last: number backup: number current: number startPoint: Point endPoint: Point points: Array<Point> static FLAG_PENCEL: number = 1 static FLAG_ERASER: number = 2 static FLAG_S_LINE: n...
a88c1a20a1f8fab389f1572ee024917d99db2857
TypeScript
plumthedev/cutter
/src/core/tabs/contracts/repository.ts
2.71875
3
import Tab = chrome.tabs.Tab; import QueryInfo = chrome.tabs.QueryInfo; /** * Tabs repository interface. * * @author Kacper Pruszyński (plumthedev) <kacper.pruszynski99@gmail.com> * @package Cutter/Core */ interface Repository { /** * Get all tabs. * * @param query {chrome.tabs.QueryInfo} ...
27209f2cf1aae9200d6e894db9f424a3cdb23d0b
TypeScript
MarioLegenda/voca-builder
/src/app/http/ErrorFactory.ts
2.75
3
import { ApiError, AppError, ErrorType, FailedRequest, NetworkError } from './Errors'; import { getHeaders } from './httpHelpers'; import { AxiosResponse, AxiosError } from 'axios'; export default class ErrorFactory { static isNetworkError(e: AxiosError) { if (!e.response) { const re = new RegExp('timeout'...
f461222f8132c430a1491d9801ed4c1f30d0c6d1
TypeScript
mremolt/stundenzettel-webcomponents
/src/app/store/counter/counter.reducer.ts
2.984375
3
import { ActionType, getType } from 'typesafe-actions'; import { DeepReadonly } from 'utility-types'; import * as actions from './counter.actions'; export type CounterAction = ActionType<typeof actions>; export const initialState = { value: 0 }; export type CounterState = DeepReadonly<typeof initialState>; export ...
2750db121a126b1bafb91bb4c4a5a2ec4e315ca3
TypeScript
heikaimu/phaser3-game-one
/src/state-machine/StateMachine.ts
3.171875
3
/* * @Description: 状态机器 * @Version: 2.0 * @Autor: Yaowen Liu * @Date: 2021-01-11 22:26:28 * @LastEditors: Yaowen Liu * @LastEditTime: 2021-01-12 12:41:25 */ class StateMachine { private initialState: string; private possibleStates: Object; private stateArgs:Array<any>; private state?:...
c4c34832beea7bf25cc2f8cf8be10cf78d7b1789
TypeScript
da-peng/common-manager
/crewler-ws/src/repositpry/AnchorRepository.ts
2.796875
3
import { EntityRepository, Repository } from "typeorm"; import { Anchor } from "../entity/Anchor"; @EntityRepository(Anchor) export class AnchorRepository extends Repository<Anchor> { /**唯一 */ async createAndSave(nickName: string, anchorLink: string, sex: string = 'male' || 'female' || '', ageGroup: string = ...
aea7e9083a6493b38eb6d79c60df121e3434b8d2
TypeScript
Hawkbat/ToDoQuestBootstrap
/src/app/store.service.ts
2.859375
3
import { Injectable } from '@angular/core' export enum Status { Editing = 1, InProgress = 2, Completed = 4 } export namespace Status { export function print(status: Status) { if (status == Status.InProgress) return "In Progress" else return Status[status] } } export interface ITask { name: string info: st...
90d3305e7309cd84c47f217b42e087a958ba52d5
TypeScript
manuncorrea/backend-sistema-de-cadastro
/src/services/DeleteUserService.ts
2.703125
3
import { isValidObjectId } from 'mongoose'; import User from '../models/User'; interface Request { id: string } class DeleteUserService { public async execute({ id }: Request) { if(!isValidObjectId(id)) throw new Error('Invalid id argument type') const userExists = await User.findById(id) if(!userEx...
81a9b38c83784c3654cbb4c9820faa327d2dcd5b
TypeScript
fnortes/commons-utils
/tests/text/validations/text.test.ts
2.921875
3
import { isNull, isNotNull, isEmpty, isNotEmpty, isEmptyString, isNotEmptyString, isBlankString, isNotBlankString, isBlank, isNotBlank, isBase64Encoded } from "../../../src/text/validations/text"; describe("it should exist a isNull function", () => { test("should return true", () => { expect(isNull(undefined)).t...
d3b4868039b9d15d12b140b3fe90956b183f8213
TypeScript
jpatel3/typescript-edx
/edx_9/gen_constraints.ts
2.796875
3
class List<T extends IAccount>{ _items:T[] = []; add(item:T){ this._items.push(item); } getItem(): T[{ return this._items; } }
f548f68086467639c16b1567f96024a7b55f8daa
TypeScript
ketFriendly/url-shortener-api
/src/controllers/url.controller.ts
2.609375
3
import { Controller, Get, HttpStatus, Post, Req, Res } from '@nestjs/common'; import { UrlService } from '../services/url.service'; import { Request, Response } from 'express'; import * as validUrl from 'valid-url'; import * as _ from 'lodash'; import * as UrlParse from 'url-parse'; @Controller('api') export class Ur...
95ae6cc95abaa9d8a7750732cb81e28d9b25844e
TypeScript
travetto/travetto
/module/di/test/deps.ts
3.09375
3
import { Injectable, Inject, InjectableFactory } from '../src/decorator'; import { DbConfig, AltConfig, Empty } from './config'; export abstract class BasePattern { } @Injectable() export class SpecificPattern extends BasePattern { } export class BaseTypeTarget { } /** * @concrete .:BaseTypeTarget */ export inte...
78c266ba77cb8b8ba25ccfd58965247615e7a7f8
TypeScript
tabo-syu/backlog-issue-viewer
/src/BacklogIssuesTreeView.ts
2.5625
3
import { TreeDataProvider, TreeItem, TreeItemCollapsibleState } from 'vscode'; import BacklogApiClient from './utils/backlogApi'; import { IssueResponse } from './utils/backlogApi/types'; import path from 'path'; type Cache = IssueResponse[] | null; export class BacklogIssuesTreeProvider implements TreeDataPro...
40d5293d2b4cae373f49d55526b7dfe23d865ff9
TypeScript
AdamCsordas21/codewars
/remove-first-and-last-char/index.spec.ts
2.96875
3
import { removeChar } from '.' describe('removeChar', () => { it('should remove first and last characther of a given element', () => { const name1 = removeChar('Pogba') const name2 = removeChar('Rashford') const name3 = removeChar('Fernandes') const name4 = removeChar('Cavani') expect(name1).to...
c9aadd1a455a20316df14ca271a0f39cf3101def
TypeScript
mcculleydj/rosetta-code
/ts/solutions/trees/trees_4.ts
3.34375
3
import { TreeNode } from './trees_1' // for TreeNode class see Minimal BST // O(n) function isBST( tn: TreeNode, leftBound: number = null, rightBound: number = null, ): boolean { if (!tn) return true if (leftBound !== null && tn.data <= leftBound) { return false } if (rightBound !== null && tn.dat...
6d9d1f5718ee9ed323694e77224822f6b14e38a0
TypeScript
andrewsantarin/rc-dock-extended
/src/rc-dock-extended.utilities/create-tab-data.ts
2.609375
3
import { createElement, Fragment } from 'react'; import { TabBase, TabData } from 'rc-dock'; /** * Generates a tab data object. * * @param {(TabData | TabBase)} [options] Additional tab data options. * * @returns A new tab data object. */ export const createTabData = (options?: TabData | TabBase) => { const t...
c4a31b272971b901d0638393ec68cbb0157fd932
TypeScript
bapinmalakar/basic_ionic4_demo
/src/app/services/helper.service.ts
2.515625
3
import { Injectable } from '@angular/core'; @Injectable() export class HelperService { constructor() { } treatmentOnData(data) { return this.removeEmptySlot(data); } removeEmptySlot(data) { data = data.split(' '); let filter_data = []; data.filter((d) => { ...
a7740d9e7ea0c49c610baad36cc36aeb8f383cf4
TypeScript
vtalas/koren
/src/modulove/demo/app.ts
2.78125
3
/// <reference path="../modulove.d.ts"/> /// <reference path="../class.moduloveFactory.ts"/> import ModuloveFactory = modulove.Modulove; var itemData = [ [1, 1], [1, 1], [3, 3, 1, 1], [3, 2], [2, 2], [3, 2], [1, 1], [1, 1], ]; var items = itemData.map((item) => { return new grids.SimpleLocation([item[0], it...
f8ed2c09529ef18a9b215d7fb8b71fcd55414f20
TypeScript
cdnjs/cdnjs
/ajax/libs/amcharts4/4.9.33/.internal/core/rendering/filters/LightenFilter.d.ts
2.859375
3
/** * Module for "Lighten" filter. */ /** * ============================================================================ * IMPORTS * ============================================================================ * @hidden */ import { Filter, FilterProperties } from "./Filter"; import { AMElement } from "...
3045a5df7abd28d84ed7ccf316dfef73fa834c8a
TypeScript
azeem/webvs
/src/utils.ts
3.25
3
import flow from "lodash-es/flow"; import map from "lodash-es/map"; import { default as pr } from "lodash-es/partialRight"; import takeRight from "lodash-es/takeRight"; /** * A No-Op function */ // tslint:disable-next-line:no-empty export function noop() {} /** * Checks if an object contains the required propertie...
970493d835092008aafd91c5a510c26fab15985d
TypeScript
bugkiwi/san-ssr-target-php
/src/utils/timing.ts
2.90625
3
class Measure { private startTime: number constructor () { this.startTime = Date.now() } duration () { const dur = Date.now() - this.startTime return dur + 'ms' } } export function startMeasure () { return new Measure() } export function measure (fn: Function) { c...
6c0c8c68f4ac8e984bd5e3dacd67e82f679ddee2
TypeScript
Purdue-io/WebApp
/PurdueIoWebApp/Scripts/typescript/Pages/TermSelectPage.ts
2.6875
3
class TermSelectPage extends Page { private terms: Array<Term>; constructor(app: App) { // Set component ID, page title this.componentId = "TermSelectPage"; this.pageTitle = "Purdue.io"; super(app); } public show(): void { if (this.terms == null) { this.getApp().progressIndicator.pushWork(); this...
e3c60f65ddfa97f35285fb38e8bcd7f7dd5c87f5
TypeScript
NickHeiner/iberville
/test/unit/is-equal-float.ts
2.640625
3
/// <reference path="../../typings/tsd.d.ts" /> import '../../types'; import '../types'; import isEqualFloat = require('../../lib/is-equal-float'); const tape = require('tape'); tape('isEqualFloat', function(t: IT) { t.test('is equal – no floats', function(t: IT) { t.plan(1); t.equal(isEqualFloa...
6d8f00be042e088ad63c30d58e6a188c01e4ca2e
TypeScript
andreyyyyyyyyy/tapzero
/test/zora/test-cases.ts
2.59375
3
'use strict' import * as test from '@pre-bundled/tape' import * as fs from 'fs' import * as path from 'path' import * as child_process from 'child_process' import * as util from 'util' import * as jsdiff from 'diff' const readFile = util.promisify(fs.readFile) const dir = path.join(__dirname, 'fixtures') const files...
0f8b2de662b71a955b8356b11ed9cd2254ffdf6b
TypeScript
viridia/vortex.web
/packages/vortex-client/src/operators/library/Blend.ts
2.671875
3
import { DataType, Input, Operator, Output, Parameter } from '..'; import { Expr, defineFn, fork, refInput, refTexCoords, refUniform, getAttr, multiply, add, subtract, } from '../../render/Expr'; import { GraphNode } from '../../graph'; import { makeFunctionType } from '../FunctionDefn'; import { ve...
aac971efb0c2f15ece9ba3e253f3bdf0978a8b88
TypeScript
iwe7/ngx-renderer
/src/renderer/advanced-renderer.ts
2.953125
3
import { ExpressionArguments } from './expression'; export type RendererGlobalTarget = 'window' | 'document'; export enum AdvancedRendererMethod { execute, invokeElementMethod, invokeGlobalTargetMethod, setGlobalTargetPropery, getGlobalTargetProperty, } export abstract class AdvancedRenderer { abstract e...
78a735da2a7768adc5337d70c5c32d268847aa98
TypeScript
PauloDevelo/enginemonitor.reactfront
/src/services/OnlineManager.ts
2.578125
3
import actionManager from './ActionManager'; import httpProxy from './HttpProxy'; import analytics from '../helpers/AnalyticsHelper'; export interface IOnlineManager { isOnlineAndSynced(): Promise<boolean>; isOnline(): Promise<boolean>; isSynced(): boolean; isOfflineModeActivated():boolean; setOf...
daab0b96c369a4d11e1927bb5539bd3e8f42ed7c
TypeScript
cutaisyah/fe-assignemnt4
/src/app/services/auth-interceptor.ts
2.546875
3
import { UserService } from 'src/app/services/user.service'; import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http'; import { Injectable} from '@angular/core'; import { catchError } from 'rxjs/operators'; import { TokenService } from './token.service'; import { Observable, throwErr...
d94f78fc4f52b25dfcd5b82b1817faf051db12a2
TypeScript
Firestitch/ngx-code-generator
/libs/schematics/src/utils/build-correct-path.ts
2.6875
3
import { buildRelativePath } from './find-module'; import { dasherize } from '@angular-devkit/core/src/utils/strings'; import { Tree } from '@angular-devkit/schematics'; /** * Build right services's path for correct component * @param options * @returns {string} */ export function buildRelativePathForService(optio...
a5dd64b3fc1f5994172af172ce83b4f88e36849d
TypeScript
nbeach/function-injection
/src/inject.spec.ts
2.90625
3
import {inject} from "./inject" import {expect} from "chai" describe(inject.name, () => { const objectify = (a: string, b: number, c: boolean) => ({a, b, c}) it("can partially apply some parameters of the source function", () => { const injected = inject(objectify, "X", 5) expect(injected(tru...
e6a6983c71de6181555a28dc7c418f99d9ef21a9
TypeScript
IvanKuzyshyn/modest-trello
/src/scenes/board-page/selectors/card.ts
2.578125
3
import { StateAccessor } from '../../../context/types/state' import { Card } from '../types/card' export const getCardsByColumnId: StateAccessor<Card[]> = ( state, columnId: number ) => state.cards.filter((card) => card.columnId === columnId) export const getCardById: StateAccessor<Card | undefined> = ( state, ...
50926cee0197b1e081a30e01a302e03948fe21b7
TypeScript
mattsetyadi/QS-inventoryv2-TS
/src/Modules/Supplier/Store/SupplierReducer.ts
2.78125
3
import { Action } from 'redux'; import { IFetchSupplier } from './SupplierAction'; export const initialState: any = { list: [], }; export default function SupplierReducer(state = initialState, action: Action) { if (!action) return state; const newState = Object.assign({}, state); switch (action.type) { c...
b317ec0886841305982e94cdc1f204fcdff523a5
TypeScript
Rasmoh/cactbot
/src/types.ts
2.703125
3
// Name the lines and which indices in an array of nine elements are members of that line type LineDefinition = { name: string; indices: number[]; }; export const LineDefinitions: LineDefinition[] = [ { name: "Top Row", indices: [0, 1, 2] }, { name: "Middle Row", indices: [3, 4, 5] }, { name: "Bott...
ebe7003fc2c885a544c355be8945ebfd30562b91
TypeScript
alistairvu/mern-ecommerce
/frontend/src/redux/user/userAuthSlice.ts
2.578125
3
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit" import axios from "axios" export const registerUser = createAsyncThunk( "user/registerUser", async ( { name, email, password, }: { name: string; email: string; password: string }, thunkApi ) => { try { const ...
efd0fa10b03c0bf28722825f650df0cd4bfca05f
TypeScript
dchambers/noforms-with-chakra-plus-nodetap
/src/pages/user-account/register/register-reducer.ts
2.890625
3
import makeError from 'make-error' import { registerViewModel } from './register-view-model' const InvalidStateError = makeError('InvalidStateError') export type RegisterFormState = { email: string password: string confirmationPassword: string emailAlreadyRegistered: boolean actionUnderway: boolean verif...
d2f793ac6279f80e1d1ecf3d3ac4c91f5d4eed77
TypeScript
Vulxan/react
/components/tabs/tabs-context.ts
2.546875
3
import React, { CSSProperties, MouseEvent } from 'react' export type TabsInternalCellProps = { onClick: (value: string) => void onMouseOver: (e: MouseEvent<HTMLDivElement>) => void activeClassName?: string activeStyle?: CSSProperties hideBorder?: boolean } export type TabsInternalCell = React.FC<TabsInterna...
f108e5e988d5b7bf14c3337c6f2df6311ae4b6e3
TypeScript
MoranGoz/ezxpress
/src/app/map.service.ts
2.609375
3
import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs'; @Injectable() export class MapService { public addressUpdated : Observable<any>; public addressSubject: Subject<any>; localAddress : string; constructor() { this.addressSubject = new Subject<any>(); this.addressU...
3933c3ac2cbfedbd76d50475d4393ec112aaf636
TypeScript
ColdFire87/beenion
/application/link.ts
2.578125
3
import { getLinkId } from '../model/link/getLinkId' import { EventStore } from '../infrastructure/databases/eventstore/eventStore' import { linkReducer } from '../model/link/reducers/linkReducer' import { rate } from '../model/link/command/rate' export const linkCommandHandlers = ( eventStore: EventStore, userId: ...
cf1421e2e343ab4187a9b4836ca6fbe2104d7670
TypeScript
epicmaxco/vuestic-ui
/packages/ui/src/composables/useDebounce.ts
2.75
3
import { isRef, Ref, unref, watch } from 'vue' import debounce from 'lodash/debounce.js' export const useDebounce = <T>(onUpdate: () => any, timeout: Ref<number> | number) => { const createDebounced = () => { return debounce(() => { onUpdate() }, unref(timeout)) } let debounced = createDebounced()...
30353e16ac7b07eab0566c8a3253aecd3f08cd35
TypeScript
sebastiangolian/angular-ngrx-playground
/src/app/todo/store/todo.reducer.ts
2.625
3
import { Action, createReducer } from '@ngrx/store'; import { Todos } from '../interfaces/todo.interface'; export const key = 'todos'; export const initialState: Todos = { todos: [ { id: 1, title: 'todo 1', completed: true }, { id: 2, title: 'todo 2', completed: false }, ], }; const todoReducer...
e46563fc2ad4ad2a0ff8bd233d4fb05a12c43fdc
TypeScript
kilicmu/ToyScript
/test/peek-generator.test.ts
2.84375
3
import { PeekGenerator } from './../src/common/PeekGenerator'; import { array2Gen } from '../src/common/array2Gen'; import { equal } from '../src/common/equal'; describe('PeekGenerator test', () => { const str = "abcdefghijklmnopqrstuvwxyz"; let gen: Generator; let iter: PeekGenerator<string>; befo...
f7edc9f7e2fc5dc463403210a76be10a60cbe403
TypeScript
qnighy/sourcemap-explorer
/src/parse.ts
2.6875
3
import { SourceFileState, UploadedFileState } from "./file_states"; export interface ParseResult { files: Map<string, ParsedFile>; sourceFiles: Map<string, SourceFileState>; } const initResult = (): ParseResult => ({ files: new Map(), sourceFiles: new Map(), }); export interface ParsedFile { content: Array...
b80da13e66758803ada34d0e9e0ec71979ddd7aa
TypeScript
staeke/minimal-html-parser
/parser.test.ts
2.90625
3
import {Comment, Element, parseHtml} from './parser'; test('basic test', () => { const dom = parseHtml('<b>Hello</b>'); expect(dom[0]).toBeInstanceOf(Element); expect((dom[0] as Element).tagName).toBe('b'); expect((dom[0] as Element).innerText).toBe('Hello'); }); test('Test with comment', () => { ...
77081427e6be931674caf602f56907f743a08b7d
TypeScript
UgurAsaner/shoppingCart-NodeJS
/src/models/Coupon.ts
2.8125
3
import { DiscountType } from "./DiscountType"; import Discount from "./Discounts"; export default class Coupon extends Discount { private minPurchase: number; constructor(minPurchase: number, discount: number, discountType: DiscountType) { super(discount, discountType); this.minPurchase = minPurchase; this.t...
0b16841f01e98f61d0fb9c32fe4bb5bc1039d8bd
TypeScript
ShatDev/bsc-sniper
/bot.ts
2.546875
3
import { Contract } from 'ethers'; import { bnbAmount, tokenAddress, token } from './config.json'; import { getFactory, getRouter, getTokenConfig, TokenConfig, fetchBuy, } from './util'; const bot = async ( router: Contract, factory: Contract, config: TokenConfig ) => { const wbnbAddressLower = Strin...
bee07e1c68f58cae3ad2280f696e9361db469a88
TypeScript
galvc/angular-eventapp-clone
/src/app/events.service.ts
2.546875
3
import { Injectable } from "@angular/core"; import { HttpHeaders, HttpClient } from "@angular/common/http"; import { Observable, of } from "rxjs"; import { Event } from "./event"; import { catchError, map, tap } from "rxjs/operators"; @Injectable({ providedIn: "root" }) export class EventsService { order = { ...
3ac39c8978675c4fcba6d3900d254b5aadf0ddc6
TypeScript
davezabriskie/variate-generation
/src/app/variate-functions/functions/weibull/weibull.ts
3.453125
3
export class Weibull { private shape: number = 1; private scale: number = 2; constructor(shape: number, scale: number) { this.updateShape(shape); this.updateScale(scale); } updateShape(shape: number): void { if (shape > 0) { this.shape = shape; } } updateScale(scale: number): vo...
51d15fa5de9fa2ce14f578956caeacc1869c7b68
TypeScript
octoml/relay-to-js
/src/nodes/common.ts
3.125
3
import {GenericNode} from './'; export type BaseType = { id: number; }; export type DType = 'float32' | 'int32' | string; export type GType = GenericNode.Type; export type GSType = GenericNode.SType; export type FromTVMParams = { id: number; nodes: GSType[]; visited: GType[]; }; export const typeMismatch =...
771c6cd711d498dc9664e651e8722dc82d0812f1
TypeScript
bzlibby/textual-engine
/src/service/loader/index.ts
2.75
3
import { Service } from '..'; import { DataFile } from '../../model/file/Data'; export interface LoaderService extends Service { /** * Write a debug payload to a local path. * * This always writes to a local resource, even for network-based loaders. */ dump(path: string, data: Buffer): Promise<void>; ...
f61804f9c04bb2358eb3b27c028e4c845eb88726
TypeScript
zacharyplat/iabtcf-es
/modules/core/src/tcstring/encoders/VendorVectorEncoder.ts
3.03125
3
import {SpecificEncoder} from './SpecificEncoder'; import {VectorEncodingTypeEnum} from '../VectorEncodingTypeEnum'; import {IntEncoder} from './IntEncoder'; import {BooleanEncoder} from './BooleanEncoder'; import {BitLength} from '../../model/BitLength'; import {Vector} from '../../model/Vector'; export class VendorV...