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
b0a19bc06bfeeba51eba5ed0e7e3669179d7278f
TypeScript
nullptru/puppeteer-crawl
/src/index.ts
2.578125
3
import puppeteer from 'puppeteer'; import { cookie, elementsConfig, startPage } from './config'; import { log, error } from './log'; import { createDir, download } from './utils'; class Crawl { browser: puppeteer.Browser | undefined; crawlCount = 0; async init() { this.browser = await puppeteer.launch( ...
9dcddfe132a79e6e543145958ca5b2ad8cd20f50
TypeScript
chenzhaozheng/express-ts-api
/src/util/util.ts
3.015625
3
/* * @Author: chenzhaozheng * @Date: 2019-12-02 10:17:13 * @LastEditors : chenzhaozheng * @LastEditTime : 2020-02-05 17:55:31 * @Description: file content */ /** * 加上前缀0 * @param num * @returns */ export const addPreZero = (num: any) => { if (num < 10){ return '0' + num; } ...
f152b582ac9da204a78436062f86f1509147190a
TypeScript
EddieAbbondanzio/MechanicLog.net
/src/user-system/services/auth/user-credentials.ts
2.9375
3
/** * Login credentials for a user. */ export interface UserCredentials { /** * The email of the user. */ email: string; /** * The password of the user. */ password: string; }
c867b1797c2e0b14e2d4e9634fc30e97fd525d00
TypeScript
ZorroLeVrai/Web.PathFinder
/src/controllerMediator.ts
2.5625
3
import { GridSize } from "./commonTypes"; import GameController from "./Game/gameController"; import SettingsController from "./Settings/settingsContoller"; export default class ControllerMediator { constructor(private gameController: GameController, private settingsController: SettingsController) { } ...
147ef566c0c310be9f983c028da0ca9cc731d20a
TypeScript
Mistrall/TypeScript.NET
/System/Collections/IList.ts
3.046875
3
/* * @author electricessence / https://github.com/electricessence/ * Licensing: MIT https://github.com/electricessence/TypeScript.NET/blob/master/LICENSE */ module System.Collections { export interface IList<T> extends ICollection<T> { /* From ICollection<T>: count: number; isReadOnly: boolean; add(...
da76ea877194626f2318af66fa12f908d769f02b
TypeScript
Canxr/Hummer
/tenon/packages/tenon-utils/src/style/transformer/adapter.ts
3.25
3
/** * 属性适配,特定场景下增加属性值 * @param style 待转换的Style值 * @param view 组件 */ import {makeMap} from '../../utils' const borderRadius = "border-radius,border-top-left-radius,border-top-right-radius,border-bottom-left-radius,border-bottom-right-radius" const isBorderRadius = makeMap(borderRadius) export function transformAd...
890694288b443e1dc1fcfc986408a30f1f4de550
TypeScript
goldenhiar/react-native-mmkv
/example/src/Benchmarks.ts
2.703125
3
import AsyncStorage from '@react-native-async-storage/async-storage'; import { MMKV } from 'react-native-mmkv'; declare global { var performance: { now: () => number; }; } const storage = new MMKV({ id: 'benchmark' }); export const benchmarkAgainstAsyncStorage = async () => { console.log('Starting benchmar...
6b8e204efa84f66230291f86848e707e034b8287
TypeScript
faramond/source-master
/patel-ui/src/app/app.ts
2.5625
3
import {Observable, OperatorFunction, throwError} from 'rxjs'; import {catchError, tap} from 'rxjs/operators'; import {HttpErrorResponse} from '@angular/common/http'; import {FormGroup} from '@angular/forms'; import {environment} from '../environments/environment'; export function scrub(formGroup: FormGroup): any { ...
92a15f41e765bb4495d73086519d679ab3850253
TypeScript
long2805l2/game_dashboard
/app/frontend/src/app/obj/Admin.ts
2.625
3
export class Admin { readonly domain: string; public permissions?: any; constructor (domain: string, permissions?:any) { this.domain = domain; this.permissions = permissions ? permissions : { // "admin_password": true // , "admin_permissions": true // , "admin_list": true // , "admin_add": true // , ...
e1be5e869b1aa1ef53824a5a070d736403ef58ca
TypeScript
JohnnyRacket/elysian
/src/ViewObjects/DebugViewObject.ts
2.625
3
import { Dimensionable } from './../Shared/Dimensionable'; import { DoubleBufferedViewObject } from './DoubleBufferedViewObject'; import { DrawingStrategy } from './../DrawingStrategies/DrawingStrategy'; import { ClickableViewObject } from '../ViewObjects/ClickableViewObject'; import { AttachableViewObject } from './At...
156e76b47dd1b419240d71839d80b85e16b7d278
TypeScript
tinyx3k/animeab
/client/src/controller/apis/controller.ts
2.6875
3
const baseUrl = "api"; export class ApiController { static GET_ANIME( animeKey = "", stus = 0, banner = false, sort = "date", take = 0, trend = 0): string { let url = `${baseUrl}/animes`; if(animeKey !== "") url += `/${animeKey}`; else...
f1b4bf8a77deb452cfb1bdf7061bde6ba89e73ed
TypeScript
takaaki12353491/scheduler
/client/app/src/modules/storage.ts
2.828125
3
export const set = (key: string, item: any) => { localStorage.setItem(key, JSON.stringify(item)) } export const get = <T>(key: string) => { let data = localStorage.getItem(key) if (!data) return null let obj = JSON.parse(data) as T return obj } export const remove = (key: string) => { localStorage.re...
e66cebf5853b89ffb180a882174393e4a7750ab6
TypeScript
reghu-nair/timetrack
/server/src/resolvers/project.ts
2.640625
3
import { Resolver, Query, Ctx, Arg, Mutation } from "type-graphql"; import { Project } from "../entities/Project"; import { MyContext } from "../types"; @Resolver() export class ProjectResolver { @Query(() => [Project]) projects(@Ctx() { em }: MyContext): Promise<Project[]> { return em.find(Project, {}); } ...
473ddb8b23305a29b6d71be6fc0cdf6e67537a71
TypeScript
jeffwu85182/usm
/packages/usm-redux/src/core/reducers.ts
2.546875
3
import { ActionTypes, Reducer, State, moduleStatuses } from 'usm'; export function getModuleStatusReducer<T>(types: ActionTypes, initialValue: T): Reducer { return (state = initialValue || moduleStatuses.initial, { type }): State<any> => { switch (type) { case types.init: return moduleStatuses.pend...
dd887c7be926ff73a3ec80e7840ec26f119374aa
TypeScript
hejie3920/hejie-all
/个人部分博客文档总结和脚本/index.ts
3.34375
3
const enum Hejie { up = 1, down, left, right, } enum Type { a = "A", b = "B", } const enum Direction { Up = 1, Down, Left, Right, } type test = `${Hejie}-Haha`; type PickFuncProp<T> = { [P in keyof T]: T[P] extends Function ? P : never; }[keyof T]; interface tt { fn: function; name: string;...
8f6c2f7ef2ce7a65ec894add9f4a39fd1cdb3d29
TypeScript
mage/mage-module-maintenance
/src/index.ts
2.984375
3
import * as fs from 'fs' import * as http from 'http' import * as path from 'path' import * as mage from 'mage' /** * Details regarding the current maintenance * * @export * @interface IMaintenanceDetails */ export interface IMaintenanceDetails { start: number end: number message: string } /** * Command ...
cf5e50603229e2257f2d77fce24d82f33b8edfba
TypeScript
kryz81/typescript-fast-refresh
/src/concepts/discriminated_union/discriminated_union.ts
4.5625
5
interface Circle { radius: number; } interface Square { sideLength: number; } // shape can be a circle or a square type Shape = Circle | Square; // will throw error, because only Circle has radius, but the function expects Shape, which can also be Square // function getArea(shape: Shape) { // return Math.PI * s...
515bf8225c512b6bb888a96daa9c1c2adec3ebd9
TypeScript
NationalBankBelgium/stark
/packages/stark-rbac/src/modules/authorization/entities/state-permissions.entity.intf.ts
3.109375
3
import { Ng2StateDeclaration } from "@uirouter/angular"; import { StarkStateRedirection, StarkStateRedirectionFn } from "./state-redirection.intf"; /** * Describes the content of the `permissions` object to be set inside the `data` property of a Router state configuration */ export interface StarkRBACStatePermission...
2513fead460cf4bb062a4a1277c72540bfa7c663
TypeScript
zcong1993/node-delay-queue
/src/logger.ts
3.34375
3
function toPadStr(num: number, len: number) { const str = String(num); const diff = len - str.length; if (diff <= 0) return str; return '0'.repeat(diff) + str; } function getNowStr() { const now = new Date(); const year = now.getFullYear(); const month = now.getMonth() + 1; const day = now.getDate(); ...
153ccc79380d31debb8b10ae15e1963ff3ad3235
TypeScript
ornahasson/CoronaInvestigation
/client/src/redux/Airlines/airlineReducer.ts
2.84375
3
import * as Actions from './airlineActionTypes'; const initialState: Map<number, string> = new Map(); const airlineReducer = (state = initialState, action: Actions.airlinesAction) : Map<number, string> => { switch (action.type) { case Actions.SET_AIRLINES: { return action.payload.airlines ...
20dd5f0972a435c45f7bb5ea9bbc32afe9929791
TypeScript
unrealdrake/LParty
/Clients/Web/LP.Clients.Web.Endpoint/Features/Registration/RegistrationPage/RegistrationPage.ts
2.578125
3
interface IRegistrationPageViewModel { firstName: string; lastName: string; login: string; password: string; passwordConfirm: string; } function registrationPageViewModel(): IVue { var registrationPageViewModel = new Vue({ el: '#registration', data: { firstName: "",...
99f2dae3ecb85a0025be705d79fc7a0a806b54b2
TypeScript
jokester/toosimple
/lib-ts/util.ts
3.65625
4
/** * Methods that convert (err, result)=>void callback to promise * * NOTE not working well with overloaded functions * NOTE not working well with parameter names */ export namespace Promisify { interface CallbackFun1<A1, R> { (arg1: A1, callback: (err: Error, result: R) => void): void; } in...
21686e6a3618ee5e0366d5adbb0eb8d890a15fab
TypeScript
Samour/story-guess
/fe-app-manager/src/services/LogInService.ts
2.546875
3
import { Store } from 'redux'; import { CreateSessionRequest, CreateSessionResponse } from '@story-guess/ts-shared/dtos/session'; import { IState } from '../state'; import { IApiService } from './api/ApiService'; import { ISessionStorageService } from './api/SessionStorageService'; import { userAuthenticatedEvent } fro...
20eed812f949bd1d31151866167431eeb322b4a7
TypeScript
rohitbakoliya/bugKira
/server/controllers/user.controller.ts
2.59375
3
import { Request, Response } from 'express'; import httpStatus from 'http-status-codes'; import { IUser, User } from '../models/User'; import { validateBio, validateName, validateUsername } from '../validators/User.validators'; /** * @desc all users * @route GET /api/user/:username * @access private */ expor...
ec2b564f1f04cceed8a010f81dde4e6c9293c508
TypeScript
admpresales/uft-one-flight-te-reflection-regression
/uft-one-flight-te-reflection-regression/Action2/Script.mts
2.875
3
' View Order ' Viewing the order is not easy. You can't just enter the order number and view it. ' Instead you have to scroll through the orders and use an algorithm - FindOrder - to find it. OrderNum = 0 ONum = 0 PgDown = 0 RowIndex = 0 Function FindOrder(OrderNum) ' Create the page down and row index for the given...
c6eaac92f0c795322d64993cb6e3ae399d8fa004
TypeScript
davd33/BlablaMovie
/backend/src/users/users.service.ts
2.5625
3
import { Injectable } from '@nestjs/common'; import { CreateUserDto } from './dto/create-user.dto'; import { BlablaUser } from './entities/user.entity'; import { InsertResult, Repository } from 'typeorm'; import { InjectRepository } from '@nestjs/typeorm'; import { QueryDeepPartialEntity } from 'typeorm/query-builder/Q...
c6123f5e31ab5ed122dbdd6a01aa2713789e81fc
TypeScript
ananay/iaux
/packages/ia-js-client/src/controllers/item/item.ts
3.046875
3
import { MetadataService, Metadata } from '../../services/metadata' import { DetailsService, DetailsResponse } from '../../services/details' /** * early prototype of audio file class (will change) */ export class AudioFile { name:string length:number track:string artist:string sources:Array<{ file:stri...
6fd80c1d67ad51083a626c4a029e0cccf9e4526b
TypeScript
xiexingen/blog
/docs/note/_demos/core/function/index.ts
3.390625
3
Function.prototype["myCall"] = function (ctx, ...args) { // 未传ctx上下文,或者传的是null和undefined等场景 if (!ctx) { ctx = typeof window !== "undefined" ? window : global; } ctx = Object(ctx); // 生成一个唯一的key const fnName = Symbol(); // 这里的this就是要调用的函数 ctx[fnName] = this; // 将args展开,并调用fnname 此时fnName函数内部的this也就...
c8f4e222dfdaffc0a5a9f4bc72fae0765dc83c24
TypeScript
Loki1237/starsbook
/frontend/src/store/AutBar/actions.ts
2.6875
3
import { AppThunkAction } from '../thunk'; import { Dispatch } from 'redux'; import { toast as notify } from 'react-toastify'; import { history } from '../../middleware'; import { appUserLogIn } from '../../store/App/actions'; import { AuthAction, SignUpUserData, AUTH_LOG_IN_LOADING, AUTH_SIGN_UP_LOADI...
a873b6e69aff2cc34e64b001bbfbfd6e0755cb0e
TypeScript
usfsoar/purchasing-manager
/src/global.d.ts
3.421875
3
/** * All the simple triggers that will run automatically without installation. * These triggers must have the names provided or they won't be found. * @see https://developers.google.com/apps-script/guides/triggers */ type SimpleTriggers = { /** * Runs when a user opens a spreadsheet, document, presentation, o...
4e584a05a2326f233e7ab130979d35794f575c69
TypeScript
samsystems/vts
/src/utilities/isNull.ts
3.78125
4
/** * Returns val is null or val is undefined or val is NaN * * @func * @sig a -> b) * @param value * @return {Function} A Function :: value -> boolean. * @example * * const f =v.isNull(false); => false */ export const isNull = (value?: any) => value !== 0 && value !== '' && value !== false && !Boolean(v...
c5816da777535502c2b52a7b88d6bf374bb68d48
TypeScript
jaba0x/yaml-import
/src/get-schema/create-tree.ts
2.515625
3
import path from 'path'; import yaml from 'js-yaml'; import namify from 'namify'; import getFiles from './get-files'; import read from '~/read'; import { IOptions } from '~/types'; export default function createTree( file: string, directory: string, options: IOptions, schemas: yaml.Schema[], recursive?: bool...
cd55caf9f2f078701113694d7ef5f9026cffa0e4
TypeScript
ultrabis/ultrabis
/workspaces/wow-common/src/enums/PlayableRace.ts
2.515625
3
/** * Playable races. Taken from Blizzard API. */ enum PlayableRace { Human = 1, Orc = 2, Dwarf = 3, NightElf = 4, Undead = 5, Tauren = 6, Gnome = 7, Troll = 8 } export default PlayableRace
c77c5a0b4aab99b1984bcb56d1615c7a197c452d
TypeScript
tspayne87/t-box
/modules/server/tests/schemas/index.ts
2.546875
3
import { Schema, Document } from 'mongoose'; export interface IUser extends Document { username: string; password: string; } export interface IRole extends Document { name: string; description: string; } export const User = new Schema<IUser>({ username: String, password: String }); export co...
b85881caa77877eb8a22ca9fff565f8452d251c7
TypeScript
ChristopherA8/ICOC-Teens
/commands/info/staffroles.ts
2.609375
3
module.exports = { name:"staffroles", execute(msg) { const { roleMembersCount } = require('../../helper_functions/roleMembersCount.ts'); let staffRoles = [ { name:"Bug Hunter", count:roleMembersCount("775448648229453865") }, { name:"Gulag Gamer", count:roleMembersCount(...
6db0dc722b985c71fd5f06bffd13f46af8a165ef
TypeScript
opensource-emr/hospital-management-emr
/Code/Websites/DanpheEMR/wwwroot/DanpheApp/src/app/payroll-module/Shared/Payroll-Leave-Category.model.ts
2.53125
3
import {NgForm, FormGroup, FormControl, Validators, FormBuilder, ReactiveFormsModule } from '@angular/forms' export class LeaveCategories{ public LeaveCategoryId:number = 0; public LeaveCategoryName:string = ""; public Description:string = ""; public CreatedBy: number = 0; public CreatedOn : string...
8158b168713063e68693bef385696cc17cc4d470
TypeScript
gomberg5264/tfg
/crawler/src/util.ts
3.234375
3
import { IncomingMessage as httpIncomingMessage } from 'http' /** * Generate a numeric hash of a string * @param str */ export function stringHash (str: string): number { let hash = 5381 let i = str.length while (i) { hash = (hash * 33) ^ str.charCodeAt(--i) } /* Convert signed int to an unsigned by...
458544adfe3c0bd64b7db5f31c54a1516e17abd1
TypeScript
Dennis2512/Musclery-Backend
/examples/orders.ts
2.71875
3
import * as admin from 'firebase-admin'; import * as functions from 'firebase-functions'; import { Bestellung } from './models/bestellung.model'; import { BestellungService } from './service/bestellung.service'; const cors = require('cors')({ origin: true }); export function handler( request: functions.https.Reques...
983d74ee46d22747494032042186a7baf02f432c
TypeScript
jakub-gawlas/nest-todo-api
/src/modules/tasks/tasks.controller.ts
2.59375
3
import { Response } from '@types/express'; import { Controller, Get, Post, Res, Param, Body, HttpStatus, } from '@nestjs/common'; import { TasksService } from './tasks.service'; @Controller('tasks') export class TasksController { constructor( private tasksService: TasksService, ){} @Get() a...
ad0ff41fc8d9e4f86fc9833d4caada76a79eaf29
TypeScript
hoflish/beagle-web-core
/src/beagle-view/render/styling.ts
2.578125
3
/* * Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required...
027ebf1c43a071ad1eb1864bfcc98d1ffd616bd1
TypeScript
dsehnal/CIFTools.js
/src/Binary/Parser.ts
2.75
3
/* * Copyright (c) 2016 - now David Sehnal, licensed under MIT License, See LICENSE file for more info. */ namespace CIFTools.Binary { "use strict"; function checkVersions(min: number[], current: number[]) { for (let i = 0; i < 2; i++) { if (min[i] > current[i]) return false; } ...
fc5880c3a1ae8deb3bd77198f8735505811d985a
TypeScript
linode/manager
/packages/manager/src/features/Firewalls/FirewallDetail/Rules/shared.ts
3.0625
3
import { APIError } from '@linode/api-v4/lib/types'; import { prop, sortBy } from 'ramda'; export type Category = 'inbound' | 'outbound'; export interface FirewallRuleError { category: string; formField: string; idx: number; ip?: { idx: number; type: string; }; reason: string; } // This is not the...
b35d047fb83994dd8166a9e4c53f20f1dca83578
TypeScript
an-Onion/leetcode
/src/848.shifting-letters.ts
3.109375
3
/* * @lc app=leetcode id=848 lang=typescript * * [848] Shifting Letters */ // @lc code=start export function shiftingLetters( s: string, shifts: number[] ): string { let sum = 0; for( let i = shifts.length-1; i >= 0; i-- ) { sum = ( sum + shifts[i] ) % 26; shifts[i] = sum; } const ret: string[] =...
8fbb16d5ed2fcc3a610ae0b015e2fd116f327f57
TypeScript
benjamin0809/xggl
/src/pipes/date/date.ts
3.28125
3
import { Pipe, PipeTransform } from '@angular/core'; /** * Generated class for the DatePipe pipe. * * See https://angular.io/api/core/Pipe for more info on Angular Pipes. */ @Pipe({ name: 'datePipe', }) export class DatePipe implements PipeTransform { /** * Takes a value and makes it lowercase. */ tran...
35acc16b034898c7bbc9cc29f729197e8e326591
TypeScript
kknshastri/kk-learning-sample01
/src/app-old-BKP/common/left-sidebar/left-sidebar.component.ts
2.53125
3
import { Component, OnInit, OnDestroy } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Store, select } from '@ngrx/store'; @Component({ selector: 'app-left-sidebar', templateUrl: './left-sidebar.component.html', styleUrls: ['./left-sidebar.component.scss'] }) export class LeftSideb...
0bef21e8e5606bedb0cc010c165b19e339ab8b4e
TypeScript
ronyland/visualization
/src/componentsLibrary/Copy/directive.ts
2.796875
3
import { DirectiveBinding } from 'vue' import CopyFun from './Copy' interface CusDom extends HTMLElement { $value: string handler: () => void } const Copy = { // 绑定元素的父组件挂载时调用 mounted(el: CusDom, { value }: DirectiveBinding) { el.$value = value el.handler = () => { CopyFun(el.$value) } // ...
ab8b91f50be0677933d4fee6979959c9a35a6871
TypeScript
lionnnnn/z-ftp
/src/ftp/index.ts
2.71875
3
/** * @file ftp 二次封装功能 */ import { ERROR_CODE, SUCCESS_CODE } from '../const/code'; import FtpNode from 'ftp'; import retry from 'retry'; import Uploader, { IUploader } from '../class/uploader'; import { FtpConnectOptions, OprStatus } from '../type/common'; import { logger } from '../util/log'; export default clas...
eb52fd27195e024f913604a6d61f9055a635502b
TypeScript
dskoogh/game-of-life
/src/app/services/grid-creator.service.ts
2.5625
3
import { CellHandler } from './cell-handler.service'; import { Cell } from './../model/cell'; import { Grid } from './../model/grid'; import { Injectable } from '@angular/core'; import { flatten } from '@angular/compiler'; @Injectable({ providedIn: 'root' }) export class GridCreatorService { constructor(private c...
532df5bdfb270d41f8a0b358f26dde531f59e8e0
TypeScript
ratpeddler/cribbigage
/src/game/rules.ts
3.125
3
export interface GameRules { name: string; players: number; dealSize: number; keepSize: number; dealerExtra: number; cribExtra: number; cutSize: number; pointsToWin: number } function createGame(name: string, players: number, dealSize: number, keepSize: number, dealerExtra = 0, cribExtr...
09145d15310a34621bcc3df77248eeda50f2945e
TypeScript
dferrer333/personalFinance
/backend/server/src/main.ts
2.703125
3
import CSVModel from './model/CSVModel'; import Logger from './utils/Logger'; import Server from './Server'; require('dotenv').config(); async function initializeServer() { const port: number = getHostPort(); const logger = new Logger(); const model = new CSVModel(); const server = new Server(logger, model, ...
d4a1c844eb438f5883a01f5cc7e2b5e865de93ac
TypeScript
Apple-Music-Clone/back
/src/lib/orm/query_builder/query_builder.ts
2.671875
3
import { QueryExpressionMap, TableRef, WhereClause, WhereClauseCondition, } from "./query-expression-map"; import { Connection } from "../../../connection/connection.interface"; import { QueryRunner } from "../query_runner/query_runner.interface"; export abstract class QueryBuilder<T = any> { public expressi...
0b5f8a2fc258e103b65b1b4e9bc5108f61f9e609
TypeScript
WebForFunThailand/css-challenge
/src/data/questions.ts
2.875
3
interface Question { id: string; difficulty: 'e' | 'm' | 'h'; image: string; defaultHtml: string; defaultCss: string; usedPixels: number; } const questions: Question[] = [ { id: `debug-easy1`, difficulty: `e`, image: `q0.png`, defaultHtml: `<div class='debug-question'></div>`, default...
fc6a16bbeb5341a60d2784549a76ed18466098ea
TypeScript
gw2efficiency/recipe-calculation
/tests/helpers/recipeItems.spec.ts
2.75
3
import { recipeItems } from '../../src' import { RecipeTreeWithCraftFlags } from '../../src/types' describe('helpers > recipeItems', () => { it('gets all unique item ids of a recipe tree', () => { const recipeTree: RecipeTreeWithCraftFlags = { id: 1, craft: true, totalQuantity: 6, usedQua...
3b837cd4945f80ebe7f1ccca6519fe2cf0810843
TypeScript
cuzfrog/palm-game
/ui/src/store/graphic/animation-console-start.ts
2.921875
3
import { I, O } from "./graphic-types"; import { List } from "immutable"; import { AnimType } from "./anim"; type Anim = import("./anim").Anim; class ConsoleStartAnimation implements Anim { private readonly step: number; constructor(step?: number) { this.step = step === undefined ? 1 : step; } ...
50ee05a7ef15455a9769e11150402f82f49f882e
TypeScript
sintetico82/cube-greenhouse
/src/farmer.ts
2.640625
3
var sensor = require('node-dht-sensor'); import { Led, Board, Pin, LCD, Sensor } from "johnny-five"; import util from "util"; import cron, { CronJob } from "cron"; import EventEmitter from "events"; import moment from 'moment'; import * as fs from 'fs'; class FarmerData { public static readonly FILE_NAME ...
d690eac99530fae9df0375deec431856bea2b6d1
TypeScript
doYoungAn/chart
/lib/piechart.ts
2.734375
3
import * as d3 from 'd3'; interface IPiechartData { [key: string]: number; } export interface IPiechartConfig { element: HTMLElement; data: IPiechartData margin?: number; strokeColor?: string; strokeWidth?: number; textColor?: string; textSize?: number | string; baseOpacity?: number; strongOpacity...
cf9c184630a5e0c9cd75ec4e52d9e3514a38eeb5
TypeScript
stardazed/sd-streams
/packages/streams-compression/src/decompression-stream.ts
2.84375
3
/* streams-compression/decompression-stream - transform stream expanding compressed data Part of Stardazed (c) 2019-Present by @zenmumbler https://github.com/stardazed/sd-streams */ import { Inflater } from "@stardazed/zlib"; const decContext = Symbol("decContext"); const decTransform = Symbol("decTransform"); class...
eb7545f33bed668ce568b252804806f774d34fef
TypeScript
DefinitelyTyped/DefinitelyTyped
/types/array-rearrange/index.d.ts
3.421875
3
// Type definitions for array-rearrange 2.2 // Project: https://github.com/dfcreative/array-rearrange#readme // Definitions by: BendingBender <https://github.com/BendingBender> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = reorder; /** * Reorder elements within array by index. Mutates o...
eb1f74f998bf0bd8a0040e0940d89bb930656cbe
TypeScript
ianwremmel/clark
/src/lib/version.spec.ts
2.96875
3
import {assert} from 'chai'; import {select} from './version'; describe('version', () => { describe('select()', () => { it('selects the greater of two compatible semver ranges', () => { [ ['^1.0.0', '^1.1.0', '^1.1.0'], ['^1.1.0', '^1.0.0', '^1.1.0'], ['~1.3.0', '^1.1.0', '^1.3.0']...
1b2330e69bd2ab898879834d2b623f0988d1d999
TypeScript
Innolize/twitter-front
/src/common/IAxios.ts
2.609375
3
import axios from 'axios' import { store } from '../redux/store' import { User } from '../types/User' export const axiosI = axios.create({ baseURL: process.env.REACT_APP_BACKEND_URL, withCredentials: true }) axiosI.interceptors.request.use(function (config) { const token = store.getState().authReducer.tok...
30eb8f3d13fdeb5a22226cd7583d69491bf669db
TypeScript
pixore/pixore
/src/utils/__tests__/Color.spec.ts
2.78125
3
import { toHsl, toHsv, create, createHsv, createHsl, fromHsl, fromHsv, fromHex, } from '../Color'; test('toHsl', () => { expect(toHsl(create(21, 105, 172))).toEqual(createHsl(207, 78, 38)); expect(toHsl(create(255, 0, 0))).toEqual(createHsl(0, 100, 50)); }); test('toHsv', () => { expect(toHsv(c...
5324e2dd1ff39c27204f87a114d55d4cd30bff44
TypeScript
abellaismail7/gas-station-electron
/src/local/users.ts
2.515625
3
import { UserI } from "@/types/User" import Knex, { QueryBuilder } from "knex"; const electron = window.require("electron"); const db: Knex = electron.remote.getGlobal("$db"); const userdb: QueryBuilder = db("users"); export default class UserRepository { async insert(user: UserI) { const res = await us...
449ffc0476be6ca7977554683269a2954738d460
TypeScript
Mirroar/hivemind
/src/role/exploit/builder.ts
2.625
3
/* global FIND_DROPPED_RESOURCES RESOURCE_ENERGY FIND_SOURCES_ACTIVE FIND_STRUCTURES FIND_MY_CONSTRUCTION_SITES */ import utilities from 'utilities'; import Role from 'role/role'; import BuilderRole from 'role/builder'; export default class ExploitBuilderRole extends Role { builderRole: BuilderRole; constructor() ...
9ce95cfb816476b5167564af22270b401fe3b164
TypeScript
njmyers/javascript-monorepo
/packages/smalldash/src/async/__tests__/pipe-async.test.ts
3.390625
3
// @ts-nocheck import pipeAsync from '../pipe-async'; const defer = value => new Promise(resolve => { setTimeout(() => resolve(value), 0); }); const return1 = 1; const return2 = 2; const return3 = 3; const fn1 = jest.fn().mockImplementation(() => defer(return1)); const fn2 = jest.fn().mockImplementation(() =...
9595cc2679e3db2bd60001e58f4f228db6be81cf
TypeScript
vis-au/visflow
/client/src/common/color-scale.ts
2.921875
3
import { scaleLinear, scaleOrdinal } from 'd3-scale'; import { schemeCategory10 } from 'd3-scale-chromatic'; import _ from 'lodash'; enum ScaleType { LINEAR = 'linear', ORDINAL = 'ordinal', } export interface ColorScaleInfo { id: string; label: string; type: ScaleType; contrastColor: string; domain: num...
5f436d0eea409293187c40289b28fe5398f4a64b
TypeScript
alex404A/type-challenges
/questions/10-medium-tuple-to-union/test-cases.ts
2.828125
3
import { Equal, Expect } from "../../utils"; type TupleToUnion<T extends any[]> = T[number]; type TupleToUnion2<T extends any[]> = T extends Array<infer ITEMS> ? ITEMS : never; type cases = [ Expect<Equal<TupleToUnion<[123, "456", true]>, 123 | "456" | true>>, Expect<Equal<TupleToUnion2<[123]>, 123>> ];
4a6a957625e275842773e64c39fff7f8936af616
TypeScript
DefinitelyTyped/DefinitelyTyped
/types/yuka/test/examples/misc/savegame/index.ts
2.546875
3
import * as YUKA from "yuka"; import { CustomEntity } from './CustomEntity'; import { CustomVehicle } from './CustomVehicle'; const entityManager = new YUKA.EntityManager(); const time = new YUKA.Time(); const targetMesh = {matrix: new YUKA.Matrix4()}; const vehicleMesh = {matrix: new YUKA.Matrix4()}; // register cus...
6cff76314cf33cca77a840593a254b8d38861f63
TypeScript
Gipphe/twitter-stream
/packages/backend/tests/Heartbeat.spec.ts
2.671875
3
import timers, { NodeClock } from '@sinonjs/fake-timers'; import { AbortController } from 'abort-controller'; import test from 'ava'; import { Heartbeat } from '../src/Heartbeat'; test('does not start by default', (t) => { const clock = timers.createClock(); t.deepEqual(clock.countTimers(), 0); // eslint-disable-ne...
d13a59683bfd4c5059cf7f85ec27a4c414cf2853
TypeScript
delta62/json-schema-validator
/test/validators/type.test.ts
3.359375
3
import { SchemaType } from '../../lib/schema' import validateType from '../../lib/validators/type' const CASES: Record<string, any[]> = { null: [ null ], boolean: [ true, false ], integer: [ 0, -0, -10, 10 ], number: [ -12.34, 12.34 ], string: [ '', 'foo', '42', '\x00' ], object: [ { }, { foo: [ ] },...
8689e53f21bca0c33c5e689a451af5efe42d4f67
TypeScript
ToreRisinger/SpaceAge
/src/shared/data/shipmodule/ShipModuleInfo.ts
2.53125
3
import { ISprite } from "../ISprite"; import { IModuleTypeProperties } from "./IModuleTypeProperties"; import { EModuleItemType } from "../item/EModuleItemType"; import { EStatType } from "../stats/EStatType"; import { EStatModifier } from "../stats/EStatModifier"; import { EItemType } from "../item/EItemType"; import ...
72f104052561abf4b32099e4cbb3de17c894d91e
TypeScript
kyoujuro/typescript_practice
/20201122/add_function.ts
3.46875
3
function add(a: number, b: number): number{ return a + b } console.log(add(1, 2)) console.log(add.apply(1, null)) console.log(add.apply([1, 2], null)) console.log(add.apply(null, [1, 2])) console.log(add.call(1, 2, null)) console.log(add.call(null, 1, 2)) console.log(add.call([10, 2], null)) console.log(add.bind(1...
bb8f767ae1b1411702f5a5cb7b3028253bc2e78d
TypeScript
esterw/client
/src/app/shared/shared-pipes/filter-pipe.pipe.ts
2.625
3
import { Pipe, PipeTransform } from "@angular/core"; @Pipe({ name: 'TextFilterPipe', pure: false }) export class TextFilterPipe implements PipeTransform { filteredItems:any[]; transform(items: any[], args: any[]): any { //console.log("*******args*************/////////"+args.toStri...
4cf1dedbd51f37066a24733130089f094a7c9c46
TypeScript
svenliebig/jarvil
/src/electron/plugins/JarvilSystemPlugin.ts
2.578125
3
import { ipcMain } from "electron" import Events from "../Events" import { ResultItem } from "../Processor" import Logger from "../utils/Logger" import JarvilPluginInterface from "./JarvilPluginInterface" import { resolve } from "path" export enum JarvilSystemPluginAction { Settings = "jarvil/settings", Close ...
2e07a7c6eb485541de9a9bb25465525efbfcf9e0
TypeScript
ksdemo/agile-mobile
/src/radio/PropsType.ts
2.578125
3
export interface RadioGroupPropsType { className?: string; style?: object; value?: string | number; activeColor?: string; direction?: 'horizontal' | 'vertical'; disabled?: boolean; children: any[]; onChange?: (e: object) => void; } export interface RadioListPropsType { className?: string; style?: o...
390f4fe9508a5dc6c9a41f84edbd93e48332b501
TypeScript
Seikho/briskly-router
/test/request-match.ts
2.59375
3
import Types = require('../src/index.d.ts'); import Match = BR.Match; import request = require('../src/parsers/request'); import route = require('../src/parsers/route'); import match = require('../src/match/request-part'); import chai = require('chai'); var expect = chai.expect; describe('request/part comparison tests...
4150a95b20a7d818b7c5368b4892b2dd69d20d79
TypeScript
starsoccer/cryptotithe
/src/utils/keyByValue/index.ts
3.15625
3
export default function keyByValue(value: unknown, object: Record<string, unknown>): undefined | string { const keys = Object.keys(object); for (const key of keys) { if (object[key] === value) { return key; } } return undefined; }
16208c7fa206e6ee9dbbb5385ef73b3771e2fbd0
TypeScript
Naucana/appts
/app4.ts
3.171875
3
import { Usuario } from './class/usuario'; // Ejemplos con la clase usuario, la cual extiende de la clase abstracta Persona let u1: Usuario; u1 = new Usuario(1, "Antonio", "Direccion", 40); console.log(u1.toString()); let u2: Usuario; u2 = new Usuario(2, "Jose", "Direccion", 40); console.log(u2.toString()); let u3: ...
eacfb697df4981066f8c531723f9fa94d9f34d8f
TypeScript
ChALkeR/kaiwa
/src/js/storage/disco.ts
2.59375
3
export default class DiscoStorage { constructor (public storage) {} setup (db) { if (db.objectStoreNames.contains('disco')) { db.deleteObjectStore('disco'); } db.createObjectStore('disco', { keyPath: 'ver' }); } transaction (mode) { const...
85a92f3a640538be19ffaa6680e5122af9394cbb
TypeScript
quilljs/delta
/src/Op.ts
3.0625
3
import AttributeMap from './AttributeMap'; interface Op { // only one property out of {insert, delete, retain} will be present insert?: string | Record<string, unknown>; delete?: number; retain?: number | Record<string, unknown>; attributes?: AttributeMap; } namespace Op { export function length(op: Op):...
23f10e8dd9cf1634cc7786b6b3c4e8f902a85030
TypeScript
ctc87/proyectoCremas
/src/app/pipes/app.pipe.respuestas.ts
2.78125
3
import {Pipe} from '@angular/core'; // Tell Angular2 we're creating a Pipe with TypeScript decorators @Pipe({ name: 'res' }) export class ResPipe { // Transform is the new "return function(value, args)" in Angular 1.x transform(value, args?) { // ES6 array destructuring let [id] = args; ...
dc24122247aba6f77c1d29f67fb979869cd181b5
TypeScript
sprengerjo/stryker
/packages/api/testResources/module/useReport.ts
2.609375
3
import { Reporter, MutantResult, MutantStatus, ReporterFactory, SourceFile, MatchedMutant } from '@stryker-mutator/api/report'; import { Config } from '@stryker-mutator/api/config'; class EmptyReporter {} class AllReporter implements Reporter { public onSourceFileRead(file: SourceFile) {} public onAllS...
6975cd812b4254f73f3328c73da09181819af699
TypeScript
l0ll098/ACTT
/src/app/services/log.service.ts
2.53125
3
import { Injectable } from "@angular/core"; import { environment } from "../../environments/environment"; import { IndexedDBService } from "./indexedDb.service"; // Logs will be written to IDB if the specific variable is set to true of if the app is in production. const enableIDBLog = environment.enableIDBLog...
ddcc9fd5dd831bfe013479c71de7a4a392b84be2
TypeScript
KeithTuttle/Map-Pin
/frontend/src/store/UserStore.ts
2.6875
3
import { EventEmitter } from 'events'; import { User } from '../viewModels/UserWithErrorMessage'; import Dispatcher from './dispatcher'; class UserStore extends EventEmitter { user: User | null = null; constructor(){ super(); } setUser(user: User | null){ this.user = user; ...
c8dc4069416b8cb7623e57fdf2836eb602000e41
TypeScript
viictorcamposs/blockbuster-api
/src/routes/categories.routes.ts
2.515625
3
import { Router } from "express"; import { CategoriesRepository } from "../repositories/CategoriesRepository"; import { CreateCategoryService } from "../services/CreateCategoryService"; const categoriesRoutes = Router(); const categoriesRepository = new CategoriesRepository(); categoriesRoutes.get("/", (request, res...
9956d5a2f22053d6b3d2f446498c98ecf5ad86b7
TypeScript
simp42/inventory
/frontend/src/data/StockRepository.ts
2.53125
3
import * as BSON from "bson"; import * as Realm from "realm-web"; import {Article} from "./Article"; import {ArticleCountChange, CountableArticle} from "./CountableArticle"; export default class StockRepository { private readonly app: Realm.App; private readonly service: string; private readonly database: ...
a6f2f11657157eae37ea547a30de62baf31aa2f0
TypeScript
aashishmaheshwar/misc-view-performance
/src/hooks/useUtilityFns.ts
2.515625
3
import { Comment } from "pages/DataViews"; import { useCallback } from "react"; export const useUtilityFns = () => { const groupByPostId = useCallback((data: Array<Comment>) => { const groupedDataSet = data.reduce((groupedComments, comment) => { const { postId, ...rest } = comment; ...
9b4b43afc3d20e30695e648f6642954098e270e3
TypeScript
BLZbanme/leetcode
/0501-0600/0501-0550/0529Minesweeper/demo.ts
3.3125
3
function updateBoard(board: string[][], click: number[]): string[][] { check(board, click[0], click[1]); return board; }; function check(board: string[][], i: number, j: number): void { if (i < 0 || j < 0 || i === board.length || j === board[0].length) { return; } if (board[i][j] === 'M') ...
6a09db5c36d5b4290ae48afd10728e26c7df2df7
TypeScript
ajun568/data-structures-and-algorithms
/src/leetcode/leetcode_239_1.ts
3.296875
3
// 239. 滑动窗口最大值 // test6~8 // 测试用例超时 const maxSlidingWindow = (nums: number[], k: number) => { let queue: number[] = []; let maxArr: number[] = []; nums.forEach(item => { if (queue.length <= k) { queue.push(item); } if (queue.length === k) { let max = queue[0]; for (let i = 1; i < qu...
9e7db53e5654d913ec1fa71b3c024ee2eb09b07d
TypeScript
DomiR/rxjs-commented-operators
/src/operators/sampleTime.ts
3
3
/** * Sample time operator * * @author Dominique Rau [domi.github@gmail.com](mailto:domi.github@gmail.com) * @version 0.0.1 */ import { Observable, of, Subscription, timer, interval, Subscribable, Subject } from 'rxjs'; import { take } from 'rxjs/operators'; import { sampleTime as sampleTimeOriginal } from 'rxjs...
dd79d7530b7e2fe059177e7019d14d0620cbe063
TypeScript
hwawrzacz/MatrixCalculator
/src/matrix/Matrix.ts
2.796875
3
import MatrixControls from "./MatrixControls"; import ElementBuilder from "../builders/ElementBuilder"; import ControlsBuilder from "../builders/ControlsBuilder"; export default class Matrix { private _tableWrapper: Element; private _DOMTable: Element; private _rows: number; private _cols: number; ...
65a1fea86649a12d459f190c19be2c6c857eb62a
TypeScript
joostlubach/swagger-ts-generator
/src/helpers/sanitizeKey.ts
2.75
3
import * as Handlebars from 'handlebars' import {quote} from './quote' import options, {Casing} from '../CommandLineOptions' import {camelCase, upperFirst, kebabCase, snakeCase} from 'lodash' Handlebars.registerHelper('sanitizeKey', function (key: string, opts: Handlebars.HelperOptions) { return new Handlebars.SafeS...
f16bad3f91758cb73d97914884b20b82dd16865a
TypeScript
otofu-square/GraphQL-BFF-with-graphql-yoga
/src/Users/Query.ts
2.625
3
import { User } from './types'; import { api } from './api'; type UserQuery = (a1: any, a2: { id: number }) => Promise<User>; const userQuery: UserQuery = async (_, { id }) => { const user = await api.show(id); return { ...user }; }; type UsersQuery = () => Promise<User[]>; const usersQuery: UsersQuery = async ()...
4f5b861f3bf7f3f9ec34374d2d38977a82b229b2
TypeScript
Everythingmaybe/cook-book
/client/src/store/reducers/config.reducer.ts
2.703125
3
import {ActionType, getType} from "typesafe-actions"; import * as actions from '../actions/config.actions'; import {ConfigState, initialConfigState} from "../states/config.state"; type Action = ActionType<typeof actions>; export const configReducer = (state: ConfigState = initialConfigState, action: Action): ConfigS...
41fe746078a510f0dce10804a3407cb20ef2d3b6
TypeScript
AdithyaBhat17/habit-tracker
/lib/fetcher.ts
3.078125
3
export interface FetchProps { url: string; method?: "GET" | "POST" | "PUT" | "DELETE"; token?: string | undefined; body?: any | undefined; } export async function fetcher<ApiResponse>({ url, method = "POST", token = "", body, }: FetchProps): Promise<ApiResponse | any> { try { const r = await fetc...
751f0ce88e3658725d63942b5259843ed8c5d028
TypeScript
shivijain93/guvi
/extends_TypeScript/animal.ts
3.578125
4
class Cat{ name; constructor(catName){ this.name=catName; let catImage= document.createElement("img"); catImage.src= "http://pngimg.com/uploads/cat/cat_PNG50539.png"; catImage.onclick= this.catOnClick(); document.body.appendChild(catImage); } catOnClick(){ return()=> { alert("this "+this.name+"...
9e72357e9fdff5215972fb0c5b077d23348dfee9
TypeScript
manuth/TypeScriptESLintPlugin
/src/Diagnostics/LintDiagnosticMap.ts
3.421875
3
import { ILintDiagnostic } from "./ILintDiagnostic"; /** * Provides a set of lint-diagnostics. */ export class LintDiagnosticMap { /** * The problems. */ private map = new Map<string, ILintDiagnostic>(); /** * Gets the problem with the specified start and end. * * @param start ...
47b081bffce7b8d667f1e80baa0f10a6cf42c7eb
TypeScript
yhong4/WebsiteInformationComparator
/webclient/src/store/mutations.ts
2.59375
3
import stateType from './type' import {IState} from './state' import { MutationTree } from 'vuex' import Vue from 'vue'; const mutations:MutationTree<any> = { [stateType.SET_NEW_CATEGORIES](state:any, data:any):void{ state.newCategories = []; state.newCategories = Object.assign([], data.categoryLis...
ff7a477dfe8d2f725f789b7e1f82b8df1f7415b5
TypeScript
Metatavu/pakkasmarja-berries
/src/test/product-test.ts
2.59375
3
import * as test from "blue-tape"; import * as request from "supertest"; import auth from "./auth"; import { Product, ProductPrice } from "../rest/model/models"; import ApplicationRoles from "../rest/application-roles"; import database from "./database"; import TestConfig from "./test-config"; const testDataDir = `${_...
66c07337f1a48a2b8a721d11e325e9379f373cb9
TypeScript
reggi/mongo-operation-design
/src/collection.ts
2.5625
3
import { FindAndModifyCommand } from './commands/find_and_modify'; import { Db } from './db' import { ClientOptions, ClientOptionsInput } from './client_options' import { MongoDB } from "./types" import { maybePromise } from './utility/maybe_promise' import { Server } from './server'; type Query = Exclude<MongoDB.Comm...
07cd4d2811a0d7b225f20a7135e4b1a90c92cc9e
TypeScript
kkatzen/health-equity-tracker
/frontend/src/data/query/BreakdownFilter.ts
3.296875
3
import { ALL } from "../utils/Constants"; /** * Specifies a set of filters to apply to a breakdown. When `include` is true, * filters the results so that only the specified values are included. When * `include` is false, removes the specified values and leaves the rest. */ export default interface BreakdownFilter ...