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
c16fc9f94a0ebd07a0a06db1a6e1e19d6b8dbf9a
TypeScript
LunarFuror/phantasmal-world
/src/core/observable/Disposer.test.ts
3.359375
3
import { Disposer } from "./Disposer"; import { Disposable } from "./Disposable"; test("calling add or add_all should increase length correctly", () => { const disposer = new Disposer(); expect(disposer.length).toBe(0); disposer.add(dummy()); expect(disposer.length).toBe(1); disposer.add_all(dumm...
2f2f1d31a5545427f9532032995f834be7fe4e58
TypeScript
HdrHistogram/HdrHistogramJS
/src/PercentileIterator.ts
3.375
3
import JsHistogram from "./JsHistogram"; import JsHistogramIterator from "./JsHistogramIterator"; const { pow, floor, log2 } = Math; /** * Used for iterating through histogram values according to percentile levels. The iteration is * performed in steps that start at 0% and reduce their distance to 100% according to...
356b6dacc2ae17ba3b1fd2e19266ef07893b2eaa
TypeScript
Howard86/github-search
/src/server/cache/memory.ts
2.78125
3
import LRUCache, { Options } from 'lru-cache'; import { AbstractCache } from './model'; export default class MemoryCache<K, V> extends AbstractCache<K, V> { private readonly lruCache: LRUCache<K, V>; constructor(options: Options<K, V>) { super(); this.lruCache = new LRUCache(options); } async get(key...
6bfcaa8b0ba66c672452fc4c029d2361b439d85f
TypeScript
AM-Solutions23/bigcash
/src/config/core/config/writers/wr.entities.ts
2.8125
3
export default class Entities{ private entity:string; private entity_options:string; constructor(fragments){ this.entity_options = fragments.entity_options; this.entity = fragments.entity; } public EntitiesData(){ let data:String = `import {Entity, PrimaryGeneratedColumn, Co...
882ba5f627e0e452565645aeb6238dc9a51d1ea5
TypeScript
PeculiarVentures/xmldsigjs
/src/pki/x509.ts
2.53125
3
import * as Asn1Js from "asn1js"; import { Certificate, CryptoEngineAlgorithmParams } from "pkijs"; import { ECDSA } from "../algorithms"; import { Application } from "../application"; export type DigestAlgorithm = string | "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512"; /** * List of OIDs * Source: https://msdn.micro...
d0ab58829480bf20b1c48ba338be27482ffd0d7d
TypeScript
vitordelfino/pokedex
/src/store/modules/typeahead/types.ts
2.609375
3
export interface TypeaheadState { pokemons: string[]; search: string[]; } export const TypeaheadTypes = { SEARCH_POKEMONS: '@@typeahead::SEARCH_POKEMON', SEARCH_POKEMONS_SUCCESS: '@@typeahead::SEARCH_POKEMON_SUCCESS', SEARCH_POKEMONS_ERROR: '@@typeahead::SEARCH_POKEMON_ERROR', FILTER_NAMES: '@@typeahead::F...
08d8841109c77b4cc3baa0b4461607ae086a2c08
TypeScript
SarathLUN/metronic_v8.0.25_react
/demo1/src/_metronic/assets/ts/components/_SwapperComponent.ts
2.8125
3
import { getAttributeValueByBreakpoint, stringSnakeToCamel, getObjectPropertyValueByKey, EventHandlerUtil, throttle, } from '../_utils/index' export class SwapperStore { static store: Map<string, SwapperComponent> = new Map() public static set(instanceId: string, drawerComponentObj: SwapperCo...
4eba0b6621b80c4dd1869fa30f38b3efb8355443
TypeScript
LCluber/Indium.js
/src/ts/zones/left.ts
2.578125
3
import { Zone } from './zone'; import { IZone } from '../interfaces'; import { Vector2 } from '@lcluber/type6js'; export class Left extends Zone implements IZone { private limit: number; constructor(limit: number) { super(); this.limit = limit; } public contains(touchPosition: Vector2): boolean { ...
bff868ea26464b13315fabf9f311feffde6181d7
TypeScript
Dewscntd/AccuWeatherNgrx
/src/app/features/weather/store/reducers/location.reducer.ts
2.5625
3
import { createReducer, on, Action } from '@ngrx/store'; import * as fromLocationActions from '../actions/location.actions'; export interface LocationKeyState { locationKey: string; locationName: string; error: Error; } const initialState: LocationKeyState = { locationKey: null, locationName: null, erro...
d50af900e397167b50740eb504f5d5a0816f4efc
TypeScript
yardenGoldy/hw_1
/backend/services/errors/unAuthorizedError.ts
2.53125
3
import { IStatus } from './status'; export class UnAuthorizedError extends Error implements IStatus { statusCode: number; constructor(message?: string) { super(message || "Authentication credentials not valid."); this.statusCode = 401; } }
60480754795a5799df057e43acf6afb78b8f8d0f
TypeScript
gabolauro/angular-rocks
/src/app/pipes/breakline.pipe.ts
2.671875
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'breakline' }) export class BreaklinePipe implements PipeTransform { transform(text: string): string { let parrafos = text.split('</br>'); let textoTodo = '' for (var i = 0; i < parrafos.length; i++) { textoTodo+=parrafos[i]+"\n\r" ...
d0667b498af5dc8ddf6dee90279e16128a26acea
TypeScript
youknowme786/fivee
/src/fivee.ts
2.734375
3
import { BaseData, FiveeOptions, APIResource } from './structures' import axios, { AxiosResponse } from 'axios' import { NotFoundError } from './errors' import { AbilityScoresManager, ClassesManager, RacesManager, ConditionsManager } from './managers' const defaultOptions: FiveeOptions = { baseURL: 'https://www.dn...
b75598a6fb3c3e0336008a0d2ab97a3c90fa0836
TypeScript
ubl-chj/mirador-monorepo
/packages/mirador-core/src/selectors/windows.ts
2.6875
3
import {ICompanionWindow, IWindow} from 'mirador-core-model'; import {createSelector} from 'reselect' import {getManifestTitle} from './manifests'; /** */ export const getWindow = (state: any, { windowId}: {windowId: string, position?: string}) => { return state.windows && state.windows[windowId]; } /** Return pos...
9137fcd2c749cc422f6b76bb028e58f6b1effd00
TypeScript
Reynals/discord-bot-ts
/src/classes/bot.ts
2.765625
3
import { ApplicationCommandOption, Client, ClientOptions } from "discord.js"; import { Collection } from 'discord.js'; import { promises, readdirSync } from 'fs'; import { join } from 'path'; class bot extends Client { // Defining the custom properties commands: Collection<string, Command> = new Collection(); ...
38622f83ad77b00575ace254736b592b1100c39c
TypeScript
HTMLProgrammer2001/messangerClient
/src/utils/helpers/secondsToTime.test.ts
2.75
3
import secondsToTime from './secondsToTime'; describe('Test seconds to time function', () => { const vals: [number, string][] = [ [0, '03:00AM'], [(3600 + 183) * 1000, '04:03AM'], [(3600 * 11 + 300) * 1000, '02:05PM'] ]; it('Test', () => { for(let [time, str] of vals) expect(secondsToTime(time)).toBe(s...
051aaf79a6a3e84eee2318d589b582c896974c7e
TypeScript
saijeevanballa/chat-socket.io
/chat-be/src/utils/authenticate.ts
2.5625
3
import { jwt_Verify } from "./modules/jwt"; import APIError from "./custom-error"; import { userSchema } from "../users/model"; // USER AUTHENTICATION export default async function authenticate(req: any, res: any, next: any) { try { if (!req.headers.authorization) throw new Error("Missing Token.") ...
55976c6ac27bfcb1dbb480879effa3be298122eb
TypeScript
volunux/Student-Support-and-Thesis-Management-System
/src/app/shared/misc/dynamic-form-validators.ts
2.578125
3
import { FormGroup } from '@angular/forms'; import { dynamicDataValidator } from '../services/dynamic-control-validator'; export class DynamicFormValidators { public static createPermanent(entry , datas : { [key : string] : any } , form : FormGroup) : void { if (datas != null) { for (let $prop in datas) {...
078311041873a8573856f862fa210eefac3099ca
TypeScript
rzvpopescu/typy
/lib/Bindings/PropertyBindings/ValueBinder.ts
2.53125
3
import {PropertyBinder} from './PropertyBinder'; import {ExpressionsHelper} from '../ExpressionsHelper'; import {ObserverEngine} from '../../Observer/Observer'; export class ValueBinder extends PropertyBinder { protected BINDING_ATTRIBUTE = "value.bind"; elementBind(element: HTMLElement, viewModel: any, expr...
0052765cc3bebe940a6a04394dcea0a1a987b65c
TypeScript
Dead-Crumb-Trail/node-backend
/src/services/hash.ts
2.671875
3
import { Service } from 'typedi'; import crypto from 'crypto'; import { HashResult } from '../models/internal'; import { logger } from '../util/logger'; @Service() export class HashingService { constructor() {} async withSalt(value: string): Promise<HashResult> { const salt = crypto.randomBytes(16).toString(...
5a4306e173998efcb6af279224593a8cdd4b076d
TypeScript
jwworth/conway
/src/app_helper.ts
2.859375
3
import { chunk } from 'lodash'; const PURPLES = [ '#e6e6fa', '#d8bfd8', '#dda0dd', '#ee82ee', '#da70d6', '#ff00ff', '#ff00ff', '#ba55d3', '#9370db', '#8a2be2', '#9400d3', '#9932cc', '#8b008b', '#800080', '#4b0082', ]; export const randomColor = (): string => PURPLES[Math.floor(Math.ran...
e265077f56b2c8791b505de28e9ba2f083d3870f
TypeScript
gabrielgraciani/next-reactmon-backend
/src/modules/cities/services/ListCitiesService.ts
2.734375
3
import { getCustomRepository } from 'typeorm'; import CitiesRepository from '../repositories/CitiesRepository'; import City from '../models/City'; interface Request { offset: number; limit: number; } interface Response { data: City[]; total_records: number; } class ListCitiesService { public async execut...
014d72d55a81bef2a77cc1a5358d343a147540b4
TypeScript
issaafalkattan/zira-ui
/src/utils/statusUtils.ts
2.59375
3
import { TicketStatus } from '../types/index'; export const getTagColor = (status: TicketStatus): string => { switch (status) { case "OPEN": return "magenta"; case "PENDING": return "cyan"; case "CLOSED": return "green"; default: return "red"; } };
5f1356709fdbdf43bb1e2a1af5e3fe1f234f517c
TypeScript
LukaGrdinic/Angular-Modular-Forms
/src/app/custom-validators.ts
2.71875
3
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; export class CustomValidators { static minDate(minDate: Date): ValidatorFn { return (control: AbstractControl): ValidationErrors | null => { const isControlOk: boolean = control.value ? new Date(control.value) > minDate : true...
037a2a631c0127e8bfb2bbdf71f9c9a4b4545f0e
TypeScript
gitter-badger/alloy
/source/config/Properties.ts
3.234375
3
import { ramda as R } from "../../vendor/npm"; /** * Defines Alloy configuration properties and provides basic utilities for * working with them. * * @author Joel Ong (joelo@google.com) */ export default class Properties { // Available properties. public static BUILD_DIRECTORY: string = "out"; public static...
af58106a42da8451b0311865f5818fd1282d081b
TypeScript
typedninja/flowable
/src/lib/utils.ts
2.6875
3
export function restack (error: Error, ignore: Function = restack): Error { if (error.stack !== undefined) { const stackObj = { stack: '' } Error.captureStackTrace(stackObj, ignore) const stackLines = stackObj.stack.split('\n') stackLines.shift() const newStack = stackLines.join('\n') err...
9da0b16785674b06413c6b2dadd8517d76ca254f
TypeScript
afroradiohead/yumi-interview
/src/app.service.ts
2.640625
3
import {Injectable} from '@nestjs/common'; import {EntityManager} from 'typeorm'; import {Order} from './models/order.entity'; import * as moment from 'moment'; import {get} from 'lodash'; interface IFindOrdersProps { user_id: number | string; delivery_date?: string; per?: number | string; page?: numbe...
b8419e5e7e82e824e791db7cc88b6392779b4528
TypeScript
ficsit/data-landing
/interfaces/structs/FExponentialFogSettings.ts
2.640625
3
import { float } from '../native/primitive'; import { LinearColor } from '../native/structs'; export interface FExponentialFogSettings { /** * The ZValue of the fog */ FogHeight: float; /** * Density of the fog */ FogDensity: float; FogInscatteringColor: LinearColor; /** * Distance at whi...
f9ef18b66f4b678969b7425626d88bba4918f715
TypeScript
Portia-Nelly-Mashaba/ToDoList-Typescript
/index.ts
2.546875
3
// Import stylesheets import './style.css'; // Write TypeScript code! const appDiv: HTMLElement = document.getElementById('app'); appDiv.innerHTML = `<h1>TypeScript Starter</h1>`; let ToDoList = [ {taskName: "MarkRegister", taskDate: "2020/08/17", taskStatus: "Done"}, {taskName: "DoHouseChores", taskDate: "2020/0...
84ad25ea266257fa771680790cae6a0a7dfd71fc
TypeScript
Eriickson/PROYECTO-INTEGRADOR-I-PROYECTO-FINAL-SERVER
/src/gcp/makePrivateFile.ts
2.546875
3
import bucket from "./bucketMain"; interface IMakeFilePrivateArgs { destination: string; metadata: Record<string, string>; } export default async function makeFilePrivate({ destination, metadata }: IMakeFilePrivateArgs) { // Seteamos la metadata al archivo y luego lo hacemos privado await bucket.file(destinat...
20598d369cb1cfba01ca8732ed5e9c19863717bd
TypeScript
RoelVB/pnpjs
/packages/graph/onedrive/users.ts
2.609375
3
import { addProp } from "@pnp/queryable"; import { _User } from "../users/types.js"; import { IDrive, Drive, IDrives, Drives, _Drive, DriveItem, IDriveItem } from "./types.js"; declare module "../users/types" { interface _User { readonly drive: IDrive; readonly drives: IDrives; } interface ...
c8303c53a2b3cd6f4931dba69c26c96289b724f0
TypeScript
JoshRosenstein/styleaux
/packages/styleaux-styles-base/src/mdn/scroll-snap/scrollMarginLeft.ts
2.859375
3
import { Config } from '../../types'; import { style, styler, GetValue } from '@styleaux/core'; import { ScrollMarginLeftProperty } from '@styleaux/csstype'; const SCROLLMARGINLEFT = 'scrollMarginLeft'; export interface ScrollMarginLeftProps<T = ScrollMarginLeftProperty> { /** * The `scroll-margin-left` property...
dbbd72b0fc48a7879f5c425975380d95d6b833ab
TypeScript
yasoonOfficial/adf-builder-javascript
/dist/nodes/index.d.ts
2.921875
3
export interface Typed { type: string; [key: string]: any; } export interface JSONable { toJSON: () => Typed; } export declare class ContentNode<T extends JSONable> { private readonly type; private readonly minLength; private content; constructor(type: string, minLength?: number);...
def406d8a28f74b029d3432365fbe9b8db6e209b
TypeScript
karinariv/libraryAPI
/repositories/bookRepository.ts
2.640625
3
import { DeleteResult, getRepository, Repository } from "typeorm"; import { Book } from "../models/books"; export default class BookRepository { private repository_: Repository<Book>; constructor () { } private get repository(): Repository<Book> { if(!this.repository_){ thi...
cbd63ee8022735e505ecc32850f9d9062d6a76d5
TypeScript
e-cloud/ngxs-store
/packages/store/src/operators/of-action.ts
2.890625
3
import { OperatorFunction, Observable, MonoTypeOperatorFunction } from 'rxjs'; import { map, filter } from 'rxjs/operators'; import { getActionTypeFromInstanceOrClass, getActionTypeFromClass } from '../utils/utils'; import { ActionContext, ActionStatus } from '../actions-stream'; import { ActionType, IAction } from '.....
1423217f3935e7912829bb54fcd5f99e550111d9
TypeScript
coolba73/InsightStudioAlways
/src/app/myapp/common/shapeobject/SelectBox.ts
2.78125
3
import { BaseObject } from "./BaseObject"; export class SelectBox extends BaseObject{ x1 : number; x2 : number; y1 : number; y2 : number; //_____________________________________________________________________________________________________________________________________________________________...
94a81e1ffdf703aedf988f14d4762f46dc817cf8
TypeScript
Str4thus/p5-Columbus-App
/src/app/services/socket/socket.service.ts
2.59375
3
import { Injectable, Inject } from '@angular/core'; import { SocketConfiguration, defaultSocketConfiguration } from 'src/columbus/data-models/socket/SocketConfiguration'; import { ModuleDataService } from '../module-data/module-data.service'; import { CommandService } from '../command/command.service'; import { Columbu...
ab88115bc13ff61fca872c666e42cf3bfe52ddb8
TypeScript
urbit/urbit
/pkg/interface/src/logic/lib/useStatelessAsyncClickable.ts
2.96875
3
import { MouseEvent, useCallback, useEffect, useState } from 'react'; export type AsyncClickableState = 'waiting' | 'error' | 'loading' | 'success'; export function useStatelessAsyncClickable( onClick: (e: MouseEvent) => Promise<void>, name: string ) { const [state, setState] = useState<AsyncClickableState>('wai...
7f24d091fd511d8a37e7699305d021307b7993e4
TypeScript
davidthorn/html5-graph
/src/GraphObject.ts
2.84375
3
import { GridObject, GridMargin, GridPoint, GridIncrementColor, GridAxisOption } from './graph.module' import { GridAxis } from './graph'; export class GraphObject { context: any frame: GridObject incremetColor: GridIncrementColor = GridIncrementColor.increment separatorColor: GridIncrementColo...
f202f3619811d3da268a85b5a2f277c0b65e9b5e
TypeScript
VitaliyDrapkin/SocialNetwork-Client
/src/redux/authReducer.ts
2.765625
3
import { actionsTypes } from "./actionTypes"; export const AUTHORIZATION = "AUTHORIZATION"; export const INITIALIZE = "INITIALIZE"; export const REFRESH_TOKEN = "REFRESH_TOKEN"; export const CHANGE_PROFILE_IMAGE = "CHANGE_PROFILE_IMAGE"; export interface initialStateType { isInitialized: boolean; isAuth: boolean;...
e4422cdabbde37c4d718a1e3db8b2cf30b546ea4
TypeScript
byte-it/backer
/src/BackupSource/BackupSourceFactory.ts
2.65625
3
import {ContainerInspectInfo} from 'dockerode'; import {singleton} from 'tsyringe'; import {BackupSourceMysql, IMysqlLabels} from './BackupSourceMysql'; import {IBackupSource} from './IBackupSource'; import {ILabels} from '../Interfaces'; /** * BackupSourceProvider is a factory to instantiate {@link IBackupSource}s b...
b039ecc02d8355cc44b99adc138fcb91709f2c5b
TypeScript
PurpleMyst/bombcleaner
/src/grid.ts
3
3
import { shuffle, createSquareGridTemplate } from "./utils"; import { Square } from "./square"; const MINE_DISTRIBUTION = 1 / 10; export class Grid { public container: HTMLElement = document.createElement("div"); public squares: Square[] = []; constructor(public side: number) { this.container.style.display...
a5d81ef5ce018f34de372a1cce2aa1e6d9707fc4
TypeScript
mdchia/overchill
/game/direction.ts
3.078125
3
export enum Cardinal { // The four cardinal compass directions N = 0, E = 2, S = 4, W = 6, } export enum Diagonal { // The four diagonal directions NE = 1, SE = 3, SW = 5, NW = 7 } export type Direction = Cardinal | Diagonal; // Full set of eight directions
c029955f1fb2445fe766b25022719ba7b0d7c80a
TypeScript
ramya0820/azure-service-bus-node
/examples/samples/partitionedQueues.ts
2.71875
3
// Enable partitions for the topics in the azure portal and then execute the sample. // For partitioned queues, the topmost 16 bits of the SequenceNumber(64-bit unique integer assigned by ServiceBus for a message) reflect the partition id. // The usual the ascending SequenceNumber characteristics is no longer guarantee...
883a337dad3ac62654d1e8ae12a50edb44a59407
TypeScript
anthonyec/rect
/src/createPoint.ts
2.859375
3
import { Point } from "./types"; /** Create a representation of a point */ export default function createPoint(x: number, y: number): Point { return { x, y }; }
2edb34c8ca34f16c0c695addd28eeddfbd560af5
TypeScript
RyanDur/Developing-at-the-Disco
/src/app/data/method/index.ts
2.65625
3
import {Params} from './types'; import {HttpRequest} from '../types'; import {has} from '../../../lib/util/helpers'; const createParams = (params: Params = {}) => Object.keys(params) .map(param => `${param}=${params[param]}`) .join('&'); const createPath = (endpoint: string[], params?: string) => [endpoin...
6986e96f087dc99bc7cb03e222dc6cf01c6754ce
TypeScript
Azure/autorest.typescript
/packages/typespec-ts/test/integration/arrayItemTypes.spec.ts
2.90625
3
import ArrayItemTypesClientFactory, { ArrayItemTypesClient } from "./generated/arrays/itemTypes/src/index.js"; import { assert } from "chai"; import { matrix } from "../util/matrix.js"; interface TypeDetail { type: string; defaultValue: any; convertedToFn?: (_: any) => any; } const testedTypes: TypeDetail[] =...
6568830e4697688d5727c589d5fd83a54d248388
TypeScript
AsierLarranaga/angular-menu-component
/as_modules/as_class_manager.ts
2.703125
3
export class as_class_manager { as_removeAllElementsByClass(as_className) { const as_elements = document.getElementsByClassName(as_className); for (let i=0; i<as_elements.length; i++) { if (as_elements[i].classList.contains(as_className)) { as_elements[i].classList.r...
eb745af97bd636eaec38cf6b675228083596866a
TypeScript
elix/elix
/src/base/FilterListBox.d.ts
2.578125
3
// Elix is a JavaScript project, but we define TypeScript declarations so we can // confirm our code is type safe, and to support TypeScript users. import ListBox from "./ListBox.js"; export default class FilterListBox extends ListBox { filter: string; itemMatchesFilter(item: ListItemElement, filter: string): boo...
416ead27ffeb05bc7cf8c96e61c333a8eddbf5a1
TypeScript
tchambard/f-streams
/test/unit/binary-test.ts
2.875
3
import { assert } from 'chai'; import { setup } from 'f-mocha'; import { run, wait } from 'f-promise'; import { binaryReader, binaryWriter, bufferReader, bufferWriter, cutter } from '../..'; setup(); const { equal } = assert; const TESTBUF = Buffer.from([1, 4, 9, 16, 25, 36, 49, 64, 81, 100]); function eqbuf(b1: Buf...
c3dd40665d9fd3d8249c11c37f38d1d070e69bbf
TypeScript
codxse/ts-noob
/design-pattren/sorting/src/index.ts
3.03125
3
import { NumbersCollection } from "./NumbersCollection"; import { CharactersColletion } from "./CharactersCollection"; import { LinkedList } from "./LinkedList"; const numberCollection: NumbersCollection = new NumbersCollection([10, 3, -5, 0]); console.log(numberCollection.collection); numberCollection.sort(); console...
21abe4f3a761ca00df3e1470aa24c4050b8627c3
TypeScript
koluch/own-proxy
/entry-points/common/observables/activeTab.ts
2.5625
3
import { Subscribable } from "light-observable"; import { Tab } from "../browser"; import { createSubject } from "light-observable/observable"; export function create(): Subscribable<Tab> { const [stream, sink] = createSubject<Tab>(); function update(): void { browser.tabs .query({ currentWindow: true, ...
9f7a5a73576a6e4a5fa8026f29d32029eba2cb22
TypeScript
cyg720/slykApp
/src/pages/fund-simulation/chart.ts
2.59375
3
import {FundSimulationDetailsHospitalVo} from "./vo/FundSimulationDetailsHospital"; import {FundSimulationDetailsAgeVo} from "./vo/FundSimulationDetailsAge"; import {FundSimulationDetailsHospLevelVo} from "./vo/FundSimulationDetailsHospLevel"; declare let c3; /** * 医院仿真情况 * @param c3 * @param data * @param el */ e...
da9dabecf0b997181ddcb4841ab95aa57e41eab6
TypeScript
green-fox-academy/egedurukan
/week02/day01/compare-lenght.ts
3.265625
3
'use strict' let firstList: number[]= [1, 2, 3] let secondList: number[]= [4, 5] if(secondList.length > firstList.length){ console.log("p2 is longer") }else{console.log("p2 is shorter")}
c5e20bbef4834f07564b5f08ad5104b5ed2de9ad
TypeScript
mohamadarbash-eng/rating-system
/src/app/store/movies-list.reducer.ts
2.703125
3
import { Action, createReducer, on } from '@ngrx/store'; import { MoviesListAction } from './movies-list.action'; export interface InitialState { itemId: string, rating: number } export const initialState: InitialState = { itemId: null, rating: null }; const reducer = createReducer( initialState,...
ff03adc4da937bf4efca71eba7f909f1d1e436d7
TypeScript
tanepiper/npm-lint
/rules/properties.ts
2.625
3
import propertyName from './subrules/properties-name'; import propertyVersion from './subrules/properties-version'; import propertyPrivate from './subrules/properties-version'; import * as types from '../src/types'; export default { name: 'Properties Rules', description: 'Handles the checking of properties wi...
7c903816eb6b5e9e68844070530cffd2621fde50
TypeScript
7PH/ENSEEIHT-STDL-Mini-Java
/tests/test.ts
3.28125
3
import {TAM} from "./TAM"; const SLOW_TEST_MS: number = 2000; /* ############################################### * ## GRAMMAR TESTS ## * ############################################### */ describe('# Grammar tests', function () { this.slow(SLOW_TEST_MS); /* *******************...
f022740d0da98dbc78124cb6bde724e602bf05a6
TypeScript
kondratyev-nv/vscode-python-test-adapter
/src/logging/defaultLogger.ts
2.640625
3
import { WorkspaceFolder } from 'vscode'; import { ILogger, LogLevel } from './logger'; import { ILogOutputChannel } from './logOutputChannel'; export class DefaultLogger implements ILogger { constructor( private readonly output: ILogOutputChannel, private readonly workspaceFolder: WorkspaceFolde...
7ac9bf8a39bb5812c203619c6a59380dd49f20c8
TypeScript
gatsbyjs/gatsby
/packages/gatsby/src/utils/merge-gatsby-config.ts
2.96875
3
import _ from "lodash" import { Express } from "express" import type { TrailingSlash } from "gatsby-page-utils" export interface IPluginEntryWithParentDir { resolve: string options?: Record<string, unknown> parentDir: string } // TODO export it in index.d.ts export type PluginEntry = string | IPluginEntryWithPar...
f8b6005f711ab837b00a5e7c57dfa1c37e410854
TypeScript
bgwest/learning-typescript
/src/learning-ts/interfaces.ts
4
4
// interface example function printLabel(labelledObj: { label: string, helloWorld: string }) { console.log(labelledObj.helloWorld); } let myObj = {size: 10, label: "Size 10 Object", helloWorld: 'testing123'}; printLabel(myObj); // another interface example interface Food { tacos: string, pizza: string } ...
faaabaf8d84bfdafbbe5626cc7f2efae457d9faa
TypeScript
ciwen91/AutoIt
/AutoIt.Foundation/AutoIt.Foundation.Web.Scripts/MetaData/ValLimit/ValLimitForStr.ts
3.015625
3
namespace MetaData { export class ValLimitForStr extends ValLimitBase { MinLength?: number; MaxLength?: number; constructor(minLength: number = null, maxLength: number = null, parttern: string = null) { super(SimpleType.string,parttern); this.MinLength = minLength; ...
798ad84b4a15644c1e9109cdf72471f597e70867
TypeScript
t4d-classes/bootcamp_09142020
/demo-app/src/reducers/calcToolReducers.ts
3.078125
3
import { Reducer, combineReducers } from 'redux'; import { ADD_ACTION, SUBTRACT_ACTION, MULTIPLY_ACTION, DIVIDE_ACTION, CalcActions, isCalcAction, isCalcHistoryAction, isCalcOpAction, isCalcValidationAction, } from '../actions/calcToolActions'; import { CalcHistoryEntry, CalcToolState } from '../models/calcTool'; ...
ebcb24f9688ad582a22827e8c4298255c6d0bd83
TypeScript
hyemmie/dutch
/src/utiles/assetTokenNamePrettier.ts
2.6875
3
// ELYSIA_ASSET_BLUE_3_EL => AssetBlue3El const assetTokenNamePrettier = (input: string): string => { try { const res = input.toLowerCase().replace('elysia_', '').split('_').map((str) => str.charAt(0).toUpperCase() + str.slice(1)).join('') return res } catch (e) { alert(e) return input } } expor...
4890bd98ea2b4f85d221616a492fdc508c2efaa7
TypeScript
gititGoro/PampForkFrontEnd
/client/src/components/Layout/PageContent/Common/TokenImage.ts
2.71875
3
import imageData from '../../../../images/dataimages.json' export interface ImageType { BASE64: string, name: string, address: string } export const ImgSrc = (network: string) => { const images = imageData.filter(n => n.network === network) return (address: string): ImageType => { if (ima...
2fe5db55135c6f8b70a94e1c3bafe7aea8831abe
TypeScript
PRX/styleguide.prx.org
/projects/ngx-prx-styleguide/src/lib/datepicker/calpicker.component.ts
2.578125
3
import { Component, AfterViewInit, OnChanges, Input, Output, EventEmitter, ViewChild, ElementRef } from '@angular/core'; import * as Pikaday from 'pikaday'; import { SimpleDate } from './simpledate'; // patch pikaday to show up to 12 months // https://github.com/Pikaday/Pikaday/issues/749 const originalConfig = Pikada...
8d2c8ca566484f10e5d1b56975501607b16bc561
TypeScript
OleksandrKyrylyuk/TypeScript-Basic-OOP-
/src/LinkedList.ts
3.515625
4
import { Sorter } from './Sorter'; class Nodes { next: Nodes | null = null; constructor(public value: number){} } export class LinkedList extends Sorter{ head: Nodes | null = null; add(data: number): void { const node = new Nodes(data); if (!this.head) { this.head = node; return } let tail = thi...
0769fe7d4e355d988d66a196ff2dd590f9e828f4
TypeScript
MyCupOfTeaOo/teaness
/src/utils.ts
2.90625
3
import { ErrorsType } from './Form/typings'; /** * 常用的moment日期格式化枚举 */ export enum DateFormat { sec = 'YYYY-MM-DD HH:mm:ss', min = 'YYYY-MM-DD HH:mm', hour = 'YYYY-MM-DD HH', day = 'YYYY-MM-DD', month = 'YYYY-MM', year = 'YYYY', } /** * 跳转到表单字段处,如果可以focus则自动focus * @param fieldKey 字典id * @param optio...
bedffba81193b57d33460d86bcb778e5a5a86d7e
TypeScript
MaxV-LTTVinh/learning-react-ts
/src/store/account/actions.ts
2.6875
3
import { Dispatch } from "react" import { userService } from "../../services"; import { AccountActionTypes, LOAD_CURRENT_LOGIN_USER_FAILURE, LOAD_CURRENT_LOGIN_USER_REQUEST, LOAD_CURRENT_LOGIN_USER_SUCCESS, LOGIN_FAIL, LOGIN_REQUEST, LOGIN_SUCCESS, LOGOUT } from "./types" export const login = (email: string, password:...
4ea36053d326fa6f2c0715a48f8ecc34cb8c9746
TypeScript
mora50/empty-template
/src/hooks/useDebounce.ts
2.890625
3
import { useRef } from "react"; export default function useDebounce( fn: (...args: any[]) => void, delay: number ) { const timeoutRef = useRef(null); function debouncedFn(...args: any[]) { clearTimeout(timeoutRef.current); timeoutRef.current = setTimeout(() => { fn(...args); }, delay); } ...
51c2be7ae97c10ef692d7eec59a122bb8c0a4cc7
TypeScript
speakwithalisp/csp-with-ts
/src/impl/processEvents.ts
2.625
3
import { IStream, ProcessEvents, CLOSED } from './constants'; import { isChan } from './channels'; import { makeFakeThread } from './utils'; import { IChanValue, IChan, IProcPutE, IProcTakeE, IProcSleepE } from './interfaces'; import { CSP } from './service'; import { instructionCallback } from './instructions'; import...
837c651e1af5fd7b50885ec8d348c5338d3cc4ea
TypeScript
polyglotm/coding-dojo
/coding-challange/leetcode/medium/~2022-08-11/386-lexicographical-numbers/386-lexicographical-numbers.ts
3.625
4
/* 386-lexicographical-numbers leetcode/medium/386. Lexicographical Numbers URL: https://leetcode.com/problems/lexicographical-numbers/ NOTE: Description NOTE: Constraints - 1 <= n <= 5 * 104 NOTE: Explanation NOTE: Reference */ function lexicalOrder(n: number): number[] { const result = []; for (let i = 1; i ...
fbb4483c853bbec8e66b5a8fcbf8fc42b2c375c9
TypeScript
MasashiFukuzawa/design-patterns-learned-in-typescript
/chap19-state/src/state/nightState.ts
2.703125
3
import { State } from "./state"; import { Context } from "../context/context"; import { DayState } from "./dayState"; export class NightState implements State { private static singleton: NightState = new NightState(); private constructor() {} static getInstance(): State { return NightState.singleton; } ...
cfaee087d046f5c1351b1e5d00135d5df2ca1084
TypeScript
jaytonbye/dicey_business_typescript
/app.ts
3.5625
4
class Die { value: number; constructor() { this.value = Math.floor(Math.random() * 6) + 1; } roll() { this.value = Math.floor(Math.random() * 6) + 1; } } // I used ! to end the line below, I don't think this was what you were looking for :( let generateBtn = document.getElementById("generate-die")!; ...
a9eb7d02e03dc1c359c960d8e0125a1d2c5410aa
TypeScript
craftina/SoftUni
/Angular/01.Introduction-To-Angular/05.Boxes/boxes.ts
3.59375
4
class Box<T>{ private _boxes = []; get count(){ return this._boxes.length; } public add(element): void{ this._boxes.unshift(element); } public remove(): void{ this._boxes.shift(); } } let box = new Box<Number>(); box.add(1); box.add(2); box.add(3); console.log(box...
1a89d5e098d7c5ddccd616fdb2f7eeaa46842046
TypeScript
akulyk/ts29022020
/old/observable.ts
2.625
3
import { Observable } from "rxjs"; const sequence = new Observable((subscriber) => { console.log('Internal') let count = 1; const intervalID = setInterval(() => { subscriber.next(count++); if (count === 10) { subscriber.complete(); clearInterval(intervalID); ...
7537694338bc885b56593a3d087701548857b8fe
TypeScript
GoofyCMS/Frontend
/app/shared/resources/logger.ts
2.625
3
import {Component} from '@angular/core'; import {Growl, Message} from 'primeng/primeng'; @Component({ template: '<p-growl [value]="messages"></p-growl>', directives: [Growl] }) export class Logger { messages: Message[] = []; /** * Log Info message * @method * @param {string} title...
0e30abf9da2f6e71f809afcf32d2851972ea802f
TypeScript
okipeterovie/hobeei
/src/services/NumberToWord.ts
3.3125
3
export class NumberToWord { _currency: string = ""; //Naira _decimalCurrency: string = ""; //Kobo set currency(currencyName: string) { this._currency = currencyName; } get currency(): string { return this._currency; } set decimalCurrency(currencyName: string) { th...
de304e2b2e1365a61cac68f7e4783d7e309075c0
TypeScript
benkolera/salty-deadlands
/src/CharacterSheet/DiceSet.ts
3.25
3
import { Chance } from "chance"; export type Sides = 4 | 6 | 8 | 10 | 12 | 20; export type TraitResult = "bust" | number; export type Successes = number; export type Raises = number; export type VsTn<A> = "bust" | "failure" | A; export interface OpposedDraw { type: "draw"; attackerBusted: boolean; defende...
1ee891d5dda34a00c09287c8ccac787488d3e29a
TypeScript
baltel/Ang5WebAPI
/AngularSPAWebAPI/app/shared/log-publishers.ts
2.75
3
import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; import 'rxjs/add/observable/throw'; import { Http, Response, Headers, RequestOptions } from '@angular/http'; import { LogEntry } from '../services/log.service'...
57e23578e8af441a59d09cf7d91cf199715815d2
TypeScript
nightism/react-scax
/src/pool/pools.ts
2.8125
3
import { error } from '../common/utils'; import { IPool, IPoolView, TScaxerBatchConfiguration, TScaxerDataTypeMap } from '../types'; import Pool from './Pool'; const poolViewNameObjectMap: { [poolName: string]: IPoolView, } = {}; /** * Create a pool uniquely identified by a name. * @param poolName a unique stri...
5857e0220ffb22f0e66e194e5b5c729a9a57ee00
TypeScript
KiranKaur/Racing-Car-Assignment3
/COMP397-MailPilot/Scripts/game.ts
2.609375
3
/// <reference path="typings/stats/stats.d.ts" /> /// <reference path="typings/easeljs/easeljs.d.ts" /> /// <reference path="typings/tweenjs/tweenjs.d.ts" /> /// <reference path="typings/soundjs/soundjs.d.ts" /> /// <reference path="typings/preloadjs/preloadjs.d.ts" /> /// <reference path="utility/utility.ts" /> ///...
d42773c03bc46b7f8368e2823b502c235108a00d
TypeScript
bradmartin/nativescript-sentry
/src/index.d.ts
2.78125
3
export abstract class Sentry { /** * Initializes the Sentry SDK for the provided DSN key. * @param opts [SentryOptions] - The SentryOptions for the SDK. */ static init(opts: InitOptions): void; /** * Log a message. * @param message [string] - The message to log. */ static captureMessage(messa...
f5869c54c55c3f7f420372229a70d8c77daa09cc
TypeScript
terzurumluoglu/ChatApplication
/functions/src/services/token.ts
2.5625
3
import { Device } from "../model/model"; // Bu metot user ın bütün device tokenlarını alır çoklanmış olanların tekilleştirir ve diğerlerinin indexlerini silinmek üzere ayırır. export const findRepeatingElement = function (array: Device[]): any[][] { const temp: any = {}; const deleteTokensIndexes: any[] = []; ...
4bea2de03a81f8fd51c39dcf7a157d07615f2479
TypeScript
ByDSA/datune
/packages/strings/src/parsing/utils/tokenize.ts
2.59375
3
import { Lexer, TokenType } from "chevrotain"; import { Options } from "lang"; import { GLOBAL_TOKENS } from "./tokens"; export type TokenizeOptions = Options & { input: string; langTokens: TokenType[]; }; export default function tokenize(options: TokenizeOptions) { const { langTokens } = options; ...
c30743618add3103ab99ac598acab57e351882d3
TypeScript
duongquang1611/agora_test1
/src/app-redux/product/reducer.ts
2.75
3
import ActionType from './types'; const initialState: any = { arrayImage: [], category: '', brand: '', }; const product = (state: any = initialState, action: any) => { switch (action.type) { case ActionType.UPDATE_IMAGE: return { ...state, arrayImage: action.data }; case Ac...
0186d65df3620f2a2aad066c72ff1b24e73e8b8b
TypeScript
Cotel/iToldo
/src/weather/types.ts
3.140625
3
/** * Weather descriptions found in openweather api https://openweathermap.org/weather-conditions */ export type WindSpeed = number export type Weather = 'Clear' | Clouds | Rain | 'Drizzle' | Thunderstorm | 'Mist' | 'Haze' | 'Fog' const rain = ['Light', 'Moderate', 'Heavy', 'Very Heavy', 'Extreme'] as const export...
24111f597fb09b95840d18c26097f4bc106caa52
TypeScript
GRPMIPSVisualizer/HardwareLogic
/Assembler2/src/ts/MapForInsType.ts
2.71875
3
export class MapForInsType { private static map = new Map(); private constructor() {} public static getMap(): Map<string, string> { if (this.map.size == 0) { let typeR: string = "R"; let typeI: string = "I"; let typeJ: string = "J"; let typeP: strin...
d0bfc3a61e2c83ddb7c6b4941406853aac0cb008
TypeScript
mckatoo/clinica
/api/src/data/protocols/cache/cache-store.ts
2.578125
3
export interface CacheStore { delete: (deleteKey: string) => void insert: (insertKey: string, values: any) => void replace: (key: string, values: any) => void }
dfbb4e05e82e525aa3c840ec01a35d2b727aea42
TypeScript
intro-to-prog/frontend
/src/app/reducers/shopping.reducer.ts
2.5625
3
import { EntityState, createEntityAdapter } from '@ngrx/entity'; import { createReducer, Action, on } from '@ngrx/store'; import * as actions from '../actions/shopping.actions'; export interface ShoppingEntity { id: string; description: string; } export interface ShoppingState extends EntityState<ShoppingEntity> {...
86e033ffa4c73b6e7073a2f2627e869fe1c7df19
TypeScript
nimuseel/hi-nest
/src/movies/movies.service.ts
2.71875
3
import { Injectable, NotFoundException } from '@nestjs/common'; import { CreateMovieDto } from './dto/create-movie.dto'; import { UpdateMovieDto } from './dto/update-movie.dto'; import { Movie } from './entites/Movie.entity'; @Injectable() export class MoviesService { private movies: Movie[] = []; getAll(): Movie...
af19deb0dd67f50f0bcbd194be82f416a9a5bde4
TypeScript
joni-/packages-parser
/util.ts
3.28125
3
export const isEmpty = <T>(v: string | T[]) => Array.isArray(v) ? v.length === 0 : v.trim().length === 0; export const trim = (s: string) => s.trim(); // note: if there are duplicated values, keeps the last occurrence export const uniqBy = <T>(getKey: (v: T) => string, input: T[]): T[] => { const xs = input.reduc...
daf2fa37b83b02cdc4245b75b020123503af1020
TypeScript
Jareechang/esbuild-examples
/examples/tree-shaking-annotations/src/index.ts
2.84375
3
import * as utils from './utils'; import getConfig from './config'; console.log(utils.add(2, 3)); // Not removed, but unused const result1 = utils.subtract(5, 3); // removed because of no annotation and of no reference const result2 = /* @__PURE__ */ utils.subtract(5, 3); // keep code even with annotation because o...
e492447b1bc3abbb361ba47a66e9c2737e440421
TypeScript
folke/adventofcode
/src/2015/day1.ts
3.1875
3
import { Input, Solution } from "../util" export const part1: Solution = (input: Input) => { let ret = 0 for (const c of input.data) { if (c == "(") ret++ else ret-- } return ret } part1.examples = [] part1.answer = 280 export const part2: Solution = (input: Input) => { let ret = 0 for (let i = 0;...
833eef1e323b5aca08489da4f717adcd6ccda092
TypeScript
lostfictions/rot.ts
/src/fov/fov.ts
3.140625
3
import { DIRS } from "../constants"; export interface FOVOptions { topology: 4 | 6 | 8; } export type LightPassesCallback = (x: number, y: number) => boolean; export type VisibilityCallback = ( x: number, y: number, r: number, visibility: number ) => void; export abstract class FOV { protected _lightPas...
eef9b541f54dfd8cd0f580324446b6ea99f1fdcb
TypeScript
EugeneDraitsev/simple-blog-task
/src/stores/feed.store.ts
2.8125
3
/* eslint-disable no-param-reassign */ import { action, observable } from 'mobx' import { persist } from 'mobx-persist' import { StoryModel } from '../models' export class FeedStore { @persist('list', StoryModel) @observable public feed: StoryModel[] = [] @observable public draftStories: StoryModel[] = [] cons...
2c5938007e713fe091abc05d1d4c6ca0103a1413
TypeScript
openfl/starling
/samples/demo_npm/typescript/src/constants.ts
2.515625
3
class Constants { public static GameWidth:number = 320; public static GameHeight:number = 480; public static CenterX:number = Math.floor(Constants.GameWidth / 2); public static CenterY:number = Math.floor(Constants.GameHeight / 2); } export default Constants;
19604fac8f94f2cff211557fddfb735224fcd254
TypeScript
PookMook/pokedex
/src/types/attack.ts
2.546875
3
import { Type } from "./type"; export type Attack = { name: string; type: Type; damage: number; };
9ac43428c8f2961fa3dc0997317c37971ebeed74
TypeScript
sujandev/laputa-iot-dashboard
/src/utils/util.ts
2.859375
3
import { validatenull } from './validate' import * as CryptoJS from 'crypto-js' import { defHttp } from '/@/utils/http/axios'; import { BasicPageParams } from '/@/api/model/baseModel'; // 表单序列化 export const serialize = (data : any) => { const list = [] Object.keys(data).forEach(ele => { return list.push(`${e...
85afc904a875de200639e648a0a679c090cc55e1
TypeScript
ElaheSmailpour/ToDO-Bootstrap
/src/models/model.ts
2.59375
3
export class Model { user; items: any[]; constructor() { this.user = 'Toplearn-Elahe'; this.items = [ { action: 'computer buy', done: false }, { action: 'do work', done: false }, { action: 'task one', done: true }, { action: 'work second', don...
64ae08d473e77dc7fd63a7f52eeacddf044a0965
TypeScript
patrikduch/EcommerceDDD
/EcommerceDDD.WebApp/ClientApp/src/app/core/models/Order.ts
2.625
3
export class Order { orderId: string; orderLines: OrderLine[] = []; createdAt: Date; totalPrice: number; status: string; } export class OrderLine{ productId: string; productName: string; productPrice: number; productQuantity: number; currencySymbol: string; }
b3920a47291609adbcbdf9055a8eb49c15c7c318
TypeScript
Dazaer/photo-items-app
/frontend-photo-items-app/src/models/Item.ts
2.796875
3
export default class Item { public id: number = 0; public name: string = ""; constructor(item?: Partial<Item>) { Object.assign(this, item); } public static getNullSelectedItem() { return new Item({name: "All"}); } }