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
83efc8eae0d8f2bab58652403937bb9d4fbc7991
TypeScript
kazuhideoki/salon-tablet
/src/util/db/checkIsGeneratePubulicPage.ts
2.5625
3
import { UserInfo, UserInfoFromDB } from '../interface/Interface'; import { db } from './db'; import { userInfoParamsFromSql } from './userInfoParamsFromSql'; export const checkIsGeneratePubulicPage = async ( slug: string ): Promise<UserInfo | null> => { try { const data = (await db(`SELECT * FROM user_info`))...
c41905d0597731abfff22a682fc6939d1fd2c031
TypeScript
Antiplusists/Cardsetta
/Core/ClientApp/src/patchHelpers/DeckPatcher.ts
2.921875
3
export default class DeckPatcher { private _name: string | null; private _description: string | null; constructor() { this._name = null; this._description = null; } public patchName(newName: string): DeckPatcher { this._name = newName; return this; } ...
2a07263ada6834c9b8c77523100b3602e7dd3c75
TypeScript
icon-project/icon-sdk-js
/lib/builder/call/Call.ts
2.84375
3
/* * Copyright 2021 ICON Foundation * * 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 agreed...
aa1504c2b025d70e4017c4b03375400c5ccd0294
TypeScript
RichieAHB/normal-distribution
/src/__tests__/NormalDistribution.spec.ts
3.21875
3
import NormalDistribution from "../NormalDistribution"; describe("NormalDistribution", () => { describe("#cdf", () => { it("should return 0.5 for a z-score of 0", () => { const nd = new NormalDistribution(); expect(nd.cdf(0)).toEqual(0.5); }); it("should return 0 for a z-score less than -3.5...
a3b71fcbd3e82cfe57bcb256888dc1c0bb6a8104
TypeScript
tacthgin/MagicTower
/MagicTower/assets/GameFramework/Script/NodePool/NodeObject.ts
2.65625
3
import { ReferencePool } from "../Base/ReferencePool/ReferencePool"; import { ObjectBase } from "../ObjectPool/ObjectBase"; import { INodeHelper } from "./INodeHelper"; /** * 节点对象 */ export class NodeObject extends ObjectBase { private _nodeHelper: INodeHelper = null!; static create(name: string, node: obje...
f8babef68c452d7186011aa0ad7d0682bf159693
TypeScript
QPC-database/jacdac-docs
/src/components/widgets/svg.ts
2.90625
3
/* eslint-disable @typescript-eslint/no-explicit-any */ function mkTitle(txt: string): SVGTitleElement { const t = <SVGTitleElement>elt("title") t.textContent = txt return t } export function title(el: SVGElement, txt: string): SVGTitleElement { const t = mkTitle(txt) el.appendChild(t) return t ...
75fb325c0bab27dd590b597a13321b219413f34e
TypeScript
andrew-oxenburgh/hospitalrun-frontend
/src/clients/db/PatientRepository.ts
2.765625
3
import Patient from '../../model/Patient' import Repository from './Repository' import { patients } from '../../config/pouchdb' const formatFriendlyId = (prefix: string, sequenceNumber: string) => `${prefix}${sequenceNumber}` const generateSequenceNumber = (currentNumber: number): string => { const newNumber = curr...
45256b8b791f348f6fd72d0cf2654b320c4aa656
TypeScript
peraltapam/dracarys
/src/app/dragon/dragon-edit/dragon-edit.component.ts
2.546875
3
import { Component, OnInit } from '@angular/core'; import { NgForm } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { Dragon } from '../dragon.model'; import { DragonService } from '../dragon.service'; @Component({ selector: 'app-dragon-edit', templateUrl: './dragon-edit.component...
6aab4fb74487843b5f8a7956934702b4d24c9adb
TypeScript
daxingyou/Mafia
/client20689/client514/PalaceWar/src/game/model/config/prison/PrisonCfg.ts
2.546875
3
namespace Config { /** * 牢房配置类 */ export namespace PrisonCfg { let prisonItemList: Object = {}; export function formatData(data: any): void { for (var key in data) { let prisonItemCfg: PrisonItemCfg; if (!prisonItemList.hasOwnProperty(String(key))) { prisonItemList...
3915937ec8ebbea0ec4aae6cde14fbd8b1b4d009
TypeScript
pozterz/nestjs-jwt
/src/controllers/auth.controller.ts
2.640625
3
import { Controller, Post, Body, Res, HttpStatus } from '@nestjs/common' import { AuthService } from '../services/auth.service' @Controller('auth') export class AuthController { constructor(private readonly authService: AuthService){ } @Post() async authenticate(@Body() req, @Res() res) { const token = awai...
5233d97cafc40bb74b13e441ad3e6a5c8298ce51
TypeScript
theorye/oandats
/src/definitions/Transaction/CreateTransaction.interface.ts
3.09375
3
import { Transaction, TransactionType } from "."; import { Integer, Currency } from "../Primitives"; // A CreateTransaction represents the creation of an Account export interface CreateTransaction extends Transaction { // // The Type of the Transaction. Always set to “CREATE” in a // CreateTransaction. // ty...
324d3a1df6dcd24f6c3d5efeb8a818db1fd469a6
TypeScript
dmc1985/ExerciseTimer
/src/common/typings.ts
2.890625
3
export type NumericDictionary<T> = { [index: number]: T; }; // eslint-disable-next-line @typescript-eslint/no-explicit-any export type Dictionary<T = any> = { [index: string]: T; }; export type Nullable<T> = T | null; export type Optional<T> = T | undefined; export type Nillable<T> = T | null | undefined;
c0523417c2742dd7c3ff56a87bb0689660655f17
TypeScript
infojav/initReactAppTemplate
/packages/remoteFile/sagas.ts
2.546875
3
import { takeLatest, put } from "redux-saga/effects" import { ActionTypes, actions } from "./actions" function* fetchData(action: any) { const url = `github/Remotefile?url=${action.payload}` try { const data = yield fetch(url).then(r => r.json()) if (data.statusCode && data.statusCode > 299)...
3e4e5002a179352569f54994af4c757e9d443065
TypeScript
Hermanoid/RaidArea51
/src/app/Player.ts
2.59375
3
//let bountyHunter = new BountyHunter(null, null, null, null, null, null, null, null); //let money = 0; //let bhOffenseTotal = 0; //let bhDefenseTotal = 0; //let damage = 0; //name: string; //weight: number; //cost: number; //description: string; //function PlayerCharacter(firstName, lastName, ag...
ec3ef203722bd925dbbfc9f08750a73451249680
TypeScript
Lionkka/AngularFlow
/HomeWork/myron.kurus/hw-2/jQueryCookie/task#4/app.ts
2.765625
3
function setPromise(delay: number): Promise<string> { return new Promise((resolve) => { setTimeout(() => resolve("DONE"), delay*1000); }); } let prom1 = setPromise(1); let prom2 = setPromise(2); let prom3 = setPromise(1); Promise.all([prom1, prom2, prom3]).then(values => { console.log(values); });
16e7e619d09cefda1a88fa8ce584d0f364d540e5
TypeScript
AlCalzone/shared-utils
/src/typeguards/typeguards.test.ts
3.171875
3
import { assert, expect } from "chai"; import { isArray, isObject } from "."; import type { Equals } from "../types"; // tslint:disable:no-unused-expression // Used to tests types function assertTrue<T extends true>() { return undefined!; } type UnspecifiedObject = Record<string | number | symbol, unknown>; describe...
aa034a53a77f352b2e27ccc9077298185fb17c95
TypeScript
dwtcourses/immunity-booster
/functions/src/Database/foodsAndCategories.ts
3.046875
3
export const categories = [ "Vitamin B6", "Vitamin C", "Vitamin E", "Prebiotic", "Probiotic", ]; const b6Foods = ["Chicken", "Salmon", "Tuna", "Trout", "Chickpeas"]; const cFoods = [ "Oranges", "Grapefruits", "Tangerines", "Strawberries", "Kiwifruit", "Red bell peppers", "Brussel sprouts", "C...
b0fe8bac4509696662ee2f6be9c62f84ad30ab20
TypeScript
CrimSol/ajv-formats
/tests/issues/617_full_format_leap_year.spec.ts
2.609375
3
import Ajv from "ajv" import addFormats from "../../dist" describe("PR #617, full date format validation should understand leap years", () => { let ajv: Ajv beforeAll(() => { ajv = new Ajv({strictTypes: false}) addFormats(ajv) }) test("should handle non leap year affected dates with date-time", () =>...
431ac593133320faf54b2b46b44ec2c8cdfc330a
TypeScript
duyoji/design_pattern_with_typescript
/app/js/Singleton/RegisterNote.ts
2.546875
3
/** * Created by Tsuyoshi on 2014/09/19. */ module Singleton { export class RegisterNote { private static instance : RegisterNote; static getInstance() : RegisterNote { if (!this.instance) { this.instance = new RegisterNote(); console.log("new create ...
e43b2d96c343f840d59cf0712ddbdc6b16f8fa94
TypeScript
DefinitelyTyped/DefinitelyTyped
/types/three/src/math/Vector3.d.ts
3.078125
3
import { Euler } from './Euler.js'; import { Matrix3 } from './Matrix3.js'; import { Matrix4 } from './Matrix4.js'; import { Quaternion } from './Quaternion.js'; import { Camera } from '../cameras/Camera.js'; import { Spherical } from './Spherical.js'; import { Cylindrical } from './Cylindrical.js'; import { BufferAttr...
7467c4f61a1463436b7e54fb43e5e57ce954ce3c
TypeScript
miguelyoobic95/ngIfModalBug
/design-system/stencil/src/utils/pipes/currency/currency.pipe.ts
2.6875
3
import { Pipe } from '../base'; export class CurrencyPipe extends Pipe<number, string> { transform(value: number, options: string = 'EUR'): string { return value.toString() + ' ' + options; } }
b938fb59b5e920b5b5d4f25376b25dd8fb93681d
TypeScript
trangtt-1054/ts-web
/src/index.ts
2.890625
3
/* import { User } from "./models/User"; const user = User.buildUser({ id: 1 }); //set up event listener user.on("change", () => { console.log(user); }); user.fetch(); import { User } from "./models/User"; // const collection = new Collection<User, UserProps>( // "http://localhost:3000/users", // (json: UserP...
d69a93c038ff06678e60177d9e617785bb3f14d1
TypeScript
scrum-gang/jobhub-web
/src/api/userAPI.ts
2.671875
3
import { AxiosPromise } from "axios"; import UserType from "../config/types/accountTypes"; import ILoginResponse from "../config/types/loginResponse"; import IUser from "../config/types/user"; import API from "./api"; enum UserEndpoints { USERS = "/users", SELF = "/users/self", LOGIN = "/login", LOGOUT = "/lo...
285c0929e0cef220ff4adeca759fa6bcf6797201
TypeScript
SingularityF/PixivWallpaper
/Client/PWF_Desktop/app/reducers/appInitializedReducer.ts
2.8125
3
interface ActionType { type: string; } export default function appInitializedReducer( state: Boolean = false, action: ActionType ) { switch (action.type) { case 'INIT_DONE': return true; default: return state; } }
994a91bf4822db8dcdbe259cb7f0146c9101740e
TypeScript
katiaRomanova/curso-angular
/ej-typescript/modulos/mascota.ts
3.046875
3
//export default Mascota; // se puede hacer export delante de la clase, class Mascota { nombre: string; tipo: string; constructor(nombre: string, tipo: string = 'gato') { this.nombre = nombre; this.tipo = tipo; } } let roky = new Mascota('Roky', 'perro'); //si vamos a exportar solo...
26c78b1a1bf5660f2f0bb0996eb2ee989078649b
TypeScript
koyadovic/dia-mobile
/src/components/food-selected/food-selected.ts
2.5625
3
import { Component, Input, Output, EventEmitter } from '@angular/core'; import { FoodSelected, selection_kcal, weight, FoodDetailable } from '../../models/food-model'; import { style, state, animate, transition, trigger } from '@angular/animations'; import { TranslateService } from '@ngx-translate/core'; @Component({ ...
b29e37394f06a8ae5bb90b1b13ec745a44496ad6
TypeScript
pro-react233/fullStack01
/src/libs/rd-url-utils/api.ts
3.140625
3
export interface NoMatch { isMatched: false; } export interface Match<TParams, TQueryString> { isMatched: true; params: TParams; query?: TQueryString & { [key: string]: string }; } export interface LocationDescriptor { search?: string; pathname: string; } export interface UrlPath<TParams, TQu...
e0d616ccca4540dfc62cd8b7d7e426e03fe3a795
TypeScript
MRazvan/lib-workers
/src/pool/serialization.ts
2.640625
3
import { isNil, isString } from 'lodash'; import { isArray, isBoolean, isNumber } from 'util'; import { GetSerializers, ISerializer, SerializationHandlerKey } from './attributes/serializer'; import { SerializationError } from './errors/serialization.error'; import { getLog, Logger } from './logging'; export class Seri...
b0b4a39915045c1e0fc2807edad8fabe17ff5454
TypeScript
chrto/sandbox-composition-monad
/src/factory/functor.ts
3.328125
3
export interface IFunctor<T> { lift: <I, O>(fcn: (v: I) => O) => IFunctor<O>; done: () => T; } const Functor = <T>(value: T): IFunctor<T> => ({ lift: <I, O>(func: (v: I) => O): IFunctor<O> => Functor(func.apply(null, [value])), done: (): T => value }); export default Functor;
1b105019be6393fee20c66d8f73ff340eea1961b
TypeScript
ducnguyen96/ducnguyen96-apis-microservices
/api-gateway/src/graphql/types/common.interface.entity.ts
3.0625
3
import { InterfaceType, Field, ID, ObjectType, Int } from '@nestjs/graphql'; import { Type } from '@nestjs/common'; @InterfaceType({ description: 'Node', }) export abstract class Node { @Field(() => ID) id: string; } @InterfaceType() export abstract class Edge { cursor?: string; } @ObjectType() export class ...
55e3ea5feee5042348240c69916fc580bf0159c5
TypeScript
wuerstle/EIA2
/Abschlussaufgabe/js/main.ts
3.09375
3
/* Aufgabe: Abschlussaufgabe Name: Lisa Würstle Matrikel: 254072 Datum: 20.07.2017 Hiermit versichere ich, dass ich diesen Code selbst geschrieben habe. Er wurde nicht kopiert und auch nicht diktiert. */ namespace Abschlussaufgabe { window.addEventListener("load", init); export let context: CanvasRenderi...
8d5f1c26f08348b3518825b6968689116824979c
TypeScript
fernandoj92/ltm-learning-interface
/app/dashboard/test-cytoscape/model/cytoscapeNode.ts
2.703125
3
import { Node } from '../../../model/bayesianNetwork/dag/node' export class CytoscapeNode{ data: CytoscapeNodeData constructor(node: Node){ this.data = new CytoscapeNodeData(node.id, node.name) } } class CytoscapeNodeData{ id: string; name: string; constructor(id:string, name:string...
67a517cd2813cb39b63bc563703ee906e688a821
TypeScript
alexanderyarm/sesame
/src/shared/components/Autocomplete/hooks/clickOutsideElement.ts
2.953125
3
import { MutableRefObject, useEffect, useRef } from "react"; const refStack: MutableRefObject<Element | null>[] = []; export const useClickOutsideElement = (callback: () => void) => { const ref = useRef<HTMLDivElement>(null); useEffect((): ReturnType<React.EffectCallback> => { refStack.push(ref); const ...
dbc0c91ac0c0702290e6d8424930b924633e9604
TypeScript
boterojuanpa/hackaton-proteccion
/frontend/src/app/shared/model/usuario.model.ts
2.8125
3
export class Usuario { public nombre: string; public cedula: number; constructor(nombre: string, cedula: number) { this.nombre = nombre; this.cedula = cedula; } }
4bf10ad4e3bec7bb878c67b08c7090f2e4dca1fc
TypeScript
typescript-eslint/typescript-eslint
/packages/eslint-plugin/src/rules/naming-convention-utils/parse-options.ts
2.578125
3
import * as util from '../../util'; import { MetaSelectors, Modifiers, PredefinedFormats, Selectors, TypeModifiers, UnderscoreOptions, } from './enums'; import { isMetaSelector } from './shared'; import type { Context, NormalizedSelector, ParsedOptions, Selector, } from './types'; import { createVal...
477bbdcd68db5570924c8b3d33a7dcb74677c748
TypeScript
DaYeSquad/json-ts-mapper
/src/object-mapper.ts
2.96875
3
// Copyright 2018 Frank Lin (lin.xiaoe.f@gmail.com). All rights reserved. // Use of this source code is governed a license that can be found in the LICENSE file. export interface JsonField { name: string; jsonKey: string; serializer?: (value: any) => any; } /** * Mapping for object. */ export class ObjectMapp...
7d3e62e0be999b00a4064f736d83c9284055da9b
TypeScript
younaAnn/playwright-seed
/src/page-objects/ui-elements/input.ts
2.734375
3
import { Timeouts } from '../../shared/timeouts'; import { UIElement } from '../base/ui-element'; export class Input extends UIElement { async fill(value: string, options?: Record<string, any>): Promise<void> { const el = await this.wait(); return el.fill(value, options); } async press(key...
9481ca12f2bb31e2cf1b737e67e0f943c793c181
TypeScript
DistinctionWei/ts-utility-plugins
/src/ddzy/__tests__/array/pullAll.test.ts
3.359375
3
import { pullAll } from "../../utility/array/pullAll"; describe('pullAll tests...', () => { test('Method pullAll should receive an array composed of number and return the filtered array', () => { const received = { origin: [1, 2, 3, 1, 2, 3], selector: [2, 3], }; const expected = { ...
0af37b417fa531152bdaff113ba28d6355504f74
TypeScript
tarngerine/blogring
/src/lib/index.ts
2.625
3
import { filterHueRotate, formatRgb, parse } from 'culori'; import { useEffect, useRef, useState } from 'react'; import { Vec } from '../types'; // lerp function between two ranges export function lerp(value: number, r1: [number, number], r2: [number, number]): number { return ((value - r1[0]) * (r2[1] - r2[0])) / ...
ba77e51bbdf5d033d4134147bf0d2c5ce3e2ce7f
TypeScript
rafael-g-depaulo/discord-bot
/libs/ol-fantasy-battle/src/Models/PlayerUser/index.test.ts
2.984375
3
import mockAttributes from "Utils/mockAttributes" import { useDbConnection } from "@discord-bot/mongo" import PcModel, { Pc } from "Models/PlayerCharacter" import PlayerUserModel, { PlayerUser } from "./index" import { createPlayerUserProps } from "./statics/create" describe("PlayerUser Model", () => { useDbConnect...
595423ef4c79eb2cc37a3ff6ac903ca18d32e08e
TypeScript
Gimorhee/prep-repo
/November2019/Typescript/greeter.ts
3.703125
4
class Student { fullName: string; constructor(public firstName: string, public middleInitial: string, public lastName: string) { this.fullName = firstName + " " + middleInitial + " " + lastName } } interface Person { firstName: string; lastName: string; } function greeter(person: Pers...
24f647f841ed450fcda9a677010cf897da14b5d1
TypeScript
simonxmh/restaurant-menu-builder
/src/ts/utils/Interfaces.ts
3.140625
3
import MenuItem from '../models/MenuItem'; import { Action, Store, Dispatch } from 'redux'; // Format of a menu item loaded from the API: export interface IMenuItemRaw { // Which category to put this food item under: Category: string, // Name of the menu item: Name: string, // Description of the menu i...
3db5addf4b2b4688ab16992fd27276c41a97e471
TypeScript
nkescobar/node-fundamentals
/02-fundamentos/callbacks.ts
3.421875
3
setTimeout(() => { console.log('hola mundo'); }, 1000); const getUsuarioById = (id: number, callback: Function) => { const usuario = { id, nombre: 'Nasly' }; setTimeout(()=> { callback(usuario); },1500); }; // Callbacks Una funcion que se manda como argumento a otra funcion...
144089d6f74f6ec46e543cfd618e58dbd8875f00
TypeScript
Jerell/fams
/public/model/__tests__/node.ts
3.15625
3
import Node from '../node' describe('Constructor - initial properties', () => { it('should have a name', () => { const node = new Node() expect(node.name).toBeTruthy() }) it('should have an x position', () => { const node = new Node() expect(node.x).not.toBeUndefined() }) it('should have an elevation'...
4eaa35e71ef19834035f219ee7841981c1bbf3ea
TypeScript
Silence-dream/Study-Note
/杂乱的代码/javascript/01-链表.ts
3.703125
4
interface node<T> { node: node<T> | null; next: T | null; } class LinkedList<T> { // 链表头部 private head: node<T> | null; // 链表长度 private size: number; // 链表尾部 private tail: node<T> | null; constructor() { this.head = null; this.size = 0; this.tail = null; } addFirst(...
4d710678fa3ece45883bdc6352e5a82d3cfaf0f1
TypeScript
sam-barker/ts
/src/lib/number.spec.ts
3.03125
3
import test, { ExecutionContext } from 'ava'; import { double } from './number'; function testDouble( t: ExecutionContext, input: number, expected: number ): void { t.is(double(input), expected); } testDouble.title = ( providedTitle: string = '', input: number, expected: number ) => `${providedTitle} ...
2aed46233793177243e16a523ac6be398ba3eafa
TypeScript
hotsoycandy/hotsoyblog
/src/core/common/errors/CommonError.ts
2.84375
3
export abstract class CommonError extends Error { constructor (message: string, resErrorMessage?: string) { super(message) this.resErrorMessage = resErrorMessage ?? message } // http api response properties readonly abstract resErrorCode: string resErrorMessage: string readonly abstract resStatusCo...
ee9aadb44353299365f79c5e12744d51981c9412
TypeScript
ZephyrAndMoon/best-utils
/src/addClass.ts
3.109375
3
import hasClass from './hasClass' /** * addClass 添加class类名 * @version 1.0.2 * @param el THML元素 * @param cls class类名 * @category addClass * @example * ``` typescript * addClass(el, 'dom-class-wrap') * ``` */ const addClass = (el: HTMLElement, cls: string): void => { if (!el) return let curClass = el.class...
a48677d5433b6964cac50eb33b616109f6c16182
TypeScript
kanbang/battle-city-mp
/actions/Action.ts
3.0625
3
export enum ActionType { ANY = 'any', BUTTON_PRESS = 'button-press', } export interface ActionOptions { timestamp: number; type?: ActionType; } export class Action { timestamp: number; type: ActionType; constructor(options: ActionOptions) { this.timestamp = options.timestamp; ...
6460a969cc3a84d69016191672b17ccb2960db22
TypeScript
ruslanguns/nest-mongoose-crud
/src/talents/talents.controller.ts
2.578125
3
import { Controller, Get, Post, Put, Delete, Param, Body } from '@nestjs/common'; import { TalentsDto } from './talents.dto'; import { ValidateObjectId } from '../_shared/pipes/validate-object-id.pipe'; import { TalentsService } from './talents.service'; import { HttpException } from '@nestjs/common/exceptions/http.exc...
17c7a9db550a3c1a4a693f258b7006a3688a0e0b
TypeScript
OptimalBits/ground
/lib/container/sequence.ts
2.65625
3
/** Ground Web Framework (c) 2011-2013 Optimal Bits Sweden AB MIT Licensed. */ /** Sequence Class This class represents a ordered collection of models. The sequence supports persistent storage, offline and automatic client<->server synchronization. Events: */ /// <reference path="container.ts" /> /// ...
5321ab2a57eea697379b48a524bd64cf93b2237c
TypeScript
tmastalirsch/clean-architecture-ts
/src/utils/decorators/Injectable.ts
2.609375
3
import { container } from './../Container'; /** * Decorator that marks a class as a provider. * Providers can be injected into other classes via constructor parameter injection. */ export function Injectable(): ClassDecorator { return function (constructor: any) { container.provide({className: construct...
72a677c18084295d9f3c73698b1bb2d0f8ac40a2
TypeScript
Rajiv-Patel/Angular6HerokuApp
/src/app/entertainment/music/music.service.ts
2.515625
3
import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import { HttpClient } from '@angular/common/http'; // Ang5 // import { Observable } from 'rxjs/observable'; // Ang6 import { Observable } from 'rxjs/Observable'; import { map } from 'rxjs/operators'; import { RootObject} from '....
c9070b93c9c689081155be2004ad135ef5e3b88d
TypeScript
robholland/ui
/src/global.d.ts
2.625
3
/// <reference types="@sveltejs/kit" /> interface Window { Prism: { highlightAll: () => void; }; } type Heroicon = { [key: string]: string }[][]; type WorkflowStatus = | 'Running' | 'TimedOut' | 'Completed' | 'Failed' | 'Completed' | 'ContinuedAsNew' | 'Canceled' | 'Terminated' | null; typ...
6bb12508185db8c937951198767f177f6dcc8d43
TypeScript
LanceTurri/destiny-ipsum
/src/data/vance.ts
2.59375
3
// tslint:disable-max-line-length export const VANCE_INTROS = [ 'Is it time?', 'I\'m listening, Guardian.', 'Let\'s talk.', 'Go ahead, Guardian.', 'The Trials will wait for you.', 'Eyes open Guardian.', 'Light go with you, Guardian.', 'Go with the Light.', 'I hope we\'ll meet again.'...
a5c4fe1d74b297d05961f47365868a18487d5d4b
TypeScript
huanghaiyang/cook-hooks
/src/useWaterfall.ts
2.59375
3
import { useMountedState } from 'react-use'; import { useCallback } from 'react'; export type UseWaterfall = () => (wrappedPromises: ((param?: any) => Promise<any>)[]) => Promise<any>; const useWaterfall: UseWaterfall = () => { const isMounted = useMountedState(); return useCallback((wrappedPromises: ((param?: an...
28eba6b5c3918e331de5f438d48efe964990544f
TypeScript
ATKovz/blog
/2022/[TS]练习/29.实现StringToPath.ts
3.671875
4
// 实现一个 ToPath 工具类型,用于把属性访问(. 或 [])路径转换为元组的形式。具体的使用示例如下所示: namespace ToPath { type A = ToPath<'foo.bar.baz'> //=> ['foo', 'bar', 'baz'] type B = ToPath<'foo.bar[0].baz'> //=> ['foo', 'bar', '0', 'baz'] type ToPath<S extends string, Stack extends any[] = []> = S extends `${infer Head}[${infer N}]${infer Rest}...
f89f1b89a78b3c7ca4647e634d26c27c40d6f1a8
TypeScript
oliviertassinari/material-ui
/packages/mui-system/src/createTheme/createSpacing.test.ts
3.109375
3
import { expect } from 'chai'; import createSpacing, { Spacing } from './createSpacing'; describe('createSpacing', () => { it('should be configurable', () => { let spacing: Spacing; spacing = createSpacing(); expect(spacing(1)).to.equal('8px'); spacing = createSpacing(10); expect(spacing(1)).to.e...
f3ba17357feea80bf1c7b53e211b7ef7fe495fff
TypeScript
nadberezny/nussknacker
/ui/client/reducers/toolbars.ts
2.703125
3
import {persistReducer} from "redux-persist" import storage from "redux-persist/lib/storage" import {Reducer} from "../actions/reduxTypes" import {combineReducers} from "redux" export enum ToolbarsSide { TopRight = "TOP-RIGHT", BottomRight = "BOTTOM-RIGHT", TopLeft = "TOP-LEFT", BottomLeft = "BOTTOM-LEFT", H...
8cce11fb28babe76a8c2564b8d8bfd250b396553
TypeScript
danikaze/kokan
/store/clean-state-for-client.ts
3
3
import { State } from './model'; /** * Return a copy of the passed state after cleaning it for the client * Basically, edits and removes parts that shouldn't be "shown" in the client */ export function cleanStateForClient(state: State): State { const frontendState = { ...state }; const log = state.settings.log;...
dc7e8542ebcbc0562ea1c3239c111d14f7db7356
TypeScript
fixiabis/Sealed
/Relati/v0.1.3/Relati/js/signOXDUA.ts
2.625
3
function signOXDUA(board) { var symbolColor = { "O": "#dc143c", "X": "#4169e1", "D": "#ffa500", "U": "#2e8b57" }; var viewer = board.viewer; function cleanSign(grid) { for (var i = 0; i < grid.views.length; i++) { viewer.removeChild(grid.views[i]); ...
f05c2b3e0c7d58a24c856370d4c748b4fb7342bd
TypeScript
bigcommerce/checkout-sdk-js
/packages/core/src/common/utility/guard.ts
3.03125
3
export default function guard<T>(value: T, errorFactory?: () => Error): NonNullable<T> { if (value === undefined || value === null) { throw errorFactory ? errorFactory() : new Error('An unexpected error has occurred.'); } return value as NonNullable<T>; }
1adff6e2dbd9dfcf77a419f73da2e1c2aafed620
TypeScript
mlnima/reactServerSideRenderingWithNext
/packages/custom-util/src/date-utils/convertDurationStringToIso8601.ts
3.046875
3
const convertDurationStringToIso8601 = (duration: string) => { try { const splitDuration = duration.split(':') const seconds = parseInt(splitDuration[splitDuration.length - 1]) const minutes = parseInt(splitDuration[splitDuration.length - 2]) const hours = parseInt(splitDuration.leng...
5b26151bfd5d81cf28916dd6c835f4df038e0ed6
TypeScript
esfx/esfx
/packages/struct-type/src/internal/array/arrayTypeImpl.ts
2.53125
3
/*! Copyright 2023 Ron Buckton 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 agreed...
2b0c420dea878e1c2360e4ca067d7545ab35facd
TypeScript
tomas-ortega/nodejs-architecture-training
/full-app-examples/full-app/src/dao/singleton/MongoDBConnectionPoolDAO.ts
2.640625
3
import * as mongoDb from "mongodb"; import { DatabaseConnectionDTO } from "../../domain/DatabaseConnectionDTO"; export class MongoDBConnectionPoolDAO { private static _instance:MongoDBConnectionPoolDAO = new MongoDBConnectionPoolDAO(); private _connectionPool:any = null; private _firstInstance:boolean = f...
71ce0e3848325ec8248d35069f6fb45799793807
TypeScript
Esri/hub.js
/packages/common/src/utils/titleize.ts
3.390625
3
import { capitalize } from "../util"; /** * Capitalize every word in a sentence * @param {string} value * @returns {string} a sentence with every word being capitalized */ export function titleize(value: string) { return value .split(" ") .map((k) => capitalize(k)) .join(" "); }
534aafaef59717673cc76c924b343cc652317da6
TypeScript
gmmurugan/cloud-reports
/src/analyzers/aws/route53/domain_transfer_lock.ts
2.515625
3
import { CheckAnalysisType, ICheckAnalysisResult, IResourceAnalysisResult, SeverityStatus } from "../../../types"; import { BaseAnalyzer } from "../../base"; export class DomainsTransferLockAnalyzer extends BaseAnalyzer { public analyze(params: any): any { const allDomains = params.domains; if (!a...
b5e434e22174531347c58ba958d40d4d32a24ba9
TypeScript
Zabadeus/o-marketplace
/server/src/product/resolvers/product.ts
2.59375
3
import { Response } from "express"; import { Arg, Ctx, Mutation, Query, Resolver } from "type-graphql"; import { AnyObject } from "../../common/types/AnyObject"; import { MyContext } from "../../common/types/MyContext"; import { checkAndUpdate } from "../../common/utils/checkAndUpdate"; import { Product } from "../enti...
e84523c3c7cb5ad635cd64e4aba6e9e19a176987
TypeScript
aardvarkxr/aardvark
/websrc/whiteboard/src/stroke.ts
2.640625
3
import { AvVector } from '@aardvarkxr/aardvark-shared'; import { vec2, vec3 } from '@tlaukkan/tsm'; import Color from 'color'; import { exportGLB, GLTFAsset, Material, Mesh as GltfMesh, Node, Scene, Vertex } from "gltf-js-utils"; import { CatmullRomCurve3, ExtrudeGeometry, ExtrudeGeometryOptions, Geometry, Matrix4, Sha...
dcb28d6bd7ea6dc8e0e7155ea4fad4ccabb3c3b1
TypeScript
nhsz/trello-clone
/src/reducers/appState.ts
2.515625
3
import { nanoid } from 'nanoid'; import { DragAction, ListAction, TaskAction } from '../actions'; import { AppState } from '../contexts'; import { emptyAllOtherLists, findListIndexById, findTaskList, getTasksFromOtherLists, insertItemAtIndex, moveItem, overrideListAtIndex, removeItemAtIndex } from '../u...
d1833e06d18d8d87557fc74b33125e52f6647171
TypeScript
evansb/source-toolchain
/src/session.ts
3.0625
3
/** * Interactive toolchain Session. */ import * as es from 'estree' import * as EventEmitter from 'eventemitter2' import * as invariant from 'invariant' import { parse } from './parser' import { StaticState } from './types/static' import { createContext } from './context' import { InterpreterState } from './types/...
2282a2a63600c1c7eba76b980908522b93af201f
TypeScript
jedster1111/simple-vectors
/src/vector/createVector.ts
3.296875
3
import { Vector, VectorPosition } from './types'; import { addVectors } from './addVectors'; import { areVectorsEqual } from './areVectorsEqual'; import { calculateVectorArea } from './calculateVectorArea'; import { createPosition } from './createPosition'; import { isVector } from './isVector'; import { scaleVector } ...
b1c9265a9b62508c8767d668b45bdfe0f7baed26
TypeScript
pauek/markright-ts
/tests/walk.ts
3.328125
3
import { test } from "uvu"; import * as assert from "uvu/assert"; import * as mr from "../src/markright"; const lines = (lineArray: string[]): string => lineArray.map((line) => line + "\n").join(""); test("Walk a text", () => { const tree = mr.parse(`hi`); const result = mr.walk(tree, { [mr.symText]: ({ tex...
c3f9192aad4d737f9aa17ab760ee004ecd971336
TypeScript
gribblee/GAME-Match3
/typescript-match3/src/matchthree/game/utils/PieceDisplayPool.ts
2.609375
3
import { Sprite } from "pixi.js"; import { AtlasKeys } from "./../../utils/AtlasKeys"; export class PixiSpritePool { public static spriteList: Map<string, Sprite[]>; public static init(): void { this.spriteList = new Map<string, Sprite[]>(); } public static getImage(assetId: string): Sprite { ...
88c1086b1ff626f24ec3cde3c5a9f35c2d66d658
TypeScript
dyotov87/dyotov87.github.io
/projects/yuuvis/framework/src/lib/pipes/user.pipe.ts
2.71875
3
import { Pipe, PipeTransform } from '@angular/core'; import { UserService } from '@yuuvis/core'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; /** * Transforms any user ID into the users display name. * * @example * <div *ngFor="let id of userIds | DisplayName">...</div> */ @Pipe({ na...
d404b3752e200d54a94b263349519e9cc8bf2227
TypeScript
megazazik/validate
/src/index.ts
2.734375
3
import { Result, getErrors } from './result'; export { getErrors }; export type Rule<D, R, Meta> = Meta extends undefined ? (obj: D, meta?: Meta) => R : (obj: D, meta: Meta) => R; export type RuleError<K, R extends Rule<any, any, any>> = { type: K; data: ReturnType<R>; }; export type ObjectRules<T, Meta = undef...
f3ae2836bac30288a156ce9a1ab9aad75864bb10
TypeScript
fossabot/streamdeck-events
/test/Events/Streamdeck/Sent/WillAppearEventTest.ts
2.609375
3
import 'mocha'; import { expect, use } from 'chai'; import { WillAppearEvent } from '@/Events/Streamdeck/Sent'; import { WillAppearType } from '@/StreamdeckTypes/Sent'; import jsonschema from 'chai-json-schema'; use(jsonschema); describe('WillAppearEvent test', () => { it('validates the event against the json sch...
3e13d23e6960a43ecc9886d40b29493647a5427e
TypeScript
Chortech/chortech-backend
/common/src/events/base-pulisher.ts
2.5625
3
import { Stan } from "node-nats-streaming"; import { Event } from "./base-event"; export abstract class Publisher<T extends Event> { abstract subject: T["subject"]; private client: Stan; constructor(client: Stan) { this.client = client; } publish(data: T["data"]): Promise<string> { return new Promis...
66e857b8abc322c59a5d8f91e5e972c4058013f6
TypeScript
tobidot/diffuse_light_plattformer
/src/game/RendererWebGL.ts
2.75
3
import { MapRenderer } from "./Map"; import Field from "./Field"; import Camera from "./Camera"; class RayResult { public x: number = 0; public y: number = 0; public z: number = 0; public distance: number = 0; } /* export default class RendererWebGL implements MapRenderer { private resolution_wi...
ea28a763069e1829b20cee55f4473db56b4e636d
TypeScript
ylerjen/classe84.front
/src/app/models/User.ts
3.265625
3
export enum EGender { Male = 'M', Female = 'F' } /** * A user object that describe a member person */ export class User { public id: string; public last_name: string; public maiden_name: string; public first_name: string; public gender: EGender; public birthdate: Date; public is_a...
9811b2599a79b3ba84f3f697e2e95a82df958760
TypeScript
Aslanchik/tsfiddle
/src/models/project.ts
2.84375
3
// Project Type export enum ProjectStatus { Active, Finished}; export class Project { constructor(public id:string, public title:string, public description:string, public people:number, public projectStatus:ProjectStatus){} }
f40bf178ec7397d0baaa5220e16ccf4f5ea6e37e
TypeScript
tk1cntt/drop-shipping-backend
/src/main/webapp/app/entities/order-history/order-history.reducer.ts
2.546875
3
import axios from 'axios'; import { ICrudGetAction, ICrudGetAllAction, ICrudPutAction, ICrudDeleteAction } from 'react-jhipster'; import { cleanEntity } from 'app/shared/util/entity-utils'; import { REQUEST, SUCCESS, FAILURE } from 'app/shared/reducers/action-type.util'; import { IOrderHistory, defaultValue } from 'a...
82ce5753fe6c355b7400ef6a8d41f5b4dc59f2ab
TypeScript
javfres/javicv
/src/ts/server.ts
2.703125
3
import http from 'http'; import express, {Application} from 'express'; import nunjucks from 'nunjucks'; import sass from 'sass'; import { CVError } from './cverror'; import inlineSVG from './inlineSVG'; /** * This is an express server to handle all the resources needed to render the pdf */ export default class Serv...
ad809abf64bf3fee784891749c7da598e2c62e56
TypeScript
cdimascio/express-openapi-validator
/src/framework/modded.express.mung.ts
2.859375
3
/* istanbul ignore file */ /** * Modification of richardschneider;s mung * https://github.com/richardschneider/express-mung * */ 'use strict'; let mung: any = {}; let faux_fin = { end: () => null }; function isScalar(v) { return typeof v !== 'object' && !Array.isArray(v); } mung.onError = (err, req, res, next)...
064a17cea424c7f1bafbc6b37da945e4f9cb613c
TypeScript
borisenki/SpaceShooterGame
/assets/Game/Player/Bullet.ts
2.546875
3
const { ccclass, property } = cc._decorator; @ccclass export default class Bullet extends cc.Component { @property(cc.Vec2) direction: cc.Vec2 = null; @property speed: number = 1000; onCollisionEnter(other) { if (this.node.parent) { this.node.parent.removeChild(this.node); ...
83f10e6f2d659f12ac0c46ab9f675239e2ad3fc4
TypeScript
sunke/codenest
/design-patterns-ts/src/visitor.ts
3.703125
4
import { PatternDemo } from "./pattern"; let name = "Visitor Design Pattern"; let description = ` Represent an operation to be performed on elements of an object structure. Visitor lets you define a new option without changing the classes of the elements on which it operates. Visitor pattern is commonly used in parse...
953e61c3f53c5c2194db16bc8ded4179b54030ca
TypeScript
cborac/node-discord
/lib/api/rateLimit/RateLimitBucket.d.ts
2.59375
3
import { Params, RequestFile, ReturnedData } from './Requests'; import { Bot } from '../../bot'; import { HttpMethod } from '../constants'; import { StatusCode, EndpointRoute } from '../endpoints'; export declare const ValidCodes: StatusCode[]; export declare class RateLimitBucket { /** * The bot instance ...
0f810ec5803734227cf23522601327df7cf72dc3
TypeScript
cdaringe/rad
/src/util/glob.ts
2.6875
3
import { fs, path } from "../3p/std.ts"; import type { WithLogger } from "../logger.ts"; import { toArray } from "./iterable.ts"; type CreatePathMatcherOpts = { root: string; pattern: string }; export const createPathMatcher = ({ root, pattern, }: CreatePathMatcherOpts) => { const isAbsolute = pattern.startsWith...
0104eddf42b15dcc38247ec971b22b5df044efbd
TypeScript
riderx/typescript-training
/src/functions/various/random.spec.ts
3.609375
4
describe('Collection Random Access', () => { it('can be used to pick random items', () => { // write a closure which accepts a collection in the 1st step // and, with no parameters, returns random item in the 2nd step // like this: randomItemFrom([1,2,3])() randomItemOnceFrom// define `randomItemFrom` funct...
41164cfc4ea54a625323ebacd8730275661aa7ff
TypeScript
whatsaaaa/ts-monorepo
/packages/types/src/type-guards.ts
3.53125
4
import { IMessage } from "./types"; /** * Check whether a given value is an array where * each member is of a specified type * * @param arr - array to check * @param check - type guard to use when evaluating each item * @public */ export function isTypedArray<T>( arr: unknown, check: (x: any) => x is T ...
3a4f91a2d6f9d25d770bc7e53e07cd58e51fb608
TypeScript
Duban-sg/prueba-test
/src/app/pipe/paginator-pipe.pipe.ts
2.53125
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'paginatorPipe' }) export class PaginatorPipePipe implements PipeTransform { transform(Students: any[], paginationIndex:number,paginationSize:number): any { let start = (paginationIndex*paginationSize); let finished = start+paginationSize;...
d516ecfe50aa78cd11de5a1b929075e1e58ceaa4
TypeScript
alexey-dc/jupyter_fourier
/src/deezer.ts
2.953125
3
// Work around Deezer CORS limitations via jsonp - see below in #jsonp let callbackIndex = 0 const assignToWindow = (key: any, value: any) => { /* Sadly, typescript requires explicitly declaring globals. https://stackoverflow.com/questions/12709074/how-do-you-explicitly-set-a-new-property-on-window-in-typescr...
2eda1a5e3a81c0cc0c2c0424396ccb54e936b3f9
TypeScript
Siteimprove/alfa
/packages/alfa-selective/test/selective.spec.ts
3.53125
4
import { test } from "@siteimprove/alfa-test"; import { Refinement } from "@siteimprove/alfa-refinement"; import { Selective } from "../src/selective"; const isFoo: Refinement<string, "foo"> = (string): string is "foo" => string === "foo"; const isBar: Refinement<string, "bar"> = (string): string is "bar" => st...
f36f86dfbff0c177b21e7e85c14547a60f3cdb7d
TypeScript
samritigupta/LeaverageTypeScript
/Classes/Prototypical_Inheritance/app.ts
3.828125
4
/* JavaScript is a bit confusing for developers experienced in class-based languages (like Java or C++), as it is dynamic and does not provide a class implementation per se (the class keyword is introduced in ES2015, but is syntactical sugar, JavaScript remains prototype-based). When it comes to inheritance, JavaScri...
9239cdae6e8d453ebc16c1981de3f9b48b6ddfe6
TypeScript
markoradu/test-app
/src/app/core/auth/auth.reducer.ts
2.90625
3
import { IAccount } from 'src/app/shared/interfaces/account.model'; import { AuthActions, AUTHENTICATE, UNAUTHENTICATE, PROTECTED_URL, } from './auth.actions'; export interface State { isAuthenticated: boolean; currentUser?: IAccount | null; protectedUrl: string | null; } const initialState: State = { ...
537d31d1630772adde43ac761b73d412cf5db17d
TypeScript
fhereduardo90/nodejs-clean-architecture
/src/application/use-cases/users/find-one-user.case.ts
2.546875
3
import { IUserRepository } from '../../contracts/repositories/user.repository' import { UserDto } from './dtos' export interface IFindOneUserCase { execute(id: string): Promise<UserDto> } export class FindOneUserCase implements IFindOneUserCase { constructor(private readonly userRepository: IUserRepository) {} ...
3f7284e801a8a49ff3f94ab6e254c4c2f89b4eb5
TypeScript
DefinitelyTyped/DefinitelyTyped
/types/memwatch-next/index.d.ts
2.65625
3
// Type definitions for memwatch-next 0.3.0 // Project: https://github.com/marcominetti/node-memwatch // Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "memwatch-next" { type EventCallback = (data: LeakInformat...
e2576a43cc10657d09af42a984be350e7c58bbb9
TypeScript
davidrensh/ng2_mycodebak
/ExStore/src/app/ce.ts
2.53125
3
import { Directive, HostListener, Input, ElementRef, OnInit, OnChanges, SimpleChanges, EventEmitter, Output } from '@angular/core'; function selectElementContents(el) { var range = document.createRange(); range.selectNodeContents(el); var sel = window.getSelection(); sel.removeAllRanges(); sel.addRange(range)...
54eaae7751bbc6feb5b5fb6c9b8fdeb30f36b027
TypeScript
neoskop/nem
/src/provider/view-directory.ts
2.703125
3
import { VIEWS } from '../tokens'; import { Provider } from '@neoskop/injector'; /** * Provide an additional view directory * @usage * ``` * * nem({ * providers: [ * viewDirectory('./views') * ] * }).bootstrap(ExampleModule).listen(8000); * * * @NemModule({ * providers: [ * viewDirectory('....
2000c74aa7170742c82e1d141b78ca7ba6819335
TypeScript
voil/github-trending-app
/platform/src/support/utils.ts
2.984375
3
import { orderBy } from "lodash"; import { RepositoryType } from "../store/repositories.reducer"; import { FiltersType } from "../store/filters.reducer"; /** * Helper function to create url filters. * @param FiltersType filters * @return String */ export function hCreateUrlFilters(filters: FiltersType): string { ...