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
a0b5bf2f00aef614af26747a99e89ec9b97b86a5
TypeScript
lucsbasto/paint-calculator
/src/wall/schemas/wall.schema.ts
2.578125
3
import { Document } from 'mongoose'; import ObjectID from 'bson-objectid' import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; export interface PaintCans { '0.5L': number, '2.5L': number, '3.6L': number, '18L': number } @Schema({ timestamps: true }) export class Wall { @Prop({ type: Number, requi...
8ab093d061c7b14ff3ed9204cf5d991ee0058c71
TypeScript
LaghzaliTaha/insiders
/app/shared/forms/services/form.service.ts
2.703125
3
import { Injectable } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { InputBase } from '../models/input-base'; @Injectable() export class FormService { constructor() { } toFormGroup(inputs: InputBase<any>[] ) { let group: any = {}; inputs...
6d009e251c7dd97385cbf8937fa6488da3e14bdd
TypeScript
dingchaolin/ts-demo-3
/class/class_static.ts
3.8125
4
/** * Created by chaolinding on 2017/10/19. */ // x** 表示x的平方 class Gird{ static origin = {x:0, y:0}; Distance(point:{x:number, y:number}){ let xDist = point.x - Gird.origin.x; let yDist = point.y - Gird.origin.y; return Math.sqrt( xDist** 2 + yDist** 2); } } let g = new Gird(); co...
a26a72c9c69e6b7f7319d722c6c0fe55be8b2b26
TypeScript
RickMu/single-page-shop
/src/common/extensions/utils/linkedlist.ts
3.375
3
import LinkedNode from "../LinkedNode"; export function constructLinkedList<T>(items: T[]): LinkedNode<T> { const head: LinkedNode<T> = { item: items[0], next: undefined, prev: undefined }; const remainedItems = items.slice(1); remainedItems.reduce((prevValue: LinkedNode<T>, currentValue: T) => {...
578c9b49f03ce198016a643dd78423e7bda67d2e
TypeScript
michaelrondon27/curso_angular_sockets
/03-socket-server-multi/classes/ticket-control.ts
2.84375
3
import { Ticket } from './ticket'; export class TicketControl { private hoy: any = new Date().getDate(); private tickets: Ticket[] = []; private ultimo: number = 0; private ultimos4: Ticket[] = []; constructor() { if (new Date().getDate() !== this.hoy) { this.reiniciarCon...
411da47fea5399c0852a86ee9e9cafc9c4868540
TypeScript
future4code/Gabriel-Mina
/semana18/semana18-projeto/src/endpoints/anotherUserProfile.ts
2.515625
3
import { Request, Response } from "express" import connection from "../connection" import { generateToken, getTokenData } from "../services/authenticator" import { compare } from "../services/hashManager" // id fo francis 15495c8f-7442-43d6-86df-c0078cb187d4 export default async function anotherUserProfile( req: ...
4f0099335f01b35f2dc0dcd72afc0da9cac9c89f
TypeScript
JohnathanMB/PruebaAccFront
/src/app/componentes/consulta/consulta.component.ts
2.625
3
import { Component, OnInit } from '@angular/core'; import { ReactiveFormsModule, FormBuilder, FormGroup, Validators, AbstractControl } from '@angular/forms'; import { ConsultaService } from '../../services/consulta/consulta.service'; @Component({ selector: 'app-consulta', templateUrl: './consulta.component.html', ...
c50dcdfafb45e8024303aea9ff7e84015c9d41cf
TypeScript
Ch4mpl00/typescript-and-express
/src/app/user/useCases/authorizeUserByEmailAndPasswordUserCase.ts
2.53125
3
import { Left, Right } from "monet" import { User } from "~/app/user/domain/entity/User" import { EmailAndPasswordDoNotMatch } from "~/app/user/domain/errors/emailAndPasswordDoNotMatch" import UserNotFoundError from "~/app/user/domain/errors/userNotFoundError" import Email from "~/app/user/domain/values/Email" import {...
cf123b8d830779de929cb7b0a93613a1d62a879e
TypeScript
arzamax/json-editor-service
/client/lib/hooks/use-click-outside.ts
2.671875
3
import React, { useEffect, useRef } from 'react'; type CbType = () => void; export const useOnClickOutside = (refs: Array<React.RefObject<HTMLElement>>, cb: CbType) => { useEffect(() => { if (refs && Array.isArray(refs) && cb) { const handleMouseDown = (e: any) => { let isTarget = false; ...
049eb6266d84ecd971e8121ce4b9bc56aca6f952
TypeScript
tiagolascasas/FEUP-ASSO
/src/view/renderer_svg.ts
2.796875
3
'use strict' import { Renderer } from './renderer' import { Shape, Rectangle, Circle, Triangle } from '../model/shape' export class SVGRenderer extends Renderer { objs = new Array<Shape>() factory = new SVGShapeRendererFactory() constructor(elementID: string) { super(elementID) this.eleme...
6cc99b785dc7cefdbb35a6bf0938bad9d9c50332
TypeScript
artnez/jsxstyle
/tests/meta.spec.ts
2.53125
3
import { getPackages } from '@lerna/project'; import fs = require('fs'); import packlist = require('npm-packlist'); import path = require('path'); // NOTE: this interface is incomplete // See: @lerna/package interface Package { name: string; location: string; private: boolean; toJSON: () => string; } const JS...
8a1e37459f86c81d678078f79e5cc7532aacc1dc
TypeScript
RoxnnyABarriosC/node-experience
/src/Shared/Presentation/Requests/Filter.ts
2.90625
3
import IFilter from './IFilter'; import { ParsedQs } from 'qs'; abstract class Filter implements IFilter { private readonly filters: Map<string, any>; constructor(query: ParsedQs) { this.filters = new Map<string, any>(); const queryFilters: any = query.filter ?? []; const defaultFi...
c7eabdfecb750f130e7b9f73191bd6f637d8bf1a
TypeScript
sheetaljadam/UserManagement
/src/app/core/services/validation.service.ts
2.625
3
import {Injectable } from '@angular/core' import { FormGroup, FormControl } from '@angular/forms'; @Injectable() export class ValidationService { //Email validation validateEmail(c: FormControl){ let EMAIL_REGEXP = /^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z...
947d5473a3369b763f42f49003ce28ee5d8fdd68
TypeScript
ImranOpenFin/layouts-service
/src/client/tabbing.ts
2.765625
3
/** * @module Tabbing */ import {Identity} from 'hadouken-js-adapter'; import {tryServiceDispatch} from './connection'; import {AddTabPayload, getId, parseIdentity, SetTabstripPayload, TabAPI, UpdateTabPropertiesPayload} from './internal'; import {ApplicationUIConfig, TabAddedPayload, TabGroupEventPayload, TabProper...
8e08aa8e3868274118844e1c8b2821e7d8421a60
TypeScript
omeralper/sdnproject
/client/src/app/swagger/AAAPROTOCOL.ts
2.53125
3
//imports start AAAPROTOCOL import {IModelDef} from "./IModelDef"; //imports end 'use strict'; /** * AAA Sunucuları tarafından desteklenen protokol tipini belirten ENUM değeri.\nDeğerler şunlardır;\n\n| Adı | Açıklama |\n|:---------|:-------------------|\n| RADIUS | RADIUS Protokolü |\n| LDAP |...
3078aa9f760520c190938b543439246637d2cf6e
TypeScript
celo-tipbot/celo-github-bot
/test/parse.test.ts
2.515625
3
import { parseGitHubComment } from '../src/parse' describe('Command parser', () => { test('parses a correct TIP command', () => { const comment = { user: { login: 'Alice123' }, body: '@celo-tipbot TIP @Bob456 10' } // @ts-ignore const command = parseGitHubComment(comment) ...
a133a53178896830b0ef5d6573c3a0d584640ff5
TypeScript
ucdavis/uccsc-mobile-functions
/functions/src/models/venue.ts
2.515625
3
export function mapVenueFromJsonApi(data) { if (!data) { return null; } const result = { title: data.title, building: data.field_venue_name, room: data.field_room_number_name, address: { street: '', city: '', state: '', ...
0bc9ac1e0deab9b814af9c2ee82186c08abb5701
TypeScript
RenateBrokelmann/b2c-api-react-example
/src/helpers/common/salutation.ts
2.640625
3
import { TSalutationVariant } from '@interfaces/customer'; import { salutationVariants } from '@constants/customer'; export const getSalutationToShow = (salutation: string): JSX.Element | string => { const salutationVariantData = salutationVariants.filter((item: TSalutationVariant) => (item.value === salutation));...
7f41dffdd929802613badfd4d967a5a1a0c04b1f
TypeScript
sanketughade/sankets-libraray-management-app
/src/app/books/books.service.ts
2.71875
3
import { EventEmitter,Injectable } from '@angular/core'; import { Book } from './books.model'; @Injectable() export class BooksService{ private books:Book[]= [ new Book(1,'Book 1','Author 1',100,'Publisher 1'), new Book(2,'Book 2','Author 2',200,'Publisher 2'...
c23773489cce1741abf860327e82ac16ac589c40
TypeScript
Eveble/typend
/src/validators/collection-including-validator.ts
2.984375
3
import { isPlainObject, get, isEmpty } from 'lodash'; import { diff } from 'deep-diff'; import { PatternValidator } from '../pattern-validator'; import { InvalidTypeError } from '../errors'; import { getResolvablePath } from '../helpers'; import { types } from '../types'; import { CollectionIncluding } from '../pattern...
bc2640a625b3c368412f233a2d1b86990ab0b435
TypeScript
Amolmore456/reactive-ng
/src/app/products/store/reducers/card.reducer.ts
2.671875
3
import * as fromCardAction from '../action/card.action'; import { Card } from '../../models/card.model'; import { reduce } from 'rxjs/operators'; export interface CardState { entities:{[id:number]:Card}, loading:boolean, loaded:boolean } export const initialState:CardState = { entities:{}, load...
478dcbaa9dfa1f7a946fc592bb58b7a1526c6122
TypeScript
gzuidhof/zarr.js
/src/nestedArray/ops.ts
3.234375
3
import { ArraySelection, SliceIndices } from '../core/types'; import { ValueError } from '../errors'; import { TypedArray, TypedArrayConstructor, NestedArrayData, NDNestedArrayData } from './types'; import { normalizeArraySelection, selectionToSliceIndices } from '../core/indexing'; /** * Digs down into the dimension...
4a9ab65b4c2b3dc065f7ae44038008d223199341
TypeScript
exaptis/ngrx-rest-app
/client/src/models/FacetModel.ts
3.015625
3
export interface IFacetModel { id: number; name: string; } export default class FacetModel implements IFacetModel { id: number; name: string; constructor(name: string) { this.id = Math.ceil(Math.random() * 100); this.name = name; } getReadableText(): string { retur...
95e63bb14b54887f8898bd50236db5b3b4ed3866
TypeScript
tswordyao/babel-plugin-define-wrap-imports
/source/index.ts
2.6875
3
import * as babel from 'babel-core'; import * as t from 'babel-types'; import { NodePath,default as traverse,} from 'babel-traverse'; const nejDefineMark = '_nej_defined_'; function addNejDefineMarkOnlyOnce(identifier){ if(!identifier.name.includes(nejDefineMark)){ identifier.name += nejDefineMark } }...
1cf42376d39b16d557f8fe4a7299ae1f4e4dcbfb
TypeScript
vercel-support/dokkie
/src/utils/assets.ts
2.515625
3
import { ISettings, IFile } from "../types"; const { readFile, writeFile, mkdir, stat } = require("fs").promises; import { join, basename, dirname } from "path"; import { download, createFolder, asyncForEach } from "./"; import * as log from "cli-block"; const downloadImage = async ( image: string, settings: ISettin...
d8fb94c4adb1707404d6ba8000fc40d1bdccf1cb
TypeScript
sangonz193/openfing-web
/src/hooks/useObservableStates.ts
2.734375
3
import { useObservableState } from "observable-hooks" import React from "react" import type { Observable } from "rxjs" export const useObservableStates = <TStore extends {}, TKeys extends keyof TStore>( store: TStore, keys: TKeys[] ): { [K in TKeys]: TStore[K] extends Observable<infer TValue> ? TValue : never } => {...
fb5e46b1d6cf98d4fd53c8b1fbae0b143b5a2ea6
TypeScript
bescione/jhipster-angular-typescript
/src/main/webapp/ts-app/app/commons/subscriptions.service.ts
2.578125
3
/** * Created by mmasuyama on 10/22/2015. */ module Onesnap { export interface IStreamService { setStream(streamKey: string, stream: any) getStream(streamKey: string) getStreams() } export class StreamsService implements IStreamService{ private streams = {}; private generalListeners =...
27a7f74433e1f4194f3f7474912c9f59c8616a07
TypeScript
Zackwn/clean-architecture-api
/src/repositories/external/mongodb/user/mongodb-user-repository.ts
2.765625
3
import { UserData } from "../../../../entities/user/user-data"; import { Either, left, right } from "../../../../shared/either"; import { UpdateUserData, UserRepository } from "../../../../usecases/ports/user-repository"; import { UserAlredyExistsError } from "../../../errors/user/user-alredy-exists"; import { UserDoNo...
900233add14785c4baeb76fb36f765baeb9ed987
TypeScript
FrederikKristensen/3Website
/src/js/index.ts
2.734375
3
import axios, { AxiosResponse, AxiosError } from "../../node_modules/axios/index" interface ICoronaTest { testId: number machineName: string temperature: number location: string date: string time: string } let baseUrl: string = "https://coronatest.azurewebsites.net/api/CoronaTests" ne...
752e49f0b1d9db2472ab0b35f6fbd7e852585678
TypeScript
lcolyott/react-hocs
/src/api/index.ts
2.90625
3
/** * Mocks an async call to inject a script * @returns string */ async function fetchScriptsAsync(): Promise<string | undefined> { var scriptToInject: string | undefined = "InjectedScript"; let promise = new Promise<string | undefined>((resolve, reject) => { setTimeout(() => { resolve(s...
e9faeda26344d006baede343ad07a8aa53307fe3
TypeScript
origin1tech/colurs
/dist/interfaces.d.ts
2.734375
3
export interface IColursChain extends IColursStyle { (): boolean; (str: any, ...args: any[]): any; } export interface IColursStyle { reset?: IColursChain; bold?: IColursChain; dim?: IColursChain; italic?: IColursChain; underline?: IColursChain; inverse?: IColursChain; hidden?: IColur...
1a6d0a8e190a7c79ddbf2301b34a88456069aaab
TypeScript
runictree/chronos
/src/Record.ts
2.703125
3
export interface Record { /** * Internal ID * * In some devices, it is Record ID, but some devices it is internal user ID * * For reliable user ID, use UserId instead */ id: number, /** * User ID * * Input via Add User in the device menu */ userId?: string, /** * Verificatio...
c9684e267ac057aa3024d1e332754bfbd8031642
TypeScript
codehub0x/TypeScript-DeFi
/src/gambling-strategies/low-brainers/momentum-trader.ts
2.53125
3
import { BinanceConnector } from "../../binance/binance-connector" import { Player } from "../utilities/player" import { PortfolioProvider } from "../utilities/portfolio-provider" export class MomentumTrader { private binanceConnector: BinanceConnector private historicData: any[] = [] private portfolioPro...
3c471985ba75274120524da591e089fba59d04fa
TypeScript
saumyasinghal747/pixel-editor
/src/store/index.ts
2.71875
3
import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) function makeArray(x: number,y: number,d: any) : Array<object> { return JSON.parse(JSON.stringify((new Array(y)).fill((new Array(x)).fill(d)))); } interface Cell { people: Array<any>, type: string } // @ts-ignore export default new Vuex.Store({ ...
d11d457fe12b37bb41833c4a479c7a009fbf1bcf
TypeScript
romusulin/js-challenger
/src/middleware/verify-token.ts
2.59375
3
import { NextFunction, Request, Response } from 'express'; import { HTTP_CODES } from '../app'; import { AUTHORIZATION_SCHEMA } from '../security/auth-utils'; import { verifyToken } from '../security/auth-utils'; import { ResponseWithLocals } from './custom-response'; export function verifyAuthorizationTokenMiddleware...
5d8d7addd3e3cd60546e44320965a6d6af514772
TypeScript
devpt-org/estirador
/client-side/web-app/src/components/ui-kit/core/utils/camel-case-to-css-property-name.ts
2.734375
3
export function camelCaseToCSSPropertyName(camelCasedName: string) { return camelCasedName.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`); }
ec188d773b20d811a87e8328042e6e32f1c83561
TypeScript
gadget2015/gamble
/noteservice/src/noteservice.ts
2.765625
3
import {Request, Response} from 'express'; import * as db from 'mysql'; import myprops = require('properties-reader'); import {Logger} from 'winston'; /** * The Note service, that handles CRUD operations. * */ export class Noteservice { logger: Logger; constructor(logger : Logger) { th...
d2504e859bf6899239796c2c708155f86343dd00
TypeScript
tadayosi/hawtio-next
/packages/hawtio/src/plugins/camel/camel-preferences-service.ts
2.828125
3
export interface ICamelPreferencesService { loadCamelPreferences(): CamelOptions saveCamelPreferences(newValues: Partial<CamelOptions>): void } export type CamelOptions = { isHideOptionDocumentation: boolean isHideDefaultOptionValues: boolean isHideUnusedOptionValues: boolean isIncludeTraceDebugStreams: bo...
55dc73701c1674c2b949604d148484a768cd6600
TypeScript
andy0104/graphql-federation-lib
/book-service/src/services/book-factory.ts
2.671875
3
import Book from '../models/book'; import BookAuthor from "../models/book-author"; import { MutationSaveBookArgs } from '../graphql/generated'; class BookFactory { public async getAllBooks(): Promise<Book[]> { try { return await Book.findAll({ include: { model: BookAuthor, as: '...
d45afeb2335e7b8d49758f7f389155e9ce32d9cb
TypeScript
urwrstkn8mare/angularshoppinglist
/src/app/shoppinglistitems.service.ts
2.671875
3
import { Injectable } from "@angular/core"; import { ShoppingListItem } from "./shopping-list-item"; import { AngularFirestore } from "@angular/fire/firestore"; @Injectable({ providedIn: "root" }) export class ShoppinglistitemsService { collection; constructor(public db: AngularFirestore) { this....
26d6de338be6926ca629d2d161f87680d8b7d389
TypeScript
DaeronAlagos/warcry-statshammer
/api/tests/statsController.test.ts
2.90625
3
import { StatsController } from '../controllers/statsController'; import * as t from '../controllers/statsController.types'; import Fighter from '../models/fighter'; const mockMappedResult: t.TMappedResult = { toughness: 4, results: { 'Test Fighter': { buckets: [ { damage: 0, count: 9, probabilit...
d37757094f3a91f56796147d4f5ae6b76b114cd3
TypeScript
Eunice17/LIM014-burger-queen-api-client
/src/app/services/products/product.service.spec.ts
2.5625
3
import { ProductService } from './product.service'; import { Product } from '../../model/product-interface'; import { defer } from 'rxjs'; import { AuthService } from '../auth/auth.service'; fdescribe('ProductService', () => { let httpClientSpy: { get: jasmine.Spy }; let authServiceSpy: { get: jasmine.Spy }; let...
975c295e08163737a3547c53bee99759f99c72cb
TypeScript
firedev/zerg
/src/LoggerModule.ts
2.765625
3
import {TLogLevel, TExtendedData, TLogFunction} from './types'; class LoggerModule { name: string; readonly __originLog: TLogFunction; constructor(name: string, logFn: TLogFunction) { this.name = name; this.__originLog = logFn; } private log(level: TLogLevel, message: string, extendedData?: TExtend...
e7bfe622e9275ca69cd62bf6d7a8fc7dc288a3a0
TypeScript
ThomasDupont/core
/packages/system/src/Stream/Stream/flattenTake.ts
2.59375
3
// ets_tracing: off import type * as TK from "../Take" import type { Stream } from "./definitions" import { flattenChunks } from "./flattenChunks" import { flattenExitOption } from "./flattenExitOption" /** * Unwraps `Exit` values and flatten chunks that also signify end-of-stream by failing with `None`. */ export ...
f081008bd8d8b634f177e489b5a9961f0e496478
TypeScript
defifarmer/bot
/src/commands/moderation/prune.ts
2.734375
3
import {Argument} from 'discord-akairo'; import {bold} from 'discord-md-tags'; import {Collection, Message, Permissions} from 'discord.js'; import {AkairoArgumentType, DiceCommand, DiceCommandCategories} from '../../structures/DiceCommand'; export default class PruneCommand extends DiceCommand { constructor() { sup...
ab5ac24be889d4fcd862872ad9dee0f3f9564309
TypeScript
figuevigo/angular-escalable-vitae-febrero
/libs/data/src/lib/services/validators.service.ts
2.6875
3
import { Injectable } from '@angular/core'; import { AbstractControl, FormGroup } from '@angular/forms'; @Injectable({ providedIn: 'root', }) export class ValidatorsService { getInputValueFromDate(theDate: Date) { if (typeof theDate === 'string') { theDate = new Date(theDate); } // ! hack to avoi...
d695f98d0163ddbafcacee2d6c3717f81ca35f3a
TypeScript
Setheum-Labs/ethers.js
/misc/admin/src.ts/cmds/get-config.ts
2.515625
3
import { config } from "../config"; if (process.argv.length !== 3) { console.log("Usage: get-config KEY"); process.exit(1); } const key = process.argv[2]; (async function() { const value = await config.get(key); console.log(value); })().catch((error) => { console.log(`Error running ${ process.arg...
1374c3acde37fa719347bab3bce4fe02ea3b0fd1
TypeScript
KimPalao/OverflowOnline
/overflow-backend/src/migration/1617933917033-AddNormalCards.ts
2.546875
3
import { Card, CardType } from '../entity/card.entity'; import { MigrationInterface, QueryRunner } from 'typeorm'; export class AddNormalCards1617933917033 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise<void> { const connection = await queryRunner.connection; const promise...
1f4d005663d05182e06ccecbf94156c2e10deef6
TypeScript
jmontesv/firstproject
/src/app/tasks/form-tarea/date-validation.directive.ts
2.6875
3
import { Directive } from '@angular/core'; import { NG_VALIDATORS, Validator, AbstractControl } from '@angular/forms'; @Directive({ selector: '[appDatevalidator]', providers: [ { provide: NG_VALIDATORS, useExisting: DateValidator, multi: true } ] }) export class DateValidator implement...
c4d4f6c57e18dfd9cd08234e5fa318e9078c822e
TypeScript
ceottaki/graphql-api-server-boilerplate
/app/src/app.ts
2.515625
3
import GraphQLServerOptions from 'apollo-server-core/dist/graphqlOptions' import { graphiqlRestify, graphqlRestify } from 'apollo-server-restify' import { GraphQLObjectType, GraphQLSchema, GraphQLString } from 'graphql' import { GraphQLDateTime } from 'graphql-iso-date' import * as restify from 'restify' import { IQue...
83d76329a8b2fa74cb426905bcbea9e09c81e745
TypeScript
alexweltman/fullstack-typescript-starter
/src/index.ts
2.515625
3
import bodyParser from 'body-parser'; import express, { Request, Response } from 'express'; import path from 'path'; const app = express(); const port = process.env.PORT || 5000; app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.get('/api/hello', (req: Request, res: Response) => { ...
7fd3ac1d2ca655ab532867a8a7a02181df127a09
TypeScript
yandex-cloud/nodejs-sdk
/src/generated/yandex/cloud/cdn/v1/origin_group.ts
2.65625
3
/* eslint-disable */ import { messageTypeRegistry } from "../../../../typeRegistry"; import Long from "long"; import _m0 from "protobufjs/minimal"; import { Origin } from "../../../../yandex/cloud/cdn/v1/origin"; export const protobufPackage = "yandex.cloud.cdn.v1"; /** Origin group parameters. For details about the ...
239ae82871d6cbc212d6facd13d238ceed22615e
TypeScript
ngseke/picsee-oa
/src/composables/use-generate-history.ts
2.609375
3
import { computed } from 'vue' import { useRoute } from 'vue-router' import { useLocalStorage } from '@vueuse/core' import History from '@/interfaces/History' export default function () { const route = useRoute() /** 當前身分(來自於 URL 參數) */ const feature = computed(() => route.query.feature) /** 是否為 admin */ ...
68b1ab0c0f345c94b1e2fc3ca2864bf6722e791a
TypeScript
DmitrijTrifanov/TcContext
/src/tc-context.ts
2.5625
3
// tc-context.ts /** * Module containing the main TcContext Class, responsible for establishing connection over TwinCAT's ADS layer, * generating the Type and Symbol Maps for future communication. * * * Licensed under MIT License. * * Copyright (c) 2020 Dmitrij Trifanov <d.v.trifanov@gmail.com> * * Permiss...
e8ff88d34e2bda247fcc28652c826722d2f09ff2
TypeScript
Brocco/stencil
/src/mock-doc/test/event.spec.ts
2.71875
3
import { MockWindow } from '../window'; describe('event', () => { let win: MockWindow; beforeEach(() => { win = new MockWindow(); }); it('Event() requires type', () => { expect(() => { new win.Event(); }).toThrow(); }); it('Event(type)', () => { const ev = new win.Event('click') as ...
f2092460940edcc50db89cc3cea67d27c82f7491
TypeScript
guardaco/javascript-sdk
/__tests__/decoder.test.ts
2.515625
3
import * as amino from "../src/amino" import { unMarshalBinaryLengthPrefixed } from "../src/amino" import { AminoPrefix, StdTx, SendMsg } from "../src/types/" class Msg { constructor(opts) { opts = opts || {} this.string = opts.address || "" this.buf = opts.buf || Buffer.alloc(0) this.price = opts.pr...
37a3ab088086fa8a408e89438b2d333c663315b4
TypeScript
newfangledman/typedown
/src/classes/handlers.ts
2.671875
3
import { ParseElement } from "./parser"; import { IMarkdownVisitable, IMarkdownDocument, IMarkdownVisitor } from "./types/interfaces"; import {MarkdownVisitable} from "./visitors" abstract class Handler<T>{ protected next: Handler<T> | null = null; public setNext(next: Handler<T>): void{ this.next = ne...
b30ec087282ca691ce536c3dd92bb1e350507c25
TypeScript
Yota-K/apollo-server-sample
/src/index.ts
2.671875
3
import { ApolloServer, gql } from 'apollo-server'; import { Resolvers } from './generated/graphql'; const typeDefs = gql` type Query { hello: String } `; // MEMO: リゾルバの型を指定。 // 以下のように記述することで、スキーマとリゾルバの型が一致しない時はTSのコンパイルが通らなくなる const resolvers: Resolvers = { Query: { hello: () => 'world', }, }; const s...
66cac1c4cc7d81b6a49c8ba91992ec2da8f59c94
TypeScript
type-challenges/type-challenges
/questions/09160-hard-assign/test-cases.ts
3
3
import type { Equal, Expect } from '@type-challenges/utils' // case1 type Case1Target = {} type Case1Origin1 = { a: 'a' } type Case1Origin2 = { b: 'b' } type Case1Origin3 = { c: 'c' } type Case1Answer = { a: 'a' b: 'b' c: 'c' } // case2 type Case2Target = { a: [1, 2, 3] } ...
fd0862d7ca5809449ef5965183f9c452fa60dca5
TypeScript
mediasourcery/cross-blockchain-doc-uploader
/src/apis/capabilities/createCapabilityApi.ts
2.65625
3
import axios from 'axios'; export interface ICreateCapabilityApi { (request: ICreateCapabilityApiRequest): Promise<ICreateCapabilityApiResponse>; } export interface ICreateCapabilityApiRequest { owner: string; name: string; target: string; } export interface ICreateCapabilityApiResponse { success: boolean;...
1cc324fd2f5e566ce3d67044d5fa3a6da997bcc6
TypeScript
kozlov-victor/vEngine2
/demo/dataTexture/pbmReader.ts
3.03125
3
import {DebugError} from "@engine/debug/debugError"; import {Game} from "@engine/core/game"; import {DataTexture} from "@engine/renderer/webGl/base/dataTexture"; import {ITexture} from "@engine/renderer/common/texture"; export class PbmReader { constructor(private game:Game,buff:ArrayBuffer){ this.file = ...
abff64087d82e6697480f686966e0af2873e508e
TypeScript
by1773/MT-Data
/src/utils/common.ts
2.875
3
/* * @Descripttion: * @version: * @Author: by1773 * @Date: 2019-09-17 13:54:16 * @LastEditors: by1773 * @LastEditTime: 2019-09-24 08:42:51 */ /** * 共用函数 */ import Taro,{ Component } from "@tarojs/taro"; export const repeat = (str = '0', times) => (new Array(times + 1)).join(str); // 时间前面 +0 export const pad...
7dd5ac819962622e99d1769308242922d7764b66
TypeScript
mickmister/live-to-jam-app
/src/types/model-interfaces.ts
3.0625
3
export interface Note { number: number // i.e. 84 name: string // i.e. "C" octave: number // i.e. 5 } export interface Chord { name: string notes: Note[] midiNotes: MidiNote[] } export interface Scale { root: Note quality: string } export interface Progression { chords: Chord[] } export interface ...
426d585ef330d6569307fb26947bbced0444ba3e
TypeScript
AndriiChernyshov/angular-shop
/src/app/app.component.ts
2.515625
3
import { Component, OnInit } from '@angular/core'; import { Cart } from './components/cart/models/cart.model'; import { Product } from './components/product/models/product.model'; import { ProductService } from './components/product/product.service' @Component({ selector: 'app-root', templateUrl: './app.componen...
ae6b98ecddeac5520259a12d44e681de832be7de
TypeScript
svirmi/stream-charts
/src/app/charts/utils.ts
3.1875
3
import {Dimensions, Margin} from "./margins" import * as d3 from "d3"; import {Selection, ZoomTransform} from "d3"; import {calculateZoomFor, ContinuousNumericAxis} from "./axes"; import {ContinuousAxisRange} from "./continuousAxisRangeFor"; /** * No operation function for use when a default function is needed */ ex...
44405f7598035c2c1721ec470a761eb2ce57d17e
TypeScript
AhmadKabakibi/checkout-cart
/src/app/modules/collection/collection.module.ts
2.703125
3
export class Collection { public id: string; public price: number; public name: string; public description: string; public photo: string; public updateFrom(src: Collection): void { this.id = src.id; this.price = src.price; this.name = src.name; this.description = src.description; this...
8253edee6f638b92c36fce47db537931d984e37d
TypeScript
dex-it/react-native-template-dex
/template/src/core/BaseComponent.ts
2.640625
3
import React from "react"; export abstract class BaseReduxComponent<TSP, TDP, TS= {}, TOwnProps = {}> extends React.Component<IReduxProps<TSP, TDP, TOwnProps>, TS> { get dispatchProps(): TDP { return (this.props as any).dispatchProps; } get stateProps(): TSP { return (this.props as any...
9e13e5804b91a3c7d2a59040960cd4c19a8f6670
TypeScript
PrayaAmadigaPitasa/react-native-design-kit
/src/types/chip/ChipType.ts
2.828125
3
export type ChipActionType = 'chip' | 'radio' | 'checkbox'; export type ChipIcon = (info: ChipInfo) => JSX.Element; export type ChipIconAction = ( id: string, isSelected: boolean, ) => 'delete' | 'check' | (() => void); export interface ChipInfo { id: string; isSelected: boolean; }
238d8b1a7e2eb2c40e675893cf03425447f8a4fe
TypeScript
AndreiShybin/Authenticator
/src/ui/qr.ts
2.515625
3
import * as QRGen from 'qrcode-generator'; import {OTPType, UIConfig} from '../models/interface'; import {OTPEntry} from '../models/otp'; import {UI} from './ui'; async function getQrUrl(entry: OTPEntry) { return new Promise( (resolve: (value: string) => void, reject: (reason: Error) => void) => { co...
64ca8a8f4e3c424d413023698baaa1ff1e8c914d
TypeScript
nicx519y/H5Game-Fish
/src/water.ts
2.578125
3
// import { AssetsLoader } from './assetsLoader'; // import { WaterMask } from './waterMask'; export class Water extends createjs.Container { private box; //水的mask,负责水浮动动画 private width: number = 0; private height: number = 0; private duration: number = 0; private color: string = '#000000'; /** * * @param w...
19c1d4654007a017a021a7d4ef68a127ff32598c
TypeScript
G-Rath/terra
/src/utils/assertDefined.ts
2.71875
3
export function assertDefined(val: unknown, message?: string): asserts val { if (val === undefined) { throw new Error(message ?? `Unexpected undefined value`); } }
6369933e0259da7201a1ea7705a5194715a54618
TypeScript
chunkitmax/node-decorators
/di/src/container.ts
2.890625
3
import { InjectableId, Provider, StoreProvider, ClassProvider, FactoryProvider, ValueProvider, Dependency, Injectable, Factory } from './types'; import { Store } from './store'; import { MissingProviderError, RecursiveProviderError } from './errors'; export class Container { /** * Register new ...
795f9f840ad8ccc25fa68cc10901666e1565e0a5
TypeScript
BrooklinJazz/dragon-chess
/src/gamelogic/Piece.ts
2.84375
3
import { positionNumbers, positions as allPositions } from "../constants/positions"; import { IPiece } from "../constants/pieces"; import { Position } from "./Position"; import { Player } from "../redux/types"; import { PieceFactory } from "./PieceFactory"; import { pipe } from "../helpers.ts/pipe"; export class P...
29c8c792f8ec96df2f14014df41a44acb79e54de
TypeScript
akulaarora/fancystack
/packages/web/src/lib/helpers.ts
2.796875
3
import { ManualFieldError } from "react-hook-form" import dayjs, { Dayjs } from "dayjs" export const snakeToCamel = (value: string) => value.replace(/_(\w)/g, m => m[1].toUpperCase()) export const capitalize = (str: string) => { return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase() } export const round...
d02c4aa1340f8c1f1298d31703ff722d25d4cda8
TypeScript
meghoshpritam/mail-send
/src/entities/Register.ts
2.625
3
import { Schema, model, Document } from 'mongoose'; export interface Register extends Document { name: string; email: string; status: boolean; } const registers = new Schema({ name: { type: String, required: true }, email: { type: String, required: true, unique: true }, status: { type: Boolean, default: f...
4459a97c2f1a46192c7adb138d79e25aac036a87
TypeScript
LoicMahieu/yup-locales
/src/locales/he.ts
2.9375
3
/*eslint-disable no-template-curly-in-string*/ import printValue from '../util/printValue'; import { LocaleObject } from 'yup'; // Based on https://github.com/jquense/yup/blob/2973d0a/src/locale.js export const mixed: LocaleObject['mixed'] = { default: '${path} לא קיים או לא תקין', required: '${path} הינו שדה חוב...
8d35e7beb0af25d9a76c3f53b520bd289354db9f
TypeScript
CodeguruEdison/leetcode-typescript-solutions
/problems/207-Course-Schedule.ts
3.390625
3
// TS // Runtime: 84 ms, faster than 95.45% of TypeScript online submissions for Course Schedule. // Memory Usage: 41.1 MB, less than 77.27% of TypeScript online submissions for Course Schedule. function canFinish(numCourses: number, prerequisites: number[][]): boolean { const graph: number[][] = Array.from(Array(nu...
97e723a80214db7f69a3e10fc4c2b8373a45bd9e
TypeScript
AlexandreKimura/sixth-challenge-ignite-nodejs
/src/modules/statements/useCases/getStatementOperation/GetStatementOperationUseCase.spec.ts
2.6875
3
import { InMemoryStatementsRepository } from "@modules/statements/repositories/in-memory/InMemoryStatementsRepository" import { InMemoryUsersRepository } from "@modules/users/repositories/in-memory/InMemoryUsersRepository" import { CreateUserUseCase } from "@modules/users/useCases/createUser/CreateUserUseCase" import {...
13385abacdfc2103eddb68802952c4b252c2edf1
TypeScript
larongbingo/AZGH-College-Public-Portal
/src/shared/database/models/Room.entity.ts
2.59375
3
import { AllowNull, Column, DataType, Model, Table, } from "sequelize-typescript"; import { IRoom } from "../../interfaces/models/IRoom"; @Table({ tableName: "rooms", paranoid: true, }) export class Room extends Model<Room> implements IRoom { @AllowNull(false) @Column(DataType.STRING) public roomC...
22149ea12e3f9c0a1f544c8baef07e306b8c750a
TypeScript
VanSan888/thinknario
/src/providers/bibliothek/bibliothek.ts
2.53125
3
import { Injectable } from '@angular/core'; import firebase from 'firebase'; @Injectable() export class BibliothekProvider { constructor() { } // Funktion, um alle erstellten Szenarien auf ein Array zu schreiben getSzenarioList(): Promise<any> { return new Promise( (resolve, reject) => { firebase....
e0b114f8596c8f2a8840f2ac3a63e5ef4ea16332
TypeScript
pinkfish/teamsfuse
/firebase/functions/ts/util/updateusers.ts
2.78125
3
import * as admin from 'firebase-admin'; import { DocumentSnapshot } from '@google-cloud/firestore'; const FieldValue = admin.firestore.FieldValue; const db = admin.firestore(); interface UsersAndPlayers { users: Record<string, any>; players: Record<string, any>; } // Updates the usersAndPlayers with exciti...
acde142a207cf990f5a769e6fe3ad120550efae9
TypeScript
ag-grid/ag-grid
/grid-packages/ag-grid-docs/documentation/doc-pages/integrated-charts-api-cross-filter-chart/examples/sales-dashboard2/data.ts
2.90625
3
var numRows = 500; var names = [ 'Aden Moreno', 'Alton Watson', 'Caleb Scott', 'Cathy Wilkins', 'Charlie Dodd', 'Jermaine Price', 'Reis Vasquez', ]; var phones = [ { handset: 'Huawei P40', price: 599 }, { handset: 'Google Pixel 5', price: 589 }, { handset: 'Apple iPhone 12', pr...
fbfb34fe12883de39f32d7efa1fdd02eca7f99b1
TypeScript
hisoftking/algorithm
/algorithm/HashTable/0219_contains_duplicate_ii.ts
3.421875
3
/** * @author lizhi.guo@foxmail.com * @source https://leetcode-cn.com/problems/count-primes/ * @time 2019-11-13 * * Time Complexity: O(n) * Space Complexity: O(n) */ function containsNearbyDuplicate (nums: number[], k: number) { let map = new Map(); for (let i = 0; i < nums.length; i++) { if (map.has(n...
fde761e1310ed5829532b21cca48605c24ce3214
TypeScript
Kotpes/monthly-wages
/tests/helpers.test.ts
2.75
3
import {currencyFormatter, getOvertimeWageRate, calculateDailyWage, handleData} from '../src/utils/helpers' describe('currency formatter', () => { const formattedCurrency = currencyFormatter('en-US', 'USD').format(110.34) test('should not be undefined', () => { expect(formattedCurrency).toBeDefined() }) ...
64db63316bd6ef72c5d14d57de1c296ef34cd6e7
TypeScript
JunkProvider/ng-tracks
/src/app/common/components/text-input/text-input.ts
2.734375
3
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; export interface SuggestionProvider { provide(value: string): Promise<string[]>; } interface Word { index: number; text: string; } @Component({ selector: 'app-text-input', templateUrl: './text-input.html', styleUrls: ['./text...
dfec0c4c4f8c180d31891f09f6d3e1bdbe853d68
TypeScript
tusbar/vscode-linter-xo
/server/src/buffered-message-queue.ts
2.578125
3
// Copied from https://github.com/Microsoft/vscode-eslint/blob/ad394e3eabfa89c78c38904d71d9aebf64b7edfa/server/src/server.ts import { CancellationToken, RequestHandler, NotificationHandler, IConnection, RequestType, NotificationType, ResponseError, ErrorCodes } from 'vscode-languageserver'; interface Request<...
490a56d8cc5e9aa4bbeda06dad46024eda7ce97c
TypeScript
shanehickeylk/angular-libraries
/projects/pipes/src/lib/string/remove_html_tags.ts
2.609375
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'removeHtmlTags' }) export class RemoveHtmlTagsPipe implements PipeTransform { // This pipe removes all HTML tags from a text string // Used for sanitizing input so that html tags are not shown transform(value: string): string { return va...
f5b72dde6cd99ca2857a694eb1ac400acadb9387
TypeScript
craigmichaelmartin/pure-orm
/test-utils/thirteen/models/member.ts
2.53125
3
import { IModel, ICollection, IColumns } from '../../../src/index'; export const tableName: string = 'member'; export const columns: IColumns = ['id']; export class Member implements IModel { id: number; constructor(props: any) { this.id = props.id; } } export class Members implements ICollection<Member>...
2963d980d842f08e5a92f7aaeab53bcf4e525241
TypeScript
rapharw/beauty-az-cli
/src/app/wizards/az-cli/operations/shared/subscription-question-select.ts
2.578125
3
import Choice from "../../../../../lib/inquirer/choice"; import Question from "../../../../question"; import QuestionSelect from "../../../../question-select"; import Account from "../az-account/account"; import Subscription from "../az-login/subscription"; /** * Know how to get the question(s) */ export default ()...
e62cc506b03f88e4a7bfd5e6bce5513153db37d6
TypeScript
fork-from-others-coder/QinScript
/src/Parser/DataStruct/HashFile.ts
2.515625
3
export class HashFile{ //hash文件的数据结构 hashValue:number;//grammar文件内容的hash值 hashDate:number;//grammar文件的修改日期hash值 constructor(hashValue: number, hashDate: number) { this.hashValue = hashValue; this.hashDate = hashDate; } }
bb412e298c4b8c5ff7e45285aab7d511a07e3156
TypeScript
FrederikBolding/tournament-brackets
/hooks/useBracket.ts
2.953125
3
import { useState } from "react"; import { Game, Round } from "../types"; import { BracketGenerationOptions, generateBracket } from "../utils/bracket"; export const useBracket = (teams: string[], options?: BracketGenerationOptions) => { const [rounds, setRounds] = useState(generateBracket(teams, options)); const ...
29e18237cedda22913f7c53e2d8a64fde9cdd1f9
TypeScript
majo44/redux-tx
/lib/utils/optimisticMerge.ts
2.859375
3
export function optimisticMerge(outisde: any, before: any, after: any, path: Array<string> = []) { if (!isObject(outisde, before, after)) { throw 'Transaction commit failed. The state should bean an plain object.'; } let target: any = {}; uniq(Object.keys(after) .concat(Object.keys(befor...
6a2e850db07ea65e20efe6454c60eeb659636b6b
TypeScript
jbrowneuk/jblog
/apps/jblog/src/app/services/rest.service.ts
2.6875
3
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; export type Headers = { [key: string]: string }; @Injectable({ providedIn: 'root' }) export class RestService { constructor(private http: HttpClient) {} /** * Gets a resource fro...
b4690e4a321394db0ba8882c377c908e2f3fb6e2
TypeScript
jbhouse/automation
/utilities/models/supplement.ts
2.671875
3
import { Language } from './language.enum'; export class Supplement { name: string; language: Language; code: string; notes: string; constructor(name: string = '', language: Language = Language.TEXT, code: string = '', notes: string = '') { this.name = name; this.language = languag...
5db2f87981fb82fea985b52442e2e0212d1f71c3
TypeScript
xyz252631m/web
/js/tool/tree.ts
2.890625
3
class Tree { //转为tree型 list convertTreeData(list) { let repMap = {}; let temList = []; //去除重复 list.forEach(d => { if (!repMap[d.id]) { repMap[d.id] = d; temList.push({...d, isOpen: false, children: []}) } }); ...
3853f5cfb7e8ea88be808300107c3ab0ff10d8c0
TypeScript
LucasSimpson/js_web_graphics
/webGL/framework.ts
3.203125
3
/** * Created by lucas on 08/07/17. */ class PolygonData { protected vertices: Array<number> = []; protected colors: Array<number> = []; protected indices: Array<number> = []; public getColors() { return this.colors; } public getVertices() { return this.vertices; } ...
2c3bb7ebd89169e4c747963d61ef78da973a91a3
TypeScript
sketch7/ssv-au-core
/src/logging/logging.model.ts
2.640625
3
export interface ILog { debug(method: string, message?: string, data?: any): void; info(method: string, message?: string, data?: any): void; warn(method: string, message?: string, data?: any): void; error(method: string, message?: string, data?: any): void; }
69258bf1f5cc5f8fb7d1e450d204f64ce42ee5e6
TypeScript
microsoft/fluentui
/tools/workspace-plugin/src/generators/migrate-converged-pkg/lib/utils.ts
2.6875
3
import { logger } from '@nx/devkit'; import ejs from 'ejs'; import fs from 'fs'; /** * Similar to @nx/devkit#generateFiles function but for getting content only * * @param src - the source folder of files (absolute path) * @param substitutions - an object of key-value pairs * @returns */ export function getTempla...
570fa3729b1f68e7f3b48edc122a9aeabd5c8c12
TypeScript
hiephn/hoctypescript
/lession18.ts
3.140625
3
class Person{ constructor (name){ this.name = name; console.log('Xin chao ' + this.name); } static talk(){ console.log('Talk'); } run(){ console.log('Run'); } } var p1 = new Person('hiep'); Person.talk();
9fbb407aa45f9e1bd38c38a695077d37a8279678
TypeScript
mrWh1te/gardn
/libs/data/src/lib/event/types.ts
2.828125
3
import { Event, EventData } from './../generated' /** * Just like the Event type, generated, except more relaxed aka "loose" in typing via Partials */ export type LooseEvent = Omit<Partial<Event>, 'data'> & { data: Partial<EventData> // don't require 'dateCreated' }