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
399e148b72268db82d98f500ce7b4e6165fc89a1
TypeScript
JuanIPlanes/PI-Games
/PI-Videogames/api/src/ts/game_list.ts
2.65625
3
import * as express from "express" import { getGames, msg, Params } from "../functions"; const router = express.Router() // GET https://api.rawg.io/api/games // GET https://api.rawg.io/api/games?search={game} // GET https://api.rawg.io/api/genres // GET https://api.rawg.io/api/games/{id} router.get('/', async (req, re...
f29179d5e1b2974e8aca51f302b24cbea3d98cb3
TypeScript
vote-by-mail/website
/packages/client/src/lib/unstated/memoize.ts
3.109375
3
import React from 'react' // From https://stackoverflow.com/a/52645018/8930600 // eslint-disable-next-line @typescript-eslint/no-explicit-any const deepEqual = (a: any, b: any): boolean => { if (a === b) return true if (typeof a !== typeof b) return false if (a instanceof Date && b instanceof Date) return a.getT...
6ee9322d61984173c7a025370ee12abc3ebbf332
TypeScript
rdrahul/angular2-serverless-todo
/src/webtasks/add-task.ts
2.625
3
import { config } from '../common/config'; import { firebasesecret } from '../common/config-secret'; import { AddTaskCommand , Task } from '../common/model'; var request = require('request'); module.exports = function( context , callback ){ console.log("Here"); const taskurl = ` $(config.firebase.databaseURL...
bb7aa1fe9f1ddfb0ea471b6480759f0320624db0
TypeScript
XEonAX/muuri-react
/src/hooks/useData.ts
3.171875
3
import {useItemContext} from '../contexts'; import {invariant} from '../invariant'; import {useFunction} from '../utils/hooks'; // The method return by the hook. export type SetDataMethod = (data: object, options?: UseDataOptions) => void; // The options of the hook and the method. export type UseDataOptions = { /*...
8ff2f130b44f3350f91eb4ab377b8b6e3597b58c
TypeScript
tekiela/powered-up
/@powered-up/protocol/src/messages/output/mode-output.ts
2.546875
3
import {MessageType} from '../../types'; import {Message} from '../message'; export class ModeOutput extends Message { public constructor( public readonly portType: number, public readonly modeType: number, public readonly valueReportThresholdDelta: number, public readonly valueReportEnabled: boolean...
113fada27a40bdfce41273aa567631d3416c9703
TypeScript
AvalonCV/sharp-responsive-multi-image-loader
/src/index.ts
2.515625
3
import { loader } from 'webpack'; import { getOptions, interpolateName } from 'loader-utils'; import sharp from 'sharp'; interface CoreImageData { src: string; type: string; width: number; height: number; placeholder?: string; responsive_images?: { src: string; width: number; type: string; }[]; } type I...
789dc8715b54367b3a4ccf416c6a5e2d15b66ac3
TypeScript
kasbah/electron
/electron/src/design.ts
2.515625
3
import * as path from 'path' import { Crate } from './crate' import { HierarchyPass, RenameCellPass } from './passes' import { ir, YosysBackend, KicadBackend, BomBackend, MarkdownBackend } from './backend' export class Design { constructor(readonly crate: Crate, readonly ir: ir.IModule[]) {} getModul...
255a3580b5b01bfc412bef5efdd62acf2d6cda04
TypeScript
uloganathanp/multi-request
/multi-request/src/urlMapGroups.ts
2.90625
3
/* * Filename: multi-request\src\urlMapGroups.ts * Path: multi-request * Created Date: Saturday, May 1st 2021, 10:12:27 pm * Author: Uloganathan Paramasivam */ import { groupByCount } from "./groupByContent"; /** * Create map of promises based on batch size * @param urlList * @param iterator - Fun...
dbe7a2ce9a1a416ed5c1c21fcbd8c4b478b36ad6
TypeScript
Tangent128/ld43
/src/Applet/Keyboard.ts
3.3125
3
export type KeyName = "up" | "down" | "left" | "right" | "a" | "b" | "menu"; /** * A mapper from keys to game actions; * meant to be easy to swap out, so only one * of these for each "screen" or "menu" is needed. */ export interface KeyHandler { /// A key has been pressed press?(key: KeyName): void, /...
6843833762f9911944f3e8e1c93acb7609d18771
TypeScript
ngbox/translation-generator
/src/commands/json/index.ts
2.609375
3
import { Tree } from '@angular-devkit/schematics'; import path from 'path'; import { chromium } from 'playwright'; import { insertPlaceholders, replacePlaceholders, stripHtml, } from '../../utils/text-utils'; import schema from './schema.json'; export default function ({ src, to, from, left, right }: Params) { ...
001b47b4a93388bca31e3e243f29f35e57347eca
TypeScript
codestates/the-GOD-client
/modules/reducer.ts
2.53125
3
import { combineReducers } from 'redux'; import user from './user'; import auth from './auth'; import content from './content'; import comment from './comment'; import artist from './artist'; const rootReducer = combineReducers({ user, auth, content, comment, artist, }); // 루트 리듀서를 내보내주세요. export default ro...
9029fdf0aaaf611b715d7c327b5373a003d91366
TypeScript
huaweicloud/huaweicloud-sdk-nodejs-v3
/services/elb/v2/model/UpdateWhitelistRequest.ts
2.734375
3
import { UpdateWhitelistRequestBody } from './UpdateWhitelistRequestBody'; export class UpdateWhitelistRequest { private 'whitelist_id'?: string; public body?: UpdateWhitelistRequestBody; public constructor(whitelistId?: string) { this['whitelist_id'] = whitelistId; } public withWhitelist...
90f0b5615415f655f980e66255a2c1b421206de0
TypeScript
jaredfarfan/admin-lte-angular7-starter-template
/src/app/app.service.ts
2.890625
3
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; /** * This is AppService available on root module level so all the modules can access it. * * @author Pravin P Patil */ @Injectable({ providedIn: "root" }) export class AppService { ...
4dae75620cf1151c8f17d753b8f49fa2a486f0fb
TypeScript
Yesterday17/ZSlang
/src/utils/FileSystem.ts
3.109375
3
import * as fs from "fs"; import * as path from "path"; function traversal(baseDir: string, addr: string[]): void { const dir = fs.readdirSync(baseDir); for (const content of dir) { const p = path.resolve(baseDir, content); const stat = fs.statSync(p); if (stat.isFile() && p.substr(p.length - 3) === "...
0305005c5bb9158a7131bb9c358a61cdbfd46270
TypeScript
elierotenberg/otter-den
/api/src/lib/schemas/index.ts
2.65625
3
import { Static } from "@sinclair/typebox"; import Ajv from "ajv"; import addFormats from "ajv-formats"; const ajv = addFormats(new Ajv({ strict: true }), [ "date-time", "time", "date", "email", "hostname", "ipv4", "ipv6", "uri", "uri-reference", "uuid", "uri-template", "json-pointer", "relat...
34310f09ee1178b60d6daab30cf64f051dbb1f33
TypeScript
yuhj86/ionic-cli
/packages/ionic/src/commands/config/get.ts
2.59375
3
import chalk from 'chalk'; import { CommandLineInputs, CommandLineOptions } from '@ionic/cli-utils'; import { Command, CommandMetadata } from '@ionic/cli-utils/lib/command'; @CommandMetadata({ name: 'get', type: 'global', description: 'Print config values', longDescription: ` By default, this command prints p...
ffeedfd0f4702243bc94720c133a605f753efb67
TypeScript
leonardopliski/clean-ts-api
/src/data/protocols/db/account/check-account-by-email-repository.ts
2.53125
3
export interface ICheckAccountByEmailRepository { checkByEmail: (email: string) => Promise<ICheckAccountByEmailRepository.Result> } export namespace ICheckAccountByEmailRepository { export type Result = boolean }
d62246ba13ad27214e553ac0cbd02ec52e6f2128
TypeScript
jianxinWan/rainbow
/examples-webgl/indexedDB/indexedDB.ts
2.84375
3
export class DB { public db!: IDBDatabase constructor(public indexedDBData: { dataBaseName: string, objectStore: string, keyPath: string, indexKeys: Array<string>, version?: number }) { this._init() } /** * 初始化 */ _init() { let request = this._open() request.onerror = (err) => { cons...
edc0e69e2b38f3d3e1a99d9afc5010684349216e
TypeScript
influxdata/ui
/src/utils/fast.test.ts
3.234375
3
import {range} from 'lodash' import {fastFilter, fastMap, fastReduce} from './fast' describe('fast', () => { describe('reduce', () => { it('should return initial value for empty array', () => { const initialValue = {} expect(fastReduce([], jest.fn(), initialValue)).toBe(initialValue) }) it('...
d49c8e7c04e0b898a45cff76f6bbea021b7907f6
TypeScript
LiviaLavy/Spring-Domina_Front-End
/src/app/models/consommation.ts
2.71875
3
import { Installation } from './installation'; import { Piece } from './piece'; export class Consommation { idConsommateur: number; fournisseur: string; type: string; instal: Installation; piece: Piece; constructor(idConsommateur: number, fournisseur: string, type: string, instal: Installation,...
deb8eb28257ac55217c830ca2b57e327f1886505
TypeScript
PiNengShaoNian/cracking-the-coding-interview
/src/chapter-2-linked-lists/__test__/2-8.loop-detection.test.ts
2.9375
3
import buildLinkedList from '../../util/buildLinkedList' import { findListNodeByVal } from '../../util/findListNode' import { cycleEnterPoint } from '../2-8.loop-detection' test('能找到环的入口', () => { const head = buildLinkedList(['a', 'b', 'c', 'd', 'e']) const nodeE = findListNodeByVal(head, 'e')! const nodeC = f...
71a159dd9fff8bd2675e37efe06dac8c5a5dad66
TypeScript
Voxelum/x-minecraft-launcher
/xmcl-keystone-ui/src/composables/dialog.ts
2.515625
3
import { computed, InjectionKey, provide, Ref, ref } from 'vue' import { injection } from '@/util/inject' import { useBroadcastChannel } from './broadcastChannel' export const kDialogModel: InjectionKey<DialogModel> = Symbol('ShowingDialog') export function useZipFilter() { const { t } = useI18n() const zipFilte...
651262091e1aa66f22ded0872350f538b9bf0d4f
TypeScript
pucelle/flit-ui
/src/bindings/tooltip.ts
2.90625
3
import {getMainAlignDirection, ensureWindowLoaded, AlignOptions, isVisibleInViewport} from '@pucelle/ff' import {html, defineBinding, BindingResult, TemplateResult, UpdatableOptions} from '@pucelle/flit' import {PopupBinding, PopupOptions} from './popup' import {TooltipType} from '../components/tooltip' export interf...
ce903549cd1fc58451a62ef27ae8cf3d83ceabb1
TypeScript
yorek/azure-event-hubs-node
/client/lib/rhea-promise/index.ts
2.609375
3
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. import * as rhea from "rhea"; import * as debugModule from "debug"; import { AmqpMessage } from ".."; const debug = debugModule("rhea-promise"); /** * Establis...
0d51bcca03ae437d3ab9a2f6fa1647118e3bd425
TypeScript
anderson178/otus-learning
/src/lesson2/engine.ts
3
3
import { ParsedLineType } from "./parser"; import { isNumber } from "./helpers"; import { mathOperators, mathPriorities, mathOperatorsPriorities, } from "./mathOperators"; const [FIRST, SECOND, THIRD, FOURTH] = mathPriorities; export const secondPrioritiesCalc = (stack: ParsedLineType): ParsedLineType => stac...
c84d77e915c91c40789d4a74d97f25aefea03ff0
TypeScript
VincentCharpentier/MiniRPG
/src/scripts/Models/Entities/Buildings/Wall.ts
2.65625
3
class Wall extends BuildObject { constructor(x: number, y: number) { super(x, y, GAME_OBJECT_TYPE.WALL); } }
59d5fd65442e81ae98384c442adc79926eb40d82
TypeScript
sciencesakura/react-redux-tutorials
/5-redux-react/src/actions/userActions.ts
2.8125
3
import { User } from "../domains"; export interface FetchUserAction { type: "FETCH_USER"; } export interface FetchUserFulfilledAction { type: "FETCH_USER_FULFILLED"; payload: User; } export interface FetchUserRejectedAction { type: "FETCH_USER_REJECTED"; payload: Error; } export interface SetUserNameActio...
5b14d9f8c9eb794e6f9f573f0c7e8bb5b64c587f
TypeScript
Kadsuke/passerelle
/src/main/webapp/app/entities/gestioneau/mode-evac-excreta/mode-evac-excreta.model.ts
2.75
3
export interface IModeEvacExcreta { id?: number; libelle?: string; } export class ModeEvacExcreta implements IModeEvacExcreta { constructor(public id?: number, public libelle?: string) {} } export function getModeEvacExcretaIdentifier(modeEvacExcreta: IModeEvacExcreta): number | undefined { return modeEvacExc...
5cd934e6312eb0659d8485cd88a1703f2d3d2b7c
TypeScript
felangel/Dart-Code
/src/extension/providers/ignore_lint_code_action_provider.ts
2.609375
3
import { CancellationToken, CodeAction, CodeActionContext, CodeActionKind, CodeActionProviderMetadata, Diagnostic, DiagnosticSeverity, DocumentSelector, Range, Selection, TextDocument, WorkspaceEdit } from "vscode"; import { config } from "../config"; import { isAnalyzableAndInWorkspace } from "../utils"; import { Dart...
870b24ff018e5d681b8f38417a8caa499454afec
TypeScript
SuNR0N/crud-angular-demo-app
/src/app/services/profile.service.spec.ts
2.71875
3
import { IProfileDTO } from '../interfaces/dtos/ProfileDTO'; import { ProfileService } from './profile.service'; describe('ProfileService', () => { const profileMock = {} as IProfileDTO; let profileService: ProfileService; beforeEach(() => { profileService = new ProfileService(); }); describe('getProfi...
59eeb3f584d964fb2107b15fc4d02c40de8f31cb
TypeScript
kjgarza/citation-model
/src/package.ts
2.890625
3
import * as fs from "fs"; import * as yaml from "js-yaml"; class Package{ data: any; constructor(type?: string) { switch (type) { case "ruby": this.data = yaml.load(fs.readFileSync("./CITATION.cff", "utf8")); break; case "python": break; case "node": this.dat...
b5ed23dd57010006a62d345e22d31648a0fe48d9
TypeScript
GrubbyHunter/LeetCode
/Array/双指针/1004.最大连续-1-的个数-iii.ts
3.875
4
/* * @lc app=leetcode.cn id=1004 lang=typescript * * [1004] 最大连续1的个数 III */ // @lc code=start function longestOnes(nums: number[], k: number): number { let startIndex = 0 let endIndex = 0 let max = 0 // 使用双指针遍历 for (; endIndex < nums.length; endIndex++) { // 右指针为0 if (nums[endIndex]...
5f79dad05ebfeee50381ea6df96420c560597019
TypeScript
Olian04/ChatFlux
/tests/integration/database.test.ts
2.609375
3
import { describe, it } from 'mocha'; import { expect } from 'chai'; import { ChatFlux } from '../../src/api'; import { CountAction, CountState } from '../util/countTypes'; import { createDB } from '../util/inMemoryDatabase'; import { renderer } from '../util/countRenderer'; import { reducer } from '../util/countReduce...
4286662c86751dd77565e854c6bdf443a8cb079b
TypeScript
ciklum-digital/xmess
/packages/core/src/classes/hook.class.spec.ts
2.703125
3
import { Hook } from './hook.class'; describe('[Hook]', () => { let hook: Hook; let subscriber; beforeEach(() => { hook = new Hook(); subscriber = jest.fn(); }); describe('public subscribe(subscriber: IHookSubscriber): void', () => { it('should add subscriber to "subscribers" array', () => { ...
17d23419cd64132d1a8450bdc7412c957660a383
TypeScript
Exac/project36
/src/js/eng/Sprite.spec.ts
2.515625
3
import { assert } from "chai"; import { expect } from "chai"; import Sprite from "./Sprite"; describe("Sprite", () => { describe("#loaded", () => { it("is a boolean", () => { const s: Sprite = new Sprite(); /* tslint:disable:no-string-literal */ expect(s["loaded"]).to.be.a("boolean"); /* ...
64da9f1ad9189481df64202348029ae8710613c6
TypeScript
software-developer-org/ng-rxjs-xstate-demo
/src/app/examples/reactive-programming/reactive-programming.component.ts
2.53125
3
import { Component, OnInit } from '@angular/core'; import { combineLatest, Subject } from 'rxjs'; import { map } from 'rxjs/operators'; import { ExampleService, Exec } from '../example.service'; @Component({ selector: 'reactive-programming', templateUrl: './reactive-programming.component.html', styleUrls: ['./re...
2d0d5df83c5c177373453af1c86688aecf7b08f0
TypeScript
mastermunj/khoj
/src/types.ts
2.75
3
export interface AnyObject { // eslint-disable-next-line @typescript-eslint/no-explicit-any [property: string]: any; } export type FilterConfig = { type: string; } & AnyObject; export type TokenizerConfig = { type: string; } & AnyObject; export type AnalyzerConfig = { type: string; tokenizer?: TokenizerC...
4ae2bfcbe4c05302c65bd35330086cdfd9778fdc
TypeScript
AtsukiImamura/blackjack-simulator
/src/background/options/policies/betting/MiniStairsMethod.ts
2.953125
3
import BettingPolicy, { GameResult } from "./BettingPolicy"; export default class MiniStairsMethod extends BettingPolicy { public calcNextBet(): number { let nextBet = 0; switch (this._gameResult) { case GameResult.WIN: nextBet = this._unitAmount * Math.min(Math.flo...
207c3682e914c5ce76185218fda528151fd59945
TypeScript
AolinHaHa/CSC436---HW3
/src/app/patient.model.ts
2.515625
3
export class Patient { emailAddress: string; profileImage: string; doctorName: string; FName: string; LName: string; constructor(FName: string, LName: string, emailAddress: string, profileImage: string, doctorName: string) { this.emailAddress = emailAddress; this.profileImage = profileImage; th...
4b2ccba2e38e53fdd8c3ed455dedee297712e3fb
TypeScript
qdubious/yata
/todo/src/app/shared/todo.service.ts
2.671875
3
import { Injectable } from '@angular/core'; import { AsyncLocalStorage } from 'angular-async-local-storage'; import { Todo } from './model.types'; import * as Q from 'q'; export const KEY_TODOS = 'todos.list'; @Injectable() export class TodoService { todos: Todo[] = []; constructor(private localStorage: AsyncLo...
4a6a3e05cec22549feb0d715d65b8b934e15363f
TypeScript
keen/keen
/packages/react-hooks/src/hooks/use-scroll-overflow-handler/use-scroll-overflow-handler.ts
2.9375
3
import React, { useCallback, useEffect, useState } from 'react'; import { getElementOffset, hasContentOverflow } from '@keen.io/charts-utils'; /** * Hook that allows to detect how referenced element overflows parent * @param containerRef: ref of element * @returns overflowRight: determines if element overflows pare...
f03885726e00802191906df79b957e914daea466
TypeScript
genrique98/AWS-Full-Stack
/api/src/handlers/orders.ts
2.796875
3
import express, { Request, Response } from 'express' import { Order, OrderStore } from '../models/orders' import { Order_product, Order_ProductsStore } from '../models/order_products' import jwt, { Secret } from 'jsonwebtoken' import verifyAuthToken from '../middleware/auth' const store = new OrderStore() const orderP...
caaffc24d19fd2862af365d695a97743621a500e
TypeScript
vck3000/ProAvalon
/src/sockets/commands/mod/mgetban.ts
2.5625
3
import { Command } from '../types'; import Ban from '../../../models/ban'; import moment from 'moment'; export const mgetban: Command = { command: 'mgetban', help: '/mgetban <username>: Find the players latest active ban that would be undone by /munban.', run: async (args, senderSocket) => { if (!args[1]) { ...
72e25812659dbae13608b2226458d0840bf3f61d
TypeScript
hongaar/bandersnatch
/tests/unit/utils.spec.ts
2.921875
3
import { isPromise } from "../../src/index.js"; test("isPromise should return true for promises", () => { expect(isPromise(Promise.resolve())).toBe(true); const rejected = Promise.reject(); expect(isPromise(rejected)).toBe(true); expect(isPromise(new Promise(() => {}))).toBe(true); // Cleanup rejected.catc...
986f6db497a8865f064505536baefa5b85f63587
TypeScript
kpagan/phaser3-typescript-template
/src/scenes/HelloWorldScene.ts
2.515625
3
import Phaser from 'phaser' import BouncingLogo from './BouncingLogo' enum ImageNames { Sky = 'sky', Logo = 'logo', RedParticle = 'red_particle' } export default class HelloWorldScene extends Phaser.Scene { constructor() { super('hello-world') } preload() { this.load.setBaseUR...
d9bcde413f557b18c0d4a6d537456c4be7082e40
TypeScript
strawberrysunset/SpaceXViewer
/src/utils/sortArray.ts
3.828125
4
export interface Props<T> { array: T[] | undefined // Array that will be sorted. direction: 'ascending' | 'descending' // Sorting direction. statePick(value: T): number // Function for picking state which will be compared. } export function sortArray<T>({ array = [], direction, statePick }: Props<T>) { return ...
cb9dbb8310bd26a068cc74ebf98a9c3fce168565
TypeScript
daylonsc/crud-pessoas-ui
/src/app/department/department-data.service.ts
2.59375
3
import { Injectable } from '@angular/core'; @Injectable({ providedIn: 'root', }) export class DepartmentDataService { departments: any[]; constructor() { this.departments = [ { Id: 1, Name: ".net", Description: ".Net" }, { Id: 2, Name: "HR", Description: "HR" }, ...
3cdf2f62f5dbaa60a68404c25a0eeed8f6a11b11
TypeScript
NathanKun/my-screeps-ts-scripts
/src/roles/Harvester.ts
2.53125
3
import { FindSourceUtil } from "utils/FindSourceUtil"; import { BaseCreep } from "./BaseCreep"; export class Harvester extends BaseCreep { public hasHostile: boolean = false; public roomLinks: RoomLinks[]; constructor(creep: Creep, hasHostile: boolean, roomLinks: RoomLinks[]) { super(creep); this.hasHos...
c190fb6c732a2749ff1a816d0ced5abd67b9847d
TypeScript
fpagliar/Finance-Webapp
/website/typescript/Authenticator.ts
2.640625
3
/// <reference path="typings/jquery.d.ts" /> /// <reference path="UserManager.ts" /> class Authenticator { private static userPool : UserManager = UserManager.build(); public static signIn = (username: string, password: string, newPasswordPromise: () => Promise<string>) : Promise<boolean> => { return Authent...
fa50fbd07f4bd85ca3b5f7c08600f168c8c4cbed
TypeScript
dasnonap/Cars
/src/entities/car-type/car-type.service.ts
2.6875
3
import { Injectable, ConflictException } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Type_of_car } from './car-type.entity'; import { Repository } from 'typeorm'; import { CarTypeModel } from 'src/DTO/carType.model'; @Injectable() export class CarTypeService { constructor( ...
4aca54f21fd506fd7fb083d5c39ce3d497066160
TypeScript
Hermicks/angular-test-demo
/src/app/basics/string/string.ts
2.578125
3
// Exportamos la función para poder usarla en otros componentes, como por ejemplo en su spec export function message(nombre: string): string { return `Saludos ${ nombre }!!!!`; }
ac15945ffda9e1639697dd6ea7f74b68f4070c61
TypeScript
Solotzy/koa-demo
/src/storge/entity/User.ts
2.875
3
import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm'; /** * 数据库的用户模型 */ @Entity('user') export class User { @PrimaryGeneratedColumn() id: number | undefined; /** * 姓名 */ @Column('varchar', { length: 50 }) name: string | undefined; /** * 年龄 */ @Column('int...
7851c68855700b46f1d848667504b2f498a7903c
TypeScript
simoneromano96/thunder-server
/src/graphql/order/api.ts
2.609375
3
import { Order, OrderInfo } from "@prisma/client" import prisma from "../../utils/db" import { getFileUrl, IUpload, saveBase64Image, saveImage } from "../../utils/file" import { ChangeTypes } from "./types" type OrderWithInfo = Order & { orderInfoList: OrderInfo[] } /** * Gets the order, throws if not found * @pa...
cfadc236dc1fb792a5e9283039ae954bbb7af05d
TypeScript
aayalacdv/MINIMOEA
/backend/src/models/user.model.ts
2.828125
3
import { Document, Schema, model } from "mongoose"; import log from "../logging/logger"; import bcrypt from "bcrypt"; import config from "config"; export interface IUser extends Document { username: string; password: string; email: string; createdAt : Date; updatedAt : Date; comparePasswords(candidatePas...
a26979cb06896a55485ac8f76f10c32f2160ad38
TypeScript
thatcosmonaut/love-typescript-definitions
/include/modules/data/enums/HashFunction.d.ts
2.734375
3
/** * Hash algorithm of love.data.hash. * @link [HashFunction](https://love2d.org/wiki/HashFunction) * @since 11.0 */ declare type HashFunction = "md5" | "sha1" | "sha224" | "sha256" | "sha384" | "sha512";
c6a1954d24238f3bd3da9bd9b831fb86178608e5
TypeScript
RealShadowNova/framework
/src/optional-listeners/message-command-listeners/CorePreMessageCommandRun.ts
2.625
3
import { Listener } from '../../lib/structures/Listener'; import { Events, type PreMessageCommandRunPayload } from '../../lib/types/Events'; export class CoreListener extends Listener<typeof Events.PreMessageCommandRun> { public constructor(context: Listener.Context) { super(context, { event: Events.PreMessageComma...
3f164a67dda1339d90257a51751664ab5f0725a6
TypeScript
tvedtorama/restdbNative
/app/reducers/tasks.ts
2.71875
3
import * as _ from 'lodash' import {ITask} from '../IState' import {ADD_TASK, SET_TASK_COMPLETION, DELETE_TASK} from '../sagas/mainLoop' export function tasks(state: ITask[] = [], action: {type: string}) { if (action.type === ADD_TASK) { const {task} = <{task: {text: string, taskId: string, isDone: boolean}}><any>...
8f2d7183bef25f8253aba8d429bc6438eceeb57c
TypeScript
ioaur/ugram-web-2
/frontend/src/reducers/notificationsReducer.ts
2.796875
3
import { Reducer } from "redux"; import { NotificationLevel } from "../common/notifications"; import { NOTIFICATIONS } from "../actions/notifications"; import { BaseAction } from "../common"; export type NotificationsState = Readonly<{ message: string; level: NotificationLevel; display: boolean; }>; const...
a90a934feb89091c145012c15bbed8c92c73e6bb
TypeScript
tepandey/week-1-react
/day-3/app_sunny.ts
3.34375
3
const SUNNY_DAY_MESSAGE: string = "It is sunny ou today"; let isSuny: boolean = true; let numberSunnyDays: number =1; function sunnyDayMessage(isSunny:boolean, numberSunnyDays:number):string { let i:string = "sunny"; if (isSunny==false) { i = "cloudy"; } return `Hi! It is ${i} Today. It has been ${i} for ...
2283c9313532dba9e5d005b37c1ef72e1aa18627
TypeScript
maggie-x/rxjs-tslint-rules
/source/rules/rxjsNoUnsafeScopeRule.ts
2.65625
3
/** * @license Use of this source code is governed by an MIT-style license that * can be found in the LICENSE file at https://github.com/cartant/rxjs-tslint-rules */ /*tslint:disable:no-use-before-declare*/ import * as Lint from "tslint"; import * as ts from "typescript"; import * as tsutils from "tsutils"; import ...
e81e0df1fd46f5230682145e9b261b4cc435646e
TypeScript
mbrowne/typescript-dci
/src/compiler/syntax/textSpanWalker.ts
2.796875
3
///<reference path='references.ts' /> module TypeScript { class TextSpanWalker extends SyntaxWalker { private _position: number = 0; constructor(private textSpan: TextSpan) { super(); } public visitToken(token: ISyntaxToken): void { this._positio...
e426ccabf52f984ec1cb162bf8b71969a8be971c
TypeScript
lKaisal/nuxtjs-blank
/plugins/filters.ts
2.625
3
function normalizePrice(price: number) { const priceStr = String(price).split('') as any[] priceStr.splice(-3, 0, '&nbsp;') const priceFinal = priceStr.join('') return `₽&nbsp;${priceFinal}` } export { normalizePrice }
bc4e97310c533439929b6e186ca9781a3f7187fc
TypeScript
fengzhicool163/Sibo
/src/gameSrc/objects/PlayerObject.ts
2.8125
3
module game.objs { import GamePlayerStage = gameenum.GamePlayerStage; import PlayerAllowActions = gameenum.PlayerAllowActions; /** 游戏玩家对象 */ export class PlayerObject extends GameObject { /** 服务器玩家阶段与本地玩家状态映射 */ private static playerSeverStageMap = { JOIN: GamePlayerSt...
48737dbc63b57c150d292dfd60d464d49ec143f9
TypeScript
adela05/MovieFav
/src/app/movie.service.ts
2.75
3
import { Injectable } from '@angular/core'; export class Movie { // Setting my properties title: string; descript: string; imgUrl: string; constructor(title: string, descript: string, imgUrl: string) { this.title = title; this.descript = descript; this.imgUrl = imgUrl; } } @Injectable({ providedIn: 'root...
38544dd1960386a0839c6e293ad880614ffa0044
TypeScript
alexvcasillas/graphdb
/src/utils/empty-object.ts
2.578125
3
export const isEmptyObject = (obj: object) => Object.entries(obj).length === 0 && obj.constructor === Object;
7559491a46f5652dedc9aec8a1a5f41170cb0b85
TypeScript
gualtierim/dickbott
/scripts/slack/Types.ts
2.65625
3
export interface PostMessageRequest extends SlackMessage { /** * You can either pass the channel's name (#mururoa) or encoded ID (C024BE91L), and the message will be posted to that channel. */ channel?: string; /** * Text of the message to send. This field is usually required, unless you're p...
a7c747fdd9bd355c47e3e9316df9fa7446a6b110
TypeScript
SamKirkland/noa
/src/lib/entities.ts
2.71875
3
import vec3 from 'gl-vec3' import EntComp from 'ent-comp' import { updatePositionExtents } from '../components/position' import { setPhysicsFromPosition } from '../components/physics' import Engine from ".." import { inherits } from "util" export interface IEntitiesOptions { shadowDistance: number; } const entit...
b4428bb1d86e4dfd6f01b2bb567b3d227f97bc86
TypeScript
HonoluluHenk/ngx-json-datetime-interceptor
/projects/ngx-json-datetime-interceptor/src/lib/ngx-json-datetime-interceptor.ts
2.6875
3
import {HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http'; import {Injectable, Optional} from '@angular/core'; import cloneDeepWith from 'lodash/cloneDeepWith'; import {Observable} from 'rxjs'; import {map} from 'rxjs/operators'; // noinspection MagicNumberJS const MINUTE_...
0673b616da8788ad1c7b371e825f36b74057d982
TypeScript
allenchengwork/test_project
/nail-admin-angular2/angular-src/app/interceptor/server-url-interceptor.class.ts
2.8125
3
import { Interceptor, InterceptedRequest, InterceptedResponse } from 'ng2-interceptors'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/throw'; import 'rxjs/add/operator/catch'; export class ServerURLInterceptor implements Interceptor { public interceptBefore(request: InterceptedRequest...
ab060700a2497e3fbde107cc4fa976f4ffa16ecc
TypeScript
cgatno/ts-type-predicate-example
/instanceOf.ts
3.75
4
/** * Type predicate to validate an input object `input` against a specific type definition `T` using * a descriptor. IMPORTANT: note caveats outlined in readme and instanceOf.test.ts. * See https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates. * * @template T The type to validate ag...
4bba0f65601cb77e04cd7a0feea463bcdddbb765
TypeScript
chaojituolu/-Ts-
/src_空/06_泛型/test1.ts
2.875
3
/* 泛型: 指在定义函数、接口或类的时候,不预先指定具体的类型,而在使用的时候再指定具体类型的一种特性。 */ (() => { })()
62b8e4f4c2995969ee4a953528c33056fdc08143
TypeScript
vector-js/vector
/source/examples/math/triangle-area-between-two-vectors.ts
3.171875
3
/** * @title Area Between Two Vectors * @description This interactive demonstrates the area formed between two vectors. * @tags [math] */ // import Interactive from 'https://unpkg.com/@interactive-svg/library/dist/Interactive.js'; import {Interactive} from '../../index.js'; export default function main(id:string){ /...
02b1ac0d6298a7121a321a1a63f950a497e1faca
TypeScript
ar1a/whatsapp-2
/types/types.ts
2.53125
3
import firebase from "firebase/app"; type FieldValue = firebase.firestore.FieldValue; export type Timestamp = firebase.firestore.Timestamp; export interface User<MODE extends "create" | "read"> extends firebase.User { lastSeen: MODE extends "create" ? FieldValue : Timestamp; } export interface Chat<MODE extends "c...
cc2fc47244f2d51b3c3d56569887e400862c1f01
TypeScript
MartinPavlik/ramda-async
/index.ts
3.046875
3
import { map, curry } from 'ramda' /** * Performs left-to-right function composition and automatically lifts the initial value to a promise. */ function pipeAsync<A, B, C>( ab: (a: A) => B | Promise<B>, ): (a: A) => Promise<B>; function pipeAsync<A, B, C>( ab: (a: A) => B | Promise<B>, bc: (b: B) => C | Promis...
e5500c816e8a6d28fee0614dbe3c86fb59d8a9ae
TypeScript
thepercival/superelf
/src/app/lib/gameRound.ts
2.703125
3
import { AgainstGame, Period } from 'ngx-sport'; import { ViewPeriod } from './period/view'; export class GameRound { protected againstGames: AgainstGame[] | undefined; protected period: Period|undefined; constructor(protected viewPeriod: ViewPeriod, protected number: number) { viewPeriod.getGameR...
b44e1e1364ef376c029cc497d83d08c60bbe6e53
TypeScript
tadashibashi/canvas-engine
/src/engine/timers/Timer.ts
3.34375
3
import { Component } from "../Component"; import { Delegate } from "../utility/Delegate"; import { GameTime } from "../GameTime"; export class Timer extends Component { /** * Whether or not this timer is counting in seconds or ticks. Set during construction. * TRUE: seconds, FALSE: ticks. */ rea...
ab34d7f3ef8ffa282e8afdf3bc7dd1f24961725d
TypeScript
openforge/openfarm-puzzle-game
/libs/shared/data-access-model/src/lib/primordials/stat/stat.class.ts
3.453125
3
/* eslint-disable @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-unsafe-argument */ import { FinalBonus } from './finalbonus/final-bonus.class'; import { RawBonus } from './rawbonus/raw-bonus.class'; import { BaseStat } from './stat.base.class'; /** * * Represents a generic Stat which is equ...
0fe477ade2f33ba24cd7fb9aff3a8b43f09c8362
TypeScript
cborac/node-discord
/src/controllers/channel/ChannelMessagesController.ts
3.203125
3
import Collection from '../../Collection'; import { TextBasedChannel } from '../../structures/channels'; import { Message } from '../../structures/message'; import { Snowflake } from '../../types'; import { BaseDeleteController, BaseFetchController, BaseFetchSomeController } from '../base'; /** * Options for when fet...
4328f1a9a88a6f9f150686365a72b8dfc81ea35f
TypeScript
witarsana/zoobc-wallet-web
/src/helpers/node-list.ts
2.5625
3
export interface NodeList { node: Node[]; timestamp: number; } export interface Node { ip: string; name: string; default: boolean; }
fff5772a1788a8198f716171029e8e068387b8d3
TypeScript
alexziskind1/tnsscratch
/reduxtodo/app/main-page.ts
2.578125
3
import redux = require("redux"); const createStore = redux.createStore; import {Page, Label, ListView, Switch, TextView, StackLayout} from "ui"; import dialogs = require("ui/dialogs"); import {EventData, PropertyChangeData, Observable} from "data/observable"; import {ObservableArray} from "data/observable-array"; ...
fb62a216f3da8dfd0820dbe07256738c053f3fa9
TypeScript
cleverson85/fruits-basket-frontend
/src/app/providers/common/toaster.service.ts
2.53125
3
import { Injectable } from '@angular/core'; import { ToastrService, IndividualConfig } from 'ngx-toastr'; enum Type { error = 'toast-error', info = 'toast-info', success = 'toast-success', warning = 'toast-warning', } @Injectable({ providedIn: 'root' }) export class ToasterService { options: IndividualCo...
e9db37e46a8dccef59d4effd114c6a2725a8586f
TypeScript
litert/molo.js
/src/lib/_internal/ClassManager.ts
2.53125
3
/** * Copyright 2021 Angus.Fenying <fenying@litert.org> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
8393b5225c79d5a226db96feb180ecdd6fd45205
TypeScript
arsdu24/readcast-test-task
/src/actions/main.actions.ts
2.671875
3
import {Action} from "../botpress"; import {TriviaContent} from "../content"; import {MaibPkiService} from "../services/MaibPkiService"; import { CurrencyCalculatedAmountState, ExchangeRateProvidersEnum, MainActionsEnum, MainFlowNodesEnum, RateVariationState, State, TodayRateState } from "../typ...
e7044ffd8dbc5bb13b0a6455f1af863118bb8076
TypeScript
besseym/msb-web
/src/ts/msb-math/utility.ts
3.453125
3
export const TWO_PI = 2 * Math.PI; export function mathDistance(x1: number, y1: number, x2: number, y2: number){ return Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2)); } export function mathHypotenuse(a, b){ return Math.sqrt(a*a + b*b); } export function mathDegrees2radians(degrees){ return d...
699b0ad352e1773af49ae9e9fce93d21c6683651
TypeScript
ehsan2003/devcon2
/src/shared/errors/bad-request.ts
2.53125
3
import {SiteError, SiteErrorErrorType} from "@shared/errors/site-error"; import StatusCode from "status-code-enum"; export class BadRequestError extends SiteError { readonly status = StatusCode.ClientErrorBadRequest; constructor(code: string, msg: string = 'some of the request failed are invalid or not exists...
ff6cd9201e51d392aa5483f5d774dbd13decce61
TypeScript
schmod/cxml
/src/xml/MemberRef.ts
2.703125
3
// This file is part of cxml, copyright (c) 2016 BusFaster Ltd. // Released under the MIT license, see LICENSE. import {Namespace} from './Namespace'; import {MemberSpec} from './MemberSpec'; /** Tuple: member ID, flags, name */ export type RawRefSpec = [ number | MemberSpec, number, string ]; export const enum Memb...
1ee9c431e24fd1623f79ab374097985fbd177e1d
TypeScript
samelhusseini/pxt-adafruit-halloween
/neopixel.ts
2.71875
3
namespace light { export class RandomAnimation extends light.NeoPixelAnimation { public rgb: number; public delay: number; private i: number; private reveal: boolean; constructor(rgb: number, delay: number) { super(); this.rgb = rgb; th...
654a74f7dea23531e78ed19be828a94fc7392877
TypeScript
vvzorichev/safecloud-frontend-ts
/src/app/my-cloud-page/main-block/toolbar/upload-menu/duck/upload-status-reducer.ts
2.921875
3
import { IAction, IUploadStatus, Types } from "./i-upload-status"; const initialState: IUploadStatus = { isUpload: false }; const uploadStatusReducer = (state = initialState, action: IAction): IUploadStatus => { switch (action.type) { case Types.UPLOAD_START: return { isUpload: true }; case Typ...
df35a948126aae378603e93e0e8c91fd23df3311
TypeScript
Pieter2406/dndidentity
/public/src/store/CharacterStore.ts
2.515625
3
import axios from 'axios'; import { ActionTree, GetterTree, Module, MutationTree } from 'vuex'; import { ICharacterState, IRootState } from './contract'; const characterState: ICharacterState = { activeCharacter: null, characters: [], }; const mutations: MutationTree<ICharacterState> = { charactersFetched(stat...
3cbe3ec8b7a6ce3fe9c32681363cc397a1f97fd9
TypeScript
AntonioBaciu/solid_D
/Classes/Stove.ts
3.25
3
import { Appliance } from "../Interfaces/Appliance"; export class Stove implements Appliance { _isOn!: boolean; public turnOn(): void { setTimeout(function () { document.getElementById("target")!.innerHTML += "<p>" + new Date().getHours() + ":" + new Date().getMinutes() +...
32372cb5631864d474f933f408840088c988b4c6
TypeScript
uzdry/Vinjab
/src/tsnode/settings/TSettings.ts
2.75
3
/// <reference path="../../../typings/postal/postal.d.ts"/> /// <reference path="./Renderer.ts"/> /// <reference path="./../parkingsensor/Communicator.ts"/> /// <reference path="./SettingsData.ts"/> /// <reference path="./CompositeStructure.ts"/> /// <reference path="../messages.b.ts" /> /** * @author: David G. */...
f470eddc500ecf450f7de67b7003e821c576e7e7
TypeScript
kjar3/photo_gallery
/app/gallery/services/gallery-image.service.ts
2.515625
3
import { Injectable } from '@angular/core'; export interface Image { title: string; url: string; } @Injectable() export class GalleryImageService { images: {}; constructor() { this.images = { 1: [ { "title": "A1", "url": "gallery_images/A1.jpg" }, { "title": "A2", "url": "gallery_images/A2.jpg" },...
d32b9421de244d98aa4698683b4f5fe0acad7976
TypeScript
TedDriggs/ginscorer
/src/components/util/Ref.ts
2.75
3
import { RefObject } from 'react'; export const focusRef = (ref: RefObject<{ focus(): void }>): void => { ref.current?.focus(); }; export const refChildHasFocus = (ref: RefObject<HTMLElement>) => (): boolean => ref.current?.contains(document.activeElement) ?? false; export const mapRef = <T, U>(ref: RefObjec...
00cf9c959e07ada97e5416b7b6bd49c1bcef5f76
TypeScript
danielegarciav/flatbed
/src/serialized-types.ts
3.1875
3
import type { ObjRef } from './obj-repo'; import { AnyObj, isObject, Primitive } from './js-types'; /** * A reference to an object whose children referred to before it finishing serializing. * Resolved after all objects have been added to the flat repository. */ export interface CircularRef { __cref: AnyObj; } /...
96f6c60ec8b676bfb3a62632fd89e9322456b47e
TypeScript
devdoshi/parser
/src/interpreter/profile-io-analyzer.ts
2.65625
3
import { DocumentedNode, EnumDefinitionNode, EnumValueNode, FieldDefinitionNode, isNamedFieldDefinitionNode, isNamedModelDefinitionNode, isUseCaseDefinitionNode, ListDefinitionNode, ModelTypeNameNode, NamedFieldDefinitionNode, NamedModelDefinitionNode, NonNullDefinitionNode, ObjectDefinitionNo...
0c7a0ae3ed42c59271d354f6a0068fbd3b6d5aff
TypeScript
GolderBrother/learn-and-collect
/angular-tutorial/2019-01-15枚举及元组及angular脚手架搭建/ts/demo2.ts
4.15625
4
window.onload = function(){ //构造函数 ES5 function Cat(name,color) { this.name=name; this.color=color; //this.type='动物'; // this.eat = function(){ // console.log('吃老鼠') // } } //原型中 Cat.prototype.type='动物'; Cat.prototype.eat = function(){ ...
c3ce8f9667ad494616fe99e23d0b6aeb6e5a321d
TypeScript
Eonasdan/tempus-dominus
/types/utilities/errors.d.ts
3.109375
3
export declare class TdError extends Error { code: number; } export declare class ErrorMessages { private base; /** * Throws an error indicating that a key in the options object is invalid. * @param optionName */ unexpectedOption(optionName: string): void; /** * Throws an error indicating that one...
e85caeffb268442d7e5413ef2ab8b59f0a1fdcea
TypeScript
fabioceolin/dockerControl
/src/services/hooks/useContainers.ts
2.59375
3
import { useQuery } from "react-query"; import { api } from "../api"; type Ports = { PrivatePort: number; Type: String; }; type Containers = { Id: string; Names: Array<string>; Image: string; State: string; Status: string; Ports: Array<Ports>; }; export async function getContainers(): Promise<Contain...
a8aac7c302b8d3a6029d09b4e5e91b5c98868bcc
TypeScript
mk422756/recoil_test
/store/store.ts
2.65625
3
import {atom, selector, DefaultValue} from 'recoil' const localStorageEffect = (key) => ({setSelf, onSet}) => { if (typeof window === 'undefined') { return } const savedValue = localStorage.getItem(key) if (savedValue != null) { setSelf(JSON.parse(savedValue)) } onSet((newValue) => { if (newVa...
907ff087b158fb6696cc4189f793a06a2e3cec4c
TypeScript
Anjali-Kumari-Dhaked/JSON-TREE
/app/validate-reactive-form/validate-reactive-form.component.ts
2.65625
3
import { Component, OnInit } from '@angular/core'; import { AbstractControl, EmailValidator, FormBuilder, FormGroup, Validators } from '@angular/forms'; @Component({ selector: 'app-validate-reactive-form', templateUrl: './validate-reactive-form.component.html', styleUrls: ['./validate-reactive-form.component.css'...