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
abd624dcf3717c534974831e9361a2dc938bc75f
TypeScript
ghaisassujit/social-cards-webApp
/src/store/actions.ts
2.84375
3
import {Action} from 'redux'; import { Story, ErrorDetail } from './types'; export enum StoryActions { ListLoading = 'ListLoading', ListLoaded = 'ListLoaded', ListLoadingError = 'ListLoadingError', AddNew = 'addNew', Saving = 'saving', Saved = 'saved', SavingError = 'savingError' } exp...
c0381fd29a52ccd54389dd89deae6f26bc890e6b
TypeScript
softcontext/workspace_ecma
/typescript/app/example1.ts
3.21875
3
function add(a: number, b:number): number{ return a+b; } (function (){ let result = add(2, 3); console.log('result = '+result); })(); var tasty: boolean; // tasty = "I haven't tried it yet"; tasty = false;
c4707106457e3c69cd1a4d1e8966050c260c694f
TypeScript
brucekruger/TypeScriptTodo
/Utils.ts
3.546875
4
interface IHaveALength { length: number; } export function clone<T>(value: T): T { let serialized = JSON.stringify(value); return JSON.parse(serialized); } export function totalLength<T extends IHaveALength>(x: T, y: T) { var total: number = x.length + y.length; return total; } clone('Hello'); clon...
093954f002dc63da2525736467a633a01048c001
TypeScript
jimbothree/craftbot-api
/src/engine/requests/send-message-request.model.ts
3.203125
3
import { Request } from './request.model'; import { RequestType } from './request-type.enum'; /** * Requests a regular message to be sent. * */ export class SendMessageRequest extends Request<{ message: string }> { public readonly command = RequestType.Message; /** * Creates an instance of SendMessageReques...
f030d1be9ec87f94ecf8f18d70bc73e4ad1932f7
TypeScript
grzegorz-bielski/newsletter-lambda
/src/EmailRepo.ts
2.578125
3
import type { DynamoDB } from 'aws-sdk'; import * as TE from 'fp-ts/lib/TaskEither'; import * as O from 'fp-ts/lib/Option'; import * as A from 'fp-ts/lib/Array'; import * as t from 'io-ts'; import { pipe } from 'fp-ts/lib/pipeable'; import { flow } from 'fp-ts/lib/function'; import { fromDecoded } from './Errors'; imp...
b14ef2ac53d4e525c5708d5c525d782195fc2ece
TypeScript
Huddly/sdk
/tests/components/upgrader/upgradeStatus.spec.ts
2.703125
3
import chai, { expect } from 'chai'; import UpgradeStatus, { UpgradeStatusStep } from './../../../src/components/upgrader/upgradeStatus'; chai.should(); describe('UpgradeStatus', () => { it('should not return complete first step is not done', () => { const step = new UpgradeStatusStep('foo'); const status =...
5f7651be34b2c7b463d6d5807de3a9f97012cb9a
TypeScript
dmitrygavrish/angular-media-manager
/src/app/common/guards/auth.guard.ts
2.640625
3
import {Injectable} from '@angular/core'; import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router'; import {AuthService} from '../services/auth.service'; @Injectable() export class AuthGuard implements CanActivate { public constructor(private authService: AuthService...
b06306746dd202bfa61f9c2ab9a43e6f9a66124a
TypeScript
un33k/atrade
/libs/ag/base/src/lib/ag-logger.spec.ts
2.671875
3
import { BaseLogger } from './ag-logger'; class Logger extends BaseLogger {} describe('Agnostic Base - BaseLogger', function() { let logger; beforeEach(() => { logger = new Logger(); }); it('should create', () => { expect(logger).toBeDefined(); }); it('should not detect IE', () => { expect(...
0c102346726ad94b615edbeb12e0dc34581dfee0
TypeScript
JaroslawPokropinski/typescript-aot
/src/compilator/ExpressionImpl/BinaryExpression.ts
2.90625
3
import * as ast from '@typescript-eslint/typescript-estree/dist/ts-estree/ts-estree'; import Expression from '../Expression'; import ExpressionVisitor from '../ExpressionVisitor'; import { AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; import ParseError from '../ParseError'; import CompilationDirector fr...
46257f96b1d6415a715aeea68f433d7684a743ca
TypeScript
duanjiuzhou/blogReactProject
/src/api/index.ts
2.71875
3
import Request from '@public/api' // http工具若需前端统一,需要后端统一普通交互格式 export enum Ret { 正常 = 0, 用户名不存在或者密码错误 = 99, 登录失效 = 100, 参数错误 = 400, 无权限 = 401, 系统内部错误 = 1000, 数据过期 = 4001, } // 自定义响应结构体 interface ICommonResponse { ret: number data: any message?: string } export default Request<ICommonResponse>({ ...
28e78728a7a820d1eb3062e2694c30e871e618f2
TypeScript
mengtest/home3
/core/clientLaya/game/src/commonGame/net/request/guide/SetMainGuideStepRequest.ts
2.921875
3
namespace Shine { /** 设置主引导步消息(generated by shine) */ export class SetMainGuideStepRequest extends GameRequest { /** 数据类型ID */ public static dataID:number=GameRequestType.SetMainGuideStep; public value:number; constructor() { super(); this._dataID=GameRequestType.SetMainGuideStep; ...
9ae67cc1d592f8bbc416375446a682557b4732bd
TypeScript
neet/masto.js
/src/adapters/serializers/is-record.ts
2.890625
3
export const isRecord = (x: unknown): x is Record<string, unknown> => typeof x === "object" && x !== null && x.constructor.name === "Object";
246fc88294d6fb83eaf774242ded2afac84fa775
TypeScript
KevinVelassco/construction-assistant-api
/src/templates/template.service.ts
2.53125
3
import * as path from 'path'; import * as fs from 'fs'; import hbs from 'handlebars'; import mjml2html from 'mjml'; export class TemplateService { static generateHtmlByTemplate(templateName: string, parameters: object = {}) { // get the path of the template const filePath = `./emails/${templateName}.mjml`; ...
3e2862ec8bf973c6b1f6c4618d16e0a002e2e701
TypeScript
Zerrien/sprintplank
/app/client/store.ts
2.6875
3
import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const state = { nodes: [], }; const mutations = { createItem(aState, obj) { aState.nodes.push(obj); }, updateItem(aState, obj) { const index = aState.nodes.findIndex(elems => elems.id === obj.id); if(index !== -1) { ...
7050c1005c709d630b2dad261b84bde95e1fa465
TypeScript
ManuRodgers/react-jira
/src/utils/index.ts
2.90625
3
export const matchPartialString = ( sources: string[], match: string ): string[] => sources.filter((source) => source.toLowerCase().includes(match)); export const isFalsy = (value: any): boolean => (value === 0 ? false : !value); export const cleanObject = (object: any): any => { const result = { ...object }; ...
ce29c026a6d75865b96f2d361c8e0a34d1ae6ec6
TypeScript
designdevy/hangman-2019
/src/utils/words.ts
3.203125
3
function getWords(cb: (words: string[]) => void): void { cb(['food', 'drink', 'tool']) } function getRandomWord(): string { let word = '' getWords(words => { const randomWord = words[Math.floor(Math.random() * words.length)] word = randomWord.toUpperCase() }) return word } export default getRandomWo...
1205d953396951689f649c43aab9a94c83e09dba
TypeScript
gentics/gentics-ui-core
/src/components/file-drop-area/drag-drop-utils.ts
2.828125
3
export function getDataTransfer(event: any): DataTransfer { // if jQuery wrapped the event which contains the dropped file, unwrap it let ev: DragEvent = event.dataTransfer ? event : event.originalEvent; return ev.dataTransfer; } export function getEventTarget(event: any): HTMLElement { // if jQuery wr...
887d02f17e468ba7a2886215d129e56beef88101
TypeScript
noppa/get-optional
/tests/typings/testbed/ts-should-pass/nth.ts
2.75
3
import {nth, get} from 'get-optional'; import {A, B, C, D, E, input} from '../ts-interfaces'; const list = [1, 2, 3]; const first: undefined | number = nth(list, 0); const nonExistent: undefined | number = nth(list, 100); const fromNullableList: undefined | boolean = nth(get(input, 'a', 'b', 'c', 'arr'), 0); ...
da8f4b26b269607620857f9d96a8b0750e4ec7a9
TypeScript
dipali208/Dipali-BT
/Frontend/src/app/Class/state.ts
2.703125
3
export class State { answer:string; questionId:number; userId:number; quizId:number; reamainingTime:number constructor(answer:string,userId:number,queId:number,quizId:number,reamainingTime:number){ this.answer = answer; this.questionId = queId; this.userId = userId; ...
80b6d997a54cdd412c6453b40dd8edceab393aa3
TypeScript
dragGH102/angular4-unit-converter
/src/app/unit-converter/units.ts
2.625
3
interface Unit { symbol: string, ratioToMeter: number, } const Meter: Unit = { symbol: 'm', ratioToMeter: 1, }; const Yard: Unit = { symbol: 'yd', ratioToMeter: 1.0936, }; const Inch: Unit = { symbol: 'in', ratioToMeter: 39.3701, }; const Units = [ Meter, Yard, Inch, ...
b2470b7574310e5ee6aa04002467aa1e6341dffb
TypeScript
xialei520/small-demo
/typescript/demo.ts
4.375
4
// 基本语法 // let bool: boolean = true; // let number: number = 888; // let string: string = '1222'; // let s1:symbol = Symbol() // 数组类型 // let arr1: number[] = [12, 11]; // let arr2: string[] = ['12', '33']; // let arr3: Array<number> = [1, 2, 3]; // let arr4:Array<number | string> = [1, 3, 4]; // 元祖 第一个必须为数字类型, 第二个必...
4f2efbbdf4b16897da313a2b5cdb33d93c5f2479
TypeScript
SuZHui/suzh-cli
/packages/@suzh/cli-service/lib/util/logger.ts
2.96875
3
import chalk from 'chalk'; // import readline from 'readline'; const chalkTag = (msg: string) => chalk.bgBlackBright.white.dim(` ${msg} `); // 格式化输出 const format = (label: string, msg: string) => { return msg .split('\n') .map((line: string, i: number) => { return i === 0 ...
6257055742dbb960cf67d5bbf86050df85f6d1f1
TypeScript
orionnye/BTTFS
/src/circle.ts
3.171875
3
import { Vector } from "./math"; export default class Circle { pos: Vector vel: Vector radius: number mass: number speed: number acceleration: number color: string constructor(pos: Vector, radius: number, color: string = "black") { this.pos = pos this.vel = new Vector(0,...
fab1cdb9cd9129ab677321f7b59d71e600bc6ac5
TypeScript
sweetim/haversine-position
/test/util.test.ts
2.6875
3
import * as assert from 'assert'; import { Util } from '../lib/util'; describe('Util', function() { describe('#toRadian()', function() { it('should return PI when 180 degree', function() { assert.strictEqual(Math.PI, Util.toRadian(180)); }); it('should return 0 when 0 degree',...
041b74e6a4380b19d13e5de9d6cb14ba78700808
TypeScript
yongwang07/angular2-ngrx-contact
/src/norm.ts
3.109375
3
import { normalize, schema, denormalize } from 'normalizr'; import { Record, List, Map, fromJS, OrderedMap} from 'immutable'; const data = { id: '123', author: { id: '1', name: 'Paul' }, title: 'My awesome blog post', comments: [ { id: '324', commenter: { id: '2', name...
b0c9698aed63764df21d74b5842a5402c0e07c22
TypeScript
rockplate/rockplate
/tests/block/LiteralBlock.spec.ts
2.953125
3
import { Builder } from '../../src/Builder'; import { Parser } from '../../src/Parser'; import { LiteralBlock } from '../../src/block/LiteralBlock'; import { getBuilders } from '../shared'; const sch = { my: { name: 'My Name', expertise: 'My Skills', }, skills: [ { skill: { name: 'Skill...
37de26b410382506aa4887ab183567618dae04d1
TypeScript
Yoostah/nextjs-sequelize-typescript
/server/repositories/PostRepository.ts
2.703125
3
import { FindOptions } from "sequelize"; import { Post } from "../models"; export class PostRepository extends Post { public static async findAllRaw(options?: FindOptions) { const data = await Post.findAll(options); const rawData = data.map((d) => ({ ...d.toJSON(), createdAt: d.createdAt.toString...
a834b87f627bf6c454fb1b070e1e82e84e180ef0
TypeScript
gatsbyjs/gatsby
/packages/gatsby-source-wordpress/src/steps/preview/cleanup.ts
2.703125
3
import { inPreviewMode, PreviewStatusUnion } from "." import { OnPageCreatedCallback } from "~/models/preview" import { getStore } from "~/store" import { NodePluginArgs } from "gatsby" /** * This callback is invoked to send WP the preview status. In this case the status * is that we couldn't find a page for the nod...
f1cafe25bb274ebdb97b8f4718fb069727d4401d
TypeScript
Tami1901/Hangman
/src/helpers/calcScore.ts
2.625
3
import { alphabet } from '../constants/alphabet'; import { ATTEMPTS } from '../constants/gameConfig'; const MAX_LEN = 200; type ScoreType = { err: number; unique: number; len: number; duration: number; }; export const calcScore = ({ err, unique, len, duration }: ScoreType): number => { return ( Math.ro...
f98e09f469a02404dd6a0c1656f4f98dea30451f
TypeScript
tzkmx/papaya
/index.ts
3.59375
4
/** * A Papaya container */ export class Papaya<T extends { [name: string]: any } = any> { private _services: { [name: string]: any } = {} private _functions: { [name: string]: true } = {} private _factories: { [name: string]: true } = {} /** * Gets a service by name. * * If the service is not set, ...
c1e6e96c1cad90c6315337c33062b8fc259a39df
TypeScript
Zielak/cardsGame
/packages/server/src/queries/__test__/queryRunner.test.ts
2.703125
3
import { LabeledEntity } from "../../__test__/helpers/labeledEntities.js" import { SmartEntity, SmartParent, } from "../../__test__/helpers/smartEntities.js" import { Player } from "../../player/player.js" import { State } from "../../state/state.js" import { queryRunner } from "../runner.js" let state: State, p...
df55114cb3bb593d8d47546318f2a0b8775078a7
TypeScript
kinashi/react-redux-example
/src/models/books.ts
2.921875
3
import Book from './book' export default class Books { private _list: Map<string, Book> constructor(books?: Book[]) { this._list = new Map() if (books) this.setList(books) return this } get list() { return Array.from(this._list.values()) } public setList(books: Book[]) { books.forEa...
ea2b2f9e22f89947ab60c960c505de7eb86efc34
TypeScript
Sztimon/Projekt
/ProjektPS/ClientApp/app/services/vehicle.model.ts
2.75
3
import { Contact } from "./contact.model"; export class Vehicle { public id: number; public name: string; public isRegistered: boolean; public image: string; public contact: Contact; public lastUpdate: number; public features: string[]; public description: string; public counter: n...
5dbc99e6aaf99f5af0506f222db2d9eef9afbbda
TypeScript
rubensworks/community-server
/src/storage/Lock.ts
3.125
3
/** * Lock used by a {@link ResourceLocker} for non-atomic operations. */ export interface Lock { /** * Release this lock. * @returns A promise resolving when the release is finished. */ release: () => Promise<void>; }
f214695edff210b21451546e464710d756f2c002
TypeScript
paf31/typescript-docs-psc
/example/example.d.ts
3.375
3
/** * An example of a module */ declare module ExampleModule { /** * A nested module */ module AnotherModule { /** * An example of a class */ class Foo implements Bar { /** * Constructor example */ constructor(); ...
bccaea2260c3d006030dec8eda12e0c9f4615451
TypeScript
Food-Ordering-Application/user-service
/src/customer/entities/customer-address.entity.ts
2.53125
3
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; import { Customer } from './customer.entity'; @Entity() export class CustomerAddress { @PrimaryGeneratedColumn('uuid') id: string; @ManyToOne(() => Customer, (customer) => customer.customerAddresses) customer: Customer; @Column() ...
1c8d4cfaa7c975d6df2e772f855923fae8bbafea
TypeScript
plugjs/plug
/test-d/11-expect5-expectations.test-d.ts
3.109375
3
import { expect, type AsyncExpectations, type Expectations } from '@plugjs/expect5' import { expectError, expectType, printType } from 'tsd' printType('__file_marker__') type TestType = boolean & { __test: never } const expectations = expect(true as TestType) class TestError extends Error { test: boolean = true } ...
a191c2187c2901daea754a001974d3e3d1e98c24
TypeScript
paikwiki/ts-algorithm
/src/q0.2.2-swapArr.ts
3.96875
4
{ // Q. // 배열과 배열의 두 원소의 위치를 인자로 받아서 값을 바꾸는 swapArr() 함수 작성 // A1. // 변수에 할당한 값은 함수를 이용해서 swap할 수 없었는데(q0.2.1-swap.ts 참고) // 변수에 할당한 배열은 함수 내에서 순서를 바꾸니까 순서가 바뀐다. const swapArr = (arr: Array<any>, pos1: number, pos2: number): void => { let temp: any; temp = arr[pos1]; arr[pos1] = arr[pos2]; ...
9ee8df909cfe9a8670f07bf763190c474f4fcdb6
TypeScript
hypermedia-app/lit-any-views
/test/render/index.test.ts
2.59375
3
import { expect } from '@open-wc/testing' import { html, render as litRender, TemplateResult } from 'lit-html' import sinon from 'sinon' import render from '../../src/lib/render' describe('render view', () => { let registry: any beforeEach(() => { registry = { getTemplate: sinon.stub(), } }) it...
be7289f70549fe40b3e73b44571bdc68914dd397
TypeScript
guiseek/angular-gamification
/src/services/progress-bar.service.ts
2.953125
3
import { Injectable } from '@angular/core'; @Injectable() export class ProgressBarService { public maxPoints: number = 0; public isFull: boolean; private updateFn: Function = () => { }; private startFn: Function = () => { }; constructor(maxPoints: number, updateFn?: Function, startFn?: Function) { this....
0bdf89c074f3c8a5480fd1953cd6f90f75eeda18
TypeScript
Mikkew/04-PipesApp
/src/app/ventas/pipes/ordernar.pipe.ts
2.578125
3
import { Pipe, PipeTransform } from '@angular/core'; import { Heroe } from '../interfaces/ventas,interface'; @Pipe({ name: 'ordernar' }) export class OrdernarPipe implements PipeTransform { transform(heroes: Heroe[], ordernarPor:string | null = null ): Heroe[] { switch (ordernarPor) { case "nombre": ...
a9feb44c20173372f7ffb655d9142c8aa61a6fbf
TypeScript
matt-moser/covid-projections
/scripts/compare_find_diff/find_diff.ts
2.796875
3
/* A throwaway script to generate file with 2 lists (before filling in missing data): 1. Fips included in county_adjacency_msa.json but not in 2018-census-fips-codes.json 2. Fips included in 2018-census-fips-codes.json but not in county_adjacency_msa.json (Fips in list #1 are those of U.S. territories not included in...
66ecfc83c0825a07f2e70e7bb28c15de23200a2f
TypeScript
jmacmahon/twitter-utils
/src/modules/muteRetweets.ts
2.59375
3
import { validate } from 'validate-typescript' import { Dict } from '../dict' import { Module } from '../module' import { TwitterClient } from '../twitterApiClient' type Params = { } const Params = (): Params => ({ }) export const defaultInjections = { consoleLog: console.log } export class MuteRetweets implemen...
37fc63016e473a8486688ab3f460e49e6d8c3714
TypeScript
RainheartLang2/hotaru-web-client
/client/src/common/beans/GoodsDocument.ts
2.546875
3
import Identifiable from "../../core/entities/Identifiable"; import {DocumentState} from "./enums/DocumentState"; import GoodsPackWithPrice from "./GoodsPackWithPrice"; import {ShipingType} from "./enums/ShipingType"; import CustomContainer from "../../core/beans/CustomContainer"; export default class GoodsDocument ex...
f62dff90f0ea86a77f87dc1df69fa3923cce8520
TypeScript
luckkiss/CookingGame_H5
/assets/Scripts/MVC/Test/CharacterInfo.ts
2.84375
3
const { ccclass, property } = cc._decorator; @ccclass export default class CharacterInfo { name: string = ''; leve: number = 1; constructor(names: string="", num: number=0) { this.name = names; this.leve = num; } }
f0497986e3be40b69afb6f80be55086bd851d23e
TypeScript
bmaximilian/jet-pack
/store/src/polyfill/constructorName.ts
2.9375
3
/** * Created on 2019-06-03. * * @author Maximilian Beck <maximilian.beck@wtl.de> */ /** * Polyfill for constructor name */ export function polyfillConstructorName() { if (Function.prototype.name === undefined && Object.defineProperty !== undefined) { Object.defineProperty(Function.prototype, 'name',...
b288e8cb7f8ef9fcecc5a887daf96b3b43463ba1
TypeScript
electronicSAINT/jabberwock
/packages/plugin-heading/src/HeadingXmlDomParser.ts
2.8125
3
import { HeadingNode } from './HeadingNode'; import { AbstractParser } from '../../plugin-parser/src/AbstractParser'; import { XmlDomParsingEngine } from '../../plugin-xml/src/XmlDomParsingEngine'; import { nodeName } from '../../utils/src/utils'; const HeadingTags = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6']; export class...
df3b74cdc73f79858ddad650ee476f5ffff49531
TypeScript
AlfredsJunior/Dynamics-365-Fraud-Protection-ManualReview
/frontend/src/models/item/purchase/geo-address.ts
2.796875
3
// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import { observable } from 'mobx'; import { getMiles } from '../../../utils/math'; import { Address } from './address'; export class GeoAddress { latitude?: number; longitude?: number; address: Address; @observable dista...
b9895e5fb32e3cdb353167d9adb366da57e7981d
TypeScript
manjirinamjoshi/notes-app
/src/utils/middleware.ts
2.6875
3
import { Request, Response, NextFunction } from "express"; import { validationResult, ValidationError } from "express-validator"; import { generate } from "shortid"; import { REQUEST_ID_HEADER, AUTHORIZATION_HEADER } from "../core/constants"; import { InputValidationError } from "../core/errors"; export const reqIdIn...
9625beeca461364d231048078179db3c36950df1
TypeScript
mmgoodnow/got-meme
/src/Search.ts
2.6875
3
import fetch from "node-fetch"; export default class ImageSearch { static url: string = "https://eastus.api.cognitive.microsoft.com/bing/v7.0/images/search"; static async searchImage(query: string) { try { // Fetches Items from Google Image Search URL let response = await fetch( `${this.url}?q=${encode...
07704a962147b1ff9655770afd97d3a54024e85d
TypeScript
admarket14/n6-geekinsider-be-alpha-6
/src/models/user.ts
2.640625
3
import { IUser } from '@/interfaces/IUser'; import mongoose from 'mongoose'; const User = new mongoose.Schema( { _id: { type: String, // This will the cognito user name itself which will be used as an id paramter required: true, unique: true }, email: { ...
4117b21e81ecbc6eab3e82535edaa1d2ec747569
TypeScript
friendsoftheweb/catalyst
/packages/catalyst/src/utils/resolveFileConflict.ts
2.703125
3
import inquirer from 'inquirer'; import chalk from 'chalk'; import diffExistingFile from './diffExistingFile'; export default async function resolveFileConflict( filePath: string, fileContent: string ): Promise<'overwrite' | 'skip'> { process.stderr.write('\n'); const config = await inquirer.prompt<{ reso...
806c3a7011ca46751b158721b6705a0b13879e30
TypeScript
malikdul/task-management
/src/tasks/task.mapper.ts
2.515625
3
import { Injectable } from "@nestjs/common"; import {plainToClass } from "class-transformer"; import { TaskDto } from "./task.dto"; import { Task } from "./task.entity"; @Injectable() export class TaskMapper { toDto(entity: Task): TaskDto { return plainToClass<TaskDto, Task>(TaskDto, entity); } t...
9128cea07f1267e62525fabb1d15c6d179ad8e04
TypeScript
FlyingTwigster/yummyplan.github.io
/components/SearchableList/SearchableMealList.ts
2.6875
3
import { Component } from 'vue-property-decorator' import { Meal } from '~/model/meal/Meal' import SearchableList from '~/components/SearchableList/SearchableList.vue' // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore @Component export default class SearchableMealList extends SearchableList<M...
61414a3ba5f05d4a3e68f26ef129ce58b8899729
TypeScript
future4code/Guilherme-Galan
/semana19/testes-business/aula64-testes-no-backend-ex-tarde-inicio/tests/UserBusiness/getAllUsers.test.ts
2.828125
3
import { UserBusiness } from "../../src/business/UserBusiness"; import { UserRole, User, stringToUserRole } from "../../src/model/User"; describe("Testing UserBusiness.getAllUsers", () => { let userDatabase = {}; let hashGenerator = {}; let tokenGenerator = {}; let idGenerator = {}; test('Should r...
8bfda3d960fc92ab8ada42c48fb61bbdeebf947e
TypeScript
vikuviku6666/todo-list
/src/app/displaytodo/displaytodo.component.ts
2.515625
3
import { Component, OnInit } from '@angular/core'; import { TodoService } from '../todos/todo.service'; import { Todo } from '../../models/todo.model'; import { Guid } from 'guid-typescript'; @Component({ selector: 'app-displaytodo', templateUrl: './displaytodo.component.html', styleUrls: ['./displaytodo.compone...
c6bba5f9b06352eb4649803b96251a7c1844ccf1
TypeScript
pafrias/40k-dice-roller
/src/Entities/Characteristic/Characteristic.ts
3.515625
4
import {rollD} from '../../helpers' export class Characteristic { D: number = 0; // Number of dice N: number = 0; // Number on the dice C: number = 0; // added constant constructor(str:string) { let {parseInt} = Number; // trim whitespace str = str.split(/\s/).join(''); // parseInt retu...
7c16c3dc0fd919e62bad133b7a784b037bca3c56
TypeScript
uncaught/doko
/packages/client/src/store/Games/DetectLastGameAndForcedSolo.ts
2.515625
3
import {Game, GameData, Player, RoundData} from '@doko/common'; import {PlayerStats} from '../Players'; import {findPlayerIndex} from '../Games'; export function detectLastGameAndForcedSolo( roundData: RoundData, gameData: GameData, sortedGames: Game[], newGameDealerId: string, activePlayers: Player[], pla...
5e2457201d4fafda198fdfba934f37abe6ee68ee
TypeScript
wrdsb/sorting-hat-functions2
/shared/findCreatesAndUpdates.ts
2.828125
3
import { isEqual } from "lodash"; async function findCreatesAndUpdates(context, calculation) { let newRecordsCount = Object.getOwnPropertyNames(calculation.records_now).length; let currentRecordsCount = Object.getOwnPropertyNames(calculation.records_previous).length; context.log('Find creates and updates....
dbc17efac36040b16b6906a79f78ec01c0c422f4
TypeScript
shaziajk/carbon-charts
/packages/core/src/model/meter.ts
2.578125
3
// Internal Imports import * as Configuration from '../configuration'; import { ChartModel } from './model'; import { Tools } from '../tools'; /** The meter chart model layer which extends some of the data setting options. * Meter only uses 1 dataset * */ export class MeterChartModel extends ChartModel { construc...
544c2e2b4d0a81d455bba2225b3f99e9f9afb608
TypeScript
brunano21/angular-4-data-table
/libs/datatable/src/utils/hide.ts
2.65625
3
import { Directive, ElementRef, Input, Renderer2 } from '@angular/core'; function isBlank(obj: any): boolean { return obj === undefined || obj === null; } @Directive({ selector: '[hide]' }) export class HideDirective { private _prevCondition = false; private _displayStyle: string; constructor(priv...
c614a2047d95b0db0cd191096172ee9410af8b4d
TypeScript
TencentCloud/tencentcloud-sdk-nodejs
/tencentcloud/services/captcha/v20190722/captcha_models.d.ts
2.875
3
/** * DescribeCaptchaOperData返回参数结构体 */ export interface DescribeCaptchaOperDataResponse { /** * 成功返回 0 其它失败 */ CaptchaCode: number; /** * 返回信息 注意:此字段可能返回 null,表示取不到有效值。 */ CaptchaMsg: string; /** * 用户操作数据 注意:此字段可能返回 null,表示取不到有效值。 */ Data: CaptchaOperDataRes;...
d7726ecc04171568fbafe07df336cd9f8d3a2315
TypeScript
vladimirlojanica/a12n-server
/src/privilege/formats/hal.ts
2.640625
3
import { Privilege } from '../types'; export function collection(privileges: Privilege[]) { const hal: any = { _links: { self: { href: '/privilege' }, item: [], }, }; for (const privilege of privileges) { hal._links.item.push({ href: '/privilege/' + privilege.privilege, titl...
2f3e5265e40444a2a05edbcac5cd920fd4d40129
TypeScript
csgpro/csgpro.com
/server/views/helpers/formatDate.ts
2.625
3
'use strict'; import * as moment from 'moment'; function formatDate(date: string | Date, format = 'MM/DD/YYYY'): string { if (arguments.length <= 2) { date = new Date(); if (typeof arguments[0] === 'string') { format = arguments[0]; } } return moment(date).format(format...
aee8fa3e1c2f84f62a9a6c63965a588aeeecb221
TypeScript
SomosCodear/checkout-api
/src/resources/ticket/processor.ts
2.5625
3
import { KnexProcessor, Operation, ResourceRelationship, JsonApiErrors } from "@joelalejandro/jsonapi-ts"; import Errors from "../../errors"; import Ticket from "./resource"; export default class TicketProcessor extends KnexProcessor<Ticket> { public resourceClass = Ticket; public async getById(id: string...
591ef2dc66b9917a21ae07162d547e9159e49eec
TypeScript
kasuparu/knowledge-brushup
/src/spec/bubble.spec.ts
2.90625
3
import { sort } from '../bubble'; const array = [4, 6, 1, 3, 8, 7, 2]; const sortedArray = array.slice().sort(); describe('bubble', () => { it('sorts', () => { const arrayCopy = array.slice(); sort(arrayCopy); expect(arrayCopy).toEqual(sortedArray); }); });
31119539caa7edb8f453e760b1a4342ef01ca8f3
TypeScript
josseas/ngrx-ie
/src/app/ingreso-egreso/ingreso-egreso.reducer.ts
2.734375
3
import { IngresoEgreso } from './ingreso-egreso.model'; import { Acciones, SET_ITEMS, UNSET_ITEMS } from './ingreso-egreso-actions'; import { AppState } from '../app.reducer'; export interface IeState { items: Array<IngresoEgreso>; } export interface AppState extends AppState { ie: IeState; } const estad...
de0bb2637c138e6d81cd0bf7def85fba3076096f
TypeScript
dividab/abstract-visuals
/packages/abstract-document/src/abstract-document/atoms/text-field.ts
2.96875
3
import * as TextStyle from "../styles/text-style"; export type FieldType = "Date" | "PageNumber" | "TotalPages" | "PageNumberOf"; export interface TextField { readonly type: "TextField"; readonly styleName: string; readonly fieldType: FieldType; readonly style: TextStyle.TextStyle; readonly target: string; ...
1eb1c3544b0f1633223ddd12e0fac3e703d8b7a5
TypeScript
RamiroPastor/portfolio_shopeame
/src/app/pipes/filter-names.pipe.ts
2.65625
3
import { Pipe, PipeTransform } from '@angular/core'; import { Product } from './../shared/models/Product'; @Pipe({ name: 'filterNames' }) export class FilterNamesPipe implements PipeTransform { transform(productList: Product[], filterText: string): Product[] { const filterT: string = filterText.toLowerCase(...
9627b76f8bc6b20e37eeaab13e040bd7c4a311c1
TypeScript
Gerasik/NETFLIX-roulette
/src/models/MoviesResponse.ts
2.515625
3
import Immutable from 'immutable'; import { Movie, MovieMap } from './Movie'; export type MoviesData = Movie[]; export type MoviesDataMap = Immutable.List<MovieMap>; export type MoviesResponse = { data: MoviesData; total: number; offset: number; limit: number; }; export type MoviesResponseMap = Immutable.Re...
8196b69ddafca251dbf20e791172e2b503b6369b
TypeScript
TIBCOSoftware/TCSTK-Angular
/projects/tibco-tcstk/tc-core-lib/src/lib/common/tc-core-common-functions.ts
2.703125
3
import {HashLocationStrategy, Location} from '@angular/common'; import {TcComponent} from '../models/tc-component'; // @dynamic export class TcCoreCommonFunctions { public static escapeString(text) { return text.replace(/"/g, '\"'); } public static fileSizeToHuman(size) { const e = (Math.log(size) / M...
0896364086e6b83c3ef1b4dafc63123059540a62
TypeScript
ULL-ESIT-INF-DSI-2021/ull-esit-inf-dsi-20-21-prct07-menu-datamodel-grupo-a
/src/food.ts
3.40625
3
import { macroType, locationType, Printable, Identifiable} from './helpers'; /** * @description Class that handles Food, that implements Printable and * Identifiable interfaces. */ export abstract class Food implements Printable, Identifiable { /** * @description Food class constructor * @param name Consist...
92e82e3c04339e8ee78c9f1378d7488e988ab842
TypeScript
iceboss3d/finloan
/src/guarantor/guarantor.entity.ts
2.515625
3
import { ApplicationEntity } from "src/application/application.entity"; import { Column, CreateDateColumn, Entity, OneToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; @Entity('guarantor') export class GuarantorEntity { @PrimaryGeneratedColumn('uuid') id!: string; @CreateDateColumn() c...
dd931e8359ab4e6820a6a43d2bcad99dca4937ea
TypeScript
rokicki/kpuzzle.js
/src/parser.ts
2.6875
3
import {KPuzzleDefinition} from "./kpuzzle" import {parse as jison_parse} from "./jison_parser"; function FixMoves(def: KPuzzleDefinition) { for (var moveName in def.moves) { var move = def.moves[moveName] ; for (var orbitName in def.orbits) { var moveOrbit = move[orbitName] ; var oldO...
61174c2e9db5599da8adbefe117e545745011359
TypeScript
ronitsingh2001/ERP-client
/src/app/services/department.service.ts
2.515625
3
import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; import { HttpClient } from '@angular/common/http'; import { map, take, tap } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class DepartmentService { url = `http://localhost:8080/` _fields = new BehaviorSubject...
c99c4107d180bee88d3e631d7854302872a4c460
TypeScript
vsaase/cornerstoneTools
/types/store/modules/segmentationModule/getSegmentsOnPixeldata.d.ts
2.75
3
/** * Returns an array of the segment indicies present on the `pixelData`. * @param {UInt16Array|Float32Array} pixelData The pixel data array. */ export default function getSegmentsOnPixelData(pixelData: any | Float32Array): any[];
5817c7877a83608143792d5c166155b86ff5e7be
TypeScript
tesla-1st-code/socpred
/helpers/data.ts
2.65625
3
import { readFileSync } from "fs"; const seasons = ['1718', '1819']; export class DataHelper { static getSeasonData(prefix) { let data = []; for (let j=0; j<seasons.length; j++) { let seasonData = JSON.parse(readFileSync('../data/' + prefix + seasons[j] + '.json').toString()); ...
d978346617736485b7fcacf18548c926b358208d
TypeScript
screenleon/javascript
/angular/itHelp/Angular30Days/Angular30DaysECApplication/src/app/checkout/receipt-info/receipt-info.component.ts
2.578125
3
import { Component, OnInit } from '@angular/core'; import { appPath } from '../../app-path.const'; import { SendType } from './send-type.enum'; @Component({ selector: 'app-receipt-info', templateUrl: './receipt-info.component.html', styleUrls: ['./receipt-info.component.css'] }) export class ReceiptInfoComponent...
81aef5e669737e3873fff598cc91d175a8ff0fd6
TypeScript
magauran/forteen
/src/utils/Keyboard.ts
2.53125
3
/* eslint-disable */ export const KEYBOARD_DID_OPEN = 'keyboardDidShow' export const KEYBOARD_DID_CLOSE = 'keyboardDidHide' const KEYBOARD_THRESHOLD = 150 let previousVisualViewport: any = {} let currentVisualViewport: any = {} let previousLayoutViewport: any = {} let currentLayoutViewport: any = {} let keyboardOpen...
391fcc221d0dcba9c25f01df352098c4f0561990
TypeScript
PatrykPasterny/BertTest
/BertoniTest/Scripts/Repositories/CommentRepository.ts
2.59375
3
import { HttpHelper } from "../Helpers/HttpHelper.js"; import { Comment } from "../Models/Comment.js"; export class CommentRepository extends HttpHelper { constructor() { super(); let self = this; self.baseUrl += "api/photo" } async getAllPhotos(): Promise<Comment[]> { le...
66af833d2e71d33be30d0d0b8549c6ef2b5c20e6
TypeScript
infojunkie/quizzical
/src/entity/Question.ts
3.125
3
import { Column, Entity, ManyToOne, PrimaryGeneratedColumn, TableInheritance } from 'typeorm'; import {Skill} from './Skill'; import {Helpers} from '../Helpers'; export class AnswerEvaluation { // Automatic constructor arguments // https://www.stevefenton.co.uk/2013/04/Stop-Manually-Assigning-TypeScript-...
b584f07c28297b63ed329026598091676ca46a37
TypeScript
nkleemann/p5-tone-starter
/src/mover.ts
3.140625
3
import * as p5 from "p5"; export class Mover { p: p5; mass: number; position: p5.Vector; velocity: p5.Vector; acceleration: p5.Vector; color: p5.Color; constructor(p: p5, _x: number, _y: number, _m: number) { this.p = p; this.m...
cf843cf200ad5f38c8fd07723dae6c96a7b775d9
TypeScript
keilaloia/helpDesk
/src/Components/_tools/fetchPUT.ts
2.6875
3
import { async } from "q"; // var data : any; //use a T template class so that we can pass in any json object being sent from the server! export const httpPUT = <T> (url: string, data: any): Promise<T> => { return new Promise(resolve => { fetch(url, { method: 'PUT',...
7c65e2620c01700bc709de1629517bfcfaa72ff7
TypeScript
gocd/gocd
/server/src/main/webapp/WEB-INF/rails/webpack/models/mixins/errors.ts
2.53125
3
/* * Copyright 2023 Thoughtworks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agr...
23da5ff8dcadd741250d387b231cf78213977ac2
TypeScript
temple-deng/dsa
/js2/leetcode/236.ts
3.875
4
/** * @file 236. 二叉树的最近公共祖先 * @link https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree/ */ class TreeNode { val: number left: TreeNode | null right: TreeNode | null constructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) { this.val = (val===...
836e376d3a3853731b703865be79384bcb1228cf
TypeScript
lukecaptaincode/SuperTodoWorld
/src/app/services/super-todo.service.ts
3.140625
3
import { Injectable } from '@angular/core'; import { TodoItem } from '../classes/todo-item'; import { Storage } from '@ionic/storage'; @Injectable({ providedIn: 'root' }) /** * @class SuperTodoService - Service class that manages all the todo list interactions */ export class SuperTodoService { todoItems: TodoIte...
e30136cd86c58a9203b8ff86045c17e8082a98ee
TypeScript
Softeq/angular-libs
/projects/angular-mls-ri-lib/src/lib/utils.ts
2.546875
3
// Developed by Softeq Development Corporation // http://www.softeq.com import { Hash, Maybe } from '@softeq/types'; import isEmpty from 'lodash/isEmpty'; export interface RiMlsRecordNormalized { key: string; params?: Hash<any>; } export type RiMlsRecord = RiMlsRecordNormalized | string; export function normali...
6de25624b3b88a0362c441872efb8ddd2d03fad2
TypeScript
Zuodion/HammingEncoder
/EncoderDecoder.ts
2.953125
3
class EncoderDecoder { private _matrix: Array<number>; private _converterFromBinary: ConverterFromBinary; private _logger: Logger; private _introduceError: boolean = false; private _introduceDoubleError: boolean = false; private _errorData: string = ''; constructor(matrix: Matrix, converterF...
0f551d1c585761539c748657571cb63359e3264a
TypeScript
morerokk/vgwdb-client
/src/app/models/weapon.model.ts
2.9375
3
import { Model } from './model.interface'; export class Weapon implements Model { private _id: number; private _name: string; private _description: string; private _imagePath: string; private _designed: string; private _manufacturer; private _games; constructor(values: Object = {}) { Object.assig...
ce3d4f829d5c63660ef44608701c91ab6f896c15
TypeScript
VinayaSathyanarayana/cube.js
/packages/cubejs-query-orchestrator/src/orchestrator/LocalCacheDriver.ts
2.859375
3
import { CacheDriverInterface } from './cache-driver.interface'; const store = {}; export class LocalCacheDriver implements CacheDriverInterface { protected readonly store: Record<string, any>; public constructor() { this.store = store; } public async get(key: string) { if (this.store[key] && this.s...
a9feb2f462f7b6d6b683539ee8ab8df32d616ab8
TypeScript
mikepuerto/orderbook-analysis
/src/univariate/univariate.ts
2.90625
3
// Univariate Analysis import { median, quantileSorted, variance, sampleVariance, linearRegression, sampleSkewness, sampleKurtosis, } from 'simple-statistics'; import { OrderBookExtended, Order, linearRegressionResult } from '../types'; export const Univariate = { medianByAsksPrice: (Orderbook: OrderBo...
72a54231b66c1c8eb2c96379560a2d2c68a37230
TypeScript
RyenToretto/blossom
/src/models/hsv/transform.ts
3.5
4
import { round } from "@util/helpers"; import type { ColorHSV, ColorRGB, ColorHSL } from "../../types"; /** * Convert HSV color object to RGB. */ export function hsv2rgb(color: ColorHSV): ColorRGB { const h = (color.h / 360) * 6; const s = color.s / 100; const v = color.v / 100; const a = color?.a ?? 1; const ...
e80cbb7ea469a90d42698055ecca0121c245e255
TypeScript
neefrehman/generative
/src/sketches/utils/shaders/types.ts
3.140625
3
import type { Vector } from "Utils/math/types"; export type UniformDimensions = "1" | "2" | "3" | "4"; export type UniformValueType = "f" | "i" | "fv" | "iv"; export type UniformType = `${UniformDimensions}${UniformValueType}`; export type UniformValue = number | Vector | Float32List | Int32List; /** * A uniform va...
f7b5c19ff30c2c6a2496e0f90505614d12015443
TypeScript
kraftwerk28/blcklstbot
/lib/fetch.ts
2.8125
3
import { request, RequestOptions } from "https"; import qs from "querystring"; type RestMethod = | "GET" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "DELETE" | "PATCH"; export function rest<T>( url: string, method: RestMethod, headers: Record<string, string> = {}, query?: Record<string, any>, body...
0ce273584d1effc320aa930982ddefb40870eed7
TypeScript
green-fox-academy/Kifrido
/week-02/day-3/starry-night-ts.ts
3.21875
3
'use strict'; const canvas = document.querySelector('.main-canvas') as HTMLCanvasElement; const ctx = canvas.getContext('2d'); // DO NOT TOUCH THE CODE ABOVE THIS LINE // Draw the night sky: // - The background should be black // - The stars should be small squares // - The stars should have random positions on t...
1fd1a920a0eb6d6c31c0925d343335f62ae6efba
TypeScript
hemant-batra/kiteAdminUI
/src/app/kitecash/services/common/data.service.ts
2.546875
3
import {Injectable} from '@angular/core'; @Injectable() export class DataService { private userRole: string = null; private userName: string = null; private fullName: string = null; private mobileNumber: string = null; private message: string = null; public getUserRole() { return this.u...
d5cb41740d677c9ca745e3f311020198565071fe
TypeScript
robsonmvieira/book-store-api
/src/modules/roles/roles.service.ts
2.546875
3
import {BaseService} from '../../infra/BaseService.service' import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import { Role } from './entities/role.entity'; import { CreateRoleDto } from './dto/create-role.dto'; import { Permission } f...
a78b40aeed548d5a846128741050ebae21fb0af2
TypeScript
entropitor/ddd-course
/typescript/index.spec.ts
3.109375
3
// Scenario: Online Reservation // The system lists movies available with given time interval, title and screening times and prices. // The user chooses a particular screening. // The system gives information regarding screening room and available seats. // The user chooses seats, and gives the name of the person doing...
2bb9e53e1599d1ca57aa8bb13fa2fe62e89b70bb
TypeScript
scottbenton/Pomodoro
/src/store/pomodoro-settings.store.ts
2.625
3
import { produce } from "immer"; import { create } from "zustand"; import { persist } from "zustand/middleware"; export enum CYCLES { WORK = "work", BREAK = "break", LONG_BREAK = "long-break", } export interface IPomodoroSettingsStore { playAudioOnCycleEnd: boolean; togglePlayAudioOnCycleEnd: (shouldPlayAud...
3a43cb5f64d9ab173e59fc60fe7f4a2455f3594d
TypeScript
sanathyadav/linked_list
/src/list.ts
3.734375
4
class Item<T> { value: T; next: Item<T> | null; constructor(value: T) { this.value = value; this.next = null; } } export default class List<T> { private head: Item<T>; private size: number; constructor(item: T) { this.head = new Item(item); this.size = 1; } private getHead() { re...