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
6a27945f8950d1e990b5abece4965663164aa45f
TypeScript
higa4/wikidata-mall-telegram-game
/source/lib/interface/notification.ts
2.59375
3
import {Notification} from '../types/notification' import {countdownHourMinute} from './formatted-time' import {emojis} from './emojis' export function notificationText(notification: Notification, fireDate: Date): string { const millisecondsUntil = notification.date.getTime() - fireDate.getTime() const secondsUntil...
ad0a8b5eb01f2eda7bd3fec3121427bf5ee1fe98
TypeScript
alenaksu/tiny-lit
/packages/core/src/utils.ts
2.84375
3
import { TemplateInterface } from './types'; export function comment(data: string = ''): Comment { return document.createComment(data); } export function text(data: string = ''): Text { return document.createTextNode(data); } export function isNode(obj: any, type?: number): boolean { return ( !!o...
5c982e2fc7daefda2bc75b19a957d3fb0e189841
TypeScript
aportraitofjoyce/todolist
/src/store/reducers/tasks-reducer/tasks-reducer.test.ts
2.671875
3
import { createTask, deleteTask, fetchTasks, Tasks, tasksReducer, updateTaskStatus, updateTaskTitle } from './tasks-reducer' import {TaskResponse} from '../../../api/tasks-api' import {addTodolist, removeTodolist, setTodolists} from '../todolists-reducer/todolists-reducer' import {TaskStatuses} from...
e1be54fd987c82fe9556dbf62d667a55cb114ddf
TypeScript
Fabrice-TIERCELIN/typescript-plugins-of-mine
/typescript-plugin-proactive-code-fixes/spec/tests/newExpr.ts
3.28125
3
// not an issue - just use getFullStart, getFullWidth, etc import Project, { TypeGuards, Identifier } from 'ts-morph'; const project1 = new Project({ useVirtualFileSystem: true }) const sourceFile = project1.createSourceFile('src/index.ts', ` class A{ } new A().foo() const oo = { bar: 1 } `) const id = sourceFi...
0fe4a6d34a6700edef3832829383164bae9a7347
TypeScript
k5trismegistus/mangashuraku
/api/src/utils/genThumbnail.ts
2.609375
3
import * as imagemagick from 'imagemagick' import { PathLike } from 'fs' import { basename, join } from 'path' export const genThumbnail = ( originalPath: string, dstDir: string, width: number ): Promise<any> => { return new Promise((resolve, reject) => { const filename = basename(originalPath) imagem...
2b7aff17ccb92302783b200f64c7a58f37f2a777
TypeScript
validated-changeset/validated-changeset
/test/utils/object-without.test.ts
3
3
import objectWithout from '../../src/utils/object-without'; describe('Unit | Utility | object without', () => { it('it excludes the given keys from all merged objects', () => { const objA = { name: 'Ivan' }; const objB = { name: 'John' }; const objC = { age: 27 }; const objD = objectWithout(['age'], ...
9e6511fa53afa429ad8ee7428d4672ca957a36fe
TypeScript
warigaya-kenji/kitamura
/src/logic/web-storage.ts
3.265625
3
/** * ソートする * @param list 一覧 */ const _sort = (list: Array<{ index: number }>): Array<any> => { if (list && list.length > 0 && Object.prototype.hasOwnProperty.call(list[0], 'index')) { const sortList = list.sort((a, b) => { if (+a.index < +b.index) return -1; if (+a.index > +b.index) return 1; ...
53a51c53ba3ac5bd00fb0de296d5606457dd0036
TypeScript
piesome/valta
/src/Common/Types/TerrainTypes.ts
2.5625
3
import {TerrainType, TypeManager} from "."; export class TerrainTypes extends TypeManager<TerrainType> { constructor() { super(); this.typeName = "terrain"; } public transformRaw(data: any): TerrainType { return new TerrainType( data.name, data.movementCost,...
61b22c8af309a3185e47daad0f9b46f83dd68b0b
TypeScript
hzoo/babel
/packages/babel-helper-annotate-as-pure/src/index.ts
2.703125
3
import * as t from "@babel/types"; import type { Node } from "@babel/types"; const PURE_ANNOTATION = "#__PURE__"; const isPureAnnotated = ({ leadingComments }: Node): boolean => !!leadingComments && leadingComments.some(comment => /[@#]__PURE__/.test(comment.value)); export default function annotateAsPure( pat...
19fd1fa2c41d5999ed02181099698c74aeae9c1e
TypeScript
osedhelu/BackendTypeScript
/src/app/_function/bcryptjs.ts
2.625
3
import * as bcryp from 'bcryptjs' export class PassFn { comprar(password1: string, password2: string) { return bcryp.compareSync(password1, password2) } async generate(password1: string) { return bcryp.hashSync(password1, 10) } }
28451c21f0e10302e431fe76d09c116cd7269478
TypeScript
otawang/typescript-study-source
/src/chapter1/chapter1.ts
3.96875
4
let isDone : boolean = false; let decimal: number = 6; let hex: number = 0xf00d; let binary: number = 0b10; let octal: number = 0o71; let color: string = 'blue'; color = 'red'; let fullName: string = 'Dongwoo Seo'; let age: number= 38; let sentence : string = `Hello, my name is ${fullName}. I'll be ${age + 1} years...
d7cfba8dd5457ffa3901c4f2ccacae30019db6dd
TypeScript
JHSeo-git/catch-a-nest
/packages/catch-a-nest-backend/src/entity/User.ts
2.8125
3
import { generateToken } from '@src/lib/token/jwt'; import { Entity, PrimaryGeneratedColumn, Column, Index, CreateDateColumn, UpdateDateColumn, getRepository, } from 'typeorm'; import { AuthToken } from './AuthToken'; @Entity({ name: 'users' }) export class User { @PrimaryGeneratedColumn() id!: numbe...
764b40d1fc0e030b8fc8dde84984077790a0947a
TypeScript
okal/plottable
/test/components/xDragBoxLayerTests.ts
2.59375
3
///<reference path="../testReference.ts" /> describe("Interactive Components", () => { describe("XDragBoxLayer", () => { let SVG_WIDTH = 400; let SVG_HEIGHT = 400; it("bounds()", () => { let svg = TestMethods.generateSVG(SVG_WIDTH, SVG_HEIGHT); let dbl = new Plottable.Components.XDragBoxLaye...
79c7dfb2dc6b69b109029c030cd98401346c6318
TypeScript
green-fox-academy/OrgovanGeza
/week-03/day-03/Exercises/Pokémon/main.ts
3.65625
4
import { strictEqual } from 'assert'; import { Pokemon } from './Pokemon' let pokemonOfAsh: Pokemon[] = initializePokemon(); // Every pokemon has a name and a type. // Certain types are effective against others, e.g. water is effective against fire. // Ash has a few pokemon. // A wild pokemon appeared! let wildPoke...
6312cfab38319941e4f45e5b6c0846ee1b62caaa
TypeScript
LoicMahieu/yup-locales
/src/locales/de.ts
3.0625
3
/*eslint-disable no-template-curly-in-string*/ /** * This work is derived from skress/yup-locale-de. * https://github.com/skress/yup-locale-de/ */ import printValue from '../util/printValue'; import { LocaleObject, FormatErrorParams } from 'yup'; // Based on https://github.com/jquense/yup/blob/2973d0a/src/locale.j...
093c44baae82b03100ead672cd55deef7a0aff18
TypeScript
SirPepe/html-import
/src/html-import.ts
2.609375
3
import { define, attr, href, string, reactive, event, } from "@sirpepe/schleifchen"; type State = "loading" | "done" | "fail" | "ready"; type Handler<E extends Event> = ((evt: E) => void) | null; type PromiseResponse = { element: HTMLImportElement; title: string; }; type FulfillmentCallbacks = [ R...
e153fd199f6817f8a3029936d700b473e8e937f7
TypeScript
BPesik/Playground
/react-app/src/store/online-status/reducers.ts
2.796875
3
import { UPDATE_ONLINE, OnlineStatusActionTypes, OnlineStatusState } from './types' export const initialOnlineStatusState: OnlineStatusState = false; export function onlineStatusReducer( state = initialOnlineStatusState, action: OnlineStatusActionTypes ): OnlineStatusState { switch (action...
1795336e4038669eeb1d0cb2a52608eaf1b39a2d
TypeScript
sajedsoliman/my-diary
/src/backends/Store.ts
2.5625
3
import { useState, SetStateAction, Dispatch } from "react"; // Router import { useHistory } from "react-router-dom"; // firebase import { db, firebase, auth, storage } from "./database"; // contexts import { AuthUser } from "contexts/UserContext"; import { useDiary } from "./../contexts/DiaryContext"; // types impo...
261904f0067158836e8fb8c86a6cc9177a1a4368
TypeScript
Kushagra767/website-2
/src/app/utils/subscription.ts
2.640625
3
import { Subscription } from 'rxjs'; export type PossibleSubscription = Subscription | undefined | null; export const unsubscribe = (subscriptions: PossibleSubscription | PossibleSubscription[]) => Array.isArray(subscriptions) ? subscriptions.map(unsubscribe) : subscriptions ? subscriptions.unsubscribe() : v...
d1e83fba60f3f9d17d01e6fd83a7ce48dc9f0d75
TypeScript
taylor928908/miggmagg-backend
/src/services/rouletteService.ts
2.640625
3
import {IRoulette} from '../interfaces/roulette' import {Roulette} from '../models' import {PointService, UserService} from '../services' import {db} from '../loaders' async function calculateRoulette(userId: number): Promise<{id: number}> { const connection = await db.beginTransaction() try { const roulette =...
b7d31b82f2bd0040e327f671edb00fa318af6664
TypeScript
islamailani/invoicer
/src/app/store/actions/app.actions.ts
2.75
3
import { Action } from '@ngrx/store'; export enum AppActionTypes { CheckUpdateAvailable = '[App] Check Update available', SetUpdateAvailable = '[App] Set Update available' } export class CheckUpdateAvailable implements Action { readonly type = AppActionTypes.CheckUpdateAvailable; } export class SetUpdateAv...
9ac08cb3c83a45c35bf2c3bcb3cd0fca1c0c0ba5
TypeScript
ppara1/Production-Angular
/apps/movies/src/app/+state/movies.reducer.spec.ts
2.84375
3
import { MoviesEntity } from './movies.models'; import * as MoviesActions from './movies.actions'; import { State, initialState, reducer } from './movies.reducer'; describe('Movies Reducer', () => { const createMoviesEntity = (id: string, name = '') => ({ id, name: name || `name-${id}`, } as Movi...
ab1ef57653a971aa0fe45395f82d0f7dc7342010
TypeScript
lukou-frontend/react-weui-ts
/build/es/components/cell/cell_header.d.ts
2.578125
3
import * as React from 'react'; import PropTypes from 'prop-types'; /** * Header of `Cell` * */ interface CellHeaderProps { className?: any; primary?: boolean; children?: React.ReactNode; style?: React.CSSProperties; [key: string]: any; } declare const CellHeader: { (props: CellHeaderProps): ...
a2929133f7adf60db5b2a18010348b59460c4edf
TypeScript
farukh110/Recipe-Angular-App
/src/app/shopping-list/shopping.model.ts
2.984375
3
export class Shopping { public productName: string; public productAmount: number; constructor(productName: string, productAmount: number) { this.productName = productName; this.productAmount = productAmount; } }
0ff5a11515e0ad382f8b75dff58547dc83ad55c8
TypeScript
laginha87/habit-tracker
/src/App/selectors.ts
2.71875
3
import { State } from "../reducer"; import { DayResult, DayData } from "../model/types"; import { DateTime } from "luxon"; import { createSelector } from "reselect"; import { List } from "immutable"; export const getDays = (state: State) => state.app.days; export const getDate = (state: State) => state.app.day; export...
fa324aa4300e0576466628274f16dae2436e12ac
TypeScript
ustaxcourt/ef-cms
/shared/src/business/utilities/DateHandler.formats.test.ts
2.6875
3
import * as DateHandler from './DateHandler'; const { createISODateString, formatDateString, FORMATS, prepareDateFromEST } = DateHandler; import { JoiValidationConstants } from '../entities/JoiValidationConstants'; describe('DateHandler', () => { describe('Date Formats', () => { let realDateNow; const mock...
7aea52a149655baf436be9f31cc6cf3135c4171d
TypeScript
genesfa/meiern
/common-lib/lib/Player.d.ts
2.53125
3
export declare class Player { name: string; id: number | null; constructor(name: string, id?: number | null); } export declare class SetPlayerNameAction { readonly name: string; static readonly type: string; constructor(name: string); } /** * Socket response for SetPlayerName * Contains Player...
7cfd77b071d93babd31db6c2732a35e54ba9ed27
TypeScript
danielo515/ergodox-configurator
/src/modules/ui.ts
2.84375
3
type State = { readonly importDialogOpen: boolean; }; const initialState: State = { importDialogOpen: false }; const prefix = "[ui]"; export const OPEN_IMPORT_DIALOG = `${prefix} OPEN_IMPORT_DIALOG`; const openImport = () => ({ type: OPEN_IMPORT_DIALOG }); export const CLOSE_IMPORT_DIALOG = `${pref...
0f924bde39d5caccfd86d24f3fe10585e47b4aee
TypeScript
Irokotia/angular-tour-des-heroes
/src/app/data/serializable.ts
2.515625
3
/** * Created by fbm on 10/02/17. */ export class Serializable { fromJSON(json) { for (const propName in json) { if (json.hasOwnProperty(propName)) { this[propName] = json[propName]; } } return this; } }
977d6a9e286cbab1cc1a8a8bae9482b38610cd4e
TypeScript
madmonkey/RetailSDK
/POS/Extensions/SequentialSignature/Handlers/PostSignatureRequestHandler.ts
2.703125
3
/** * SAMPLE CODE NOTICE * * THIS SAMPLE CODE IS MADE AVAILABLE AS IS. MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED, * OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY. * THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE...
64252df98e3a20b18877d5cea01d71aa14b21209
TypeScript
iamthismarvin/craftsmith
/src/store/modules/character.ts
2.828125
3
import { db } from '@/database'; import { CharacterState, Stats } from '@/utilities/interfaces'; export default { namespaced: true, state: { id: null, name: null, experience: null, stats: { dexterity: null, intelligence: null, stamina: null, strength: null, }, }, get...
412d22285d7976ec2e79cf95ef9f64ca56771cd7
TypeScript
dantehemerson/flash-cards-backend
/src/modules/card/card.network.ts
2.515625
3
import { Router } from 'express' import { response } from '../../response' import { createCard, findCards } from './card.controller' import { ConflictException } from '../../exceptions/conflict.exception' import { HttpException } from '../../exceptions/http.exception' export const cardRouter = Router() cardRouter.get...
233d0010533c8c7ebdbe9ef0de29cfad82ebc1fa
TypeScript
saldyy/graphql-practice
/be/src/resolver/author/AuthorResolver.ts
2.75
3
import { Author } from "entity/Author"; import { Book } from "entity/Book"; import { Arg, Mutation, Query, Resolver, InputType, Field, Authorized, } from "type-graphql"; import { Like } from "typeorm"; import { AuthorInput, AuthorQueryInput } from "./AuthorInput"; @Resolver(Author) export class AuthorResolver {...
69a8ae82059186506893d3c6a266e94de48481c6
TypeScript
keindev/codecolor.js
/src/utils.ts
3.203125
3
import { IToken } from './types.js'; const isCross = (a: IToken, b: IToken): boolean => a.start >= b.start && a.start <= b.end && a.end >= b.end; const isIncludedIn = (a: IToken, b: IToken): boolean => a.start >= b.start && a.end <= b.end; export const half = (value: number): number => ~~(value / 2); export const com...
9d6a237857dc31c9637bc981c3a3ef6fa9f51d8e
TypeScript
braintree/credit-card-type
/src/lib/is-valid-input-type.ts
2.96875
3
export function isValidInputType<T>(cardNumber: T): boolean { return typeof cardNumber === "string" || cardNumber instanceof String; }
71e5ae65a551731be3d1f343c4ca6603cb5ac640
TypeScript
Shunseii/express-mods-server
/src/seeds/create-mock-games.seed.ts
2.65625
3
import { Factory, Seeder } from "typeorm-seeding"; import { Game } from "../entities/Game"; import { Mod } from "../entities/Mod"; import { User } from "../entities/User"; import { GameFactoryContext } from "../factories/game.factory"; import { getRandomArrElement, getRandomNumBetween, } from "../utils/getRandomNu...
7c0cef287146b246f4f9565ff5858d9937697e09
TypeScript
ishabo/swapp
/src/store/swapi/reducers/index.ts
2.640625
3
import { Action } from 'redux'; import { actionTypes } from '../actions'; export interface ISwapiPerson { name: string; height: string; mass: string; hair_color: string; skin_color: string; eye_color: string; birth_year: string; gender: string; homeworld: string; films: string[]; species: string[...
00f8f17e065ac944278f0ccadc721b690df8619f
TypeScript
leorrose/HStyle
/app/client/src/app/team-members/team-members.component.ts
3.015625
3
import { TeamMemberService } from '../services/team-member.service'; import { TeamMember } from './../models/team-member'; import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-team-members', templateUrl: './team-members.component.html', styleUrls: ['./team-members.component.css'] ...
0a34f8c40002c4fba8cd65e835978c5dee467457
TypeScript
therealmbittarelli/design-patterns-exploration
/observer/observer.ts
3.984375
4
// Observer pattern enables objects to 'subscribe' to be notified about state change events // (and unsubscribe) interface Subject { // Attach observer to the Subject attach(observer: Observer): void; // Detach observer to the Subject detach(observer: Observer): void; // Notify all attached obser...
26ad97b507e6a224794b7022eddf39a0f80aaf30
TypeScript
michalczukm/mock-the-api-for-front-end-devs-presentation
/client/mock-api-client/src/app/notes/shared/note-type.pipe.ts
2.6875
3
import { Pipe, PipeTransform } from '@angular/core'; import { NoteType } from './note-type.model'; @Pipe({ name: 'noteType' }) export class NoteTypePipe implements PipeTransform { transform(value: NoteType): string { switch (value) { case NoteType.Meeting: return 'Meeting'; case NoteType.P...
f8381dff1919806cea179a0f8eed3433c811a23e
TypeScript
victorvivenzio/angularexamples
/8. Formularios/src/app/components/data/data.component.ts
2.8125
3
import { Component } from '@angular/core'; import { FormArray, FormControl, FormGroup, Validators } from '@angular/forms'; import {Observable} from 'rxjs/Observable'; @Component({ selector: 'app-data', templateUrl: './data.component.html', styles: [] }) export class DataComponent { public form: FormGroup; ...
c35f1c8a5dded546eac8a1daf5026712fe77b744
TypeScript
Parez/mean-stack-ngrx-citations
/src/app/models/citation.ts
2.53125
3
import {User} from "./user"; /** * Created by baunov on 14/10/16. */ export class Citation { //public static curId = 0; public _id:String = ""; constructor(public text:String = "", public author:String = "Unknown", public user:User = new User("Anonymous"), public tags:...
449acfafb7ef8f2bf6233e6548464f66e717e909
TypeScript
Sansossio/twisted
/src/models-dto/status/status-v4/lol-status-content.dto.ts
2.625
3
/** * Lol Status Content dto */ export class LolStatusContentDTO { /** * Incident or Maintance status language * (e.g. `en_GB`) */ locale: string /** * Incident or Maintance * (e.g. `Account Transfers Unavailable`) */ content: string }
de6a3cd9df493f94af9adcfae9eb3cf8d12faff4
TypeScript
ildaro/Fitness-App
/src/app/services/storage.service.ts
2.640625
3
import { Injectable } from '@angular/core'; import { Storage } from '@ionic/storage'; export interface Item { id: number, title: string, value: string, modified: number } export interface Exercise { id: number, name: string, description: string, sets: number, reps: number, modified: number, } c...
165ed4919067c606826c1a0b559f6187c119457f
TypeScript
pulumi/pulumi-datadog
/sdk/nodejs/monitorConfigPolicy.ts
2.515625
3
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; import * as utilities ...
0e1ccbfe37267d796c4ece69224023e4574e592f
TypeScript
ccmikechen/typescript-design-pattern
/factory_method/weaponFactory.ts
3.8125
4
export abstract class Weapon { weaponType: string; length: number; constructor(weaponType: string, length: number) { this.weaponType = weaponType; this.length = length; } getInfo(): string { return `Type: ${this.weaponType} - ${this.length} cm`; } } class Sword extends Weapon { constructor(...
80357477ca7f566a2fbc6788877ff036e9e1ed99
TypeScript
Error-331/code_tests
/src/type_script/functions.ts
3.484375
3
'use strict'; export default async () => { interface Person { name: string; surname: string; age: number; docs: string[]; } interface Register { addBeforeRegisterListener(onBeforeRegister: (this: void, registerNumber: number) => void): void; } class Car {...
e55c36e425d5d433d148980df6591ecf19b5d6bc
TypeScript
alyron/dc_laya_projects
/2DGame/src/framework/serialize/LocalValue.ts
2.75
3
module dc { /** * 本地数据 * @author hannibal * @time 2017-7-15 */ export class LocalValue { private static m_GlobalKey:string = ""; /** * 设置全局id,用于区分同一个设备的不同玩家 * @param key 唯一键,可以使用玩家id */ public static SetGlobalKey(key:string):void { ...
ba73f72cd6d2b7753a6537f823a3cfb79a236d7a
TypeScript
herculesinc/credo.io-emitter
/index.ts
2.78125
3
"use strict"; // IMPORTS // ================================================================================================ import * as redis from 'redis'; import * as msgpack from 'msgpack-js'; import * as uid2 from 'uid2'; // INTERFACES // ============================================================================...
156354271e20dc3da27ace472b551e9f4b53cde0
TypeScript
copquesz/usjt-automato
/src/app/model/note.model.ts
3.046875
3
export class Note { id: number; x: number; y: number; w: number; h: number; value: number; image: HTMLImageElement; constructor(x: number, y: number, w: number, h: number, value: number, src: string) { this.x = x; this.y = y; this.w = w; this.h = h; this.value = value; this.ima...
4dcc6de219321930208b5067356a8a709251519d
TypeScript
yoursunny/NDNts
/packages/packet/test-fixture/sign-verify.ts
2.6875
3
import { Decoder, Encoder } from "@ndn/tlv"; import { expect } from "vitest"; import { Data, Interest, type SigInfo, type Signer, type Verifier } from ".."; type Packet = Interest | Data; type PacketCtor = typeof Interest | typeof Data; export const PacketTable: ReadonlyArray<{ PacketType: string; Packet: PacketCtor ...
bf5241558f255eeb42321ec674b97c3082df7627
TypeScript
rrsqrd/UciAngular2_hw5_RockysRides
/RockysRides/app/model/product.repository.ts
2.921875
3
 import { Injectable } from "@angular/core"; import { Product } from "./product.model"; import { RestDataSource } from "./rest.datasource"; @Injectable() export class ProductRepository { private products: Product[] = []; private categories: string[] = []; // ProductRepository service commu...
e03037dd2afc60ca7cf0cc5c66dff25cd42daaf2
TypeScript
ilyajav/Counter---ReactTS
/src/bll/coutner-reducer.test.ts
3.0625
3
import { changeMaxValueAC, changeMinValueAC, counterReducer, increaseCounterValueAC, InitialState } from "./counter-reducer"; let state: InitialState beforeEach(() =>{ state = { minValue: 5, maxValue: 8, counter: 1 } }) test('max value must be changed', () =>{ ...
70d93c2c4f639cdfa431cc149745b32688514ae7
TypeScript
zenatureza/job-matching
/backend/src/modules/candidates/repositories/ICandidatesRepository.ts
2.515625
3
import RecruitingApiCandidateTechnologyDTO from '@modules/technologies/dtos/RecruitingApiCandidateTechnologyDTO'; import RecruitingApiCandidateDTO from '../dtos/RecruitingApiCandidateDTO'; import Candidate from '../infra/typeorm/entities/Candidate.entity'; export default interface ICandidatesRepository { /** Finds b...
7d3026ab9170f61c19adcae7353f189bc35d6cc5
TypeScript
lawvs/Algorithm-Training
/leetcode/350.intersection-of-two-arrays-ii.ts
3.15625
3
function intersect(nums1: number[], nums2: number[]): number[] { const arr = [] const m: { [x: number]: number } = {} for (const num1 of nums1) { m[num1] = (m[num1] || 0) + 1 } for (const num2 of nums2) { if (m[num2]) { m[num2] -= 1 arr.push(num2) } } return arr }
0d72b9ee4c8659d42a61f4b1df1c0d2db23a8f21
TypeScript
LeonBaudouin/Portfolio
/src/js/Canvas/Shapes/Square/DarkThemeSquareRenderer.ts
2.734375
3
import { DarkThemeSquareState } from "./DarkThemeSquareState"; import { RendererInterface } from "../../Core/Abstract/RendererInterface"; import { Canvas } from "../../Canvas"; export class DarkThemeSquareRenderer implements RendererInterface { public Render(state: DarkThemeSquareState, ctx: CanvasRenderingContex...
420aee6cff3fcab6ea7f18c6d34cdf6e772196d6
TypeScript
katalogoc/printer
/src/types/structs.ts
2.53125
3
export interface HashMap<T> { [key: string]: T; } export interface StoredFile { id: string path: string }
1f76ee3c51be07e777597c16d30bf5d09b777afb
TypeScript
Gelio/loose-ts-check
/src/cli/io/get-program-input.ts
2.546875
3
import { createInterface } from 'readline'; export const getProgramInput = () => new Promise<string[]>((resolve) => { const programInput: string[] = []; const rl = createInterface(process.stdin); rl.on('line', (line) => { programInput.push(line); }); rl.once('close', () => { resolve...
5535dbda3dc202afd3e1b405c4284f6940570a08
TypeScript
Kuchasz/photographers-panel
/packages/panel/src/sdk.ts
2.546875
3
import { GraphQLClient } from 'graphql-request'; import * as Dom from 'graphql-request/dist/types.dom'; import gql from 'graphql-tag'; export type Maybe<T> = T | null; export type InputMaybe<T> = Maybe<T>; export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] }; export type MakeOptional<T, K ...
2c097115e38e40b5ddf38bf4b7971b32de4aa2fe
TypeScript
ryusaka/react_fsa_thunk_example
/app/src/reducers/pure.ts
3.125
3
import axios, { AxiosResponse } from 'axios' import { Dispatch } from 'redux' const SYNC = 'user/SYNC_PURE' as const const ASYNC_START = 'user/ASYNC_START_PURE' as const const ASYNC_DONE = 'user/ASYNC_DONE_PURE' as const const ASYNC_FAILED = 'user/ASYNC_FAILED_PURE' as const class CustomError extends Error { } expor...
7fc247e2d7d51c2264553b0a8aa62f45c5708fbe
TypeScript
jzj/LiveKit-Svelte-Exploration
/src/lib/utils/mediaConstraintsBuilder.ts
2.609375
3
export type MediaConstraintsInfos = { constraints: MediaStreamConstraints, needsUpdate: boolean } const buildDefault = (id) => ({deviceId: {exact: id}}) export function buildMediaConstraints(preferredDevices: Record<MediaDeviceKind, string>, existingStream?: MediaStream): MediaConstraintsInfos { const cons...
6905c78b61fca3f12ffc9c684bedfa7c0fa9c169
TypeScript
SongFuZhen/easy_food
/modules/front/src/cuba/entities/easyfood_Shop.ts
2.640625
3
import { StandardEntity } from "./base/sys$StandardEntity"; import { User } from "./base/sec$User"; export class Shop extends StandardEntity { static NAME = "easyfood_Shop"; name?: string | null; phone?: string | null; address?: string | null; remark?: string | null; manager?: User | null; } export type Sho...
bf176ed5565d42dea98dbedc8e9d13b84f59acd9
TypeScript
johnnyb912/MigraineTracker
/src/app/store/Statements/statements.reducer.ts
2.921875
3
import {List} from 'immutable'; import * as _isUndefined from 'lodash/isUndefined'; import * as _add from 'lodash/add'; import * as _round from 'lodash/round'; import * as _toNumber from 'lodash/toNumber'; import {IPayloadAction} from '../index'; import {StatementsActions} from './statements.actions'; import {INITIAL_...
895b804e8f106f40a032f22fcdcf7179bd31b7ff
TypeScript
pjcarly/ember-field-components
/addon/components/output-field-text/component.ts
2.5625
3
import OutputFieldComponent, { OutputFieldArguments, } from "../output-field/component"; import { FieldOptionsInterface } from "@getflights/ember-field-components/services/field-information"; export interface FieldOptionsMaskInterface extends FieldOptionsInterface { mask: string; regex: RegExp; } export default...
317b8c69a2ffc3dc196304e24f6796baf3de991f
TypeScript
arduano/matrix-operations
/matrix.ts
3.3125
3
import Fraction from "./fraction"; import RowOp from "./rowOp"; import { ind } from "./helper"; export default class Matrix { protected data: Fraction[][] get width() { return this.data[0].length; } get height() { return this.data.length; } constructor(array: (number | Fracti...
13f8a7f1bd97e7958578e064bf94077fcbd6f9a5
TypeScript
rondomoon/rondo-framework
/packages/server/src/entities/BaseEntitySchemaPart.ts
2.609375
3
import { EntitySchemaColumnOptions } from 'typeorm' const transformer = { from: (value: Date) => !isNaN(value.getTime()) ? value.toISOString() : value, to: (value: undefined | null | string) => value ? new Date(value) : value, } export const BaseEntitySchemaPart: { id: EntitySchemaColumnOptions createDate: En...
b8c8b05ad212f1023a25bc7c0bfbbedfc33e1a0b
TypeScript
KrisztianNagy/UntoldJSONEnhancer
/test/02.expression-combined-binary-operator.test.ts
2.921875
3
import { expect } from 'chai'; import JSONEnhancer from '../src'; describe('Expression Combined Binary Operators', () => { it('should be able to combine plus and mins', () => { const enhancer = new JSONEnhancer(); const expressionEvaluator = enhancer.evaluator; const result = expressionEval...
14e6b58c509c31535d13d911c33707627283f7ff
TypeScript
jackovsky8/lb4-soft-delete
/src/__tests__/unit/repositories/soft-delete-crud.repository.ts
2.734375
3
import {expect} from '@loopback/testlab'; import { EntityNotFoundError, juggler, model, property, } from '@loopback/repository'; import {SoftDeleteCrudRepository} from '../../../repositories'; import {SoftDeleteEntity} from '../../../model'; describe('SoftDeleteCrudRepository', () => { let ds: juggler.DataSo...
92d17189f34e49dfcabcffec56dc1a875bec6bad
TypeScript
yijiaow/ticketing
/tickets/src/models/ticket.ts
2.875
3
import mongoose, { Schema } from 'mongoose'; import { updateIfCurrentPlugin } from 'mongoose-update-if-current'; // An interface that describes the properties required to create a new ticket interface TicketAttrs { title: string; price: number; userId: string; } // An interface that describes to properties a ti...
87f7fe29165bb14a0c1a3119423a1ddfdd31be7e
TypeScript
EvgenyiFedotov/store-api
/approach-without-contract.t.ts
2.96875
3
import { context, attachStore, attachDepend } from "./src/context"; import { store } from "./src/store"; import { depend } from "./src/depend"; const stringApi = store({ init: "", api: ({ setState, reset }) => ({ set: (value: string) => setState(value), reset, }), }); const numberApi = store({ init: 0...
4296e5702672d6a54dc2028ae0af91a72eac0b93
TypeScript
just214/logically
/firebase/db/db.api.ts
3.03125
3
import * as firebase from "firebase"; import "firebase/firestore"; import { auth } from "../../Auth/api"; const db = firebase.firestore(); /* * ***UTILITY FUNCTIONS*** * The following stamps are injected into every db create, update and delete methods. * getCreatedStamp - returns an object with timestamp and curren...
43b1a05895d8fe8b43c40826cee3b91db1cf7e18
TypeScript
hupo256/vite-react-ts-antd
/src/utils/index.ts
2.890625
3
interface parmsObj { [name: string]: any } export function urlParamHash(url: string = location.href) { let params: parmsObj = {} let hash = url.slice(url.indexOf('?') + 1).split('&') for (let i = 0; i < hash.length; i++) { const h = hash[i].split('=') // params[h[0]] = h[1] } return params } // lo...
acb23fc7ed2cebe7344fdcfd2dffcdbcaaee2eb8
TypeScript
pi-base/core
/src/Logic/Prover.ts
2.90625
3
import { And, Atom, Formula, Or, evaluate, negate, properties, } from '../Formula' import ImplicationIndex from './ImplicationIndex' import Queue from './Queue' import { Id, Implication } from './Types' import { Derivations, Proof } from './Derivations' export type { Proof } from './Derivations' // TODO...
9a4b142688ca1df0749ca266ece9ed19a2776409
TypeScript
SkaceKamen/vscode-sqflint
/server/typings/modules/glob/index.d.ts
2.875
3
// Generated by typings // Source: https://raw.githubusercontent.com/typed-typings/npm-minimatch/74f47de8acb42d668491987fc6bc144e7d9aa891/minimatch.d.ts declare module '~glob~minimatch' { function minimatch (target: string, pattern: string, options?: minimatch.Options): boolean; namespace minimatch { export functi...
d24391a9ef91e1fc6fb5ba49ca60c903c677ca59
TypeScript
timdeschryver/ngrx-tslint-rules
/src/schematics/ng-add/index.ts
2.578125
3
import { chain, Rule, SchematicContext, SchematicsException, Tree, } from '@angular-devkit/schematics' import * as fs from 'fs' import * as path from 'path' import { Schema } from './schema' export default function(options: Schema): Rule { return (host: Tree, context: SchematicContext) => { return cha...
1bb7a7228e0b97a46c2698fbc77b06abc8ea75b7
TypeScript
Tata-Images/Learning-TypeScript-I
/src/common/stringify.ts
3.515625
4
/** * Produce a string in JSON format for any standard json object * * Implemented as a data pre-prearator and wrapper for JSON.stringify() * * Note: (1) will handle a function by executing it and stringify the result * (2) will ignore Symbol, undefined, null and promises * * @since 0.0.1 * @category Obj...
4ac1df99abd3e42c27e2e365919deba8fa34a555
TypeScript
olayinkaadeleye/popularity-contest
/src/controller/candidateReadAction.ts
2.734375
3
import {Context} from "koa"; import {getManager} from "typeorm"; import {Candidate} from "../entity/Candidate"; /** * GET /candidates * * returns the top 30 links sorted by elo ranking as an array * * This is a simple GET, so no PoW is required. * * @param {Application.Context} context * @returns {Promise<void...
a65a81f174937985f04f1bfe8df7f020385f5c35
TypeScript
rivanildojr/curso-typeScript
/modulo-02/NumberAndBigInt/numberAndBigInt.ts
3.71875
4
// Example Number let number1: number = 23.0; let number2: number = 0x78CF; let number3: number = 0o577; let number4: number = 0b110001; console.log({number: number1, type: typeof number1}); console.log({hex: number2, type: typeof number2}); console.log({octal: number3, type: typeof number3}); console.log({binario: n...
c48d960a1917a46cfa44dfc36ad6e629c5b744ce
TypeScript
circlecloud/ms
/packages/websocket/src/server/index.ts
2.53125
3
import { EventEmitter } from 'events' import { ServerOptions } from '../socket.io' import { WebSocketClient } from './client' import type { Request } from './request' export enum ServerEvent { detect = 'detect', request = 'request', upgrade = 'upgrade', connect = 'connect', connection = 'connectio...
6daab77ff85f5efa62b8e5eb76ee0e1d716f4230
TypeScript
DarioJiang/kone-api-examples
/src/examples/operational-apis-demo.ts
2.6875
3
import { fetchAccessToken, fetchResources, validateClientIdAndClientSecret } from '../common/koneapi' import { fetchEquipmentBasicInformation, fetchEquipmentStatus, fetchServiceOrdersList, fetchSingleServiceOrder } from '../common/operational-api-supporting-functions' /** * Update these two variables with your own cr...
c365f1a6a350e3770d46334ccfc8cac89dd90cfa
TypeScript
just4programming/queue
/api/src/storage/storage.ts
3.03125
3
export interface Item { data: any type: string } export interface Storage<T extends Item> { push(item: T): T; pop(): T | null; getAll(): T[]; }
d6f8d6b895e382c2040de1ce75d20eab187a7054
TypeScript
sroman215/bootcamp
/api/Services/tictactoeService.ts
3.203125
3
import { Game } from "../Models/Game"; export class TicTacToeService { public defaultPosition: string = '-'; public boardSize: number = 3; public board: Array<Array<string>> = new Array(3); public currentPlayerTurn: number = 0; public lastPlayerTurn: number= 1; public personMap: Map<number, st...
5e300555939a45bf8e7ebbf1f3aa5ee35d8eff5b
TypeScript
VandyHacks/vaken
/src/common/util.d.ts
3.5625
4
import type { XOR } from 'ts-xor'; /** Utility type which makes an exclusive OR of all properties in T. */ type oneOf<T> = { [K in keyof T]: Pick<T, K> & FixTsUnion<T, K> }[keyof T]; type FixTsUnion<T, K extends keyof T> = { [Prop in keyof T]?: Prop extends K ? T[Prop] : never; }; /** Exclusive OR between T, U, and...
dae5ae9d7e3287ab2ac0f184de5f387bec5e7eaf
TypeScript
creately/mockgen
/example/src/abstract.ts
3.109375
3
export abstract class TestAbstractClass { public a1: number; private a2: number; protected a3: number; public abstract aa1: number; protected abstract aa3: number; constructor( public b1: number, private b2: number, protected b3: number, ) {} public abstract ge...
5effffb2929b496b96e7a3855cfbff29afdf8fda
TypeScript
anjum121/MEAN
/src/models/Joke.ts
2.703125
3
/** * Created by anjum on 09/05/17. */ import * as mongoose from 'mongoose'; import * as uniqueValidator from 'mongoose-unique-validator'; import * as slug from 'slug'; let User = mongoose.model('User'); let Comment = mongoose.model('Comment'); let JokeSchema = new mongoose.Schema({ slug: {type: String, lowercas...
fd5eb3ea4475fcf9646bc601473a021caf96ea21
TypeScript
Siwoo-Kim/proangular
/src/app/service/order-repository.service.ts
2.546875
3
import {Injectable} from "@angular/core"; import {Order} from "../model/Order.model"; import {Observable} from "rxjs/Observable"; import {RestDatasource} from "./rest-datasource.service"; /* * The service-api which provides Order Data from DataSource * to components. * The components does not contain ord...
5377c60ea55ba1bdf9f932b648eff22dc1fdb612
TypeScript
zengxp0605/ts-design-patterns
/src/6_proxy/a_common.ts
3.703125
4
// 抽象主题类 export interface Subject { /** * request */ request(); } // 真实主题类 export class RealSubject implements Subject { public request(): void { console.log('真实主题->request...'); } } export class Proxy implements Subject { private subject: Subject; // ...
992a23223cee177af3140ae8fe3b868bda287e69
TypeScript
colshacol/cratebox
/core/types/advanced.ts
4.21875
4
/** * This function checks if the function has received a parameter * @param {any} param */ function isUndefined(param: any) { return typeof param === "undefined"; } /** * This function checks if the type checker provider is indeed a function * @param {function} typeChecker */ function checkTypeChecker(type: a...
b9c006e974708b363f2bf95b044800c1724f0943
TypeScript
echo-mei/crciwms
/src/providers/date-util/date-util.ts
3.109375
3
import { Injectable } from '@angular/core'; @Injectable() export class DateUtilProvider { // 一天毫秒数 public DAY_MILLISECOND = 1 * 24 * 60 * 60 * 1000; format(date: Date, fmt: string): string { var o = { "M+": date.getMonth() + 1, //月份 "d+": date.getDate(), //日 "h+": date.getHours(), //小时 ...
00f59abf37550963c2227d6b901feb92d84b21b2
TypeScript
vannobi/ti-2-express-proj
/src/util/BibTex.ts
2.515625
3
import Cite from 'citation-js'; export interface Bib { title: string; author: any[]; publisher: string; URL: string; edition: string; type: string; id: string; year: number; } export const extractBookFeatures = str => { const book = new Cite(str, { output: { style: 'bibtex', }, }); ...
f703e11452874d54ec0cdcd935ad4edd5be9c753
TypeScript
khirayama/webnes
/src/NesDebugger.ts
2.65625
3
// tslint:disable:no-suspicious-comment import { logger } from 'logger'; import { dict } from 'nes/NES'; // tslint:disable-next-line:no-any declare var window: any; type debugInfoType = [string] | [string, number] | [string, number, number]; export class NesDebugger { private debugInfo: debugInfoType[]; constru...
6669418701409b51876566dc64c4b5fda9e257f6
TypeScript
SiLeBAT/mibi-portal-server
/src/app/authentication/model/token.model.ts
2.546875
3
import { UserToken, User } from './user.model'; import { TokenType } from '../domain/enums'; export interface TokenPayload { sub: string; } export interface AdminTokenPayload extends TokenPayload { admin: boolean; } export interface TokenPort { generateToken(userId: string): string; verifyTokenWithUs...
b95d85ece246e65b1baf61f940b3d67b83d263b8
TypeScript
HoltPicklesimer/Video-Game-Wishlist
/src/app/games/game-filter.pipe.ts
2.640625
3
import { Pipe, PipeTransform } from '@angular/core'; import { Game } from './game.model'; @Pipe({ name: 'gamesFilter', }) export class GamesFilterPipe implements PipeTransform { transform(games: Game[], term: string): any { let result: Game[] = []; if (term && term.length > 0) { result = games.filte...
100414166996e00485909bf4238d2147eeb942c1
TypeScript
Wikia/jwplayer-fandom
/stand-alone/loaderHelper.ts
2.625
3
import { JwPlayerContainerId, RedVentureVideoDetails, RequireOnlyOne } from './types'; export interface RedVenturePlayerContext extends JwPlayerContainerId { /** * @description Describes the location where the video player is being embedded. Useful for adding context to video tracking events */ contextName: s...
6805979141086b6b24b5174c146ba29dc34de7b1
TypeScript
codeAligned/DolphinNewsNode
/src/controllers/mysql/queries/queries.ts
2.671875
3
import { PostObject } from "../../../types/post"; import connection from "../connection"; import UserObject from "../../../types/user"; const crypto = require("crypto"); const secret = "mingade85"; export function createPost(postObject: PostObject) { return new Promise((resolve, reject) => { if (!postObject) { ...
7f791244cbf55ca510d6bf407fa8d8b33e2e0c59
TypeScript
nogataka/gatsby
/api/libs/errorCode.ts
2.546875
3
import { Response } from 'express' import { ValidationError } from 'express-validator' export const codes: {[key: number]: {code: number; message: string}} = { 301: {code: 301, message: 'page moved'}, 400: {code: 400, message: 'bad request'}, 404: {code: 404, message: 'not found'}, 409: {code: 409, message: 'c...
cb1084f5ccf0c6492e4512d0e842c678f17bfcb0
TypeScript
Hawkie/WebLib
/examples/game-air-rider/src/ts/Components/Ship/WeaponComponent.ts
2.546875
3
import { MoveWithVelocity } from "../../../../../../src/ts/gamelib/Actors/Movers"; import { Coordinate } from "../../../../../../src/ts/gamelib/DataTypes/Coordinate"; import { Transforms } from "../../../../../../src/ts/gamelib/Physics/Transforms"; import { DrawContext } from "../../../../../../src/ts/gamelib/Views/Dra...
d270af4162d85cba0a09ecf73ce7e96cceab03ab
TypeScript
aberba/fask
/ts/color.ts
2.6875
3
module fsc { interface IColor { r: number; g: number; b: number; a: number; } class Color { color: IColor; constructor(r: number, g: number, b: number, a: number) { this.color.r = r; this.color.g = g; this.color.b = b; ...
e16914181a721b4dcf375b3c0acaef317e18c438
TypeScript
oiagorodrigues/typescript_learn
/src/lessons/2_classes/4_abstract.ts
3.78125
4
// abstract abstract class Animal2 { constructor(private _name: string) { }; get name() { return this._name } set name(newName: string) { this._name = newName } abstract makeSound(): void; move(meters: number) { console.log(`${this.name} moves ${meters} meters;`); ...
2a896eb715f4b8587be928638a86bb964e4daf52
TypeScript
oguzgelal/intertext
/packages/intertext-engine/src/Runner.ts
2.828125
3
import { Timeout, OnLoad, Alert, State, Request, Navigate, } from './types/commands'; import { Renderable } from './types/renderable'; type RunnerArgs<T> = { props: T; }; type RunnerFn<T> = (args: RunnerArgs<T>) => unknown; class Runner { private timeoutRunner: RunnerFn<Timeout> = () => null; priva...