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
b27f4536539c1eb80ed4147e6364a2903b9f39a9
TypeScript
styled-components/styled-components-website
/utils/stripIndent.ts
3.046875
3
// https://github.com/sindresorhus/strip-indent const stripIndent = (str: string) => { const match = str.match(/^[ \t]*(?=\S)/gm); if (!match) { return str; } // TODO: Use spread operator when targeting Node.js 6 const indent = Math.min(...match.map(x => x.length)); const re = new RegExp(`^[ \\t]{${i...
1aaa81a3ec7b577712388f752d2f3a480a480074
TypeScript
medusajs/medusa
/packages/medusa/src/types/batch-job.ts
2.578125
3
import { Type } from "class-transformer" import { IsArray, IsEnum, IsOptional, IsString, ValidateNested, } from "class-validator" import { IsType } from "../utils/validators/is-type" import { DateComparisonOperator } from "./common" import { BatchJob } from "../models" export enum BatchJobStatus { CREATED ...
527711f67ffc103d55e748a559bd85ccb9dafdf0
TypeScript
BinaryStudioAcademy/bsa-2020-knewless
/frontend/src/containers/Notifications/reducer.ts
2.875
3
import { receiveNotificationRoutine, fetchUnreadNotificationsRoutine, readNotificationRoutine, deleteNotificationRoutine, deleteAllNotificationsRoutine, readAllNotificationsRoutine, getAllNotificationsRoutine, viewLessNotificationsRoutine } from './routines'; import { INotification } from './model/INotification';...
3904efcec22b9e6e825624ea6da9aaa5f5bcb058
TypeScript
notVitaliy/reangudux-sample
/src/app/store/reducers.ts
2.859375
3
import { combineReducers } from 'redux' import { ADD_TODO, FIN_TODO, DEL_TODO } from './list' function list(state, action) { switch (action.type) { case ADD_TODO: const item = { name: action.name, status: 'active', id: Math.random(), } return [...state, item] case FI...
a80cc25a83ac638c95917952d5a9642b817fad1b
TypeScript
nichealpham/sandrasoft
/src/modules/server/services/parse_middlewares.ts
2.546875
3
// Import external-modules import * as Ramda from 'ramda'; // Import sub-modules import { ServerMiddlewares } from "../interfaces/server_middlewares"; import { MiddlewareFunction } from "../interfaces/middleware_function"; export const parseMiddlewares = (middlewares: ServerMiddlewares = {}): MiddlewareFunction[] => ...
45315bfa8abbb50d14582660237e29c34ca14da5
TypeScript
paki14/colorizer
/src/app/app.component.ts
2.5625
3
import { Component } from '@angular/core'; import { ColorService } from './color.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { constructor(private colorService: ColorService) { } ngOnInit() { } colors =...
963dce35c3e9b0ffb6b64d8d03e01b5a22ab4e8d
TypeScript
Velfi/StructureJS
/js/model/Route.d.ts
3.6875
4
/** * The **Route** class is a model that keeps track of a specific route for the {{#crossLink "Router"}}{{/crossLink}} class. * * @class Route * @module StructureJS * @submodule model * @param routePattern {string} The string pattern you want to have match, which can be any of the following combinations {}, ::, ...
c8f7b3a5f850e9f72368908ad4f8a1acbed42b01
TypeScript
weichx/smudge
/spec/smudge_spec.ts
3.125
3
///<reference path="./typings/jasmine.d.ts"/> import { smudgable, dirtychecked, isSmudged, isDirty, unSmudge, clean, getDirtyFields, getSmudgedFields } from '../src/smudge'; //todo after recent changes replace use of window with global if env is node @smudgable() export class Test1 { ...
d6825838fe92bc93c1055b4c9fd666723c23a6d7
TypeScript
limoya/angular
/firstAngular/src/app/hero-search/hero-search.component.ts
2.796875
3
import { Component, OnInit } from '@angular/core'; import {Observable, Subject} from 'rxjs'; import {debounceTime, distinctUntilChanged, switchMap} from 'rxjs/operators'; import {Hero} from '../hero'; import {HeroService} from '../hero.service'; @Component({ selector: 'app-hero-search', templateUrl: './hero-searc...
96a48c1ccd66691e7f1f4f69ee01a0ba83a39ba9
TypeScript
oferitz/node-html-markdown
/src/visitor.ts
2.71875
3
import { NodeHtmlMarkdown } from './main'; import { ElementNode, HtmlNode, isElementNode, isTextNode } from './nodes'; import { getChildNodes, getTrailingWhitespaceInfo, perfStart, perfStop, trimNewLines } from './utilities'; import { createTranslatorContext, isTranslatorConfig, PostProcessResult, TranslatorConfig, T...
4d1d644b0e20630129054a7ca6097e700c0641a6
TypeScript
shmorgan-at-ibm/carbon-for-ibm-dotcom
/packages/web-components/tests/utils/mock-resize-observer.ts
2.53125
3
/** * @license * * Copyright IBM Corp. 2020, 2022 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import MockLayoutObserver from './mock-layout-observer'; /** * A mock version of `ResizeObserver`. */ class MockResizeObser...
2f100e704beea5afdcea15b11f9f4d2a0311aa8e
TypeScript
biowink/reg-ci-notify-github-plugin
/src/plugin.ts
2.515625
3
import { NotifierPlugin, NotifyParams, PluginCreateOptions, PluginLogger } from 'reg-suit-interface' import * as Octokit from '@octokit/rest' // This string identifies a comment as a visual regression report. We can check // whether this string appears in a comment to determine whether to update an // existing comment...
51658af3d1b6709196c76fc5420142086ebbb68b
TypeScript
piyalcodes/ngrx_state_management
/src/app/reducers/events.reducer.ts
2.828125
3
import { Action } from '@ngrx/store'; import { EventList } from './../model/event.model'; import * as EventActions from './../actions/event.actions'; const initialEvent: EventList = { name: 'Send a mail', url: 'google.com', status: 'Pending' } export function reducer(state: EventList[] = [initialEven...
20cb515bb474b08ac258d3e245639fe0c9f2c3ba
TypeScript
wag1twat/test-task
/src/hooks/useCharacter/getCharacterSaga.ts
2.59375
3
import { createAction } from "@reduxjs/toolkit"; import axios, { AxiosResponse } from "axios"; import { call, put, takeEvery } from "redux-saga/effects"; import { createHash } from "utils"; import { BaseRequestError } from "types"; import { Character, CharactersResponse } from "hooks/useCharacters"; export const getMa...
a312c9d3424aa0278085cdd2da6bcab02df3eb5e
TypeScript
mathjax/MathJax-src
/ts/core/MmlTree/OperatorDictionary.ts
2.578125
3
/************************************************************* * * Copyright (c) 2017-2022 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://w...
f4cb4aee80b76d511344de4587a8d484b07f502b
TypeScript
laaksomavrick/notes-api-v2
/src/folders/UpdateFolderHandler.ts
2.65625
3
import { NextFunction, Request, Response } from "express"; import { Handler } from "../framework/Handler"; import { BadRequestError, NotFoundError, UnprocessableEntityError } from "../framework/HttpError"; import { FolderRepository } from "./FolderRepository"; import { UpdateFolderDto } from "./UpdateFolderDto"; expor...
8c9d82aaf8c131b7dc7eb15a6bff5fc2fa0dfa0c
TypeScript
bodinaren/sudoku-solver
/tests/brokenSubsets.spec.ts
2.71875
3
/// <reference path="../typings/main.d.ts" /> import {Sudoku, Tile} from "sudoku"; import {SolverSudoku} from "../src/solverSudoku"; import {BrokenSubsets} from "../src/solutions"; import {List} from "btypescript"; import {expect} from 'chai'; let _ = 0; describe("BrokenSubsets", function() { describe("Triple", ...
701e0110daa43c7a0413273f60c13300d5e88f99
TypeScript
den19980107/BotBuilder
/src/converter/helper/scriptParser.ts
3.359375
3
import FlowShareVariable from "./flowShareVariable"; import serverConfig from '../../../config/server.json' import { internalMethods } from 'botbuilder-share' const { castToBool, castToNumber, castToString, JsonStringify, getLength } = internalMethods /** * expression: 代表在字串中,有被 "${" 和 "}" 包起來的地方 * internal method...
52c0d7e159cf6e7c212f82a9a49e3ec4f4299739
TypeScript
ChrisChloe/angular-course
/angular/typescript/Vehicle.ts
2.5625
3
export default class Vehicle { protected model: string private speed: number = 0 public speeUp() :void { this.speed = this.speed + 10 } public stop() :void { this.speed = 0 } public currentSpeed() :number { return this.speed } } export let anything: st...
f4cd57a9eeefe3624324c65662d5c799d0b846a1
TypeScript
ukyo/mp4.js
/src/finder.ts
3.265625
3
import { IBox } from "./interface.box"; export class Finder { constructor(public tree: any) {} findOne(type: string): IBox { let box!: IBox; const find = (tree: any) => { if (box) return; switch (typeof tree) { case "number": case "string": case "boolean": ret...
a4af5947027a3ab4d3f14d8e486594854d47c852
TypeScript
stanicavuleta/torus-meme-of-the-day-feature
/hub-browser-auth/src/api.ts
2.578125
3
/* eslint-disable @typescript-eslint/no-explicit-any */ /** Import our server libraries */ import Router from "koa-router"; import { createUserAuth, KeyInfo } from '@textile/security'; /** * Start API Routes * * All prefixed with `/api/` */ const api = new Router({ prefix: '/api' }); /** * Create a REST API en...
d27a85495a1387bdfbe55fc980c8530b5b120e8d
TypeScript
Balkonskii/PT.InternationalStore
/src/core/helpers/date.helper.ts
2.90625
3
import { formatISO, parse, parseISO, format } from 'date-fns'; export class DateHelper { static parse(value: string, dateFormat: string, referenceDate?: Date | number): Date { return parse(value, dateFormat, referenceDate || new Date()); } static parseDateTimeOffset(value: string): Date { ...
25a6b70b23f8700e2f4a51f456fdaa4102fad62b
TypeScript
backstage/backstage
/plugins/search-backend-node/src/test-utils/TestPipeline.ts
2.796875
3
/* * Copyright 2022 The Backstage Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or ...
abc820befd5c64f1750c56042d7e8061f6ede877
TypeScript
xspeed101/life
/Scripts/managers/collision.ts
2.71875
3
module managers { let count:number = 0; let frameCount:number = 0; export class Collision { public static Check(object1: any , object2: any) { // create two vec2 objects let P1: math.Vec2 = new math.Vec2(object1.x, object1.y); let P2: math.Vec2 = new math.Vec2(object2.x, object2.y); ...
5c452e9b0c0b3af8652b1bd06cacbb4b3abe3e66
TypeScript
peterdinis/React-Albums-App
/src/redux/actions/albumsActions.ts
2.53125
3
import {Dispatch} from "redux"; import {ALBUMS_LOADING, ALBUMS_SUCCESS, ALBUMS_FAIL, AlbumDispatchTypes} from "../types/albumsTypes"; import axios from "axios"; export const getAlbums = (id: string) => async (dispatch: Dispatch<AlbumDispatchTypes>) =>{ try { dispatch({ type: ALBUMS_LOADING ...
d7403f2973d7d2d3657c409413566b55d72787bc
TypeScript
nguyer/aws-sdk-js-v3
/clients/browser/client-glue-browser/types/SchedulerRunningException.ts
2.578125
3
import { ServiceException as __ServiceException__ } from "@aws-sdk/types"; /** * <p>The specified scheduler is already running.</p> */ export interface SchedulerRunningException extends __ServiceException__<_SchedulerRunningExceptionDetails> { name: "SchedulerRunningException"; } export interface _SchedulerRunn...
930547eae7006db49cc49b6fece37362dfc42df1
TypeScript
HTMLProgrammer2001/patterns
/Composite/Filesystem/File.ts
2.78125
3
import Component from './Component'; class TFile extends Component{ constructor(name: string, private size: number){ super(name); }; getSize(): number{ return this.size; } add(comp: Component){} remove(comp: Component){} print(){ console.log(`File ${this.getName()}`); } } export default TFile;
d149c0c567e4dc5e81a400f0049878f689f7337c
TypeScript
Mathyfight/mathyfight-rest-api
/src/shared/infrastructure/typeorm.mysql.mapper.ts
2.671875
3
import { SortingOrderCriteria } from '../domain/value-object/general/sorting-order-criteria'; export class TypeOrmMySqlMapper { static sortingOrderCriteriaToSqlCriteria( order?: SortingOrderCriteria, ): 'ASC' | 'DESC' { return order === SortingOrderCriteria.Ascendant ? 'ASC' : 'DESC'; } }
257a3573717e8041307784abe5146773d2ec09c9
TypeScript
Maxio777/lg
/new-front/src/app/models/referee/referee-model.ts
2.625
3
import {UserModel} from '@models/users/user-model'; export class RefereeModel extends UserModel { constructor(referee) { super(referee); } static fromJs(referee): RefereeModel { if (referee) { return new RefereeModel(referee); } return null; } static fromJsArr(referees): RefereeModel[...
d0ff65e0b1e044ff56a944d097e17920caf021a8
TypeScript
adamhaile/surplus-todomvc
/src/persistence.ts
2.71875
3
import S from 's-js'; import { ToDo, ToDosModel } from './models'; const LOCAL_STORAGE_KEY = 'todos-surplus'; export function LocalStoragePersistence(model : ToDosModel) { // load stored todos on init const stored = localStorage.getItem(LOCAL_STORAGE_KEY); if (stored) model.todos(JSON.parse(stored).todos....
b93b4efb719f2e1cb411cf959c74f8a2cc0b2472
TypeScript
wipkanban/wipkanban
/src/server/controllers/user/CreateAccount.ts
2.578125
3
import { BAD_REQUEST, CREATED, INTERNAL_SERVER_ERROR } from "../../utils/HttpStatusCode"; import * as ModelUser from "../../models/user"; import { Model } from "mongoose"; import { Response, NextFunction } from "express"; export default (User: Model<ModelUser.IUser>) => { return (req: any, res: Response, nex...
c59b8a547a29e77c4900487cd0b82145fda67e44
TypeScript
jorge-e-aquino/ngCalculator
/src/app/calculator/calculator/calculator.component.ts
2.5625
3
import { Component, OnInit } from '@angular/core'; // contains the display and number pad components, parses their data, and is sent to the router outlet to be displayed on the browser @Component({ selector: 'app-calculator', template: ` <div class="app centered"> <app-display [input]="input" [result]="r...
c030f7b729f73ff30c1644b20e67baaaae569298
TypeScript
brennowilliam/kahoot-points-game
/src/selectors.ts
2.6875
3
import { createSelector } from "reselect"; import _ from "lodash"; // Types import { GameState, BoardItem, BonusRewards } from "./types"; // Selectors export const items$ = (state: GameState) => _.get(state, ["game", "items"]); export const selectedItems$ = (state: GameState) => _.get(state, ["game", "selectedItem...
2b4463f55d3be6be4aa69c83ea1f13f1a6f9ad9a
TypeScript
yisraelx/authllizer
/packages/@authllizer/core/src/http/fetch.ts
2.6875
3
import extend from '../utils/extend'; import isObject from '../utils/is-object'; import { BaseHttpClient } from './base'; import { IHttpRequestOptions } from './http'; // for fetch global scope error 'TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation' // can be 'fetch.bind(this)' to solve the error....
56526f668fdd730783016a65813c7b1887d3b3e3
TypeScript
Kadsuke/passerelle
/src/main/webapp/app/entities/gestioneau/parcelle/parcelle.model.ts
2.625
3
import { ILot } from 'app/entities/gestioneau/lot/lot.model'; export interface IParcelle { id?: number; libelle?: string; lot?: ILot | null; } export class Parcelle implements IParcelle { constructor(public id?: number, public libelle?: string, public lot?: ILot | null) {} } export function getParcelleIdenti...
bda21fd2ab8e0817ddd5d89d3ed1bdbda75ff1ef
TypeScript
NoHomey/db-machine
/Field.ts
2.765625
3
//declare var require; import Fields = require("./Fields"); var fields: Fields = new Fields(); class Field { private name_: string; private field_: string; private type_: string; private value_: string; constructor(table: string, name: string) { this.name_ = name; this.fie...
e1ee9937a6912b8ff2b19f3e9b4de1e08568695e
TypeScript
jiangwenyang/front-end-assistant
/src/translate.ts
3.046875
3
var TKK = ((function () { var a = 561666268 var b = 1526272306 return 406398 + '.' + (a + b) })()) function hexCharAsNumber(xd: string) { return (xd >= 'a') ? xd.charCodeAt(0) - 87 : Number(xd) } function shiftLeftOrRightThenSumOrXor(num: number, opArray: Array<string>) { return opArray.reduce((acc, opStrin...
90a54e8adcde3c4a777e42047508ec9d734d92e0
TypeScript
MartinSka/chat
/src/app/models/user.model.ts
3.140625
3
export interface User { /** * User ID. */ id: string; /** * User name. */ name: string; /** * List of users and their respective chats ID. */ contacts: Contacts; } /** * List of users that the sender can talk to * and the chat ID that corresponds to that conversation. */ export inter...
548d5b2d5b10d5f3483c2c9731eaccf496eae470
TypeScript
Wiggins-zsz/typescript
/src/interface.ts
3.0625
3
import {Singleton} from './index'; interface Type { name: string, age: number, address?: string } interface ReadOnly { readonly x: string, readonly y: number } export function Type(param: Type) { let c = Singleton.getInstance({name: 'third', className: 'third class', content: 'third address', ca...
7127bd8e9f0d6078707157b263ba787c6901bcc7
TypeScript
taonylu/egretproject
/EgretProjects/llk_old/src/net/ClientSocket.ts
2.671875
3
/** * 文 件 名:ClientSocket.ts * 功 能: 客户端Socket * 内 容: * 作 者: 羊力大仙 * 生成日期:2015/9/14 * 修改日期:2015/9/14 * 修改日志: */ class ClientSocket { private static instance: ClientSocket; private webSocket: egret.WebSocket; private tempMsg: string = ""; //临时数据 private callBack: ISocketCallBack; ...
d0d8d5ac61f02b734480391f21d6db5eace02edc
TypeScript
cns-iu/ngx-dino
/projects/core/src/lib/fields/factories/simple-field.ts
2.53125
3
import { Seq } from 'immutable'; import { Operator } from '../../operators'; import { BaseFieldArgs, Field } from '../field'; export interface SimpleFieldArgs<T> extends BaseFieldArgs { bfieldId?: string; operator: Operator<any, T>; } export function simpleField<T>(args: SimpleFieldArgs<T>): Field<T> { const...
5a712cff0d7c386996b188bf4c418c4768442b8e
TypeScript
MagnetronGame/magnetron-client
/src/components/magnetron_game/MagnetronGame3d/boardGroupAnim.ts
2.84375
3
import * as THREE from "three" import { StaticBoard } from "./board" import { resetBoardObjectCellPositions, VisBoardPlate } from "./boardVisObject" import { range } from "../../../utils/arrayUtils" import { Anim } from "./animation/animationTypes" const positionCells = ( staticBoard: StaticBoard, boardObject:...
be0f1304de6fcf40810b2987d5340b3c2ad1b989
TypeScript
madfish-solutions/quipuswap-webapp
/src/core/operation.ts
2.53125
3
import { BlockResponse, OperationEntry } from "@taquito/rpc"; import { TezosToolkit } from "@taquito/taquito"; export const SYNC_INTERVAL = 10_000; export const CONFIRM_TIMEOUT = 60_000 * 5; export type ConfirmOperationOptions = { initializedAt?: number; fromBlockLevel?: number; signal?: AbortSignal; }; export...
c712cdb2629197c6620a0c56fd7224059ea51884
TypeScript
igoralvesantos/backend-food4u
/src/business/usecases/user/updateUser.ts
2.734375
3
import { UserGateway } from "../../gateways/userGateway"; import { JWTAutenticationGateway } from "../../gateways/jwtAutenticationGateway"; import { ValidatorsGateway } from "../../gateways/validatorsGateway"; export class UpdateUserUC { constructor( private db: UserGateway, private jwtAuth: JWTAutentication...
ec8338deef9aca3ba706b11851a6b989ee0e10b3
TypeScript
changchangge/chang-request
/src/types/object-type.ts
2.75
3
/** * @interface ObjectType */ interface ObjectType { /** * obj definition * 对象定义 */ [key: string]: unknown; } export type ObjType = ObjectType;
21d77c6812a4fb48f2fb460de2abe5a03d277fda
TypeScript
rodrigodsluz/dashboard-app
/src/utils/validation/index.ts
2.84375
3
export function checkEmailValid(value: string): boolean { if (value.length > 0) { const exclude = /[^@\-\\.\w]|^[_@\\.\\-]|[\\._\\-]{2}|[@\\.]{2}|(@)[^@]*\1/; const check = /@[\w\\-]+\./; const checkend = /\.[a-zA-Z]{2,3}$/; if ( value.search(exclude) !== -1 || value.search(check) === -1 |...
c409077afe1d3e1ad46000cc5c34e1c3a005b4ed
TypeScript
romaannaeem/unofficial-notion-api-v2
/src/lib/helpers.ts
3.046875
3
import { NotionObject, Options, Attributes, PageDTO, formatter, htmlResponse } from './types'; import slugify from 'slugify'; // Seperator for good-looking HTML ;) const SEPERATOR = ''; // HTML Tag types const types = { page: 'a', text: 'p', header: 'h1', sub_header: 'h3', sub_sub_header: 'h5', divider: '...
c48ecc2bb1d398fc1254edba5357b7c252438f23
TypeScript
rajivnayanc/Shoot_the_Balloons_HTML5_canvas
/shoot-the-balloon/src/game/Objects/ProjectileLine.ts
2.8125
3
import { BulletPosition } from './Bullet'; import { Position2D } from './common-intf'; import { LIGHT_THEME } from './consts'; import RenderableObject from './renderable-object'; import { distance, getQuadraticRoots } from './utils'; class ProjectileLine extends RenderableObject { start:Position2D; end:Posit...
9a5e278ebc1c1e5c951ff8e2f8ab83c1e85be194
TypeScript
awoimbee/TGVmax
/server/src/routes/StationRouter.ts
2.625
3
import { Context } from 'koa'; import * as Router from 'koa-router'; import StationController from '../controllers/StationController'; import { HttpStatus } from '../Enum'; import { authenticate } from '../middlewares/authenticate'; import { IStation } from '../types'; /** * Autocomplete router for train stations */...
f4a0d55145e80540b8e4b3837712e48238c22258
TypeScript
LisaLoop/typescript-demo
/src/examples/use-cases.ts
3.140625
3
export default {} type User = { id: string; name: string; }; type ServerUser = { userData: { userEmployeeId: string; userName: string; userMeta: { userMetaId: string; userMetaLastLogin: string; userMetaDetails: []; }; }; }; const getUser = (id: string) => fetch(`/api/users...
1667a0421c54830665d252157b96102546074010
TypeScript
lanrehnics/park-campus
/src/providers/buildings.ts
2.90625
3
import {Injectable} from '@angular/core'; import {Api} from './api'; import {Building} from '../models/building'; import 'rxjs/add/operator/map'; @Injectable() /** * Used by the application to interact with the buildings stored in the database on the server. */ export class BuildingProvider { /** * @param {Api...
cf50613daf2616efa12d1f952da59dfeeb866099
TypeScript
IronOnet/codebases
/codebases/anchor.fm/client/modules/AnchorAPI/v3/stations/fetchImportStatus.ts
2.65625
3
import { getApiUrl } from '../../../Url'; type ImportStatusParameters = { stationId: string; }; type Item = { rssImportItemId: number; state: 'waiting' | 'started' | 'finished' | 'failed'; kind: 'item' | 'channel'; title: string; }; type ImportStatusResponse = { state: 'processing' | 'complete'; percen...
993e7a13b02214d1444ef8b77e915534d6f7fb6c
TypeScript
CodersCamp2020-HK/CodersCamp2020.Project.FullStack-Node-React
/src/infrastructure/postgres/PostgresQueries.ts
2.765625
3
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import { Client } from 'pg'; import { parse } from 'pg-connection-string'; interface PostgresConnectionConfig { host: string; user: string; password: string; port: number; ...
d0dbeca763055ab137b531b1c0be8a2d8ffd5c89
TypeScript
mikeparisstuff/amplify-cli
/packages/graphql-relational-schema-transformer/src/RelationalDBSchemaTransformerUtils.ts
2.96875
3
import { Kind, print, ObjectTypeDefinitionNode, NonNullTypeNode, DirectiveNode, NameNode, OperationTypeNode, FieldDefinitionNode, NamedTypeNode, InputValueDefinitionNode, ValueNode, OperationTypeDefinitionNode, SchemaDefinitionNode, ArgumentNode, ListValueNode, StringValueNode, InputObjectTypeDefinitionNod...
0cb6c287dbc85d7e197dd1a2f83a71472060f8af
TypeScript
lifaon74/common-classes
/src/debug/observables-v4/observable/from/from-iterable/from-array.ts
2.84375
3
import { IObservable, IObservableUnsubscribeFunction, Observable } from '../../../core/observable'; import { IObserver } from '../../../core/observer'; export function fromArray<GValue>(array: ArrayLike<GValue>): IObservable<GValue> { return new Observable<GValue>((observer: IObserver<GValue>): IObservableUnsubscrib...
409f530b31dabea057b2ae948dd33ce98085a3cb
TypeScript
atmajs/memd
/src/persistance/StoreWorker.ts
2.765625
3
import { ICacheEntry, ICacheOpts } from '../Cache'; import { IStore } from './IStore'; export class StoreWorker <T = any> { public isAsync = false; private doNotWaitSave = false; constructor (private store: IStore, public options: ICacheOpts = {}) { this.isAsync = this.store.getAsync != null ...
8cdf812a17d9278bd1bc5909f0ebc34f8c743bab
TypeScript
daimananshen/ProAngularExamples
/JavaScriptPrimer/usingTuples.ts
2.890625
3
import { TempConverter } from "./tempConverter"; let tuple: [string, string, string]; tuple = ["London", "raining", TempConverter.convertFtoC("38")]; console.log("----Using Tuples----"); console.log(`It is ${tuple[2]} degrees C and ${tuple[1]} in ${tuple[0]}`);
f03fe954e4ec4dc174fcfeee7b774c149238d57c
TypeScript
JVB-Dev/crud-users
/Node/server/src/controllers/UsersController.ts
2.78125
3
import { json, Request, Response } from "express"; import { User } from "../models/User"; import query from "../database/DB"; class UsersController { async Index(req: Request, res: Response) { try { const result = await query("SELECT * FROM usuarios ORDER BY ID"); return res.status(200).json(result...
99155be10fd746eec2df2e25ceb480c96e7b0fde
TypeScript
colshacol/leenk
/source/client/shared/comps/Shortener/stores/ShortenerStore.ts
2.78125
3
import { observable, action, computed } from 'mobx' import { createLink } from '../../../api/link/createLink' export class ShortenerStore { @observable inputValue: string = '' @observable shortenedUrl: string = '' @action updateInputValue = ({ target: { value }}) => { this.inputValue = value } @action ...
1d53860bd9cdb59148386ccac19e99cba6f3a05b
TypeScript
jdanyow/aurelia-converters-sample
/src/examples/6/sort.js
2.921875
3
export class SortValueConverter { toView(array, propertyName, direction) { var factor = direction === 'ascending' ? 1 : -1; return array .slice(0) .sort((a, b) => { return (a[propertyName] - b[propertyName]) * factor }); } }
ebd4a162b454520ae72ddbadb2a9dd4d8d5b7589
TypeScript
TienCGC8JAVA/functions
/para.ts
3.796875
4
function userInfo1(name: string, age: number): string { return `My name is ${name}, ${age} years old`; } console.log(userInfo1("john", 20)); function userInfo2(name: string = "anna", age: number = 69): string { return `My name is ${name}, ${age} years old`; } console.log(userInfo2()); function userInfo3(nam...
9c446ba884e705d7911aae126fcf40e504a26dd0
TypeScript
green-fox-academy/ndndnd24
/lecture/week 2/day 10/hard_ones_sort_that_list.ts
4.125
4
// Create a function that takes a list of numbers as parameter // Returns a list where the elements are sorted in ascending numerical order // Make a second boolean parameter, if it's `true` sort that list descending 'use strict'; function bubble(input: number[]) { let ascendingLine: number[] = []; let x = ...
d2b46f8f7c271d837987a3dde81cddcacd9fbd66
TypeScript
gleb-mihalkov/mst-playground
/src/consts/StorageKey.ts
2.5625
3
/** * Ключ в localStorage. */ enum StorageKey { /** * Содержит токен для продления токена авторизации в RPC API. */ AUTH_TOKEN = 'auth_token', /** * Телефон, введённый при восстановлении пароля. */ RECOVERY_PHONE = 'recovery_phone', /** * Код подтверждения, введённый при восстановлении паро...
cf2e5f9a03312b6576cb6e8b313953b98725e439
TypeScript
LYRA-Block-Lattice/lyra-api
/src/controllers/BlockController.ts
3.015625
3
import BlockModel, { IBlock } from "../models/BlockModel"; import { ApolloError } from "apollo-server"; /** * * @description holds crud operations for the Block entity */ /** * gets all Blocks * @param connection database connection * @returns {IBlock[]} Block list */ export const getAllBlocks = async (connect...
865c2b624d874c2a539e7f92955040b7e3e7ccc1
TypeScript
Yupeng-li/redux-simple-state
/src/StateContainer.ts
2.65625
3
import ld from "lodash"; import { combineReducers } from "redux"; import { ActionConfig } from "./types/scheme"; import { LooseObject } from "./types/LooseObject"; import { AnyAction, Reducer } from "redux"; export default class StateContainer implements LooseObject { _name: string; _initialValue: any | undefined;...
d0148b166c7c1fe6cfa60d19c6417815d3f089c6
TypeScript
acecor-cotep/role-and-task
/lib/src/RoleSystem/Role/ARole.d.ts
2.8125
3
/// <reference types="node" /> import Errors from '../../Utils/Errors.js'; import TaskHandler from '../Handlers/TaskHandler.js'; import ATask from '../Tasks/ATask.js'; export interface DisplayMessage { str: string; carriageReturn?: boolean; out?: NodeJS.WriteStream; from?: number | string; time?: nu...
21edba85bc1a53a5862c3be2906acc6e6033695a
TypeScript
gropax/ontos
/Ontos.Web/ClientApp/src/app/models/graph.ts
3.109375
3
export class Page { constructor( public id: string, public content: string, public type: string, public references: Reference[] = []) { } } export class PageType { constructor( public id: string, public label: string, public icon: string) { } public static UNKNOWN = new PageTyp...
2c5d25b8e4b93d016136c73dd875864333e9ba30
TypeScript
MartinBenjamin/AngularCore
/Web/ClientApp/src/app/Ontology/DLSafeRule.ts
2.609375
3
import { BuiltIn, Equal, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, NotEqual } from './Atom'; import { Axiom } from './Axiom'; import { EavStore } from './EavStore'; import { IAxiom } from "./IAxiom"; import { IClassExpression } from "./IClassExpression"; import { IClassExpressionSelector } from './ICl...
9a20819af0b0fcc15d693977866d31b820588a59
TypeScript
rafaelssp/TestHelloMedtime
/TestHelloMedtime/src/app/components/ficha/filtro-nome.pipe.ts
2.515625
3
import { Pipe, PipeTransform } from '@angular/core'; import { FichaComponent } from '../../components/ficha/ficha.component'; @Pipe({ name: 'filtraFichaNome', pure: false }) export class FiltroNomePipe implements PipeTransform { transform(fichas: FichaComponent[], nome: string): FichaComponent[] { nome = n...
87e52e9eba09796d61ee50f1c1fc970042f82681
TypeScript
liuheyu/typescript_RPC_demo
/src/rpc.ts
3.578125
4
/** ═════════🏳‍🌈 超轻量级的远程调用,完备的类型提示! 🏳‍🌈═════════ */ import type * as apis from "./apis"; type apis = typeof apis; type method = keyof apis; /** Remote call , 会就近的选择是远程调用还是使用本地函数 */ export function RC<K extends method>( method: K, data: Parameters<apis[K]>, ): Promise<unPromise<ReturnType<apis[K]>>> {...
a46e3a9701a3c23a35d6cd20b7acba2f9d7e2cb0
TypeScript
jesus-crysist/text-highlighter
/src/app/state/text-highlighter-store.service.spec.ts
2.640625
3
import { TestBed } from '@angular/core/testing'; import { Action, ActionTypes } from 'src/app/state/actions'; import { HighlightModel, INITIAL_STATE } from 'src/app/state/state'; import { TextHighlighterStore } from 'src/app/state/text-highlighter-store.service'; const highlightMocks = [ { color: 'red', text: 'brow...
b5ae9a61c6b23e5d3684297700594d9f001271c7
TypeScript
stjordanis/snyk-gradle-plugin
/lib/errors/missing-sub-project-error.ts
2.765625
3
export class MissingSubProjectError extends Error { public name = 'MissingSubProjectError'; public subProject: string; public allProjects: string[]; constructor(subProject: string, allProjects: string[]) { super( `Specified sub-project not found: "${subProject}". ` + `Found these projects: ${...
581fc9c836ce80c75e5c6f5bed29b47a6c204bf9
TypeScript
Leies-202/ai
/src/serifs.ts
3
3
// せりふ export default { core: { setNameOk: (name) => `わかった!これからは${name}って呼ぶね!`, san: "さん付けした方がいい?(「はい」か「いいえ」で答えてね〜)", yesOrNo: "「はい」か「いいえ」しかわからないよ...", hello: (name) => (name ? `こんにちは、${name}♪` : `こんにちは♪`), helloNight: (name) => (name ? `こんばんは、${name}♪` : `こんばんは♪`), goodMorning: (tension, name) => ...
3365baecd2fdd92ae2ac30debd524d6a5cdc92ab
TypeScript
ATS-UAE/car-rental-management-utils
/src/utils/MathUtils.ts
2.765625
3
export abstract class MathUtils { public static rangeOverlap = ( x1: number, x2: number, y1: number, y2: number ): boolean => Math.max(x1, y1) <= Math.min(x2, y2); }
86c5f99844d730ee5794757319f542ee266e2f72
TypeScript
liangskyli/test
/config/init.ts
2.765625
3
//构建初始化前,没有local.config.js文件,要创建文件 //解决umi构建前会解析所有路径文件是否存在(尽管在函数中动态引用了并没有使用到的文件) const fs = require('fs'); const initLocalConfigJsFile = () => { const configPath = './local.config.js'; try { const isExist = fs.existsSync(configPath); if (!isExist) { const jsTemplate = `module.exports = { serverProx...
87b2b36e6ca3bf5deca638d114d6aa8c11db613b
TypeScript
El-kady/design_patterns_in_typescript
/Bridge.ts
2.9375
3
var mysql = require('mysql'); var mongojs = require('mongojs'); interface DbEngine { insert(table,data); } class MysqlMan implements DbEngine { connection; constructor(config) { this.connection = mysql.createConnection({ host: config.host, user: config.user, p...
99d94a893b48e7afd2f463944cce05bea6b1d3a7
TypeScript
tkrotoff/react-form-with-constraints
/packages/react-form-with-constraints/src/Field.test.ts
2.953125
3
import { Field } from './Field'; import { FieldFeedbackType } from './FieldFeedbackType'; import { FieldFeedbackValidation } from './FieldFeedbackValidation'; test('constructor()', () => { const field = new Field('password'); expect(field).toEqual({ name: 'password', validations: [] }); }); // Validatio...
968e25139ba60a59af9a408f7ae9485d4ade1132
TypeScript
artifact-project/octologger
/src/logger/logger.ts
2.5625
3
import { Entry, ScopeEntry, LoggerOptions, LoggerAPI, LoggerFactoryAPI, Logger, LoggerContext, LoggerScope, LoggerScopeContext, ContextSnapshot, EntryMeta, ScopeExecutor, SCOPE, ENTRY } from './logger.types'; import { universalOutput } from '../output/output'; import { now } from '../utils/utils'; const time = new Dat...
d4cb6fbd5d44cbe59dbc2186bddc26ca494286e8
TypeScript
miltone92/Design-Patterns-Game
/DesignPatterns/Iterator/Concrete/ConcreteIterator.ts
3.359375
3
class ConcreteIterator implements IIterator { container: ConcreteContainer; currentPosition = 0; first() { let obj = null; if (this.container.data.length != 0) { this.currentPosition = 0; obj = this.container.data[0]; } return obj; } next() { let obj = null; if (this.curr...
0aca5c4895f894f43e7c28d0077e6cb34c0b6caf
TypeScript
Prashoon123/ChatCube
/hooks/useDarkMode.ts
2.640625
3
import { useEffect, useState } from "react"; const useDarkMode = () => { const [theme, setTheme] = useState<"light" | "dark">( typeof window !== "undefined" ? localStorage.theme : "dark" ); const colorTheme = theme === "dark" ? "light" : "dark"; useEffect(() => { const root = window.document.document...
db7a10b3beea10cbe66ba4d08fd4fd0567b16943
TypeScript
ccamateur/money-machine
/backend/FinancialGraphs/FinancialCostFunctions/FeeCostFunction.ts
3.34375
3
import {CostFunction} from "../../GraphAlgorithms/CostFunctions/CostFunction"; import {CurrencyEdge} from "../CurrencyEdge"; /** * FeeCostFunction * * Returns the fee cost of an edge as its cost function */ export class FeeCostFunction implements CostFunction { /** * amountBps * * The amount of ...
9ba594f2d0d2c19c48eb30ec3fc89c8c36e12e9e
TypeScript
jaydh/enen
/frontend/src/reducers/graphData.ts
2.640625
3
import produce from "immer"; import parseUri from "../helpers/parseURI"; export interface IArticle { id: string; link: string; addedAt: Date; metadata?: any; HTMLData?: string; } export default (state = { domains: {} }, action: any) => produce(state, draft => { switch (action.type) { case "GET_A...
fe33d2aaaabbeb9b77a7fc3bd670dfc4cd2b8229
TypeScript
Priyanka-behera-2000/meanApr19
/empApp/src/app/services/emp.service.ts
2.59375
3
import { Injectable } from '@angular/core'; import { Emp } from '../modals/emp.modal'; @Injectable() export class EmpService { //static variabe to be used for emp id static counter:number=1; //Array of emp objects. empList:Emp[]; constructor() { this.empList=Array(); } //to add Emp objects to th...
d18410b29ff2f6b135e57cbdf2aea465ea9ff363
TypeScript
tcom-software/laitKlimat
/store/actions/products.ts
2.578125
3
// action types export const types = { ADD_NEW_CACHE: "products/ADD_NEW_CACHE", REMOVE_CACHE_BY_KEY: "products/REMOVE_CACHE_BY_KEY", CLEAR_CACHE: "products/CLEAR_CACHE", }; // action creators /// cahche export const addProductsCache = (key: any, value: any) => ({ type: types.ADD_NEW_CACHE, paylo...
85e6a95557ed640c617bcc0ba0a1e5aa5e8af623
TypeScript
heloisagabrielle/typescript
/typeStructures.ts
3.8125
4
//Aplicação de TypeScript em algumas estruturas //Variável let nome: string = 'Pedro Braga'; console.log(nome); //Array let games: string[] = ['TLOU2', 'GOW4','Goat simulator', 'Bomba Patch', 'Apex', 'KOF', 'Warzone'] console.log(games) //Objeto let carro: { nome:string ano: number preco: ...
c5d010baf62aa9691001239c672645eefe884e55
TypeScript
VunboYao/readBook
/TypeScript/Stydy_TypeScript/src/js/48-映射类型下.ts
3.671875
4
{ /* * Pick映射类型 * 将原有类型中的部分内容映射到新类型中 * */ interface TestInterface { name: string age: number } type MyType = Pick<TestInterface, 'name'> } { /* * Record映射类型 * 他会将一个类型的所有属性值都映射到另一个类型上并创造一个新的类型 * */ type Animal = 'person' | 'dog' | 'cat' interface Tes...
8013213cf6416e986e958c60a8fbe7e1492cb7a3
TypeScript
khbrst/es-practice
/src/rxjs/operators/filtering/find.ts
2.796875
3
// RxJS v6+ import { from } from 'rxjs'; import { find } from 'rxjs/operators'; const source = from([1, 2, 3, 4, 5]); const example = source.pipe(find(x => x === 3)); example.subscribe(val => console.log(`Found value: ${val}`));
f632773602d8c5cc970a01498024e66a0bd0e6f5
TypeScript
gamejolt/client-voodoo
/src/selfupdater.ts
2.515625
3
import fs from './fs'; import { Controller, Events } from './controller'; import { ControllerWrapper } from './controller-wrapper'; import { Manifest } from './data'; export abstract class SelfUpdater { static async attach(manifestFile: string): Promise<SelfUpdaterInstance> { const manifestStr = await fs.readFile(m...
15628db7def2b557f50cf22703dd2b1633a2954f
TypeScript
KrakerXyz/hook.events
/web/src/services/useCodeMirror.ts
2.6875
3
import { Ref, onUnmounted, ref, isRef, watch } from 'vue'; import { loadCodeMirrorAsync } from './loadScript'; export enum CodeMirrorLanguage { Javascript = 'javascript', Json = 'json', Html = 'xml', Text = 'text' } export async function useCodeMirrorAsync(target: string | HTMLElement, readonly: Ref<boole...
c50c9ef76498e90af5aed32cca7294d211bdf558
TypeScript
taylorjg/continuo-app
/src/components/fullscreen.ts
2.53125
3
import RexUIPlugin from 'phaser3-rex-plugins/templates/ui/ui-plugin' import { SceneWithRexUI } from '../types' import * as ui from '../ui' export class Fullscreen { private scene: SceneWithRexUI private sizer: RexUIPlugin.Sizer private enterFullscreenButton: RexUIPlugin.Label private leaveFullscreenButton: Re...
1aed7e3e85c7c1ab0597921f074e598f967e2f6d
TypeScript
kld87/ng-catering
/src/app/classes/ingredient.ts
2.625
3
export class Ingredient { id: number; name: string; isSpicy = false; isGluten = false; isMeat = false; }
75535847987672118f4037b4ebfc3d6607ae48e3
TypeScript
ioanachiorean/fav-movie
/src/app/post-component/post-component.component.ts
2.53125
3
import { Component, OnInit, Input } from '@angular/core'; import { PostService } from './services/post.service'; @Component({ selector: 'post-component', templateUrl: './post-component.component.html', styleUrls: ['./post-component.component.css'] }) export class PostComponentComponent implements OnInit { pu...
8986d46ff66b11867a7be667735e92bf1c8b023d
TypeScript
rvalimaki/joulukalenteri
/src/app/app.component.ts
2.765625
3
import {Component, HostBinding, OnInit} from '@angular/core'; class Star { constructor(public x: number, public y: number, public dx: number, public dy: number) { } move() { this.x += this.dx; this.y += this.dy; } rewind() { this.x -= this.dx; this.y -= this.dy; } } @Component({ selec...
799b8c2d4b3075bafe8fb1f347e4e70ad53ee19d
TypeScript
morlay/redux-actions
/src/__tests__/index.spec.ts
2.9375
3
import { test, } from "ava"; import { buildCreateAction, createAction, handleActions, ActionMeta, } from "../index"; interface ICounter { counter: number; } interface ITypeWrappers { success: { toString(): string; }; failed: { toString(): string; }; toString(): string; } const typeWrap...
7bedda5038b8b6d066556fad5cf74564551bc7a5
TypeScript
chase-moskal/metalshop
/source/business/auth/validate-profile.ts
3.1875
3
import {MetalProfile} from "../../types.js" export const nicknameMax = 21 export const taglineMax = 32 export function validateProfile(profile: MetalProfile): { problems: string[] } { let problems = [] let fields = Object.entries(profile) function pluck<T extends keyof MetalProfile>(prop: T): MetalProfile[T]...
c657e5bb18e260c3432b33b0b92ecc666ef8ca50
TypeScript
jsmorales/angularForms
/src/app/components/aprox-data/aprox-data.component.ts
2.71875
3
import { Component, OnInit } from '@angular/core'; // for work with forms we need to import this libs, on app.module you need to import ReactiveFormsModule below to the import of FormsModule import {FormGroup, FormControl, Validators} from '@angular/forms'; import {Observable} from 'rxjs'; interface People { id: num...
abf20766ba7ebe38c5a7154cddfcbb5fb3b312b3
TypeScript
Malinina1995/social-application
/src/reducers/usersReducer.ts
2.609375
3
import {ResultCodes, ResultType} from "../api/api"; import {UserType} from "../types"; import {ThunkAction} from "redux-thunk"; import {AppReducerType} from "../redux-store"; import {Dispatch} from "redux"; import {usersAPI} from "../api/users-api"; const FOLLOW = "user/FOLLOW"; const UNFOLLOW = "user/UNFOLLOW...
65ffc3e6c64ad13d702f8f007a6cfe4cfccd27b8
TypeScript
basarat/typescript-node
/poelstra4/myprogram.ts
3.1875
3
import mylib = require("mylib"); import myotherlib = require("myotherlib"); function assert(cond: boolean): void { if (!cond) { throw new Error("assertion failed"); } } var a = mylib.myfunc(); var b = myotherlib.myotherfunc(); var str: string = a.foo; var num: number = b.foo; assert(typeof a.foo === "string"); ...
74e46ba03f84928958b375ec5823816d6bb9eea1
TypeScript
end5/CoCWebOld
/build/Game/Items/Materials/MaterialLib.ts
2.78125
3
import { KitsuneStatue } from './KitsuneStatue'; import { Material } from './Material'; import { MaterialName } from './MaterialName'; import { Dictionary } from '../../../Engine/Utilities/Dictionary'; import { ItemDesc } from '../ItemDesc'; export class MaterialLib extends Dictionary<Material> { public constructo...
c5aa7ecade3dbe457b81de7de5f11eb6a26179cd
TypeScript
zhangchongyu/egret_p2
/src/LayerManager.ts
2.75
3
namespace manager { /** * 简单层级管理 */ export class LayerManager { public constructor() { } private static _instance: LayerManager; /** * LayerManager实例 */ public static getInstance(): LayerManager { if(LayerMana...