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
d3e87c4ea4f8efe7cdee6335e776019e8e29de00
TypeScript
Blackdread/lens
/packages/core/src/renderer/search-store/search-store.ts
3.046875
3
/** * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ import { action, computed, observable, makeObservable } from "mobx"; import autoBind from "auto-bind"; export class SearchStore { /** * An utility methods escaping us...
14bde59ebd14cce24b6e7056fbf2b4f89bac62e5
TypeScript
eduardovecino/bs-assistant
/src/rest/routes/cards.ts
2.546875
3
import { Request, Response } from "express"; import { CardService } from "../../services/card.service"; import { CardManager } from "../../managers/card.manager"; export class CardRoutes { private cardService: CardService; constructor() { this.cardService = new CardService(); } public route...
8282206ee41e3faac76d5a482779bdc134dfa504
TypeScript
francoisgeorgy/react-svg-knob
/src/knobConfig.ts
2.828125
3
export const TRACE = false; export const VIEWBOX_WIDTH = 100; export const VIEWBOX_HEIGHT = 100; export const HALF_WIDTH = 50; // viewBox/2 export const HALF_HEIGHT = 50; // viewBox/2 export const NS = "http://www.w3.org/2000/svg"; export const CW = true; // clock-wise export const CCW = !CW; // count...
d08f59d500d3a2e6b7bef7ac714f2ddf1fb79cb1
TypeScript
concord-consortium/collaborative-learning
/src/models/tiles/geometry/geometry-model.ts
2.53125
3
import { difference, intersection } from "lodash"; import { applySnapshot, getSnapshot, getType, Instance, SnapshotIn, types } from "mobx-state-tree"; import { kDefaultBoardModelInputProps, kGeometryTileType } from "./geometry-types"; import { uniqueId } from "../../../utilities/js-utils"; import { typeField } from ".....
6faa219ecd81e2473723cb1e04c1739097f9052f
TypeScript
AuHau/sequelize-store
/test/index.spec.ts
2.625
3
import chai from 'chai' import dirtyChai from 'dirty-chai' import chaiAsPromised from 'chai-as-promised' import { QueryTypes, Sequelize } from 'sequelize' import { init, getObject, reset, purge, getEndPromise } from '../src' chai.use(chaiAsPromised) chai.use(dirtyChai) const expect = chai.expect function sleep<T> (m...
4f08d3ab6a24a54eb3b3a5a00186e15cef9e953d
TypeScript
joshfeinsilber/word-chain-server
/src/Challenges.ts
3.625
4
import { shuffle } from "lodash" export enum ChallengeCategory { letterCount = "letterCount", partOfSpeech = "partOfSpeech", containsLetter = "containsLetter", endsWithLetter = "endsWithLetter", doesNotContainLetter = "doesNotContainLetter" } export interface Challenge { category: ChallengeCategory valu...
20ff8f2777a202d323c91f4c1f36e406ba0b1287
TypeScript
dejvids/Angular-Material-playground
/src/app/contacts/contacts.component.ts
2.53125
3
import { Component, OnInit } from '@angular/core'; import { Contact } from './Contact'; @Component({ selector: 'app-contacts', templateUrl: './contacts.component.html', styleUrls: ['./contacts.component.css'] }) export class ContactsComponent implements OnInit { contacts: Contact[]; constructor() { ...
37c9ddccb68b07394f3145312f0afa34d9656c28
TypeScript
alexghr/node-stats
/src/tracker.test.ts
2.953125
3
import 'jest'; import { createStatsTracker, StatsTracker } from './tracker'; import { StatsEventName } from './stats'; const TIMEOUT = 100; describe('tracker', () => { let tracker: StatsTracker; beforeEach(() => { jest.clearAllMocks(); tracker = createStatsTracker(); }); describe('...
618ac159d12ff28625030fd50eca158ddab0c679
TypeScript
hyperskill/hs-test-web
/hstest/handler/eventHandler.ts
2.703125
3
import puppeteer from "puppeteer"; class EventHandler { static async waitForEvent(eventName: string, pageInstance: puppeteer.Page, elementHandle: puppeteer.ElementHandle | null, timeout = 10000): Promise<any> { async function pageFunction (event: ...
f7a93fbc2f736c07c2c0630b33c4405e5a2f8790
TypeScript
rstedman/tfs-pullrequest-dashboard
/test/pullRequestFilter.pipe.spec.ts
2.546875
3
import {PullRequestAsyncStatus, User} from "../src/app/model"; import {PullRequestFilterPipe} from "../src/app/pullRequestFilter.pipe"; import {PullRequestViewModel} from "../src/app/pullRequestViewModel"; import {TestUtils} from "./testHelpers"; describe("PullRequestFilterPipe", () => { function createPRViewMode...
d0ec118a8d4b64623358bd29c506c9e4e653677e
TypeScript
seatsio/seatsio-js
/tests/events/createEvents.test.ts
2.5625
3
import { TestUtils } from '../testUtils' import { TableBookingConfig } from '../../src/Events/TableBookingConfig' import { Category } from '../../src/Charts/Category' import { LocalDate } from '../../src/LocalDate' import { CreateEventParams } from '../../src/Events/CreateEventParams' test('should check that a minimum...
f59daa2dda4d98224b51007f6845144115faea4a
TypeScript
oleg-prikhodko/AdventOfCode2020
/25/solution.ts
3.171875
3
function transform(subject: number, loopSize: number) { let value = subject; let loop = 1; while (loop < loopSize) { value = value * subject; value = value % 20201227; loop++; } return value; } function* getValueStream(subject: number) { let value = 1; while (true) { value = value * subje...
b66a555e5654e25550158588349aaba4e676afc5
TypeScript
benedicteb/country-visualizer
/src/utils.ts
2.640625
3
const ALL_COUNTRIES_URL = "https://restcountries.eu/rest/v2/all"; const kilometerSquaredToMilSquared = (kilometer: number): number => { return kilometer * 0.3861; }; const downloadListOfCountries = ( fields = ["name", "area", "population", "region", "languages"] ): Promise<Country[]> => { return fetch(`${ALL_CO...
6d09fd4534f74135463f4497dd4e186444264681
TypeScript
StoneT2000/brain.js
/src/activation/tanh.ts
3.40625
3
/** * Hyperbolic tan */ export function activate(weight: number): number { return Math.tanh(weight); } /** * @description grad for z = tanh(x) is (1 - z^2) */ export function measure(weight: number, error: number): number { return (1 - weight * weight) * error; }
8ffc32ef4ca3dbe7dac83352b5a87243f9a1f0d2
TypeScript
siva253/AKAN-Devices
/src/app/shared/Directives/count-to-counter.directive.ts
2.546875
3
import { Directive, OnInit, Input, Output, EventEmitter, ElementRef, HostListener } from '@angular/core'; import { interval } from 'rxjs'; @Directive({ selector: '[appCountToCounter]' }) export class CountToCounterDirective implements OnInit { @Input('toValue') toValue:number; @Output('onCount') onCount:EventEmi...
ca0a177ea6a7785cb35093d802ca33ba35337fb6
TypeScript
oooookk7/bust-it
/api/src/handlers/actionHandler.ts
2.5625
3
import { GameStateEnum, ActionTypeEnum, SocketInEventEnum, GameErrorTypeEnum, SocketOutEventEnum } from '../globals/enums' import { SocketActionEventPayload, GameStatusInfo, ErrorInfo } from '../globals/types'; import { Sessions } from '../sessions'; import { Socket } from '../socket'; import { actionHelper } from '../...
a44f235ce3bcdfebf302b5090e4e36638082a0e6
TypeScript
nikhilrwadekar/deno
/basics/server.ts
2.734375
3
// Server (http module) import { serve } from "https://deno.land/std/http/server.ts"; const server = serve({port: 3000}) console.log('Listening for requests on Port 3000') // For loop for await (No limitter) for await (const req of server) { const url = req.url; req.respond({body: `Hello Again! You visited ${url}`...
3259d2184bc10eebe6d020102110e0b5be54f70e
TypeScript
RayMa1n/clovermon-showdown
/data/mods/clover/rulesets.ts
3.046875
3
export const Rulesets: {[k: string]: ModdedFormatData} = { blobbosclause: { effectType: 'ValidatorRule', name: 'Blobbos Clause', desc: "Blobbos cannot use Eviolite. It does not need Eviolite.", onValidateSet(set) { if (this.toID(set.item) === 'eviolite' && this.toID(set.species || set.name) === 'blobbos') {...
b761382e5a00c7f278522d4bcbc985ecf975e87a
TypeScript
krsepp/wallester-test
/src/services/reqres.ts
2.5625
3
import IListUsers from '../interfaces/IListUsers'; import ISingleUser from '../interfaces/ISingleUser'; const API_ENDPOINT = 'https://reqres.in/api/'; export async function getListUsers(page: number): Promise<IListUsers> { const response = await fetch(`${API_ENDPOINT}users?page=${page}`); return await respons...
0cb67a4efaf8fbff8ed01bc26a3d3774c99186c3
TypeScript
MaddyKilmurray/adoptapetFron
/src/app/adopt/adopt.component.ts
2.515625
3
import { Adopter } from './../models/adopter.model'; import { AnimalAdoptionAPIServiceService } from './../animal-adoption-apiservice.service'; import { Animal } from './../models/animal.model'; import { Component, OnInit } from '@angular/core'; import { Adopted } from '../models/adopted.model'; @Component({ selecto...
f9c53aebceb98d4f7e9293fb38b6ed63f0af9327
TypeScript
kingsley-einstein/Event-Manager-Frontend
/src/app/management/reducers/auth.reducer.ts
2.65625
3
import { AuthActionType, AuthConstants } from "../actions"; import { AuthState, initialAuthState } from "../states"; export default (state: AuthState = initialAuthState, action: AuthActionType): AuthState => { switch (action.type) { case AuthConstants.GET_AUTH_SUCCESS: return { ...state, data: action.paylo...
06114b26435b0f0d69691a339fe36dfa03ede5f4
TypeScript
broslukasz/wez-parasol
/src/app/weather/weather.service.ts
2.515625
3
import { ChangeDetectorRef, Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { from, Observable } from 'rxjs'; import { first, mergeMap } from 'rxjs/operators'; import { WeatherbitHourlyForecast } from '../models/forecast'; interface Coordinates { readonly accuracy: number...
a8d82e844c0b97eda2e17b434798499642483436
TypeScript
chenxsa/ngx-dynamic-form-builder
/apps/demo/src/app/shared/models/exp-user.ts
2.640625
3
import { IsEmail, IsNotEmpty, IsOptional, Validate, ValidateIf, ValidateNested } from 'class-validator-multi-lang'; import { EqualsTo } from '../utils/custom-validators'; import { ExpDepartment } from './exp-department'; export class ExpUser { id: number; @IsNotEmpty({ groups: ['user', 'guest', 'new'], }) ...
31efc2c86dfc64f946e33f8f089ae2ac325ce9b5
TypeScript
ashish8833/ReactiveAngularNgRx
/src/app/store/reducers/book.reducers.ts
2.875
3
import * as fromBookAction from '../actions/'; import { Book } from '../../model/book.model'; export interface BookState { data : Book[]; loading : boolean; loadedSucceess : boolean; loadedFail : boolean; searchTerms : string; } export const intialBookState : BookState = { data : [], loadi...
9bf3be8c0bbbf435d2c453d32c05384b07a822e9
TypeScript
z4444a/AIM
/frontend/src/redux/reducers/project-suggestion-reducers.ts
2.546875
3
import { ProjectModel } from '../../model/get/project-model'; import { getType, RootAction } from 'typesafe-actions'; import { clearProjectPage, fetchProjectPage } from '../actions/project-actions'; const projectPageReducer = ( state: ProjectModel[] | [] = [], action: RootAction ): ProjectModel[] | [] => { switc...
f2c75c33642729d20d1f3c196ace779e6dfd527e
TypeScript
LittleIronMan/Match2_SanAndreas
/Match2_SanAndreas/assets/src/BasePlayField.ts
2.984375
3
import gameConfig from "./GameConfig"; import { LEFT, RIGHT, DOWN, UP, OK } from "./Constants"; import * as C from "./Constants"; import BaseTile from "./BaseTile"; import TileType, { TileTag } from "./TileType"; import Pos from "./Pos"; type Dir = (typeof RIGHT | typeof LEFT); export interface FieldProps { /** ш...
a1f9f03249bb6b199d9b7d9dc5579ac4a1eda29e
TypeScript
gauravmahto/simple-websocket-server
/src/app/run-cmd.ts
2.671875
3
/* * Copyright 2019 - Author gauravm.git@gmail.com */ import { spawn } from 'child_process'; import process from 'process'; import { createLogger } from 'libs/utils'; const logger = createLogger('run-cmd'); const isWinPlatform = (process.platform === 'win32'); export function runCommand({ cmd = '', onError =...
c7ac0f96df96ed5135b5fe0835afd625a22cba68
TypeScript
jopika/Resumemon
/src/App.ts
2.765625
3
import express from "express"; import {parse} from "./parse"; import { generatePowerLevel } from "./powerLevel"; import {generateMoveSet} from "./MoveSetGenerator"; import {getType, PokeType} from "./typeGenerator"; import {Pokemon} from "./Pokemon"; import {Move} from "./Move"; import {getPokemonByType} from "./pokemo...
2a4ac2d9a1121e544bcbc50ffa2bbac43954b673
TypeScript
bloom-housing/bloom
/sites/public/cypress/support/helpers.ts
2.828125
3
/* eslint-disable @typescript-eslint/no-explicit-any */ import { Listing } from "@bloom-housing/backend-core/types" export const listingsUrl = "http://localhost:3100/listings?limit=all" type GetIncomeReturn = { monthlyMin: number monthlyMax: number annualMin: number annualMax: number } | null type ApplyConf...
57c32ca343f1d5195989f478ea7c262d284a308f
TypeScript
strass/sigereth
/src/types/Generic.ts
2.90625
3
import { firestore } from 'firebase'; export type Action<Type extends string | number | symbol, I extends object = {}> = { type: Type; } & I; export type InterfaceValueAction<T extends object> = { [K in keyof T]: Action<K, { value: T[K] }> }[keyof T]; export enum MoteType { PERSONAL = 'personal', PERIPHERAL ...
7a2288a96c94d2f70a15a17998204ff8e97a9707
TypeScript
EYHN/crypto
/src/aes/convertToInt32.ts
2.8125
3
export default function convertToInt32(data: ArrayBuffer) { const bytes = new Uint8Array(data); var result = []; for (var i = 0; i < bytes.length; i += 4) { result.push( (bytes[i ] << 24) | (bytes[i + 1] << 16) | (bytes[i + 2] << 8) | bytes[i + 3] ); } ...
c70d1d3ad33d60f9c9568bf5d2c06eaa745b500e
TypeScript
MukulGupta005/Nosir_website
/src/app/services/auth.service.ts
2.53125
3
import { Injectable } from "@angular/core"; import { rejects } from "assert"; import * as firebase from "firebase"; import { Subject } from "rxjs"; @Injectable({ providedIn: "root", }) export class AuthService { currentUser; isLoggedIn = new Subject<boolean>(); constructor() {} signInwithGoogle() { var ...
576d789f7417e15ff2c4865b4f2037400372d96f
TypeScript
penkong/js-plain
/100algo/1.absoluteValMinimization.ts
3.3125
3
function absoluteValMinimization(a: number[]): number { const isEven = a.length % 2 === 0; return isEven ? a[a.length / 2 - 1] : a[Math.floor(a.length / 2)]; } absoluteValMinimization([1, 2, 3, 4, 5, 6, 7]); // console.log(absoluteValMinimization([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]));
129e3c756d4e1d3f3e0e2ad935e1a9f1d2dfbc5e
TypeScript
brunobispo/weather-app
/front/src/reducers/cities.ts
2.875
3
import { CitiesAction, CitiesActionTypes, UserAction, UserActionTypes } from '../actions' import { City } from '../types' interface CitiesState { editing: boolean selected: City searchTerm: string | null searchCities: City[] | null loading: boolean userCities: City[], changed: boolean } const initialSta...
cb7ba75daa1a6287010e4c9a6e10e75f060f6304
TypeScript
AkshayRana92/ionic_tutorial
/src/models/task.ts
2.515625
3
export interface Task { description: string; creationDate: Date; completionDate: Date; isComplete: boolean }
be4cf055ea4a9006f77683938c42d5beb2e1d8ef
TypeScript
alanszp/microservices-workshop
/calculator/edge-api/src/services/executorService.ts
2.796875
3
import {Operand} from "../models/operand"; import {Executor} from "../models/executor"; import {Expression} from "../models/expression"; import logger from "../logger"; import NoAvailableExecutorError from "../errors/no_available_executor_error"; const executorsMap: Map<Operand, Set<Executor>> = new Map(); export fun...
5ea3f14facb2950e580e66f52ea919c56cf625c0
TypeScript
abdallanayer/ng-bcomponents
/bcomponents/button/button.bcomponent.ts
2.546875
3
import {Component, Directive, Input, Output, EventEmitter, ElementRef} from '@angular/core'; import {BComponent, BComponentInputs, DisplayType} from '../bcomponent'; export class ButtonBase extends BComponent { @Input() text: string; @Input() type: DisplayType = "default"; @Input() click: () => void; ...
754b8de2c659be77e9f940a13e81b194f0e2132c
TypeScript
DystopianProgrammer/emilena
/src/person/common-actions.ts
2.734375
3
import { Person, Staff, Client, Address, Availability } from '../model/model'; export abstract class CommonActions { _person: Person; constructor(person: Person) { this._person = person; this._person.address = new Address(); } showAvailabilityForm: boolean = false; active = true;...
c8e534b040dbfa945e4153bac83597a6a067d7b6
TypeScript
mkinfrared/click-the-fox
/src/ui/Heading/Heading.type.ts
2.546875
3
export type HeadingProps = { className?: string; children?: React.ReactNode; /** * h1 - 36px, h2 - 30px, h3 - 26px, h4 - 20px, h5 - 16px, h6 - 14px */ variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6"; };
f2f324613f4fae3154c086a90416a15a59d56df2
TypeScript
mogo062/portfolio
/src/app/services/account.service.ts
2.8125
3
import { Injectable } from '@angular/core'; import { Stock } from './stocks.model'; import { LocalStorageService } from './local-storage.service'; import { AlertService } from './alert.service'; import { CurrencyPipe } from '@angular/common'; const defaultBalance: number = 10000; @Injectable({ providedIn: 'root' })...
65668580c39360668904db63002719b75e44efec
TypeScript
pixelfactoryio/synthetic-exporter
/src/metrics/PerformanceMetric.spec.ts
2.546875
3
import { Registry, Gauge } from 'prom-client'; import { PerformanceMetric } from './PerformanceMetric'; let registry: Registry; let pm: PerformanceMetric<Gauge<string>>; beforeAll(() => { registry = new Registry(); pm = new PerformanceMetric( new Gauge({ name: 'test_probe_seconds', help: 'Test p...
b00b3a1203d72ebeae8ffe3f983c60ee143c29bb
TypeScript
erkiesken/advent-of-code
/2019/day-10/solution.ts
2.953125
3
import { readFileStrSync } from 'https://deno.land/std@v0.25.0/fs/read_file_str.ts'; import { vec2 } from 'https://unpkg.com/gl-matrix@3.1.0/esm/index.js'; type vec2 = Float32Array; function parse(s:string) { return s.trim().split('\n').map((val) => val.split('')); } const input = readFileStrSync('input.txt'); t...
a8b94d974f94730913b884786fd61cb916ca5c3a
TypeScript
AldiPrayogi/frontend-learning-angular
/src/app/hero.service.ts
2.53125
3
import { Injectable } from '@angular/core'; import { Hero } from './hero'; import { Observable, of } from 'rxjs'; import { MessageService } from './message.service'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { catchError, tap } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) e...
1f450cbbaeae881204202d1b1af00c9710ade2ef
TypeScript
carl-eis/dnd-roller
/src/core/constants/index.ts
2.890625
3
export interface IDiceRuleset { name: string; dice: number; discardDice: number; discardSets: number; sets: number; } export interface IRulesets { [x: string]: IDiceRuleset; } export const RULESETS: IRulesets = { ROLL_3: { name: 'Roll 6x3', dice: 3, sets: 6, discardDice: 0, discardSe...
6ddc4c49f4b8e4bd50cc15b4729dbaf4e8ba397b
TypeScript
mscheetz/CryptoBits
/src/app/classes/cryptoBits/transaction.ts
2.84375
3
import { TrxType } from "./trxType"; import { Location } from "./location"; import { Address } from "./address"; /** * Represents a transaction. */ export class Transaction { private _symbol: string; private _name: string; private _pair: string; private _type: string; private _date: Date; pr...
1ddcfc3eebf150d7d1eb19c8569c9a6da0b81090
TypeScript
Blackdread/lens
/packages/core/src/common/__tests__/catalog-category-registry.test.ts
2.765625
3
/** * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ import type { CatalogCategorySpec } from "../catalog"; import { CatalogCategory, CatalogCategoryRegistry } from "../catalog"; class TestCatalogCategoryRegistry extends Cat...
4020008e2d6cbbc8e17264ce99ad8eea37d82339
TypeScript
Loeka1234/express-res-errors
/lib/errorHandlerMiddleware.ts
3.265625
3
import { NextFunction, Request, Response } from "express"; import { CustomError } from "./CustomError"; import { DefaultError } from "./errors/DefaultError"; const defaultConfig: ErrorHandlerMiddlewareConfig = { defaultResponse: { errors: [{ message: "Something went wrong" }], }, logCustomErrors: false, lo...
42a9b059cb9acdf616aac1c656650dceca0db8b9
TypeScript
RosenborgSupporterSoftware/RUSK
/src/Utility/ChunkHandler.ts
3.03125
3
/** * ChunkHandler.ts * Experimental class that provides chunking functionality. * This will hopefully result in stable code that can help RUSK store larger amounts of configuration data. * */ /** A simple class that represents a single chunk of data */ export class Chunk { private _name: string; /** ...
0fcd591295008023a4233384b2e226a8368688ed
TypeScript
kunalashar25/learn-typescript
/language_fundamentals/generics/utility_types/partial_types/app.ts
3.953125
4
interface CourseGoal { title: string; description: string; completeUntil: Date; } function createCourseGoal( title: string, description: string, completeUntil: Date ): CourseGoal { // let courseGoal:CourseGoal = {}; Type '{}' is missing the following properties from type 'CourseGoal': title, description, comple...
80af0abdac0ec2e083d6e2cc9c928c3eda413e96
TypeScript
johnnywale/labs
/src/problem4/retrieve-service.ts
2.765625
3
import {ethers} from "ethers"; import {Event} from "@ethersproject/contracts/src.ts/index"; export class ContractInfo { public static readonly BSS_PROVIDER_URL: string = "https://bsc-dataseed.binance.org/" constructor( public readonly contactAddress: string, public readonly abi: string, ) ...
eb10d5e1e43e2df46d4de29cc85f3d3f3a0c9e19
TypeScript
everdimension/draggable-list
/src/dataSources/statements/Source.ts
3.046875
3
import NanoEvents from 'nanoevents'; import nanoid from 'nanoid'; import { createReorderedArray } from './createReorderedArray'; interface ItemBase { name: string; description: string; } interface Item extends ItemBase { id: string; } interface State { items: { [id: string]: Item; }; order: string[];...
1c089e09516c93ae96a05b3a91fb19616c962aa9
TypeScript
vaibhsir1991/WeatherApp
/src/redux/reducers/reducer-location.ts
3.4375
3
interface State { latitude: number; longitude: number; city: string; } const initialState: State = { latitude: 0, longitude: 0, city: '' }; const locationReducer = ( state: State = initialState, action: { type: any; payload: any } ) => { switch (action.type) { case 'SET_LOCATION': return {...
ff062f164656ad21f86f7724c5b937ad2cebfe5a
TypeScript
Polycapa/angular-migration-tool
/src/utils/lint/rules/TripleEqualsRule.ts
2.578125
3
import { Fix } from '../models/fix'; import { LintRule } from './../models/lint-rule'; import { SimplifiedRuleFailure } from './../models/simplified-rule-failure'; export class TripleEqualsRule implements LintRule { fix(failure: SimplifiedRuleFailure): Fix { const text = failure.failure.indexOf('!=') !== -1 ? '!...
fc0dbb783ac3b50cc59e465b464d49ee9d9c7865
TypeScript
tonyonodi/Observatory
/src/index.test.ts
3.203125
3
import { Access } from "./index"; // Messing about import { Lens, fromTraversable } from "monocle-ts"; import { array } from "fp-ts/lib/Array"; import * as L from "monocle-ts/lib/Lens"; import * as T from "monocle-ts/lib/Traversal"; import { pipe } from "fp-ts/lib/function"; // Not messing about type Address = { nu...
b795e66dae77a1a23e726225a17af9797e17f3fa
TypeScript
phenomLi/Matrix4
/src/matrix4.ts
3.15625
3
import { Mat4, Vec3, Quat, _tempMatrix4, _tempMatrix3 } from "./matrix"; import { Vector3 } from "./vector3"; /** * 4 * 4 矩阵 */ export const Matrix4 = { /** * 创建 4 * 4 矩阵 * @param value */ create(value?: Mat4): Mat4 { let mat4: Mat4 = new Float32Array(16); mat4[0] = 1; ...
a1dac51643a958a36236ba7fc8e710fe34b42520
TypeScript
MrAbalogu/kcd-discord-bot
/src/admin/deduping-channel-posts.ts
2.828125
3
import type * as TDiscord from 'discord.js' import { commandPrefix, isWelcomeChannel, getMember, getMessageLink, sendBotMessageReply, isTextChannel, } from './utils' const sixHours = 1000 * 60 * 60 * 6 function isLink(text: string) { try { // eslint-disable-next-line no-new new URL(text.trim()) ...
49d5df6c7ac32bf4d7037b7f683d89b55bf74a19
TypeScript
buyforgirl/clibuilder
/src/util.ts
2.84375
3
import { Command } from './Command' export function getCommand(nameOrAlias, commands: Command[]) { return commands.find(cmd => { return cmd.name === nameOrAlias || (!!cmd.alias && cmd.alias.indexOf(nameOrAlias) !== -1) }) } export function getCommandAndAliasNames(commands: { name: string, alias?: string...
c50f531cbdec2506c1d69c22763dc690808e180d
TypeScript
ekmixon/smartthings-cli
/packages/lib/src/io-util.ts
2.984375
3
import fs from 'fs' import path from 'path' import util from 'util' import yaml from 'js-yaml' import { logManager } from './logger' export const readFile = util.promisify(fs.readFile) export const writeFile = util.promisify(fs.writeFile) export enum IOFormat { YAML = 'yaml', JSON = 'json', // for input, this i...
704476698477fda611ce44a65881495e54434263
TypeScript
RomanMitrodorv/TherapyAPI_frontend
/src/app/common/pipes/filter-articles.pipe.ts
2.53125
3
import { Pipe, PipeTransform } from '@angular/core'; import { Article } from '../models'; @Pipe({ name: 'filterArticles', pure: false }) export class FilterArticlesPipe implements PipeTransform { transform(articles: Article[], activeIndex: number) { if (!articles || !articles.length || activeIndex ...
703ac4b3af050c24051cb69ed7f2b01b58015912
TypeScript
8coon/next
/src/Error/InterceptorNotFound.ts
2.515625
3
import {JSWorksError} from './ErrorDecorator'; @JSWorksError export class InterceptorNotFoundError extends Error { constructor(typeOrName: string) { super(`Interceptor not found :"${typeOrName}"`); } }
4a50cd52b420acf7b4d888c727ede9fda797912f
TypeScript
tcgdex/cards-database
/data/Sun & Moon/Burning Shadows/82.ts
2.515625
3
import { Card } from '../../../interfaces' import Set from '../Burning Shadows' const card: Card = { name: { en: "Alolan Raticate", fr: "Rattatac d’Alola", es: "Raticate de Alola", it: "Raticate di Alola", pt: "Raticate de Alola", de: "Alola-Rattikarl" }, illustrator: "Kouki Saitou", rarity: "Rare", c...
921cfbf661ba111c47630839988da1da9a8a4727
TypeScript
CuriosBasant/shadyantra-mono
/packages/jugaad/src/new-engine/Utils.ts
2.765625
3
export const BOARD_SIZE = 10 export const ONE_LESS = BOARD_SIZE - 1 export const TOTAL_SQUARES = BOARD_SIZE ** 2 export const _DEFAULT_FEN = '0c1ia1c0/cmhgrsghmc/cppppppppc/9/9/9/9/CPPPPPPPPC/CMHGSRGHMC/0C1AI1C0' export const DEFAULT_FEN = '.c..ia..c.cmhgrsghmccppppppppc........................................CPPPPPPP...
70607b5e815eb4e408f2aa1e944b40386d96d45f
TypeScript
25juan/react-study
/vanilla-inspector/src/constructor/Stack.ts
2.9375
3
class Stack<T> { constructor(private stack:Array<T>) { } push(item:T) { this.stack.push(item); } back() { this.stack.pop(); } length() { return this.stack.length; } } const routes = new Stack<string>([]); routes.push('hello');
aa89a0cf5a4d25a9796e0ef5704e111c263746e8
TypeScript
tomekrozalski/landofhop-gatsby
/src/components/Stats/TopBrands/utils/normalizeData.ts
2.65625
3
import { add, format, isBefore, max, min } from 'date-fns'; import { TopBrandsData, RawData } from '../types'; type Props = { limit: number; values: RawData; }; const getTopBrands = ({ limit, values }: Props) => { type AccType = { [name: string]: { amount: number; badge: string; id: strin...
6911bc201a2f679712608337d1b3e6eff57ec5bd
TypeScript
ondaa/common
/lib/string/pascalCase.ts
2.984375
3
import toHeadUpperCase from "./toHeaUpperCase"; import onlyString from "./onlyString"; import rmSpace from "./rmSpace"; /** * @method pascalCase * @param str 문자열 * @description * * 파스칼 문법 ex) BigRabbit */ const pascalCase = (str: string) => onlyString(str, " ") .split(" ") .map(v => toHeadUpperCase(rmS...
fb1e707be82519562965505835847f549933fd15
TypeScript
danielcornock/habi-ui
/src/app/core/services/storage/storage.service.ts
2.6875
3
import { Injectable } from '@angular/core'; import { StorageKeys } from '../../constants/storage-keys.constant'; @Injectable({ providedIn: 'root' }) export class StorageService { constructor() {} public set(key: StorageKeys, payload: string): void { localStorage.setItem(key, payload); } public get(key...
cf335294c0952ed8421ee7c1429c7eff6aa37757
TypeScript
the-djmaze/Squire
/source/node/Block.ts
2.5625
3
import { TreeIterator, SHOW_ELEMENT } from './TreeIterator'; import { isBlock } from './Category'; // --- const getBlockWalker = ( node: Node, root: Element | DocumentFragment, ): TreeIterator<HTMLElement> => { const walker = new TreeIterator<HTMLElement>(root, SHOW_ELEMENT, isBlock); walker.currentNo...
20f64edb37b446fc6800d355dcaa60521f23cd26
TypeScript
dnikomon/fhirform-vue
/src/fhirform-vue.ts
2.65625
3
/** * @fileoverview * * @author Bell Eapen * */ import { R4 } from '@ahryman40k/ts-fhir-types'; import VueFormGeneratorSchema from 'schema'; import VueFormGeneratorField from 'field'; import Fform from 'fform'; import VueFormGeneratorGroup from 'group'; export const FhirFormVue: any = (fhirjson: any) => { // va...
c7f731905599ae0eb60d64c0b31b31140f3541d0
TypeScript
galyniayaroshenko/Resume
/src/app/form-validators/phone-number/phone-number.validator.ts
2.75
3
import { AbstractControl } from '@angular/forms'; import { IValidatorResult } from '../validator-result.interface'; export function phoneNumberValidator(control: AbstractControl): IValidatorResult { // tslint:disable-line const phoneNumberPattern: RegExp = /^([0-9()+ -]*)$/; if (control.value && !phoneNumberPatt...
c9034bd0ca1ddb3599f76e08a09b473abf25f5f5
TypeScript
ionic-team/stencil
/src/sys/node/node-lazy-require.ts
2.75
3
import { buildError } from '@utils'; import fs from 'graceful-fs'; import path from 'path'; import semverLte from 'semver/functions/lte'; import major from 'semver/functions/major'; import satisfies from 'semver/functions/satisfies'; import type * as d from '../../declarations'; import { NodeResolveModule } from './no...
047e999d75eef5fde81a0c386533d9fd85642ba8
TypeScript
duydao/vscode-mockthis
/src/switcher/SpecFileSwitcher.ts
2.71875
3
import * as path from 'path'; import * as vscode from 'vscode'; export interface SpecFileSwitcherBehavior { findFiles(include: string, exclude: string): Thenable<vscode.Uri[]>; showWarningMessage(message: string, ...items: string[]): void; } class DefaultSpecFileSwitcherBehavior implements SpecFileSwitcherBehavio...
e47723d3b61824a42cfe20b644fa45a96bacecf3
TypeScript
seek-oss/playroom
/src/utils/formatting.spec.ts
2.921875
3
import { positionToCursorOffset, cursorOffsetToPosition, formatCode, formatAndInsert, } from './formatting'; describe('cursor offset to position', () => { it('should work for one line', () => { const code = `<h1>Title</h1>`; const position = 4; // Before the capital T expect(cursorOffsetToPositi...
22b59d92daee6d07a73fbf914464d22793e3e459
TypeScript
Sersph/chaos-forum
/frontend/front/src/util/ajax.ts
2.703125
3
import axios from 'axios'; // 携带 cookie axios.defaults.withCredentials = true; type Method = | 'get' | 'GET' | 'post' | 'POST' | 'put' | 'PUT' | 'delete' | 'DELETE' | 'options' | 'OPTIONS' | 'head' | 'HEAD' | 'patch' | 'PATCH' | 'POST_FILE'; // ajax 请求封装模块 export default function ajax(m...
91e3cdb84d7b231b2a7dc71b91b8474ac48f82ee
TypeScript
ptp28/spl
/src/parsers/block-parsers/variable-statements-parser/variable-modification-parser.ts
2.859375
3
import { Scope } from "src/models/Scope"; import { LineOfCode } from "src/models/LineOfCode"; import { BlockParser } from "src/parsers/block-parsers/block-parser"; import { Block } from "src/blocks/Block"; import { VariableBlock, VariableBlockType } from "src/blocks/variable-blocks/variable-block"; import { Expressio...
4a4f8af5318c31596d4548e84b955dc0fb04f3e5
TypeScript
cybermizrach/sqlite-wasm
/src/ts/module.ts
2.6875
3
namespace Module { export type stack = number & { __type__: "stack" } export type i8 = number & { __type__: "i8", __size__: 1 } export type i32 = number & { __type__: "i32", __size__: 4 } export type ptr<T> = number & { __type__: "ptr", __deref__: T, __size__: 4 } export type arr<T extends sized> = ...
c1860d9c7dbfdcae7aefbf12d3f89eab18eff2c8
TypeScript
tiagomota79/check-it-off-frontend
/src/type.d.ts
2.828125
3
interface ITask { id: string; text: string; active: boolean; listTitle: string; listId: string; } interface IList { id: string; title: string; description: string; active: boolean; } interface IListsState { lists: IList[]; } interface ITasksState { tasks: ITask[]; } interface IThemeState { t...
cb8038fa0cd9429fb8aba6368eaf160ff12d464a
TypeScript
rehael/testcafe-config-example
/config.ts
2.71875
3
const environmentVariableName = 'env'; const defaultEnvironmentName = 'dev'; const environmentConfigurationFileName = 'environments.json'; const getArgOrEnv = (argName, defaultValue) => { let arg = process.argv.find(arg => arg.startsWith(`--${argName}=`)); return arg?.split('=')[1] ?? process.env[environme...
be7a7c8fe9b545c857804121603b02a8a8c5617f
TypeScript
petermirithu/Angular-Goal_app
/src/app/goal/goal.component.ts
2.59375
3
import { Component, OnInit } from '@angular/core'; import {Goal} from '../goal' @Component({ selector: 'app-goal', templateUrl: './goal.component.html', styleUrls: ['./goal.component.css'] }) export class GoalComponent implements OnInit { ngOnInit(): void { throw new Error("Method not implemented."); } ...
89d73168163586db5295a9ee48ef10d5e5013ea8
TypeScript
DreamLarva/js-ts-Algorithms
/leetcode/961.重复N次的元素.ts
4.40625
4
/* 961. 重复 N 次的元素 在大小为 2N 的数组 A 中有 N+1 个不同的元素,其中有一个元素重复了 N 次。 返回重复了 N 次的那个元素。 示例 1: 输入:[1,2,3,3] 输出:3 示例 2: 输入:[2,1,2,5,3,2] 输出:2 示例 3: 输入:[5,1,5,2,5,3,5,4] 输出:5 提示: 4 <= A.length <= 10000 0 <= A[i] < 10000 A.length 为偶数 * */ function repeatedNTimes(A: number[]): number { // 正常的做法 使用map 计数 一旦等于一半就是结果 // ...
8aa9bba2c4be2b309abc407f29937846c3b97667
TypeScript
supabase/supabase
/packages/ui/src/lib/utils/mergeDeep.ts
3.578125
4
/** * Check if item is Object */ export function isObject(item: any): boolean { return item && typeof item === 'object' && !Array.isArray(item) } /** * Deep merge two objects. * @return merged object */ export function mergeDeep(target: any, ...sources: any[]): any { if (sources.length === 0) return target ...
a06b57a4146ee166819bd6caf6f02eda3c3edced
TypeScript
angelbeltran/mobile-landscape
/src/canvas/entities/shapes/circle.ts
3.25
3
import Shape from './shape'; interface Props { radius: number; [key: string]: any; } /* * x, y, radius, */ export default class Circle extends Shape { radius: number; constructor(props: Props) { super(props); this.radius = props.radius; } draw() { this.ctx.beginPath(); this.ctx.arc(...
85a1fe671d6272a23b2283fb17fd411fd3fd4894
TypeScript
openluck/demoCollection-
/project/reactComponent/CatMovies-master/server/src/entities/Movie.ts
3.234375
3
import { MinLength, MaxLength, IsNotEmpty, ArrayMinSize, Min, Max, IsArray, validate, ValidationOptions, ValidatorOptions } from "class-validator" import { Type, plainToClass } from "class-transformer" import { BaseEntites } from "./BaseEntites" /** * 电影类, 记录一个电影实例的成员 */ export class Movie extends BaseEntites{ /...
d6de34c3b5e9dd05576a63877ead16d8c0bc2ee0
TypeScript
vochabular/admin-frontend
/src/helper/Diff.ts
3.5
4
import odiff from "odiff"; /** * TODO(df): Create PR and export this in the odiff lib */ type odiffResultType = "set" | "unset" | "add" | "rm"; /** * TODO(df): Create PR and export this in the odiff lib */ interface odiffResult { type: odiffResultType; path: Array<string | number>; val: any; index: number...
69ae243c99b012193542732ccc3df38cde3d39f3
TypeScript
YangSeungWook/ts-inflearn
/.history/class-note/5_operator_20210404232841.ts
4.09375
4
// function logMessage(value:any){ // console.log(value); // } // logMessage('hello'); // logMessage(100); // Union Type ( 파이프 연산자를 이용하여 추가로 사용가능) var seho : string | number | boolean; function logMessage(value : string | number){ if(typeof value == 'number'){ value.toLocaleString(); } if(typeof ...
155fff9a002cf54903e166b77ac89edc2b792eae
TypeScript
mertsev/react-test-project
/frontend/src/api/btc-data.api.ts
2.75
3
import axios from "axios"; export function fetchFromApi() { return axios({ method: 'get', url: 'https://blockchain.info/ticker', responseType: 'json' }) } let btcPrice = 0; export const getBtcData = (): Promise<number> => { const promise = new Promise<number>(resolve => { fetchFromApi().then(...
ee53364deb4390c11864db73091036be8c44ce79
TypeScript
ondfavourmachine/egora_treasury
/src/app/utilities/utility-functions.ts
2.53125
3
export class UtilityFunctions{ static toggleSidebar(event: Event, remove?: string){ if(remove){ const icons: NodeListOf<HTMLElement> = document.querySelectorAll('.targetted_icon'); const spanWithText: NodeListOf<HTMLElement> = document.querySelectorAll('.targetted'); const he...
4ed63490c01f7b87fafacccda1aed1da0340a783
TypeScript
TwinsMaj/exbanking
/src/account.ts
2.828125
3
/* eslint-disable require-jsdoc */ import { add, subtract } from './utils/currency'; import { Currency } from 'dinero.js'; export class Account { private static ACCOUNT_PREFIX = 'ACCT'; private accounts = { [`${Account.ACCOUNT_PREFIX}_USD`]: 0.0, [`${Account.ACCOUNT_PREFIX}_EUR`]: 0.0, }; public credit(amount...
cdbe5672bc9e5bb8aa343229610075aa860f8033
TypeScript
Gidaio/food-tracker-gui
/src/createIngredientComponent.ts
3.15625
3
import { element } from "./app.js" import { Component } from "./component.js" interface CreateIngredientRequest { amount: number unit: string } export class CreateIngredientComponent extends Component { protected buildTemplate(): HTMLElement { const template = element([ "form", undefined, elemen...
3ba774f80d62a6338e502ec672838ef4084cba47
TypeScript
JavCordero/frontendDGE
/reducers/authReducer.ts
3
3
import { AuthState } from "../context/AuthContext"; type AuthAction = | { type: "signIn"; payload: string; id: string } | { type: "signOut" } | { type: "checkLogin"; payload: string }; export const authReducer = ( state: AuthState, action: AuthAction ): AuthState => { switch (action.type) { case "sign...
a446edbbe4b5eb2722d2df5aae024b06d63220b7
TypeScript
denyskorolkov/typescript-samples
/src/missing.ts
4.4375
4
/** * Takes an unsorted array of unique numbers (ie. no repeats) from 1 through some number n, * and returns the missing number in the sequence * (there are either no missing numbers, or exactly one missing number). * * @example * missing([]) // undefined * missing([1, 4, 3]) // 2 * missing([2, 3...
d394ac3052b24cefa71cd3fc6160f9ecf2ccef1c
TypeScript
acburdine/denali-cli
/lib/builder.ts
2.78125
3
import { upperFirst } from 'lodash'; import * as fs from 'fs'; import * as path from 'path'; import * as Funnel from 'broccoli-funnel'; import * as MergeTree from 'broccoli-merge-trees'; import PackageTree from './package-tree'; import Project from './project'; import * as createDebug from 'debug'; import findPlugins...
f26cef2def8100b0229f7c5d3fc01e312c612b4d
TypeScript
cslogan-red/free_weather_project
/functions/src/WeatherService.ts
2.796875
3
import * as request from 'request-promise-native'; /** * @abstract Weather API service handling weather provider requests * * @author Chase */ export default class WeatherService { // lookup local weather information based on lat & lng _getWeatherResultAsync = async (lat, lng) => { const WEATHER_A...
73fcc6eae9e0a5757fa7ffabcac5ae2cecd99b9a
TypeScript
FullScreenShenanigans/SpriteMakr-Neue
/Source/References/RequireAll.d.ts
2.84375
3
/// <reference path="require.d.ts" /> /// <reference path="RequireAll.ts" /> declare module RequireAll { /** * Optional settings for loading a file. */ export interface IRequireSettings { /** * The name of the file to load (by default, the path). */ alias?: string;...
7abe51c54c6200dbe9f258678a6008ccbae1a83d
TypeScript
xujif/node_mmap_mio
/typing.d.ts
3.03125
3
export declare class MappedFile { /** * Creates an instance of MappedFile. * @param {(string | number)} path_or_fd * @param {number} [offset] * @param {number} [size_to_map] * @memberof MappedFile */ constructor(path_or_fd: string | number, offset?: number, size_to_map?: number); readonly wri...
ecbe4901e6772bb3c977bfbc513be25c5a1c0388
TypeScript
charlyee/typescript-tutorials
/7 - Code From Video/video7/classExport.ts
3.375
3
//Generally speaking: One class should be in one file. //(Yes nested classes are a thing, but that's for later!!!) export class Square { //Properties private width: number; private height: number; //Constructor public constructor(width: number, height: number) { this.width = width; ...
938d7036b092d53659a5324219e549c7dba458be
TypeScript
rajhub/algo-ds
/src/bits/BitMan.ts
3.6875
4
export class BitMan { public static invertBits(num: number) { let bitCount = Math.trunc(Math.log2(num)) + 1; for (let i = 0; i < bitCount; i++) { num = num ^ (1 << i); } return num; } public static printBits(num: number) { let bitString: string = ''; while(num) { bitString = ...
4bc79a51310a672212efde9095fc2284ff192117
TypeScript
ildede/toss-the-toast
/src/ext/OutlinePipeline.ts
2.5625
3
export default class OutlinePipeline extends Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline { // the unique id of this pipeline public static readonly KEY = 'Outline'; /** * @param {Phaser.Game} game - the controller of the game instance */ constructor(game: Phaser.Game) { super...
1ef37dd45fa990184b0362ccf43e5292731019af
TypeScript
WuertzMariia/SocialNetwork-Typescript-React-Redux
/src/redux/profileReducer.test.ts
2.609375
3
import profileReducer, {actions} from './profileReducer'; it('new post should be added', () => { // 1. test data let action = actions.actioncreatorAddPost('new post'); let state = { posts: [ {post: 'Hello', id: 1}, {post: 'how are you', id: 2}, {post: 'i am fin...
ae1062c976ac0928810a381041c0c55cf4bd5a68
TypeScript
jstarry/solana
/explorer/src/utils/program-logs.ts
2.59375
3
import { TransactionError } from "@solana/web3.js"; import { Cluster } from "providers/cluster"; import { programLabel } from "utils/tx"; import { getTransactionInstructionError } from "utils/program-err"; export type LogMessage = { text: string; prefix: string; style: "muted" | "info" | "success" | "warning"; }...
a5f338245f2a9d8272dc47a3bd95d199fdf7a981
TypeScript
bluestone029/Canvas-Renderer
/src/shape/DrawTool.ts
2.921875
3
import { TranslateMatrix, Matrix } from '../math/matrix'; // 绘制工具 class DrawTool { path: Path2D; tPath: Path2D; oX: number; oY: number; endX: number; endY: number; constructor() {} init(path: Path2D, pin: Array<number>): DrawTool { this.path = path; this.oX = pin[0]; ...