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
c1e0a1ebb4aba16824ab4c8719af563d2a182d15
TypeScript
mithunbalyada/react-to-do
/src/types.d.ts
2.796875
3
export type TodoType = { text: string, completed: boolean, } export type CompleteTodoType = (todo:TodoType) => void; export type AddTodo = (todo:string) => void export type TodoStatType = { todo:number; done:number; }
9be0c5b2b6aa3ecdc774b4efa7c75dd4dd497f92
TypeScript
anakorn/tlr-party-builder
/src/models/character.ts
2.59375
3
import { combineMaterialRequirementLists } from './material-requirement'; import { Character, Upgrade } from '../types/types'; import { findActiveUpgrade, completeUpgradeFromUpgradesList } from './upgrade'; export const getActiveUpgrades = function(character: Character) { return character.upgradeGroups .ma...
db348c043f9e5fc4b99734cd45c4ded2ad4dfdd5
TypeScript
connor-hitchcock/Leftovers-The-Ecommerce-Food-Web-App
/frontend/tests/unit/business-profile.spec.ts
2.53125
3
import Vue from 'vue'; import Vuetify from 'vuetify'; import {createLocalVue, mount, Wrapper, RouterLinkStub} from '@vue/test-utils'; import BusinessProfile from '@/components/BusinessProfile/index.vue'; import VueRouter from "vue-router"; import convertAddressToReadableText from '@/components/utils/Methods/convertJson...
047321e62a5dba5bb49fe46c0c608b9dac0e31f5
TypeScript
cuarti/tslint-test
/demo/interface.ts
2.671875
3
interface Editable {} interface Styled { className?: string; } interface Button extends Styled {} interface Project { name: string; } interface Builder<T> { build(): T; } interface ProjectBuilder extends Builder<Project> {}
c911a4e42473406e8cfc9b1ab3d25751d40b67a4
TypeScript
tinnguyenhuuletrong/near-learn-kyc-on-chain
/contract/assembly/index.ts
2.53125
3
import { context, Context, logging, storage } from "near-sdk-as"; import { KYCCandidate, KYCContract } from "./model"; let contract: KYCContract; /*********/ /* Main */ /*********/ export function initContract( bizName: string, bizBlockpassClientId: string ): KYCContract { /// Initializes the contract with th...
07bd8cc81098ac5ba30e2d0edaaf508654f431f9
TypeScript
art-grig/Reinforced.Lattice
/Reinforced.Lattice.Script/Scripts/Reinforced.Lattice/DateService.d.ts
2.96875
3
declare module PowerTables { /** * API responsible for dates operations */ class DateService { constructor(datepickerOptions: IDatepickerOptions); private _datepickerOptions; private ensureDpo(); /** * Determines is passed object valid Date object * @p...
8a9a13225b024e83450913d153e414572a16e309
TypeScript
ayumitanaka13/react-w4d2
/Exercises/exercise5.ts
3.9375
4
// ⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇⏇ // Exercise 5 – Classes // ⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈⏈ // Objectives: // • Create classes with typed properties and methods // • Add access modifiers to class members const Exercise5 = () => { // ======== Exercise 5.1 ======== // Goals: // • Add explicit parameter type ...
2589f126d296535618816bd20e57e975654da116
TypeScript
tayduivn/TrueFail
/SRC/front-end/src/core/models/http.model.ts
2.734375
3
export class ResultModel<T> { public data: T; public result: number; public errorMessage: string; public constructor(init?: Partial<ResultModel<T>>) { Object.assign(this, init); } }
774e42b27f612037f1e2e405e738f71582b74961
TypeScript
FelipeOSilva/DenunciaApp
/src/providers/sqlite-helper/sqlite-helper.service.ts
2.625
3
import { Injectable } from '@angular/core'; import { Platform } from 'ionic-angular'; import { SQLite, SQLiteObject } from '@ionic-native/sqlite'; @Injectable() export class SqliteHelperService { private db: SQLiteObject; constructor( public platform: Platform, public sqlite: SQLite ) { } //Função p...
8ac8da292a81c3b9a21e09a5f1dabf4b706b0dae
TypeScript
willsnake/SalesLoft-Challenge
/pages/api/salesloft.ts
2.53125
3
import type { NextApiRequest, NextApiResponse } from 'next' import Api from '../../helpers/api' // Interfaces import { ApiResponse } from '../../interfaces' export const config = { api: { externalResolver: true, }, } /** * This endpoint was implemented to communicate with the SalesLoft API, in the future i...
c4a60533e0b59ac2760a43098d197cc793fb0c3c
TypeScript
wudi0431/mcare-app
/src/app/shared/services/repair-shared.service.ts
2.5625
3
/** * 单例模式使用 * 用来记录多个步骤之间的数据共享操作 */ import { Injectable } from '@angular/core'; @Injectable() export class RepairSharedService { private _session = {}; constructor() { } set(key: string, value: any) { this._session[key] = value; } get(key: string) { return this._session[key]; } has(key: s...
b249b548c2f0b09c1f195df194ca09ab87f818ab
TypeScript
GuoYuFu123/typescript-learn
/typescript高级/src/3-3方法的装饰器.ts
4.125
4
// 普通函数, target对应的是类的prototype // 静态方法, target对应的是类的构造函数 // descriptor类似于definePrototype一样 function getNameDecorator(target: any, key: string, descriptor: PropertyDescriptor) { console.log(target, key, descriptor) // descriptor.writable = false; descriptor.value = function() { return 'guoguo decor...
c2712c6f684b8cfcb64b3ee8c211d20d2202a43a
TypeScript
ssube/noicejs
/src/error/ContainerNotBoundError.ts
2.734375
3
import { BaseError } from './BaseError.js'; /** * Error indicating that this container is not bound yet and not ready to be used. * * @public */ export class ContainerNotBoundError extends BaseError { constructor(msg = 'container is not bound', ...nested: Array<Error>) { super(msg, ...nested); } }
307f8ff5a9c5f5455329e06991197a1b8cf628ed
TypeScript
andeemarks/2048
/test/board.test.ts
3.078125
3
import Board from "../src/board"; describe("Board", () => { const board = new Board(); it("guards attempts to access out-of-bound rows", () => { expect(() => { board.rowAtPosition(-1); }).toThrowError(); expect(() => { board.rowAtPosition(board.height()); }).toThrowError(); }); i...
7da9e9c628367055cf934f9f4925619a0f845a52
TypeScript
mDinardo08/dissertation
/UltimateTicTacToe/ClientApp/src/app/services/api/api.service.tests.spec.ts
2.8125
3
import { ApiService } from "./api.service"; import { HttpClient, HttpHeaders } from "@angular/common/http"; import { Observable } from "rxjs/Observable"; describe("Api Service", () => { let service: ApiService; beforeEach(() => { service = new ApiService(null); }); it("Will return the Url val...
be574bdc9af662395e6daa71904f3c8b9b97be39
TypeScript
Shrugsy/jet-cdk
/packages/jet/flight/index.ts
2.75
3
import { BaseConfigWithUser, BaseConfigWithUserAndCommandStage, getUsernameFromIAM, getUsernameFromOS, loadConfig, writePersonalConfig, } from '../common/config'; import { Args } from './core/args'; import merge from 'deepmerge'; import cleanDeep from 'clean-deep'; import chalk from 'chalk'; import { listSt...
29b629e1331276b19b30e038c4232b9ac8f0fb7d
TypeScript
yuth/amplify-cli
/packages/amplify-provider-awscloudformation/src/iterative-deployment/stack-progress-printer.ts
2.5625
3
import { StackEvent, StackEvents } from 'aws-sdk/clients/cloudformation'; import { IStackProgressPrinter } from './stack-event-monitor'; import columnify from 'columnify'; import chalk from 'chalk'; import ora, { Ora } from 'ora'; const CFN_SUCCESS_STATUS = ['UPDATE_COMPLETE', 'CREATE_COMPLETE', 'DELETE_COMPLETE', 'DE...
75b8a2c034a4bc8d10480beee3e06b02a5fb54b4
TypeScript
acf136/Angular
/src/app/shared/service/user.service.ts
2.546875
3
import { Injectable } from '@angular/core'; import { IUser } from '../interfaces'; import { HttpClient, HttpErrorResponse } from '@angular/common/http'; import { Observable, throwError } from 'rxjs'; import { catchError, retry } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class UsersService { ...
c838b53d34d0f38de0a5b7800d7d337078bf91e0
TypeScript
mihaistoie/histria-js
/src/test/compositions/compositions-many.specs.ts
2.515625
3
import * as assert from 'assert'; import * as path from 'path'; import { Transaction, loadRules, serializeInstance } from '../../index'; import { DbDriver, dbManager, DbManager, IStore, serialization } from 'histria-utils'; import { Order, OrderItem } from './model/compositions-model'; async function testCreate(): P...
f687ea1c25f591e0431d842fab5a0bfa17536c1b
TypeScript
TommyBi/EnProj
/ECP1.3U1S1/listen_repeat/src/view/MainView.ts
2.53125
3
namespace game { export class MainView extends eui.Component { public kCom0: game.DialogComponent; public kCom1: game.DialogComponent; public kCom2: game.DialogComponent; public kCom3: game.DialogComponent; public kCom4: game.DialogComponent; public kCom5: game.Dialo...
569fb25a16954c1567783309af6f8a04a317eea9
TypeScript
yume-chan/cloudmusic-vscode
/packages/client/src/unblock/kugou.ts
2.78125
3
/* import type { SongDetail, SongsItem, UnlockSongItem } from "../constant"; import axios from "axios"; import { createHash } from "crypto"; import { extname } from "path"; import filter from "./filter"; interface SearchResult { data: { lists: { AlbumName: string; SingerName: string; SongName: ...
256b70d1c2a8a9ba1004557610cc6141908ee568
TypeScript
awschristou/aws-toolkit-vscode
/src/shared/logger.ts
2.625
3
/*! * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ import * as os from 'os' import * as path from 'path' import * as vscode from 'vscode' import * as nls from 'vscode-nls' import * as winston from 'winston' import * as Transport from 'winston-trans...
4b8aac6457a5ed4e5ba85f56a1f3b0870c36229d
TypeScript
evergreen-ci/spruce
/src/pages/spawn/spawnVolume/spawnVolumeTableActions/migrateVolumeReducer.ts
2.734375
3
import { FormState } from "components/Spawn/spawnHostModal"; export enum Page { First, Second, } interface State { page: Page; form: FormState; } export const initialState = { page: Page.First, form: {} }; export const reducer = (state: State, action: Action): State => { switch (action.type) { case "g...
a78ef3128a70150aff1dab0a784a6afbea7e15f6
TypeScript
itmilos/fundamental-ngx
/libs/fn/src/lib/cdk/toast/classes/duration-dismissible/base-toast-duration-dismissible-ref.ts
2.8125
3
import { OverlayRef } from '@angular/cdk/overlay'; import { BaseToastRef } from '../base-toast-ref'; import { BaseToastDurationDismissibleContainerComponent } from './base-toast-duration-dismissible-container.component'; /** Maximum number of milliseconds that can be passed into setTimeout. */ const MAX_TIMEOUT = Math...
7a4386a710cfacba9693622295cd21e51d14b48d
TypeScript
vjje/threets
/src/helpers/DirectionalLightHelper.ts
2.703125
3
module THREE { export class DirectionalLightHelper extends Object3D { public light; public color; public lightPlane; public targetLine; constructor(light, size, color) { super(); this.light = light; this.light.updateMatrixWorld(); this.matrix = li...
5c763efce74267c34b1923664b983b77fda67507
TypeScript
heathertill/barebones-w-db
/src/server/utils/routerMiddleware.ts
2.734375
3
import * as passport from 'passport'; import { RequestHandler, Request } from 'express-serve-static-core'; interface ReqUser extends Request { user: { role: string } } export const checkToken = (req: any, res: any, next: any) => { passport.authenticate('bearer', { session: false }, (err, user, info) =...
e462f382d80e8d917f34437b218c4623bf0a4d8d
TypeScript
arimah/condict
/packages/server/src/create-logger.ts
3.109375
3
import chalk, {Chalk} from 'chalk'; import * as winston from 'winston'; import Transport from 'winston-transport'; import {Logger, LoggerOptions, LogLevel} from './types'; const levels: Record<LogLevel, number> = { error: 0, warn: 1, info: 2, verbose: 3, debug: 4, }; const levelColors: Record<LogLevel, Cha...
4aa88c24646037af6ac5942bb0b7359647a3eb31
TypeScript
j03m/min-crypto
/src/strategies/slope-trend-advisor.ts
2.84375
3
import Candle from "../types/candle"; export default { shouldBuy, shouldSell, name: "slope-trend-advisor" } import BigNumber from "bignumber.js"; import {getBigNumbersFromCandle} from "../utils/util"; import {QuadBand} from "../indicators/quad-band"; const lookBack = 25 function shouldBuy(indicators:Map...
e669806dace7dc1b2c9dd6bf8056996c646e12a1
TypeScript
rajat1883/Covid19TrackingApp
/src/app/chart-service/chart.service.ts
2.515625
3
import { Injectable } from '@angular/core'; import { SingleDayData } from '../coronavirus-model/single-day-data'; import { Chart } from 'chart.js'; import { CountryData } from '../coronavirus-model/country-data'; @Injectable({ providedIn: 'root' }) export class ChartService { private ctx: any; private chart: any...
4ed2f8a670f3036ed23feff6760f3508db1a6eae
TypeScript
doulevo/doulevo
/src/lib/command.ts
2.734375
3
// // Manages execution of a system command. // import { InjectableClass, InjectProperty } from "@codecapers/fusion"; import chalk = require("chalk"); import { exec, ExecOptions } from "child_process"; import * as stream from "stream"; import { IConfiguration, IConfiguration_id } from "../services/configuration"; impo...
47d87a7bd016e949056572a1cd77b4dd1e7abf8a
TypeScript
jfalxa/systyle
/packages/systyle/src/moulinettes/helpers.ts
2.921875
3
import { By, Props } from '../types' const rxRules = /^(\&|\@|\:|\#|\.)/ export function isCSS(_: any, key: string) { if (rxRules.test(key)) return true return typeof document === 'undefined' ? require('known-css-properties').all.includes(require('kebab-case')(key)) : key in document.body.style } export...
035a2476f1745ec50d210ccc430b115f0c3ed394
TypeScript
lineCode/regax
/packages/server/src/service/connectionService.ts
2.75
3
import { values } from '@regax/common' import { Application } from '../application' export interface ConnectionLoginInfo { loginTime: number, uid: number | string address: string } export interface ConnectionStatisticsInfo { serverId: string, loginedCount: number, totalConnCount: number, loginedList: Co...
ba3cff60f68918d0c42eac42f3e7ac23e31f6112
TypeScript
aconfee/tinycrit-api
/src/services/dummy.service.ts
2.90625
3
import Dummy from './models/dummy.model'; import DummyDao from '../data/dummy.dao'; import Bluebird from 'bluebird'; // Promise library for Sequelize import Sequelize from 'sequelize'; import _ from 'lodash'; export interface IDummyService { findDummySql(id: number): any; }; /** * Dummy */ class DummyService i...
f2a7df62176a0280f4c710eb3b40895bac45138b
TypeScript
sl1673495/typescript-codes
/src/getter-type-easy.ts
3.25
3
interface Option<G> { getters: { [K in keyof G]: () => G[K]; }; } type Store<G extends {}> = { [K in keyof G]: G[K]; }; const create = <G>(option: Option<G>): Store<G> => { return {} as any; }; const store = create({ getters: { count() { return 1 + 1; } } }); // number const count = st...
efae3fc9d52f082643832653897654bebc0e1d92
TypeScript
calogar/dog-breeds-selector
/src/app/shared/components/selector/selector.component.ts
2.6875
3
import { Component, OnInit, Input, Output, EventEmitter, SimpleChanges } from '@angular/core'; import { OptionItem } from '../../models/option-item.model'; import { Select2OptionData } from 'ng-select2'; @Component({ selector: 'app-selector', templateUrl: './selector.component.html', styleUrls: ['./selector.comp...
0bcd937bfd7ca70cf7c5d1beda6025826c7174db
TypeScript
ComprosoftCEO/TrappedInside
/src/areas/MazeObject.ts
3.25
3
/// All objects that can be inside the maze export enum MazeObject { Empty, Wall, Rock, Energy, RedDoor, YellowDoor, GreenDoor, BlueDoor, RedKey, YellowKey, GreenKey, BlueKey, Battery, Lever, ToggleDoor, InverseToggleDoor, ADoor, BDoor, CDoor, ABox, BBox, CBox, Drone, Big...
8e815ae725c1c5c1dc44ef14865cd1e1ee8c31e4
TypeScript
Anastasia811625/ts__part_of_slyzer
/src/store/reducers/usersListReducer.ts
2.671875
3
import { Actions, ActionType } from "../../types"; import { UserDataType } from "../../components/RegisterForm/RegisterForm"; const InitialState: UserDataType[] = [] export const usersListReducer = (state = InitialState, action: ActionType) => { switch (action.type) { case Actions.GET_USERS_LIST: return a...
12f64e1c89211da2615beb963c93dc4ebedb0a5c
TypeScript
joefoxman/BD-ICM
/Bd.Icm.Web/app/services/dialog.service.ts
2.6875
3
module app.services { export enum DialogResult { Yes, No, Cancel, Ok } export interface IDialogService { askYesNo(title: string, message: string): ng.IPromise<DialogResult>; } class DialogService implements IDialogService { static $inject =...
85719d7fc73476dfc23e79cec5e5cb5412c1e01f
TypeScript
minjs1cn/js-toolkits
/src/loader/loadCss.ts
2.515625
3
import { appendChild, createElement, removeChild } from '../dom' import { isCrossOrigin } from '../env' export function loadCss (url: string) { return new Promise((resolve, reject) => { const linkTag = createElement('link') as HTMLLinkElement linkTag.rel = 'stylesheet' linkTag.type = 'text/css' if ...
2fd2b67cd3bab59d70f7ba6d3203ecef791abab6
TypeScript
minhtuan251295/centerManagement
/app/models/ts/KhoaHoc.ts
2.625
3
export class KhoaHoc{ public MaKhoaHoc: string; public TenKhoaHoc: string; public MoTa: string; public HinhAnh: string; public LuotXem: number; public NguoiTao: string; constructor(maKhoaHoc:string, tenKhoaHoc:string, moTa:string, hinhAnh:string, luotXem:number, nguoiTao:string){ th...
508f57a037f1c1cb8c06c35f95d41952bbbd4661
TypeScript
ShepherdDimaloun/o7
/src/lib/settings.ts
2.609375
3
import { getClient, collections } from './db'; import config from '../config.json'; interface Settings { guildId: string; prefix: string; disabledCommands: string[]; } const cache: { [id: string]: Settings; } = {}; export function defaultSettings(guildId: string): Settings { return { guildId, prefix:...
db8a2f7ade9f13ba3d4263b0f723c709a7ce9cf8
TypeScript
oparaskos/quantity-fns
/src/volume/volume-conversions.ts
2.765625
3
import { indexMappingTable } from "../lib/index-mapping-table"; import { findConversionFactor as f } from "../lib/factor-convert"; export interface IConversion { unitNames: string[]; equivelantTo: number; [additionalProperties: string]: any; } // equivelantTo refers to its value in litres export const met...
92b608799e04f297daff85891f73fe545979ad3b
TypeScript
Fiorella2411/AngularEjercicios
/Ejemplos/ejercicios/02-arr-obj-interface.ts
3.40625
3
let habilidades: string[]=['Bash','Cuuntere', 'Hola'] interface Personaje{ nombre: string, hp: number, habilidades: string[], puebloNatal?:string } habilidades.push() const personaje:Personaje ={ nombre: 'Fiorella', hp: 100, habilidades: ['hila','cjcjh'] } personaje.puebloNatal ='Cusco' ...
fe86727deb6f2fd467b810f81f9bb67d67576a91
TypeScript
dilmanous/coding-challenge-backend-c
/repositories/cityRepository.ts
2.78125
3
import { IRepository } from "./IRepository"; import { City } from "../models/city.model"; import * as fs from "fs"; const DATA_FILE_NAME = "cities_canada-usa.tsv"; export class CityRepository implements IRepository<City> { getAll() { return fs .readFileSync(`./data/${DATA_FILE_NAME}`, "utf8") .split...
391e694324a054c8d3f192f41888c295df2c3c4d
TypeScript
2018-B-GR1-AplicacionesWeb/examen-cargua-ronald
/2018-b-prueba-master/data/CorreccioExamen.ts
2.78125
3
declare var require; const fs = require('fs'); const rxjs = require('rxjs'); const inquirer = require('inquirer'); const map = require('rxjs/operators').map; const distinct = require('rxjs/operators').distinct; function buscarTipos(propiedad:string, arreglo:Character[]) { const arregloRepetido = arreglo.map((car...
25755e5f81827490c456903e4f56b3ac382484a0
TypeScript
findawayer/kineto
/src/helpers/elements/creation.ts
2.96875
3
import type { UnknownObject } from 'typings'; import { setAttributes } from './attributes'; /** * Create a new HTMLElement with attributes passed. * * @param nodeName - The name of element to be created. * @param attributes - Initial attributes that the new element should have. */ export function createElement<T ...
0e1d2a660592731dcd848b7131de7db98f4dc5ff
TypeScript
djkloop666/appic-cli
/src/cli/creator/Creator.ts
2.578125
3
// import * as inquirer from 'inquirer' import * as EventEmitter from 'events' import { clearConsole } from '../../util/clearConsole' import { loadOptions, defaults } from './options' import { formatFeatures } from '../../util/features' interface CreatorInterFace { name?: string targetDir?: string create (opts: ...
1ae8eb454dc4f4933be18d671c83b8b7ee0dcf16
TypeScript
pjmolina/typescript-dotnetmalaga-2016
/examples/v2.0/unions.ts
4.46875
4
interface VisibilityItem { isVisible: boolean; } // Intersection type must be both function doNothing(notification: MyNotification & VisibilityItem) { // You don't need a new name, but instances must match both types } // Union types can be any function hide(items: VisibilityItem | VisibilityItem[]): vo...
2150ee60d18e5e81d036a4610cfa1e50551b38d8
TypeScript
rt2zz/redux-persist
/tests/complete.spec.ts
2.703125
3
import test from 'ava' import { combineReducers, createStore } from 'redux' import persistReducer from '../src/persistReducer' import persistStore from '../src/persistStore' import createMemoryStorage from './utils/createMemoryStorage' import brokenStorage from './utils/brokenStorage' const reducer = () => ({}) const...
16164077d61a0770d550b4c5d4fc846f5808e867
TypeScript
fatho/photo-archive
/websrc/routing/HashRouter.ts
3.15625
3
export class HashRouter { private routes: Array<Route>; constructor() { this.routes = new Array(); window.addEventListener('hashchange', (ev: HashChangeEvent) => { this.route() }); } /// Return whether there is an explicit route set. hasRoute(): boolean { ...
1101ef79d535c069c83695a61ffb02f4b3805662
TypeScript
majoravery/head-first-design-patterns-typescript
/2-observer-weather-station/src/classes/WeatherData.ts
3.109375
3
import { Subject } from './../interfaces/Subject'; import { Observer } from './../interfaces/Observer'; export class WeatherData implements Subject { private observers: Observer[]; private temperature!: number; private humidity!: number; private pressure!: number; constructor() { this.observers = []; ...
4b6a58204ed820af8f40ff9edc580d5e04d8b2ac
TypeScript
ornitorrincos/qub
/src/math/utils.ts
2.90625
3
import { Vec3 } from "./vec3"; export function mix (start: number, finish: number, t: number): number { return (1 - t) * start + t * finish; } export function randomInUnitSphere (): Vec3 { let p: Vec3 = new Vec3(); do { p = Vec3.sub(Vec3.smul(new Vec3(Math.random(), Math.random(), Math.random()),...
ff15710645c2c57824a4eeff1b064734a357e153
TypeScript
Hypercubed/ifecs
/utils/regexp.ts
2.921875
3
const tokenMatcher = /(\\[^])|\[\-|[-()|\[\]]/g; // eslint-disable-line no-useless-escape /** * Determines if a regex source has a top level alternation * from https://github.com/pygy/compose-regexp.js/blob/master/compose-regexp.js */ export function hasTopLevelChoice(source: string) { if (source.indexOf("|") ===...
2bb8d4523c6d157014741e743b1e4b837ffab3ca
TypeScript
JasminBektic/express-typescript-mongoose-starter
/app/middleware/RedirectIfAuthenticated.ts
2.515625
3
import { Request, Response, NextFunction } from "express"; import { Middleware } from "../middleware/Middleware"; class RedirectIfAuthenticated extends Middleware { /** * Logged user redirection * @param req * @param res * @param next */ public handle(req: Request, res: Response, n...
0af3ec4e6ccbd4ed86e73a36f1eb03998e585c58
TypeScript
momentechnologies/Metics
/sourcecode/api/src/exceptions/unauthorized.ts
2.71875
3
import ApiException, { errorResponse } from './apiException'; export const unauthorizedTypes = { NO_ACCESS: 1, NOT_LOGGED_IN: 2, }; const uidMessages = { [unauthorizedTypes.NO_ACCESS]: 'You do not have access to this resource', [unauthorizedTypes.NOT_LOGGED_IN]: 'You are not logged in', }; export def...
a4db065961d4579ba6dcf1803ad7c20c69756c7d
TypeScript
coding-with-binaries/chronos
/chronos-client/src/app/hooks/useClock.ts
2.703125
3
import { useEffect, useState } from 'react'; import { calculateTimeInTimeZone } from '../utils/time-utils'; export const useClock = (differenceFromGmt: string) => { const initialTime = calculateTimeInTimeZone(differenceFromGmt); const [time, setTime] = useState(initialTime); useEffect(() => { const id = set...
14384f065af59af845ef8167f10c9ce4b971cbd7
TypeScript
Typescript-TDD/ts-auto-mock
/src/extension/method/provider/provider.ts
2.875
3
import { functionMethod } from './functionMethod'; // eslint-disable-next-line @typescript-eslint/no-explicit-any type Method = (name: string, value: any) => () => any; // eslint-disable-next-line @typescript-eslint/no-explicit-any type MethodWithDeferredValue = (name: string, value: () => any) => () => any; export cl...
142cf6386a3d25f0af1a7ef6afc3d809dedafe0f
TypeScript
nonsense9/TypeScriptVideoLessons
/Lesson2.ts
3.125
3
let numArray1: number[] = [1, 2 ,3]; let numArray2: Array <number> = [1, 2, 3]; let strArray1: string[] = ['1', '2', '3']; let strArray2: Array <string> = ['1', '2', '3']; let boolArray1: boolean[] = [true, false]; let boolArray2: Array <boolean> = [true, false]; //tuples let array: [number, number, string...
fbc441bd21b315915114fcc334efb6d4d28cbfdf
TypeScript
arnaspuidokas6/Gif-Party
/src/api/types.ts
2.609375
3
export interface FetchGifsRequest { query?: string; limit?: string; } // https://developers.giphy.com/docs/api/schema/#image-object export interface IGifResponse { imageUrl: string; title: string; userImage?: string; importedAt?: string; displayName?: string; } interface IUrl { url: st...
f74c248bceb4c0e2fb3ce2e2cec0de64d71c7da2
TypeScript
jaapster/map-workbench
/src/utils/util-get selected-vertices.ts
2.609375
3
import { POINT } from '../constants'; import { Co, SelectionVector, FeatureCollection } from '../types'; export const getSelectedVertices = ( { features }: FeatureCollection, selection: SelectionVector[] ): Co[] => ( selection.reduce((m, [_i, _j, _k, _l]) => ( _i == null ? m : _j == null ? features[_i...
76df8b4342eb77b84cb0500de8f22f946a997eba
TypeScript
Valentin945/helloReact
/progress/client/test.ts
3.09375
3
class speak { public static hello(person: string): string { return "Hello, " + person + "."; } } var user = "World"; console.log(speak.hello(user));
a193c96a0f64e79e6706f3ce422baa43d3bd8ace
TypeScript
guitarooman14/todoApp
/src/app/render/animations/animations.ts
2.53125
3
import {animate, state, style, transition, trigger} from '@angular/animations'; export const visibilityChangedTransition = trigger('visibilityChanged', [ state('true', style({ opacity: 1 })), state('false', style({ opacity: 0 })), transition('1 => 0', animate('300ms')), transition('0 => 1', animate('...
4422f8d70069039c7647beacb441f5ecf4fe0fab
TypeScript
alibail/editor.js
/src/components/modules/renderer.ts
2.59375
3
import Module from '../__module'; import * as _ from '../utils'; import {ChainData} from '../utils'; import {BlockToolData} from '../../../types'; import {BlockToolConstructable} from '../../../types/tools'; /** * Editor.js Renderer Module * * @module Renderer * @author CodeX Team * * @version 2.0.0 */ export d...
c11e17d99b7079815d6c6f77a5be8fb95fd433bf
TypeScript
foysavas/polkadot-js-tools
/packages/metadata-cmp/src/compare.ts
2.5625
3
// Copyright 2018-2021 @polkadot/metadata-cmp authors & contributors // SPDX-License-Identifier: Apache-2.0 import type { RuntimeVersion } from '@polkadot/types/interfaces'; import yargs from 'yargs'; import { ApiPromise, WsProvider } from '@polkadot/api'; import { expandMetadata, Metadata } from '@polkadot/types'; ...
199a68b0884b5aec9d351370964cfa50cbf94cf3
TypeScript
spinajs/http
/src/route-args/FromParams.ts
2.796875
3
import { RouteArgs } from "./RouteArgs"; import { IRouteParameter, ParameterType, IRouteCall } from "../interfaces"; import * as express from 'express'; import { Injectable } from "@spinajs/di"; @Injectable(RouteArgs) export class FromParams extends RouteArgs { public get SupportedType(): ParameterType { r...
9027c2d06bfb337e029b473d664f0a238161da6b
TypeScript
Scrum/git-update-repos-labels
/index.ts
2.59375
3
import graphqlGot = require('graphql-got'); interface options { label: label, token: string } interface label { id: string, name: string, color: string, description: string } export default ({label: {id, name, color, description}, token}: options) => { description = description === null || description ...
c5f629556eae6404276b1a3eaeaf899a05952dd3
TypeScript
WorldBrain/storex-backend-firestore
/ts/security-rules/ast.test.ts
2.625
3
import expect from 'expect' const stripIndent = require('strip-indent') import { serializeRulesAST as serializeRulesAst, MatchNode } from './ast'; function normalizeWithSpace(s : string) : string { return s.replace(/^\s+$/mg, '').split('\n').map(line => line.trimRight()).join('\n') } export function expectSecurit...
4395cee5f25c647023ec279719b96608cedd0c9f
TypeScript
sjmeverett/clync
/packages/server/src/bindDataFns.ts
2.671875
3
import { DataFnType, isDataFn } from '@sjmeverett/clync-define'; export type ActionContext<T, P extends keyof T = keyof T> = { [K in P]: DataFnType<T[K]>; }; export function bindDataFns<T, Context>(context: Context, fns: T) { const result: ActionContext<T> = {} as any; for (const k in fns) { const fn = fns...
b8cd262c647d3481a309e1e08891646975df39c9
TypeScript
alfumit/typescript-playground
/theory/generics.ts
3.734375
4
function merge<T extends object, U extends object>(a: T, b : U) { return Object.assign(a, b); } const title = merge({name: 'Geralt'}, {location: 'Rivia'}); console.log(title); interface HasLength { length: number } function countAndDescribe<T extends HasLength>(element: T) { if (!element.length) {console....
75df0d82e2fa99830e169023ab18e0f84ab80ac1
TypeScript
j-hands/CRUDex
/CRUDex/src/app/nature-data.service.ts
2.640625
3
import { Injectable } from '@angular/core'; import { Headers, Http } from '@angular/http'; import 'rxjs/add/operator/toPromise'; import { Nature } from './nature'; @Injectable() export class NatureDataService { private natureUrl = 'http://localhost:57135/api/natures'; constructor(private http: Http) { } //Re...
05be9de7a9929ac232f8774e638361f1e1c05802
TypeScript
luisgrandegg/coronavirus
/src/Gratitude/Gratitude.ts
2.703125
3
import { ObjectID } from 'mongodb'; import { Entity, ObjectIdColumn, Column, CreateDateColumn, UpdateDateColumn, BeforeInsert } from "typeorm"; import { IsString, IsOptional, IsBoolean } from 'class-validator'; export interface IGratitude { id: string; title: string; message: string; name: string; ...
7db415b7041da3ff0fed9a675c4336b515042501
TypeScript
philip-jonas/game_prototype_01
/src/Stores/PlotStore.ts
2.859375
3
import { observable, computed, action, toJS } from "mobx"; import { make2DArray } from "src/utils/Make2DArray"; import { generateRandomInteger } from "src/utils/GenerateRandomRange"; interface IPosition { col: number; row: number; } export class PlotStore { @observable public worldGrid: IPosition[] = []; ...
57b8d310753adf84bfb1860af260dd502cfecb92
TypeScript
nahann/jorge-pogger-
/jorge/src/Commands/Info/SearchCommand.ts
2.71875
3
import Command from "../../Struct/Command"; import fetch from "node-fetch" import { Message } from "discord.js"; import { CSEImage, Google } from "../../interfaces/google" export default class SearchCommand extends Command{ constructor(){ super("search",{ aliases: ["search","google"], ...
f682cbaf06f5058ab24568ac36e4219f540a53ef
TypeScript
MalikaArora/dpl-react
/src/components/Navigation/types.ts
2.9375
3
/** * Navigation Config Types */ type onLinkClick = ( e: React.MouseEvent<HTMLElement>, item: NavigationStateLink ) => void; type onClick = (e: React.MouseEvent<HTMLAnchorElement>) => void; export type LinkProps = NavigationStateLink & { onClick?: onClick }; type LinkAs = React.ComponentType<LinkProps>; type ...
ef6b859480a5d92c0d25933857626be2ab82c3b1
TypeScript
sz5t/SmartOne-Components-Module
/src/app/resolver/trigger/cn-trigger.base.ts
2.53125
3
export class CnTriggerBase { constructor(public _triggerMsg: any, public _componentInstance: any) {} public beforeOperationValidator(beforeCfg) { if (!beforeCfg) { return true; } } public conditionValidator(condCfg): boolean { if (!condCfg) { return true...
84349219862768099b5f9b43a1885ec5fac9a448
TypeScript
orta/gluegun
/src/core-extensions/template-extension.test.ts
2.546875
3
import test from 'ava' import { startsWith } from 'ramdasauce' import { Runtime } from '../runtime/runtime' const createRuntime = () => { const r = new Runtime() r.addPlugin(`${__dirname}/../fixtures/good-plugins/generate`) return r } test('generates a simple file', async t => { const context = await createRu...
7c9fef22067e7c46404299bbf3828c899ee494a1
TypeScript
JesusJimenezValverde/Proyecto_Bases_II_API_Rest
/src/models/product.ts
2.625
3
import { model, Schema, Document } from 'mongoose' export interface IProduct extends Document { name: string loc: Number productor: string } const prodSchema = new Schema({ name: { type: String, unique: false, required: true, lowercase: false, trim: true }, ...
9886bdcf45e79971553ad1bae3ebd678000d4c29
TypeScript
GoogleForCreators/web-stories-wp
/packages/story-editor/src/app/story/useStoryReducer/reducers/unselectElement.ts
2.578125
3
/* * Copyright 2020 Google LLC * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
eb46d7d32d3f14fbcd5ed7629ea52b506c6b388b
TypeScript
FrankDouwes/justHike
/src/app/type/town.ts
3.109375
3
import {Waypoint} from './waypoint'; import {Poi} from './poi'; export interface Town { trail: string; // abbr. of trail mile belongs to id: number; // id (mile number, starts at 1 not 0) label: string; // town name waypoint: ...
423160664c782f053b4e0c1369ac64c0ba273d24
TypeScript
hcoggins/momo-scheduler
/test/job/findLatest.spec.ts
2.953125
3
import { DateTime } from 'luxon'; import { ExecutionInfo } from '../../src'; import { JobEntity } from '../../src/repository/JobEntity'; import { findLatest } from '../../src/job/findLatest'; function createJob(lastFinished?: number): JobEntity { const job = { name: 'test' } as JobEntity; if (lastFinished !== und...
f26892c8949071ece64370e86672f5665877c37d
TypeScript
CourtHive/tods-competition-factory
/src/scaleEngine/governors/ratingsGovernor/aggregators.ts
2.71875
3
export const aggregateGames = (sets) => { return ( sets?.reduce( (aggregate, set) => { aggregate[0] += set.side1Score; aggregate[1] += set.side2Score; return aggregate; }, [0, 0] ) || [0, 0] ); }; export const aggregateSets = (sets) => { return ( sets?.reduce...
07e324ec0910a3191c6cb187caaac3b052a65b0f
TypeScript
YuriNikulin/teacher
/front/admin/src/pages/Page/redux/reducer.ts
2.6875
3
import { ActionsTypes } from './actions'; import * as ACTIONS from './constants'; import * as APP_ACTIONS from '@store/constants'; import { ActionTypes as AppActionTypes } from '@store/actions'; import { IPageReducer, IPage, IBlock } from '../types'; const initialState = { isLoading: true, isFormLoading: false, ...
3e05d4f15b6cec5cd8cfbffe8fd2411c3b741a9a
TypeScript
inkblotty/StarWarsQuiz
/client/src/store/actions.ts
2.8125
3
import { QuizState, SingleAnswerField, SingleQuizField, QuizAction } from './types'; export const initQuiz = (configObj : QuizState) : QuizAction => { if (!configObj || Array.isArray(configObj) || (typeof configObj !== 'object')) { throw new Error('Invalid config object.'); } return { type: 'init', q...
32f373e53ebc3b308c15e73162827fd29b323e2e
TypeScript
aondenet-sinval/typescript
/converted/converted-ts/stringMethods.ts
4.15625
4
//------------------------------------------- //Conversão: 01 //------------------------------------------- //Java script methods: //JavaScript métodos usados em strings: /* let str: string = "O mar é lindo, muito lindo"; //Retorna o indice em que a string está posicionada let lindo: number = str.indexOf("lindo"); cons...
6e8a532a4dbc0b429e067cc067c144ec92abef1e
TypeScript
npenin/akala
/packages/json-rpc-ws/src/ws/ws-socket-adapter.ts
2.8125
3
import ws from 'ws'; import { SocketAdapter, SocketAdapterEventMap } from '../shared-connection.js'; import { Readable } from 'stream'; /** * json-rpc-ws connection * * @constructor * @param {Socket} socket - web socket for this connection * @param {Object} parent - parent that controls this connection */ export...
1d24f4c68b92052b3efbc7488130855bb67b9bfc
TypeScript
harry502/CardGame
/client/src/logic/game/Base/CardManager.ts
2.71875
3
class CardManager { private static inst: CardManager; private isReady:boolean = false; private CardsList:number[]; public static getInst() { if (CardManager.inst == null) { CardManager.inst = new CardManager(); } return CardManager.inst; } constructor() { ...
9cd6e183b0c6243b2ac7b49fa12fca9b28a234d3
TypeScript
excaliburjs/Excalibur
/src/spec/BrowserEventsSpec.ts
2.625
3
import * as ex from '@excalibur'; describe('The BrowserEvents facade', () => { let browser: ex.BrowserEvents; beforeEach(() => { browser = new ex.BrowserEvents(window, document); }); afterEach(() => { browser.clear(); }); it('should exist', () => { expect(ex.BrowserEvents).toBeDefined(); })...
fca3c9d1644340d15aba351e65b94db3791ee368
TypeScript
jackhutu/lerna-study
/packages/bighouse/src/index.ts
3.015625
3
// import { bighouse } from './bighouse'; // import house from '@study/house'; // export default function() { // console.log(bighouse() + 'hello' + house); // } import { capitalize } from '@study/house'; export default class Hello { msg: string; constructor(msg: string) { this.msg = capitalize(msg); } ...
4ce1f8bccee586a069280f5347ac2df483eb9c76
TypeScript
foxz-z/react-application-core
/src/core/util/converter.ts
3.078125
3
import * as R from 'ramda'; /** * @stable [21.10.2018] * @param {Map<TKey, TValue>} map * @returns {{[p: string]: TValue}} */ export const fromMapToObject = <TKey, TValue>(map: Map<TKey, TValue>): { [index: string]: TValue } => R.mergeAll(Array.from(map.keys()).map((path) => ({[String(path)]: map.get(path)})));
a28d31db923fb369853dc24f063f73ed49b6394a
TypeScript
anibalalvarezg/RxJS
/src/Operators/02-pluck.ts
2.84375
3
import { range, fromEvent } from 'rxjs'; import { map, pluck } from 'rxjs/operators' const range$ = range(1,5); // range$.pipe( // map<number, string>(x => { // return (x*10).toString(); // }) // ).subscribe( console.log ) const keyup$ = fromEvent<KeyboardEvent>( document, 'keyup'); const keyupCode$ =...
d15d08a8ac244116964ab3b97ffbf3e9c7fdcbf6
TypeScript
iPotaje/ionic2-sqlite-example
/src/services/data.service.ts
2.8125
3
import { Injectable } from '@angular/core'; // import { Observable } from 'rxjs/Observable'; @Injectable() export class DataService { public datos = "inicial"; // private data = [ // "uno", "dos", "tres", "cuatro", "cinco" // ]; // private index = 0; constructor() { } getData(): Promise<string...
d744d497191d8b14585013e19a5b055e95040c24
TypeScript
jianh-zhou/TS_study
/code/Part4/src/07泛型.ts
4.125
4
function fn<T>(a: T): T { return a } fn(20) // 不指定泛型, TS可以自动对类型进行判断 fn<string>('哈哈') // 指定泛型 // 泛型可以定义多个 function fn2<S, A>(a: S, b: A): A { return b } fn2<string, number>('22', 11) // 定义一个接口 interface twst { length: number } // 泛型可以继承接口,表示泛型必须是接口的实现类(子类) function fn3<H extends twst>(a: H): H { return a } fn3...
a08e5f2043ed0a2f9985a51e1bf8f8c139e0fe44
TypeScript
Kcire6/CyclosInfoUGT
/src/app/api/models/ui-element-with-content.ts
2.78125
3
/* tslint:disable */ import { VersionedEntity } from './versioned-entity'; /** * Contains definitions for a UI element that has a content */ export interface UiElementWithContent extends VersionedEntity { /** * The content of this element */ content?: string; }
b812ef1ce1976600cc722f5672e1ff252e00e2d6
TypeScript
Phong111222/Admin-Panel
/src/store/product/reducer.ts
2.984375
3
import { Reducer } from 'redux'; import { ProductActions, ProductState, ProductType, ProductTypes, } from './types'; const initialState: ProductState = { loading: false, list: [], error: null, }; const productReducer: Reducer<ProductState, ProductActions> = ( state = initialState, action ) => { sw...
dafb0c643b631927ed5c3e502faabf3375473be7
TypeScript
iter-tools/iter-tools
/src/impls/async-interleave-ready/__tests__/async-interleave-ready.test.ts
2.515625
3
import { asyncInterleaveReady, asyncToArray } from 'iter-tools-es'; import { delay } from '../../../internal/delay.js'; describe('asyncInterleaveReady', () => { it('can use the return value of canTakeAny to interleave by promise readiness', async () => { const a = (async function* () { await delay(10); ...
3754ffcd4e90f5e79cb5d616a61e4e1305b6707c
TypeScript
video-dev/hls.js
/src/utils/discontinuities.ts
2.75
3
import { logger } from './logger'; import { adjustSliding } from './level-helper'; import type { Fragment } from '../loader/fragment'; import type { LevelDetails } from '../loader/level-details'; import type { Level } from '../types/level'; import type { RequiredProperties } from '../types/general'; export function f...
e98a72a959af8a578761dace03a73639363b50ac
TypeScript
nickmessing/credit-client
/src/utils/validation.ts
2.84375
3
/* eslint-disable @typescript-eslint/no-explicit-any */ import { computed, ref, Ref } from 'vue' import validator from 'validator' export type ValidatorParameters<T extends (str: string, ...args: any) => any> = T extends ( str: string, ...args: infer P ) => any ? P : never export type RuleDefinition = { [ke...
75ae7dc24b2ac0423d2380825f8ad432a919fd1c
TypeScript
eleagnt/ChatService--UI
/src/services/WebsocketService/handlers/UserConnectedHandler.ts
2.578125
3
import BaseHandler from '@/services/WebsocketService/handlers/BaseHandler' import { WebsocketReceivePayload } from '@/services/WebsocketService/WebsocketService' import SocketUser from '@/entities/websocket/SocketUser' import User from '@/entities/state/User' interface UserConnectedPayload { user: SocketUser } expo...
eb53789c29c999851213feec4908a72830c541dc
TypeScript
QDivision/chip
/src/utils/errors.ts
3.15625
3
import { log } from './log'; /** * Prints a succinct error message (without a full stack trace). Useful * for when non-fatal errors occur. Allows you to log them without polluting * stdout/stderr with stack traces that detract from other important output. */ export const printError = ({ output, message }: any) => ...
e3e427974ca3fe1c1ae7598f6d0127059e65bc6d
TypeScript
ULL-ESIT-INF-DSI-2021/ull-esit-inf-dsi-20-21-prct11-menu-api-grupo-g
/src/models/Menu.ts
2.703125
3
import {Document, Schema, model} from 'mongoose'; interface MenuInterface extends Document { name: string, plates: any[], price: number, hydrates: number, lipids: number, proteins: number, kcal: number, groups: any[], ingredients: any[], } const MenuSchema = new Schema({ name: { type: String, ...