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
b4a6050a11877ce990a9b1537777ed9d23597849
TypeScript
InvenireAude/IAW-ESB-ServiceDirectory
/src/app/filters/general-filter.pipe.ts
2.765625
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'generalfilter', pure: false }) export class GeneralFilterPipe implements PipeTransform { transform(items: any[], filter: any, pagination: any): any[] { if (!items || !filter) { return items; } const r = items.filter((item: an...
a20d31e93d49fafce4da47d763ad92ff69ba2900
TypeScript
nemyagky/requests-interceptor
/renderer/src/app/app.component.ts
2.65625
3
import {Component, ElementRef, ViewChild} from '@angular/core'; import {ElectronService} from "./core/services/electron.service"; import {HTMLLinksArray} from "./core/interfaces/links-window-data.interface"; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.componen...
ca6da41d1c6373bc0658be304cf1db1a8e018674
TypeScript
DanielleVictoria/Exercise2
/src/shoppingcart/components/filterview.component.ts
2.609375
3
import { Component, OnInit, Output, EventEmitter } from '@angular/core'; export interface FilterModel { category : string; pricerange : string; sort : string; } @Component({ selector: 'filterview', templateUrl: 'filterview.component.html' }) export class FilterViewComponent implements OnInit { ...
634cc0a089f4abaefb149ccb7f0421e3efaefd8f
TypeScript
swerfel/retromote-angular-client
/src/app/bounds/bounds.ts
2.84375
3
import { PositionChange } from '../transformation/position-change'; export class Bounds { static EMPTY: Bounds = new Bounds(0, 0, 0, 0); constructor( public x: number, public y: number, public width: number, public height: number) {} public movedBy(change: PositionChange): Bounds { return n...
d16a79a0cb237a17fffc8348b3c7e5522d91dc75
TypeScript
VitaliyKulikov/StudHub
/Frontend/src/services/route-helper.service.ts
2.515625
3
import {Injectable} from '@angular/core'; import {NavigationEnd, Router} from '@angular/router'; import {Observable} from 'rxjs'; import {filter, map, shareReplay} from 'rxjs/internal/operators'; const blackRoutes = [ ]; const blackHeaderRoute = [ ]; @Injectable() export class RouteHelperService { constructor(pri...
25400cd5b266f8bef76f04ea1e145cf4bc499bec
TypeScript
marcobiedermann/codewars
/kata/8 kyu/return-two-highest-values-in-list/index.ts
2.84375
3
function twoHighest(arr: number[]): number[] { const sorted = [...new Set(arr)].sort((a, b) => b - a); return sorted.slice(0, 2); } export default twoHighest;
848ae26b7a72c443d8c236ee0300c7532bce5b01
TypeScript
SonTrungTo/Fullstack-2020-Helsinki
/part9/calculator/bmiCalculator.ts
3.4375
3
interface bmiInputs { height: number; weight: number; } export const calculateBmi = (height: number, weight: number): string => { const bmi = Number((weight / Math.pow(height * 0.01, 2)).toFixed(2)); switch (true) { case ( bmi < 18.5): return `Underweight (very unhealthy weight)`; ...
070fa79b7706bdfe480eed66855e45ab78efd88b
TypeScript
willneedit/mixed-reality-extension-sdk
/packages/common/src/math/path2.ts
3.65625
4
/*! * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { Arc2, Orientation, Vector2 } from '.'; /** * Represents a 2D path made up of multiple 2D points */ export class Path2 { private _points = new Array<Vector2>(); private _length = 0.0; /** * If the p...
664739c83650fe5ee367ad8b96ff8b726c1a23a5
TypeScript
puncleV/ts-graphql
/src/entities/author.ts
2.65625
3
import { Field, ID, ObjectType } from "type-graphql"; import { Column, Entity, ManyToMany, PrimaryGeneratedColumn } from "typeorm"; import { Lazy } from "../types"; import { Book } from "./book"; @ObjectType() @Entity() export class Author { @Field((type) => ID) @PrimaryGeneratedColumn() readonly id!: number; ...
4592854ef3e32b7bb05d3c80e0b51fcb4eee216b
TypeScript
mecoepcoo/react-redux-ts-demo
/src/redux/store/initState.ts
2.828125
3
export interface GoodsItem { id: number; name: string; price: number; stock: number; } export interface CartItem extends GoodsItem { num: number; } export interface InitState { goodsList: GoodsItem[]; cartList: CartItem[]; } const initState: InitState = { /* 商品列表 */ goodsList: [ // { // i...
8e38d0dc82127e345df68e85c2d611d2996ebcd7
TypeScript
Trendyol/dynamic-render
/__tests__/hook.spec.ts
2.65625
3
import * as sinon from "sinon"; import * as faker from "faker"; import {expect} from "chai"; import {Hook, HookConfiguration} from "../src/hook"; const sandbox = sinon.createSandbox(); let hook: Hook; describe('[hook.ts]', () => { beforeEach(() => { hook = new Hook({ name: faker.random.word(), handl...
73a278471e8a4e1465e5db9a57d9fd4cf4196e51
TypeScript
sneha-sharma-uiux/Angular-training
/src/app/shared/directives/highlight.directive.ts
2.75
3
import { Directive, OnInit, OnDestroy, ElementRef , HostListener, Renderer2, Input} from '@angular/core'; //h2, div , any tag that contains directive is called host element //Renderer2 DOM manipulation Library @Directive({ //[] - must, represent a property // used at ant tag/component selector: '[appHighlight]'...
7e5559af1c67d4258b6fbd03f7771b369961862f
TypeScript
Dans-labs/electron-experiments
/redux-form-tutorial/src/main/typescript/reducers/submitReducer.ts
2.703125
3
import {Reducer} from "redux" import {Users} from "../model/AppState" import * as uuid from 'uuid/v4' export const usersReducer: Reducer<Users> = (state = [], action) => { switch (action.type) { case "ADD_USER": const name = action.payload const user = {id: uuid(), name} ...
5378169ace9e7bfbd7732b9f1ae251b24b20d98e
TypeScript
domhanak/tomato-chat
/src/reducers/channel/editedChannelID.ts
2.515625
3
import { TOMATO_APP_CHANNEL_EDITING_STARTED, TOMATO_APP_CHANNEL_EDITING_CANCELLED, TOMATO_APP_CHANNEL_EDITING_SUCCESS } from '../../constants/actionTypes'; export const editedChannelId = (prevState: Uuid | null = null, action: Action): Uuid | null => { switch (action.type) { case TOMATO_APP_CHA...
cb557c2074f945f7cb08d7290b61bab696a18631
TypeScript
RMo-Sloth/Sudoku
/utility/CellPosition/SudokuCellPosition.spec.ts
2.875
3
import { SudokuCellPosition } from "./SudokuCellPosition"; describe( 'SudokuCellPosition', () => { describe( '.row', () => { it( 'returns 0 for too low out of range values', () => { let cellPosition = new SudokuCellPosition( 0 ); expect( cellPosition.row ).toBe( 0 ); }); it( 'returns 0 for to...
97912efaf73c85c4e1e8f979c8e8e2eb46bf4c2a
TypeScript
farism/love2dtest
/packages/client/src/game/components/Platform.ts
2.515625
3
import { ComponentFlag } from '../flags' import { Timer } from '../utils/timer' export class Platform { static _id = 'Platform' _id = Platform._id static _flag = ComponentFlag.Platform _flag = ComponentFlag.Platform initialX: number initialY: number resetDuration: number stableDuration: number time...
03e7abfdb1bfeccb616cc487afd11cfbfee69080
TypeScript
SutRog/vscode-amphtml-validator
/server/src/utils.ts
2.65625
3
/** * Copyright 2018 The AMPHTML-Validator Authors. All Rights Reserved. * * 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 * * Unles...
863036c07a3f6fb717f707b9724a44a1ed82c441
TypeScript
jianfaw/node-blueprint
/src/model/Define/BlockDef.ts
2.75
3
import { BlockPortDirection, BlockPort } from "./Port"; import { OnUserAddPortCallback, BlockType, OnPortEventCallback, OnBlockEventCallback, OnBlockEditorEventCallback, OnAddBlockCheckCallback, OnPortUpdateCallback, OnPortRequestCallback, OnPortConnectCallback, OnPortEditorEventCallback, OnPortConnectCheckCallback, Bl...
d67e3a1b42b1bcf38e965926c3e7ad257e867895
TypeScript
gviligvili/atn4seed
/src/app/store/articles/articles.reducer.ts
2.84375
3
/** * Created by talgvili on 22/12/2016. */ import {ArticlesActions} from '../../actions/articlesActions/articles.actions' import {IPayloadAction} from "../../actions"; import {ARTICLES_INITIAL_STATE} from "./articles.initial-state"; export function articlesReducer(state = ARTICLES_INITIAL_STATE, action:IPayloadActi...
8fcbb9af17bb4804ddc5d50234ea772082073181
TypeScript
rlong/browser.app.McRemote
/Project/src/lib/json_broker.ts
2.765625
3
import 'rxjs/add/operator/take'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/toPromise'; import {Http} from "@angular/http"; export class BrokerMessage { messageType:string = "request"; // 'fault'/'oneway'/'request'/'response'/'event' metaData:any = {}; serviceName:string = "__SERVICE_NAME__"; ...
090eda0737cf0e63f5e3158ce738eac6d75e0653
TypeScript
gsanta/silhouette-people
/src/model/objects/route/routing/ReversingRouter.ts
2.671875
3
import { RouteItem } from "../RouteItem"; import { RouteController } from "../../game_object/controller_route/RouteController"; import { IRouter } from "./IRouter"; export class ReversingRouter implements IRouter { private readonly routeWalker: RouteController; private readonly referenceRoute: RouteItem; ...
8e464f357f88ef490e8ddf257c77c32d89b69ded
TypeScript
inqui05/english-for-kids-with-api
/client/src/components/button-component.ts
2.546875
3
import { Button } from '../shared/types'; export class ButtonComponent { readonly element: HTMLButtonElement; constructor(styles: string[] = [], params: Button) { this.element = document.createElement('button'); this.element.classList.add(...styles); if (params.name) this.element.innerHTML = params.na...
c07f4fa005f23d44096b92c4aa7a24523fd0665b
TypeScript
IuriiZhuk/angular_gmp_2019_q3
/src/app/courses/services/courses.service.spec.ts
2.578125
3
import { TestBed } from '@angular/core/testing'; import { CoursesService } from './courses.service'; import { ICourse } from '../models/course'; let service: CoursesService; const mockCourseList = [ { id: 'id1', title: 'title1', creationDate: '12-12-21', duration: 10, description: 'description1'...
c5523e8319bd03b5d19aa540daee21e2fced3e48
TypeScript
corefunc/corefunc
/json/stringify/with.ts
2.90625
3
import { jsonStringifySafe } from "./safe"; /** * @param {*} object * @param {Function=} replacer * @param {String=} spaces * @param {Function=} cycleReplacer * @return {String} */ export function jsonStringifyWith( object: any, replacer?: (this: any, key: string, value: any) => any, spaces?: string | numb...
e258e95e7144ae5258051c160b6421a1c29aaafc
TypeScript
Saad-Malik/gamauml
/express/examples/attribute-configuration.ts
2.578125
3
import { DomainConfiguration, Runtime } from 'graph-on-rails'; import _ from 'lodash'; // ENUM const winnerYear = { Toyota: [2020, 2019, 2018], Porsche: [2017,2016,2015,2014,2013,2012,2011,2010], Peugeot: [2009], Audi: [2008,2007,2006,2005,2004], Bentley:[2003] } const repaint = async (rt:Runtime, id:stri...
62db589dd59845a2e920222d227174ddc823422c
TypeScript
dragonxu/imodeljs
/ui/appui-abstract/src/appui-abstract/UiAbstract.ts
2.53125
3
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *-------------------------------------------------------------------------...
57b6ba3cf506e82a460fcb8a8c2d062dcf4b5ef1
TypeScript
houssemDevs/koa-ioc-utils
/src/utils.ts
2.65625
3
import { Context } from 'koa'; import mime from 'mime'; import { METADATA_KEYS } from './constants'; import { ControllerMetadata, ControllersMetadata, ErrorMapper, IReponseObject, MethodMetadata, MethodsMetadata, ParamsMetadata, } from './types'; /** * get all the decorated controllers metadata, or an e...
8815ac02d290e03a48765781a8910bcecf51d217
TypeScript
jacquesikot/AstanahServer
/src/validation/user.ts
2.765625
3
import Joi from 'joi'; import { IGoogleAuth, IUser } from '../types'; const validateUser = (user: IUser) => { const schema = Joi.object({ first_name: Joi.string().min(2).max(45).required(), last_name: Joi.string().min(2).max(45), email: Joi.string().email().min(3).max(45).required(), passwo...
6eb43da98741ebf5660a25a72cf6d37dce69a4c8
TypeScript
b3h3m0th/hellsio_vinyl_shop
/src/Hooks/useScript.ts
2.59375
3
import { useState, useEffect } from "react"; const useScript = (url: string, name: any) => { const [lib, setLib] = useState<any>({}); useEffect(() => { const script = document.createElement("script"); script.src = url; script.async = true; script.onload = () => setLib({ [name]: window[name] }); ...
62b94a6436fb8720c3f527aeae0d53930034a25e
TypeScript
lpreiss-wsei/paw
/lab5/index.ts
3.5
4
function StandardAccess(constructorFn: Function): void { constructorFn.prototype.role = Role.Standard; } function ModeratorAccess(constructorFn: Function): void { constructorFn.prototype.role = Role.Moderator; } function AdminAccess(constructorFn: Function): void { constructorFn.prototype.role = Role.Admin;...
2920043af001d280afedeb1969d67f2f5117742f
TypeScript
jiweiyuan/bytebase
/frontend/src/types/error.ts
2.609375
3
export enum GeneralErrorCode { OK = 0, INTERNAL = 1, NOT_AUTHORIZED = 2, INVALID = 3, NOT_FOUND = 4, CONFLICT = 5, NOT_IMPLEMENTED = 6, } export enum DBErrorCode { CONNECTION_ERROR = 101, SYNTAX_ERROR = 102, EXECUTION_ERROR = 103, } export enum MigrationErrorCode { MIGRATION_SCHEMA_MISSING = 201...
fe26ea4fd9852d82f624c6e872c2870728980376
TypeScript
okolomiets/stocksTrader
/src/app/store/reducers/markets.reducers.ts
2.8125
3
import * as fromMarkets from '../actions/markets.actions'; import { Market } from '../../models/market.model'; export interface MarketsState { markets: Market[]; loaded: boolean; loading: boolean; } export const initialState: MarketsState = { markets: [], loaded: false, loading: false }; export function ...
1b4ee2e0b5c5d504dd66ec140e5c34f3fe07a862
TypeScript
ClaudePlos/webNaprzodSA
/app/http-test.component.ts
2.671875
3
import {Component, OnInit} from 'angular2/core'; import {HTTPTestService} from './http-test.service'; class User { name: string; email: string; rating: number; } @Component({ selector: 'http-test', template: ` <button (click)="onTestGet()">Test get</button><br> <p>Output: {{getData}}</p> <bu...
83aecb04e6f5984f77dec901a0782ccb9a1266db
TypeScript
sonnguyen112/database-gateway
/src/v2/schemas/common.ts
2.625
3
import { JSONSchemaType } from 'ajv'; export type WhereClause = Record<string, unknown> | Array<string | [any, any, any]>; export type OrderByClause = Array<string | { column: string; order: 'asc' | 'desc' }>; const whereClauseSchema: JSONSchemaType<WhereClause> = { anyOf: [ { type: 'object', requir...
c8c55a47f0cc6b81858a8c15290e6cf8b5e81b6b
TypeScript
amandabeiner/garden-app
/src/Application/actions.ts
2.515625
3
import { PersonalInfo, HistoryInfo, GardenPreferences } from './reducer'; export const savePersonalInfo = (payload: PersonalInfo): ApplicationAction => { return { type: ActionType.SAVE_PERSONAL_INFO, payload }; }; export const saveHistoryInfo = (payload: HistoryInfo): ApplicationAction => { return { type: ActionT...
2fdaa8a48d18dbe4d7494c7ac66f571f2bff690f
TypeScript
milehighfd/confluence-mhfd-frontend
/src/store/reducers/notesReducer.ts
2.8125
3
import * as types from '../types/notesTypes'; const initState = { notes: [], groups: [], open: false, availableColors: [], isnewnote: false }; const notesReducer = (state = initState, action : any) => { switch(action.type) { case types.SET_IS_NEW_NOTE: return { ...state, isnewnot...
4986cf5b7cbaeadfb3d78529ed42be36b69b8471
TypeScript
sandeshdanwale/umber
/src/main/resources/public/scripts/src/app/actions/property.action.ts
2.578125
3
import { Action } from '@ngrx/store'; import { Property } from '../models/aggregate/property.model'; import { type } from '../util'; export const ActionTypes = { LOAD_SUCCESS: type('[Property] Load Success'), LOAD: type('[Property] Load'), UPDATE_PROPERTY_DETAIL: type('[Property] Update Property Detail') }; exp...
34bd4654ec74b75c67266b72041a88dfe0e038c0
TypeScript
hwhang0917/busiman
/backend/src/projects/entities/project.entity.ts
2.53125
3
import { Client } from 'src/clients/entities/client.entity'; import { Employee } from 'src/employees/entities/employee.entity'; import { CoreEntity } from 'src/common/entities/core.entity'; import { Document } from './document.entity'; import { Column, Entity, JoinTable, ManyToMany, ManyToOne, OneToMany, } ...
650245e60ffda6a0eb8dd2436c1ebc018a1e4840
TypeScript
WdsFomenko/schematics-react
/src/functional-component/index_spec.ts
2.53125
3
import { Tree } from '@angular-devkit/schematics'; import { SchematicTestRunner } from '@angular-devkit/schematics/testing'; import * as path from 'path'; import { Schema as FnComponentOptions } from './schema'; const collectionPath = path.join(__dirname, '../collection.json'); const defaultOptions: FnComponentOptions...
55df8783b541f0cd5af08831f10b0d77810bff8f
TypeScript
sanity-io/sanity
/packages/sanity/src/core/studio/workspaces/__tests__/validateWorkspaces.test.ts
2.890625
3
import {validateBasePaths, validateNames} from '../validateWorkspaces' describe('validateBasePaths', () => { it('allows empty basePaths', () => { validateBasePaths([{name: 'foo', basePath: '/'}]) validateBasePaths([{name: 'foo', basePath: ''}]) validateBasePaths([{name: 'foo', basePath: undefined}]) })...
abf297160a646cdb818dba198a932e3fd36ff5e4
TypeScript
Oneirocom/Magick
/packages/plugins/avatar/client/src/hooks/useOMIPersonality.ts
2.53125
3
import { useEffect, useState } from 'react' export const useOMIPersonality = (oldVRM) => { const [newVRM, setNewVRM] = useState([]) useEffect(() => { if(oldVRM) { oldVRM.scene.userData = { "$schema": "http://json-schema.org/draft-07/schema#", "title": "OMI_personality", "descri...
37ee4c562fc87acb314d000112cb311163d13824
TypeScript
danielfb88/challenge-accepted
/backend/src/models/Weather.ts
2.5625
3
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm"; @Entity({ name: "weathers" }) export class Weather { @PrimaryGeneratedColumn("uuid") id!: string; @Column({ name: "locale_id" }) localeId!: string; @Column() date!: Date; @Column() text!: string; @Column({ name: "temperature_min" }...
17f5cf077d186347b69e1412a51a3616ac7900dd
TypeScript
diegomgerminiani/blog-api
/src/controllers/InfoController.ts
2.578125
3
import db from "../database/connection"; import http from 'http-status'; import { Request, Response} from 'express'; export default class InfoController{ async index(request: Request, response: Response) { try { const infos = await db('informations').select(); return res...
83359b055167670ce41351ea0ced4b76f52cd315
TypeScript
tbone1020/Auto-Complete
/src/app/models/letter.spec.ts
3.15625
3
import { Letter } from './letter'; describe('Letter Data Structure', () => { let letter: Letter; beforeEach(() => { letter = new Letter("a"); }); it ('Assigns Letter Correctly', () => { expect(letter.letter === 'a').toBe(true); }); it ('Has isEndOfWOrd', () => { expect(letter.isEndOfWord).to...
15d72cd2cd4e032b9262d0ed411a60f95dd1f0e2
TypeScript
PJMPR/BIU_library_2
/src/view-models/TableOfContents.ts
2.78125
3
export class TableOfContents { public name: string; public listOfSubContents: TableOfContents[]; constructor(name: string, listOfSubContents: TableOfContents[]) { this.name = name; this.listOfSubContents = listOfSubContents; } }
124e3fe32788b84ffddb904600f5f54811ce6d78
TypeScript
palldalma/Bootcamp_curriculum
/I.FOUNDATION/OOP/post-it.ts
3
3
export {}; class PostIt { backgroundColor: string; text: string; textColor: string; constructor(text: string, background: string, textcolor: string) { this.text = text; this.backgroundColor = background; this.textColor = textcolor; } write(): void { console.log( 'textColor: ' + this...
943502f206a7db5161c05476c05a4805315abc09
TypeScript
bigdig/uCMS
/client/src/services/OperatorService/OperatorService.service.ts
2.609375
3
import environment from "@/environment"; import qs from "querystring"; import { OperatorResponse } from "@/models/Operators.model"; import { AxiosService } from "../AxiosService/AxiosService.service"; export default class OperatorService { public static async create({ email }: { email: string }): Promise<OperatorRes...
aee217d5ff8ce8568e1c5dc93cc227c85aadd69e
TypeScript
alejandrozeb/Angular2021
/presupuesto-app/src/app/egreso.model.ts
2.75
3
export class Egreso{ nombre:string; cantidad:number; constructor(nombre:string, cantidad:number){ this.nombre = nombre; this.cantidad = cantidad; } }
199250373c63bba587df8953a91335f50ad7eb28
TypeScript
16Yongjin/ctrl-cv-resume-write-automation
/wanted/education.ts
2.65625
3
import { Page } from "puppeteer"; import { IResumeData } from "../IResume"; import { clickText, clickHasText, clickXPath, click$x } from "../utils"; const fillEducation = (page: Page) => async ({ educations }: IResumeData) => { for (let index = 0; index < educations.length; index++) { const education =...
4440567a9c50f6546765abd90b3a1ddad1d5423e
TypeScript
denkstrap/denkstrap-core
/src/utils/helper/data.test.ts
2.828125
3
import { data } from './data'; const testObject = { bestanden: true }; const testAttributes = { t1: 't1', json: JSON.stringify( testObject ) }; const testAttributesWithPrefix = { 'prefix-t1': 't1', 'prefix-json': JSON.stringify( testObject ) }; const testResultObject = { t1: testAttributes.t1, ...
e6f72b0838e17b2f5731506f0004d909e954b4fa
TypeScript
tiborbotos/ts-collection
/src/utils.ts
3.515625
4
type stringOrNumber = string | number; export interface Map<V> { [key: string]: V; } export function isArray(arr: any): boolean { return arr && typeof arr === 'object' && typeof arr.length === 'number'; } export function isUndefined(value: any): boolean { return value === undefined; } export function isDefine...
a8ca1a18678081fc1b23fd2b1c83903f1e7c3145
TypeScript
shantu/mui-treasury-next
/packages/layout/src/utils/combineBreakpoints.ts
2.515625
3
import { Breakpoint } from "@material-ui/core/styles/createBreakpoints"; import { BREAKPOINT_KEYS } from "./muiBreakpoints"; import { Responsive } from "./types"; export const sortBreakpoints = (breakpoints: Breakpoint[]): Breakpoint[] => breakpoints.sort( (a, b) => BREAKPOINT_KEYS.indexOf(a) - BREAKPOINT_KEYS.i...
b86ae369719e262cd63be197d6c5612b68b6b8c6
TypeScript
vercel/vercel
/packages/build-utils/test/unit.glob.test.ts
2.71875
3
import fs from 'fs-extra'; import { join } from 'path'; import { tmpdir } from 'os'; import { glob, isDirectory, isSymbolicLink } from '../src'; describe('glob()', () => { it('should not return entries for empty directories by default', async () => { const dir = await fs.mkdtemp(join(tmpdir(), 'build-utils-test'...
82ccae065657fd80810ad251da7275c7152fd8cf
TypeScript
alex-vladut/online-shop-typescript
/src/guards/authorization.guard.ts
2.65625
3
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'; import { Reflector } from '@nestjs/core'; import { Role } from '../auth/role'; import { RequestWithUserInfo } from './request-with-user-info.interface'; @Injectable() export class AuthorizationGuard implements CanActivate { constructor(priv...
c38530ef3bb79a12045bfa89e015b142af13bc42
TypeScript
ksaldana1/ts-compiler-fun
/src/http/generation/createClass.ts
2.703125
3
import * as ts from 'typescript'; export function createClassDeclaration( name: string, uri: string, heritage: ts.HeritageClause, methods: ts.PropertyDeclaration[] ): ts.ClassDeclaration { return ts.createClassDeclaration( [], [ts.createToken(ts.SyntaxKind.ExportKeyword)], name, [], [heri...
eacb642eb474492ea9788b51cece8f70ff7b253b
TypeScript
piotrek-k/TaskManager
/frontend-app/src/app/DTOs/ColumnDTO.ts
2.71875
3
import { BaseDTO } from './BaseDTO'; export class ColumnDTO extends BaseDTO { id: number; name?: string | undefined; orderIndex: number; longTermGoalId: number; init(data?: any) { data = this.prepareDataIndexes(data); if (data) { this.id = data["Id".toLowerCase()]; ...
139cae51462989fad96abcca6554cfb39ec13c9a
TypeScript
kiminozo/bangumi-explorer
/src/service/bgmdb.ts
2.53125
3
import Path from "path"; import low from 'lowdb'; import FileAsync from 'lowdb/adapters/FileAsync' import { WatchInfo, UserWatchInfo } from '../common/watch'; import { watchFile } from "../common/defines"; export interface WatchDB { users: UserWatchInfo[]; } export default class BangumiDB { db: low.Lowdb...
b0ca5f0d70419d0a3e71895a915a65763cf84c84
TypeScript
senolkeskin/newSucu
/src/redux/reducers/productForCustomerReducers.ts
2.75
3
import { ProductForCustomer, Action } from "../states"; import { PRODUCT_FOR_CUSTOMER_GET, PRODUCT_FOR_CUSTOMER_LOADING } from "../types"; import {IProductForCustomerItem} from "../models/productForCustomerModel" const initialProduct:IProductForCustomerItem={ productId:0, productName:"", unitPrice:0, p...
1b785b984a5b4c50ea14bd7453e3b2af2e5e87ff
TypeScript
fuath/vectorious
/src/Matrix.spec.ts
2.953125
3
import { deepStrictEqual, throws, } from 'assert'; import { Matrix } from './'; describe('Matrix', () => { describe('Matrix.binOp(a, b, (a, b) => a + b)', () => { it('should work as the static equivalent of a.binOp(b, (a, b) => a + b)', () => { const x: Matrix = new Matrix([[1, 1, 1]]); const y:...
bcac8048625507a85c6e4ec90fa39a760e69ec25
TypeScript
newcat/baklavajs
/packages/baklavajs-playground/src/MathNode.ts
2.734375
3
import { NodeBuilder } from "../../baklavajs-core/src"; export default new NodeBuilder("MathNode") .addInputInterface("Number 1", "NumberOption", 1, { displayName: "Number" }) .addInputInterface("Number 2", "NumberOption", 10, { displayName: "Number" }) .addOption("Operation", "SelectOption", "Add", undefi...
c7dbf6516346b3cf6fd4dff821d5b36f55d0122d
TypeScript
Warrenate/ProjectTiny
/Assets/TinySamples/GalaxyRaiders/Scripts/GameService.ts
2.859375
3
namespace game { export class GameService { /** * @desc invoked once when the game is launched */ static initialize(world: ut.World, context: game.GameContext) { this.reset(world, context); ut.EntityGroup.instantiate(world, 'game.GameMenu'); cont...
80e369076bd785a688e1f8c5592c27936fb9c669
TypeScript
neerolyte/vscode-gitblame
/src/textdecorator.ts
2.703125
3
import {workspace} from 'vscode'; import * as moment from 'moment'; import * as ObjectPath from 'object-path'; import {IGitBlameInfo, IGitCommitInfo} from './gitinterfaces'; export class TextDecorator { static toTextView(commit: IGitCommitInfo): string { const config = workspace.getConfiguration('gitblame...
69126905518c8755deccd65362989845d9b5a183
TypeScript
VitorLuizC/vue-loadable
/types/callWithHooks.d.ts
2.984375
3
/** * Call function and execute its hooks. Executes `onDone` when its done and * `onError` when it throws an error. * @param call * @param onDone * @param onError */ declare const callWithHooks: <T>(call: () => T | Promise<T>, onDone: () => void, onError?: () => void) => Promise<T>; export default callWithHooks;
efb1c94a873be71f162dd5847ce68d93bdca3fde
TypeScript
isomerpages/isomercms-frontend
/src/utils/pages.ts
2.546875
3
import _ from "lodash" export const SPECIAL_PAGES = ["homepage", "navbar", "contact-us"] export const isEditPageUrl = (url: string): boolean => { // NOTE: Lowercase here because `/editpage` also works return url.toLowerCase().includes("/editpage/") && url.endsWith(".md") } export const isSpecialPagesUrl = (url: ...
d27f0a45d67b965c680de55d7a74df6cece27a0d
TypeScript
briwa/vue-flowter
/src/components/flowter-editor/index.ts
2.65625
3
// Libraries import { Component, Vue } from 'vue-property-decorator' // Components import FlowterFlowchart from '@/components/flowter-flowchart/index.vue' // Fixtures // It won't be used for production... import allGraph from '../../../__fixtures__/simple.json' // Types import { GraphNode, GraphEdge, EditingEdge...
c70a8c205681000712c4a24699d0b5ad87ceda5c
TypeScript
Bojackxiang/map-project
/client/src/Components/CustomizedHooks/useCheckiSessionToken.ts
2.796875
3
import { useEffect, useState } from "react"; import { useHistory } from "react-router-dom"; interface ICheckAuthInput { successJumpTo?: string; failJumpTo?: string; } // check if the user is logged in or not const useCheckSessionToken = (checkAuthInput?: ICheckAuthInput) => { const [isAuth, setIsAuth] = useStat...
cc37f54e019eb45366a4b3d49ee6b613620ecf82
TypeScript
fleshascs/WebRTC-DamageEvaluation
/frontend/helpers/fetchWrapper.ts
2.609375
3
import getConfig from 'next/config'; import { accountService } from '../services'; const { publicRuntimeConfig } = getConfig(); export const fetchWrapper = { get, post, put, delete: _delete, authHeader, handleResponse }; function get(url) { const requestOptions = { method: 'GET', headers: authH...
4599cfb31b74f20e776eea503241e746ef3a8902
TypeScript
hnu-digihealth/sensorframework-media-recorder
/src/web.ts
2.546875
3
import {WebPlugin} from '@capacitor/core'; import {MediaRecorderOptions, MediaRecorderPlugin} from './definitions'; interface MediaRecording { id: string; stream: MediaStream; recorder: any; chunks: Blob[]; finished: Promise<void>; name: string; } const uuidv4 = (): string => { retur...
3bda8664c6b884f8eac847f5adea48ccfacf7337
TypeScript
kunalx86/reddit-clone-server
/src/controllers/commentsController.ts
2.546875
3
import { Comment } from "@entities/Comment"; import { CommentVote } from "@entities/CommentVote"; import { Post } from "@entities/Post"; import { User } from "@entities/User"; import { LoadStrategy } from "@mikro-orm/core"; import { ICommentPostRequest, IVoteCommentRequest } from "@shared/types"; import { Response, Req...
1dd6582ebb16837fffbaee76e8193af3da426b9a
TypeScript
ethereum/js-ethereum-cryptography
/test/test-vectors/assert.ts
3.3125
3
// Minimal assert version to avoid dependecies on node internals // Allows to verify that none of brwoserify version of node internals is included in resulting build function deepStrictEqual(actual: unknown, expected: unknown, message?: string) { const [actualType, expectedType] = [typeof actual, typeof expected]; ...
915732a47c53b72ad03fd8dfbab480fa11530306
TypeScript
kamibababa/SplitTime
/src/engine/player/ability/jump.ts
3.015625
3
namespace splitTime.player.ability { export class Jump implements IAbility { body: splitTime.Body zVelocity: number /** * @param {splitTime.Body} body * @param {number} zVelocity initial z velocity (560 is a good value) * @implements {G.Ability} */ ...
d8c3db1bb62bdb6f1aa444a78bd5d5a4bbfe0871
TypeScript
doug-martin/nestjs-query
/packages/query-graphql/__tests__/types/find-one-args.type.spec.ts
2.65625
3
// eslint-disable-next-line max-classes-per-file import { plainToClass } from 'class-transformer'; import { validateSync } from 'class-validator'; import { Resolver, Query, Args, Int, ArgsType, ObjectType } from '@nestjs/graphql'; import { FilterableField, FindOneArgsType, IDField } from '../../src'; import { generateS...
476123159441ca4fe0941f707951add3ecbd629c
TypeScript
limengke123/sg2ts
/src/util.ts
2.59375
3
export const getSpaces = (num: number = 0): string => { const space: string = ' ' return space.repeat(num) }
b1171df2b214f747699fcb0b0bc870432cc0fd59
TypeScript
future4code/Adryane-Fernandes
/Semana 18 - Autorização de Usuários/Projeto - Cookenu/src/endpoints/deleteUser.ts
2.65625
3
import { Request, Response } from "express"; import connection from "../connection"; import { userExist } from "../function/userExist"; import { getTokenData } from "../services/authenticator"; import { authenticatorData, USER_ROLES } from "../types"; async function deleteUser(req: Request, res: Response): Promise<voi...
5d61f44c747323af6075add3ded09bc62a38f4ef
TypeScript
ZEISS/react-view-pdf
/src/utils/hacks.ts
3.6875
4
/** * Produces an array with N items, the value of each item is n * * @param i: Length of the array to be generated */ export function range(i: number): Array<number> { return i ? range(i - 1).concat(i) : []; } /** * Checks whether a string provided is a data URI. * * @param {String} str String to check */ e...
124f691504820a88631ba3304e9fe49b4ae081a4
TypeScript
Ntub-Class/homework-if-pippentu6708
/src/index.ts
4.28125
4
// 請介紹兩個字串方法跟數字方法 //字串1.substring的用法,將變數定義的字串值,透過參數搭配取出字串中的第幾個字元到字串第幾個位置的字元後回傳。(作業) let dd: string = 'pippentu6708'; console.log(dd.substring(6, 8)); //tu 要回傳tu,結束的值需要+1) console.log(dd.substring(6)); //tu6708,回傳第6個字串之後 //字串2. concat的用法,將變數定義的字串值,透過參數搭配一前一後的,回傳成為一個字串值顯示。(作業) let ee: string = 'Good'; let ff: st...
1cfc7b26366289d45aa428a441fbd62137340bf5
TypeScript
mpm1900/loot
/src/types/character/character.status.ts
3.015625
3
import { Guage, sGuage } from '../guage' import { AppRecord } from '..' export type sCharacterStatus = { poison: sGuage, sleep: sGuage, paralysis: sGuage, burn: sGuage, } export type iCharacterStatus = { poison?: Guage, sleep?: Guage, paralysis?: Guage, burn?: Guage, } const defaultChar...
3ece1ed3e1ea2a354fd9a426c2c02faf8eda0378
TypeScript
Minious/CoolSlide
/src/app/pawnSprites/pawnSprite.ts
3.03125
3
import { LevelScene } from "../levels/levelScene"; import { Action } from "../actions/actionInterface"; export class PawnSprite extends Phaser.GameObjects.Container { private maxLife: number; private heartsContainer: Phaser.GameObjects.Container; public constructor( scene: Phaser.Scene, x: number, y...
efbb1ffe47d44bf5d66527f5694b0f8149f48d76
TypeScript
Girimallappa/FarmManager
/src/app/services/farm.service.ts
2.578125
3
import { PaddockService } from './paddock.service'; import { FarmTypeEnum } from './../models/FarmTypeEnum'; import { Farm } from './../models/farm'; import { Injectable } from '@angular/core'; import * as _ from 'lodash'; @Injectable({ providedIn: 'root', }) export class FarmService { private storeKey = 'Farms'; ...
f4a914a5ca1c9a63a03e279a0d84b1a18f361fe3
TypeScript
krystaDev/typescript-design-patterns
/factory/pizzeria-2/pizzeria-types/americans-pizzeria.ts
2.65625
3
import {Pizzeria} from "../pizzeria"; import {Pizza} from "../pizza-abstract"; import {PizzaType} from "../pizza-type"; import {AmericanCheesePizza} from "../pizza-types/americans/american-cheese-pizza"; import {AmericanVegePizza} from "../pizza-types/americans/american-vege-pizza"; import {AmericanPepperoniPizza} from...
fbb57ac6f790fc226b67405d91c6caff77dd07d4
TypeScript
twosevenkid/yearn-data
/tools/decoder.ts
2.65625
3
import decoder from "abi-decoder"; import path from "path"; import fs from "fs"; const abidir = path.join("abi", "full"); const [_, __, ...rest] = process.argv; if (rest.length !== 1) { console.error("[!] please provide data"); process.exit(1); } const data = rest[0]; function loadAbis(dir: string) { fs.read...
1fba87980c909591b3490a743285de28d84f8f47
TypeScript
lockcp/scriptcat
/src/apps/msg-center/browser.ts
2.6875
3
// 前端用通信 import { randomString } from "@App/pkg/utils"; export type ListenMsg = (msg: any) => void; // 浏览器页面之间的通信,主要在content和injected页面之间 export class BrowserMsg { public id: string; public content: boolean; public listenMap = new Map<string, ListenMsg>(); constructor(id: string, content: boolea...
f09a9c08ed1c730fc64016ead0c501e3190359f5
TypeScript
Liam-So/bug_tracker
/frontend/src/interfaces/constants.ts
2.890625
3
export const API_URL = "http://localhost:8001"; // WE ALWAYS ASSUME THAT THESE ARE IN THIS ORDER export const status_codes = [ { value: 'pending', label: 'Pending 🤷' }, { value: 'in_progress', label: 'In Progress 🧑‍⚕️' }, { value: 'completed', label: 'Done ✅' } ]; export const getDefaultStatusCode = (st...
ebabb9a46914129eeeef2832ccb0a317bfc00b09
TypeScript
bfutema/mentorando
/web/src/components/Link/styles.ts
2.515625
3
import styled from 'styled-components'; import { shade, lighten, darken } from 'polished'; interface ILinkProps { outline?: boolean; amount?: number; color: string; func?: 'lighten' | 'darken'; } export const Container = styled.div<ILinkProps>` a { min-width: 180px; background: ${props => (props.ou...
ab673844d81d812e7841981268f3be3b7d50035b
TypeScript
WarriorRocker/angular-xo-material
/src/app/directives/clipboard/clipboard.directive.ts
2.59375
3
// Modifed from: https://www.bennadel.com/blog/3235-creating-a-simple-copy-to-clipboard-directive-in-angular-2-4-9.htm import { Directive, Input } from '@angular/core'; import { EventEmitter } from '@angular/core'; import { ClipboardService } from './clipboard.service'; @Directive({ selector: '[clipboard]', host: ...
1b20ac8cd19a85608e259dd75cb56bc7af502b3c
TypeScript
joshmedeski/wheniwork-cli
/testing/using.ts
3.546875
4
/** * Allows you to provide data to iterate and use for a test. * * @param {object} values A key used as the description and an array of values. * @param {function} func The function. */ export const using = (values, func) => { for (const key in values) { if (values.hasOwnProperty(key)) { values[key].u...
b473eece652df48ed56450fba71cd3f1313dd624
TypeScript
Gun-che/EloquentGame
/src/actors/Monster.ts
2.890625
3
import { Vec } from './../Vec'; import { State } from '../State'; import { monsterSpeed } from '../consts'; export class Monster { pos: Vec; size: Vec; constructor(pos: Vec) { this.pos = pos; this.size = new Vec(1.2, 2); } get type() { return 'monster'; } static create(pos: Vec): Monster {...
81c3b05bd6f1b07a75aad7bafaccd619821815d2
TypeScript
xiefenga/algorithm-ts
/src/types/helper/TreeNode.ts
3.125
3
class TreeNode<T> { public val: T public right: TreeNode<T> | null = null public left: TreeNode<T> | null = null public parent: TreeNode<T> | null = null constructor(val: T) { this.val = val } public isLeave(): boolean { return !this.left && !this.right } } export default TreeNode
3ac13cc7c3848af3a67aca546bc30411772ef81a
TypeScript
Ben16005/EarthdawnWebApp
/src/app/models/character.ts
2.578125
3
import { Race } from './race'; import { Discipline } from './discipline'; import { Talent } from './talent'; import { Stat } from './stat'; export class Character { public name: string; public player: string; public age: number; public height: string; public weight: number; public gender: strin...
fa2d6c1773652cb0059aa77fbb564b733f0807da
TypeScript
d-fischer/connection
/src/WebSocketConnection.ts
2.796875
3
import type { ClientOptions } from '@d-fischer/isomorphic-ws'; import { WebSocket } from '@d-fischer/isomorphic-ws'; import { AbstractConnection } from './AbstractConnection'; import type { ConnectionOptions, ConnectionTarget } from './Connection'; export interface WebSocketConnectionOptions { wsOptions?: ClientOptio...
dd58969c76ad45ce9c998c185435151c1be81679
TypeScript
cnnor/design-patterns-ts
/src/creational/tests/Builder.test.ts
2.59375
3
import { PizzaBuilder } from '../Builder'; test('make a yummy pepperoni and cheese pizza', () => { const yummyPiza = new PizzaBuilder(12).addSauce().addCheese().addPepperoni().make(); const expected = { slices: 12, sauce: true, cheese: true, pepperoni: true, veggies: [] }; expect(yummyPiza).toMatchObject(expecte...
425d8be174dd17a3561e8d386404143159fe5910
TypeScript
jorgefortunatof/clients.backend
/src/services/UpdateClientService.ts
2.796875
3
import { getRepository } from "typeorm"; import AppError from "../errors/AppError"; import Client from "../models/Client"; interface Request { id: string; name: string; email: string; cpf: string; } class UpdateClienteService { async execute({ id, name, email, cpf }: Request): Promise<Client> { const clientRep...
84b958c2a2b1d336d989321f2637148a5b35e8c8
TypeScript
bollwyvl/jupyterlab-lsp
/packages/jupyterlab-lsp/src/magics/defaults.spec.ts
2.671875
3
import { expect } from 'chai'; import { language_specific_overrides } from './defaults'; import { CellMagicsMap, LineMagicsMap } from './maps'; let CELL_MAGIC_EXISTS = `%%MAGIC some text `; let NO_CELL_MAGIC = `%MAGIC some text %%MAGIC some text `; let LINE_MAGIC_WITH_SPACE = `%MAGIC line = dd`; describe('Default I...
1e9d60199578323f49a61ce2293535eba78302a7
TypeScript
jlno/gif-share-backend
/src/controllers/video-controller.ts
2.78125
3
import { FileController } from './file-controller'; import { Inject } from '../core/decorators'; /** * VideoController */ export class VideoController { /** * fileController */ @Inject private fileController: FileController; /** * videoToBase64Gif * * @param options * @param file */ a...
7cad5c50ed46fadb0fe2b09300ea6c7ed5162188
TypeScript
GriffinLedingham/rog
/src/classes/components/camera.ts
2.828125
3
import Canvas from './canvas/canvas' class Camera { public x public y public canvas constructor(canvas: Canvas) { this.canvas = canvas } moveCamera(x,y) { this.x = x this.y = y } render() { let halfX = Math.round((this.canvas.width - 1)/2) let halfY = Math.round((this.canvas.heig...
90026a32e7055c29dea591b70b2d0c215976a3eb
TypeScript
ccorcos/datalog-prototype
/src/shared/database/memory.ts
3.1875
3
/* EAV Store. A set of utilities for maintaining 5 permutations of 3-tuples, known by various names which you can google about: - Entity-Attribute-Value Store - Datomic - Datalog - Prolog - RDL - SPARQ Knowledgebases and graph databases typically rely on something like this under the hood. */ import { ...
61ae992b3ce0dc283abdb3fac5d882b8f2a74d8d
TypeScript
vuepress-theme-hope/vuepress-theme-hope
/packages/shared/src/shared/utils/deepAssign.ts
3.28125
3
import { entries, isArray, isPlainObject } from "./helper.js"; // eslint-disable-next-line @typescript-eslint/no-explicit-any type IAnyObject = Record<string, any>; /** Deep merge objects to the first one */ export const deepAssign = < T extends IAnyObject, U extends IAnyObject = T, V extends Partial<T> & Parti...
654d30c4c702d5e2e89997eb634fbac728e3197b
TypeScript
bluelovers/node-jsdom-url
/lib/URLImpl.ts
2.5625
3
/** * Created by user on 2018/2/11/011. */ import createClassProxy, { IClassProxyHandler, ClassProxyStatic } from 'class-proxy'; import { implementation as WURLImpl } from 'whatwg-url/lib/URL-impl'; import { URLSearchParamsImpl, IURLSearchParams, URLSearchParamsImplCore } from './URLSearchParams'; import { isValidUR...
a54fd7d6481b5c906b06da4b471e8705b57c0e4e
TypeScript
imjoshellis/ticketapp.dev
/tickets/src/routes/__test__/show.test.ts
2.671875
3
import req from 'supertest' import { app } from '../../app' import { generateUserCookie } from '../../test/setup' import mongoose from 'mongoose' it('returns 404 if the id is invalid format', async () => { await req(app) .get('/api/tickets/ieawfhtiaehrstawftieharst') .expect(404) }) it('returns 404 if the i...
2f0fed017145640a14da45838f35b1f291bb2393
TypeScript
HiroakiMikami/micro-versioning-systems
/src/graph.ts
3.484375
3
import { ConstrainedData } from "./common" /** Constraints of the directed graph */ type Predicate<V, L> = (self: DirectedGraph<V, L>) => string | null /** A labeled directed graph */ interface DirectedGraph<V, L> { /** The vertex set */ readonly vertices: ReadonlySet<V>; /** The edge set (there is a v1 -...