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
6bf6b9654bcad5fce4f233464afaa07c5c067f2a
TypeScript
omkarrepal/angular-seed
/src/app/user/user.ts
2.5625
3
export class User{ constructor( public id:number=Math.floor(Math.random()*100), public name:string="", public email:string="", public editable:boolean=false ){} }
96214ad8633bebc47520bcff11acab6f792af59d
TypeScript
tierklinik-dobersberg/cliny
/src/utils/request-context.ts
2.828125
3
import {Request} from 'restify'; export class Context { private _values: {[key: string]: any} = {}; get<T>(name: string): T|undefined { return this._values[name]; } set(name: string, value: any): this { this._values[name] = value; return this; } } declare mod...
9427ffca63f460e5863d6acd3e4f58b3a757e006
TypeScript
strax/bonsai
/packages/core/src/Identity.ts
3.3125
3
import { Generic, Generic1, Kind1, TypeFamily } from "tshkt" interface IdentityF extends TypeFamily<Kind1> { (): Identity<this[0]> } export class Identity<A> { [Generic.Type]!: Generic1<IdentityF, A>; ["constructor"]!: typeof Identity static of<A>(a: A): Identity<A> { return new Identity(a) } constr...
55669ac7af28e03bb24cfd745310bc39f9e67e9f
TypeScript
marshall0410/Passenger-App
/app/passenger-dashboard/containers/passenger-dashboard/passenger-dashboard.component.ts
2.625
3
import { Component, OnInit } from "@angular/core"; import { Passenger } from "../../models/passenger"; @Component({ selector: "passenger-dashboard", styleUrls: ["passenger-dashboard.component.scss"], template: ` <div> <passenger-count [items]="passengers"> </passenger-count> ...
1a483a5fb1fa48b888d233d3f567d779f7d52007
TypeScript
StarException/promise
/typescript/src/Promise.ts
3.171875
3
export class Promise<Value> { constructor(task: (resolve:(value:Value)=>void, reject:(error: Error)=>void)=>void) { try { task(value => { this.doResolve(value); }, error => { this.doReject(error); }); }catch (e) { console.error(e) this.doReject(e) } } p...
4cc6611450683cd7f9a4769f75adc22f364cffb5
TypeScript
nguyer/aws-sdk-js-v3
/clients/browser/client-medialive-browser/types/_FrameCaptureSettings.ts
2.875
3
/** * Frame Capture Settings */ export interface _FrameCaptureSettings { /** * The frequency, in seconds, for capturing frames for inclusion in the output. For example, "10" means capture a frame every 10 seconds. */ CaptureInterval: number; } export type _UnmarshalledFrameCaptureSettings = _FrameCaptureS...
b1e28db6d8ccb8f9a96b249e8f92e80fcb3d21c8
TypeScript
danglotb/skillful_network
/skillful_network_client/src/app/shared/models/application/notification.ts
2.5625
3
import { FollowStateTracker } from '../user/FollowStateTracker'; export class Notification { public id: number; public followerSet: Set<FollowStateTracker> = new Set(); public label: string; public isRead: boolean; public postId: number; constructor(data: any) { this.id = data.id; ...
a4091246c8ac871043f1cfe33913018132e5c35e
TypeScript
parrada/testBank
/src/models/user.model.ts
2.953125
3
export class User { firstname: string lastname: string identification: string birthdate: string constructor(name,lastName,identification,birthdate){ this.firstname = name this.lastname = lastName this.identification = identification this.birthdate = birthda...
847364e6ff3fedf2bf2422b59a192ec3c32f9598
TypeScript
Ryshard/lambda
/app/ts/category-list.pipe.ts
2.515625
3
import {Pipe} from 'angular2/core'; @Pipe({ name: 'catList' }) export class CatListPipe{ transform(mediaItems):string{ var categories = []; mediaItems.forEach(mediaItem => { if (categories.indexOf(mediaItem.category) <= -1) { categories.push(mediaItem.catego...
56c4f5dde850c4b743dcbc9cd924d72f3530650b
TypeScript
rhtua/DevCRUD
/app/api/testes/unitarios/DeleteDeveloperService.tests.ts
2.65625
3
import { describe } from "mocha"; import { assert, expect } from "chai"; import { emulatedDatabase } from "../infra/connections"; import { Connection } from "typeorm"; import { DeleteDeveloperService } from "../../src/services/DeleteDeveloperService"; import { Developer } from "../../src/business/entities/Developer"; ...
23e0c4b2a3fc7abb59d5a241e9f2068f97893e94
TypeScript
lanxuexing/waresmgr
/src/app/directives/grid-item.directive.ts
2.6875
3
import { Directive, ElementRef, Renderer2, OnInit, HostBinding } from '@angular/core'; @Directive({ selector: '[appGridItem]' }) export class GridItemDirective implements OnInit { // 第一种写法:HostBinding 绑定宿主的属性or样式 可以指定为@Input() @HostBinding('style.display') display = 'grid'; @HostBinding('style.grid-template-...
f8a020dd6ac57118b6b1c0d8d1676cf336d719a4
TypeScript
RandyCHS/game-of-life-ish
/game.ts
2.671875
3
let selectedTemplate = settings.readNumber("selectedTemplate") || 0; let isRunning = false; let isFilling = false; let cursorX = 1; let cursorY = 1; const cursor = sprites.create(img` 9 9 9 9 9 . . 9 9 . . 9 9 9 9 9 `); updateCursor(); bindControllerDirectionToCursorMovement(controller.up, 0, -1); b...
ba02f21f8d0b2e319d24ea582f05a11597a0148a
TypeScript
Evanion/calculator
/src/Screens/Calculator/Calculator.interfaces.ts
2.90625
3
import { ACTIONS } from './Calculator.reducer'; export enum Operator { product = 'product', dividend = 'dividend', sum = 'sum', difference = 'difference', } export interface State { operator: Operator; values: number[]; total: number; } export interface AddValueAction { type: ACTIONS.ADD_VALUE; pay...
a7291eb094adca77401a157fa8f678529cebf2c7
TypeScript
HendrikCammann/thesis
/src/models/State/StateModel.ts
2.546875
3
import {ActivityClusterTypeCountModel} from '../Activity/ActivityClusterModel'; import {getWeeksBetweenDates} from '../../utils/time/time-formatter'; export enum ClusterTypes { Halfmarathon = 'Halbmarathon', Marathon = 'Marathon', TenK = '10 km' } export class ClusterItem { clusterName: string; id: string; ...
a57f2dcf906aef57adf3612a87960e2d4ef98f88
TypeScript
yaroslav-nikolaiko/LingvoMovieV2
/domain/webapp/src/main/ui/app/src/hal.client/paging.entity.ts
2.71875
3
import {Observable} from "rxjs/Rx"; interface Page{ size: number; totalElements: number; totalPages: number; number: number; } export class PagingEntity<T>{ constructor(public list: T[], public page :Page){} first: ()=>Observable<PagingEntity<T>>; next: ()=>Observable<PagingEntity<T>>; ...
fb0ea2a9ff0e556a185e763eafb7c87705941548
TypeScript
juancpulidos/dance-til-you-drop
/website/src/Scripts/danceCalibration.ts
2.671875
3
import { Pose } from "@tensorflow-models/posenet"; let calibrationNumber = 0; export const getCalibrationNumber = () => calibrationNumber; export const setCalibrationNumber = (calNumber: number) => { calibrationNumber = calNumber; }; const minPartConfidence = 0.1; const minPoseConfidence = 0.15; export declare int...
5b74fbd9d139c9bd3bb2d1d0860490fe6c1621ce
TypeScript
kevin-west-10x/bioinformatics-algorithms
/problems/chapter-1/BA1L.ts
3.03125
3
import { DNA, patternToIndex } from "../../utilities/lexographic"; import { assertEqual } from "../../utilities/test"; // Convert a pattern into it's lexographical index among all patterns of the same size const BA1L = (pattern: string) => patternToIndex(DNA)(pattern); // Test data assertEqual( "BA1L", BA1L("AGT"...
ef4cd53efcf75e282647816456ebb92acc74b8bd
TypeScript
seekseep/rescue-helicopter-simulation
/src/ts/simulator/services/ScheduleService.ts
2.59375
3
import { GeneralTask, Mission, Schedule, Task } from '../entities' import * as builders from '../builders' import * as utils from '../utilities' import { DAY, MINUTE } from '../constants' import { ScheduleCache } from '../entities/schedules' import { mission } from '../builders/missions' export default class ScheduleS...
1e980841abbf7bbe9867f92a0f37de00f03c0f7c
TypeScript
AlvinSaldanha/Angular4
/AngularApp/src/app/player/player.component.ts
2.515625
3
import {Component, OnInit} from '@angular/core' @Component({ selector: 'app-player', templateUrl: './player.component.html', styleUrls: ['./player.component.css'] }) export class PlayerComponent implements OnInit { title: string = "This is a Player Component!!!!"; imageSrc = "http://imgsv.imaging....
5c2f9df0029c52469532597806fce81bfdab9cc4
TypeScript
nutgaard/maybe-ts
/test/maybe-ts.classical.test.ts
3.34375
3
import { MaybeCls as Maybe } from '../src/maybe-ts'; describe('Maybe', () => { describe('class', () => { describe('of', () => { it('should create Just(3)', () => { expect(Maybe.just(3).withDefault(0)).toBe(3); expect(Maybe.of(3).withDefault(0)).toBe(3); }); it('should create No...
203cc708912fa90eba0bf35e4d4d414f04c454b2
TypeScript
jramstedt/collisions
/src/lib/Circle.ts
3.453125
3
import {Body} from './Body'; /** * A circle used to detect collisions */ export class Circle extends Body { radius: number; scale: number; override readonly _circle = true; /** * x: The starting X coordinate * y: The starting Y coordinate * radius * scale * padding: The amount to pad the bounding vol...
f410d66635bc9055fc2aa8a3de8071cf61edee3f
TypeScript
Oda2/graphql-api-estudo
/src/models/UserModel.ts
2.796875
3
import * as Sequelize from 'sequelize'; import { genSaltSync, hashSync, compareSync } from 'bcryptjs'; import { BaseModelInterface } from '../interfaces/BaseModelInterface'; export interface UserAttributes { id?: number; name?: string; email?: string; password?: string; photo?: string; createdAt?: string;...
4214d0c2c3034d8c155a347b960ea89b88221405
TypeScript
g4rcez/dont-need-for-speed
/src/services/settings.ts
2.546875
3
import { SessionStorage } from "storage-manager-js"; import { COLORS } from "components/car"; const storage = new SessionStorage(); enum StorageKeys { CAR_COLOR = "carColor", RACE_TIME = "raceTime" } export const getCarColor = (): COLORS => storage.get(StorageKeys.CAR_COLOR) ?? "original"; export const setCarC...
af0c2a10c42731a5ebcc6dba8aca6f872f047a63
TypeScript
horacehylee/workenv-cli
/src/modules/workenv/__tests__/dao/program.dao.spec.ts
2.9375
3
import { connect, resetDb } from "../../../../db"; import { addProgram, deletePrograms, getAllPrograms, getProgramsByName } from "../../daos/program.dao"; import { Program } from "../../models/program.model"; export const addTestPrograms = () => Promise.all([ addProgram( "telegram", "C:\\User...
b37da66ca4c5c79b01c5dcebe7d13cbb3930e1f2
TypeScript
yoxjs/yox-template-compiler
/test/event.test.ts
2.75
3
import { compile } from 'yox-template-compiler/src/compiler' import * as nodeType from 'yox-template-compiler/src/nodeType' import Node from 'yox-template-compiler/src/node/Node' import Element from 'yox-template-compiler/src/node/Element' import Directive from 'yox-template-compiler/src/node/Directive' test('event',...
46b398dcdc6b739dad5ee89fbc4c80d90d6ba246
TypeScript
MetaNews/meta-news-ng-app
/src/app/articles-list/articles.service.ts
2.546875
3
import { Injectable, OnInit} from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Filter } from '../models/filter.model'; import { Article } from '../models/article.model'; import { Vote } from '../models/vote.model'; import { Authentication} from '../authentication/authentication'; @Inje...
e9c66117f5f938cfb311d89ccb5cb255ba909102
TypeScript
darthtrevino/sigma.js
/src/core/domain/renderers/webgl/nodesFast.ts
2.796875
3
import floatColor from "../../utils/misc/floatColor"; import loadShader from "../../utils/webgl/loadShader"; import loadProgram from "../../utils/webgl/loadProgram"; import { Node, WebGLNodeDrawer } from "../../../interfaces"; import { Settings } from "../../classes/Configurable"; import { shaders } from "./utils"; //...
53ad0d395ac10ff27187245913343662ea200368
TypeScript
ihigani/frontegg-react
/packages/rest-api/src/fetch.ts
2.53125
3
import { ContextHolder } from './ContextHolder'; import { ContextOptions, KeyValuePair } from './interfaces'; interface RequestOptions { url: string; method: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE'; body?: any; params?: any; contentType?: string; responseType?: 'json' | 'plain' | 'blob'; headers?: Re...
59ca139ec3648e011916451f7e3b59ad01464579
TypeScript
USTCLX/DSA
/src/leetcode/567-字符串的排列/index.ts
3.9375
4
import { permutation } from "../offer38-字符串的全排列"; /** * 暴力 * 列举s1的全排列,然后依次验证其是否是s2的子串 * @param s1 * @param s2 */ export const checkInclusion = function(s1: string, s2: string): boolean { if (s2.length < s1.length) return false; const allS1 = permutation(s1); let result = false; for (let str of allS1) { ...
a5ed249ed4a3d013fb019dd46876f8a582c5e5d7
TypeScript
JoseRubioC/D10
/ejemplo.ts
3.359375
3
export class Person{ name : string; private age : number; yearOfBirth: number; address : string; constructor(newName:string, yearOfBirth:number, newAddress:string, currentYear:number){ this.name = newName; this.yearOfBirth = yearOfBirth; this.address = newAddress; t...
43353107c5f860fd30abc39111128b8aed26b78c
TypeScript
RicardoGorki/bm-teste-01
/backend/src/modules/shareholders/repositories/implementations/ShareholdersRepository.ts
2.75
3
import { getRepository, Repository } from "typeorm"; import { Shareholder } from "../../entities/Shareholder"; import { ICreateShareholderDTO, IShareholdersRepository, } from "../IShareholdersRepository"; class ShareholdersRepository implements IShareholdersRepository { private repository: Repository<Shareholde...
0855707889575a25d8c931d8ebb41f63e2ede7d7
TypeScript
alexhg128/SimpleAssembly
/src/app/models/codeloader.ts
2.609375
3
export default class CodeLoader { static instance: CodeLoader; private constructor() { } static get Instance(): CodeLoader { if(!this.instance) { this.instance = new CodeLoader(); } return this.instance; } code:string; write(code:string) { this.co...
ddd3da94286ee2ffc6a3fff33b9c94bac645ce35
TypeScript
jasonjmcghee/web-blocks
/worker/Player.ts
2.640625
3
"use strict"; /// <reference path="../typings/tsd.d.ts" /> import THREE = require('three'); import World from './World'; import com from '../common/WorldInfo'; import { Movement } from '../common/Types'; export default class Player { gravity = 0.002; changeListener: ((position: THREE.Vector3, target: THREE.Vector3...
2b3757f537292f0b491d373f00a54067c842d49b
TypeScript
hanzo2001/gi-json
/sources/Nodes/Utils.ts
2.890625
3
/// <reference path="../typings/index.d.ts" /> export var isFloatRE = /^-?(0|[1-9]\d*)(((\.\d+)|([eE]-?\d+))|(\.\d+[eE]-?\d+))$/; export var isIntRE = /^-?(0|[1-9]\d*)$/; export class ElementParser { static parseBool(v: string): boolean { if (v === 'false') {return false;} if (v === 'true') {return true;} re...
9377ceb5921a4e6c86aa317d8781a8cce7f1dbb8
TypeScript
ltruchot/fantasyland-deno-ts
/01_callbacks.ts
3.109375
3
import { randomTime } from "./helpers.ts"; // callback hell: pyramid of doom let val = ""; setTimeout(() => { val += "it begin. "; setTimeout(() => { val += "it continue. "; setTimeout(() => { val += "it end. "; setTimeout(() => { console.log(val), randomTime(); }); }...
5fbdf39fbdbd7e871e2d3bd9c6041c4769d2d0ae
TypeScript
primemaster-git/nsfw-heroku-tg-bot
/src/lib/appBotRouter.ts
2.796875
3
import express, { Router } from "express"; import * as dotenv from "dotenv"; import type TelegramBot from "./telegramBot"; dotenv.config(); const BASE_URL = process.env.APP_URL || "https://nfsw-telegram-bot.herokuapp.com:443"; /** * @typedef {import('../lib/telegramBot.js')} TelegramBot */ /** * Создание роут...
43e6e7996bbcd9a6099e832562fd63983c8ba73c
TypeScript
aws-amplify/amplify-cli
/packages/amplify-provider-awscloudformation/src/iterative-deployment/helpers.ts
2.515625
3
import { DeployMachineContext, DeploymentMachineOp } from './state-machine'; export const collectError = (context: DeployMachineContext, err: any, meta: any) => { return { ...context, errors: [ ...(context.errors ? context.errors : []), { error: err.data, stateValue: JSON.stringify(meta.state.val...
95955c57124f7091454f592836ffffa2a774dac7
TypeScript
IIpocTo/reLease
/frontend/src/app/core/dto.ts
2.828125
3
export class Page<T> { content: T[]; currentPage: number; totalPages: number; totalElements: number; constructor(content: T[], currentPage: number, totalPages: number, totalElements: number) { this.content = content; this.currentPage = currentPage; this.totalElements = total...
236e1ca4ad68c82254bad984c0ed31ebd769007e
TypeScript
serrodale/ng-trello
/src/app/model/alert.model.ts
2.84375
3
import { Icon } from './icon.model'; export interface Alert { id: number; icon: string; message: string; autoHide: boolean; type: AlertType; } export class SuccessAlert implements Alert { id: number; icon: Icon; message: string; autoHide: boolean; type: AlertType; construc...
ab5ab7b0ea472242c0b896dc4358de143d711bd7
TypeScript
IvanKomar/scalors-list
/src/hooks/useDialog.ts
2.703125
3
import { useState, useCallback } from "react"; type UseDialog = { isModalOpen: boolean; handleOpenModal: () => void; handleCloseModal: () => void; }; const useDialog = (): UseDialog => { const [isModalOpen, setIsModalOpen] = useState(false); const handleOpenModal = useCallback(() => { setIsModalOpen(tr...
336ce781a329eea514f258036c5131da18e156fb
TypeScript
jayvhaile/telegraf-bot-lib
/src/message/my_message.ts
2.546875
3
import {TelegrafContext} from "telegraf/typings/context"; import {Message} from "telegraf/typings/telegram-types"; import {Wrapped} from "../types"; import MyExtra, {MyExtraParams} from "./extra/my_extra"; import MyBody from "./body/my_body"; export class MyMessage { constructor( readonly body: MyBody, ...
87aaa861a375101cad106e045b470e2f38674482
TypeScript
shileen/Cracking-the-Coding-Interview-TypeScript
/src/chapter08_recursion-and-dynamic-programming/8.8_permutations-with-dups/index.ts
3.390625
3
class CharFrequencies { static fromString = (str: string) => new CharFrequencies(CharFrequencies.getFreqsFromString(str)); private static getFreqsFromString = (str: string) => str.split('').reduce( (frqs, c) => ({ ...frqs, [c]: (frqs[c] || 0) + 1, }), {} as { [c: string]: n...
8a51e9af8b5da43d66ab376487e80938d93e4f71
TypeScript
NguyenVuNhan/ng-path-finder
/src/app/classes/base/node.ts
3.09375
3
import {IPoint, PointType} from "../../interfaces/grid-map"; export class Node implements IPoint { x: number; y: number; cost: number; type: PointType; visited: boolean; preNode: Node; currentCost: number; constructor(x: number, y: number, type: PointType, preNode: Node = null, currentCo...
ea237f71471b8bc27e197e41331a831ab82eec5e
TypeScript
isamed92/rxjs
/src/observables/02-unsubscribe-add.ts
3.3125
3
import { Observable, Observer, observable } from 'rxjs'; const observer: Observer<any> = { next: value => console.log('next:', value), error: err => console.warn('error:', err), complete: () => console.info('completed') }; const interval$ = new Observable<number>(subscriber => { // Crear un contador ...
6eb4eeb02023c5724035d98012c087df2314d1b2
TypeScript
pongkot/learn-di
/src/modules/user/interfaces/IUserRepository.ts
2.5625
3
export interface IUserRepository { listUsers(): Array<{ id: number, name: string }> }
4b389ecead04c4ee2d6ba284f662c4b0a3240fd5
TypeScript
iyosayi/inbranded
/src/helpers/create.dir.ts
2.84375
3
import { existsSync, mkdir } from 'fs' import path from 'path' /** * @function createDir checks if the pdf directory exists already, * If not, it creates it on server startup */ export const createDir = function createDir(directory: string) { if (!existsSync(directory)) { mkdir(path.resolve(directory), { rec...
d2e368c657ae271ca6b6950a92a0ab9a55cf4e5c
TypeScript
kaorun343/vue-property-decorator
/src/decorators/Ref.ts
2.5625
3
import Vue from 'vue' import { createDecorator } from 'vue-class-component' /** * decorator of a ref prop * @param refKey the ref key defined in template */ export function Ref(refKey?: string) { return createDecorator((options, key) => { options.computed = options.computed || {} options.computed[key] = {...
14385caa61a638d6e0b4ac07f2b1a0f5c250bca3
TypeScript
alex-alina/dinner-planner-server
/src/recipes/entity.ts
2.515625
3
import { BaseEntity, Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm' import { IsString } from 'class-validator'; import RecipeIngredient from '../recipeIngredients/entity'; import Day from '../days/entity'; import Rating from '../ratings/entity'; @Entity() export default class Recipe extends BaseEnt...
e2b69928c1ac180f666a21d3d2d4cdef05d9fbd9
TypeScript
Samyuktaa-Balaji/Trello-sample
/apps/myapp-e2e/src/support/drag-support.ts
2.546875
3
export function drag(dragSelector: string, dropSelector: string) { cy.get(dragSelector).should('exist').get(dropSelector).should('exist'); const draggable = Cypress.$(dragSelector)[0]; // Pick up this const droppable = Cypress.$(dropSelector)[0]; // Drop over this const coords = droppable.getBoundingC...
4afb0e4c1c6acfa47e2649e4b216ecdb748d9a92
TypeScript
murindwaz/qwik
/src/core/util/dom.ts
2.703125
3
/** * @license * Copyright Builder.io, Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE */ /** * Remove `childNode` from `parentNode` and return `nextSibling` */ export functi...
efad1ad035c97cf39e067459ed42898e32df9b54
TypeScript
Ecodev/my-ichtus
/client/app/shared/validators.spec.ts
2.6875
3
import {UntypedFormControl, ValidatorFn} from '@angular/forms'; import {iban} from './validators'; function validate(validatorFn: ValidatorFn, expected: boolean, value: any): void { const control = new UntypedFormControl(); control.setValidators(validatorFn); control.setValue(value); expect(control.val...
f6b01233234a8250665f72974b8f8970c4240aff
TypeScript
bogdanq/tic-tac
/client/src/api/ws/types/ws.ts
2.578125
3
import { GetMessagesResponse, SendMessagesResponse, SendMessagesParams, GetMessagesParams, } from "./chat"; export enum Type { default = "default", event = "event", } export enum Methods { fetchUser = "session.get", signUp = "session.create", signIn = "session.entry", chatMessages = "chat.message...
05392ac9faa76dbbc7b117a93a76feb3bd9dc8d3
TypeScript
kaw2k/ownitama
/src/actions.ts
2.984375
3
import { Absolute, Card, Coordinate, Game, LobbyState, PlayerLobby, } from './interfaces' import { Cards } from './data/cards' import { InitialBoard } from './data/board' import { clone } from './helpers/clone' import { possibleMoves, doesCardHaveMove } from './helpers/moves' import { equalCoordinates } fro...
c37beea2aa7a52797a8c75a66b8e08d91f91aa27
TypeScript
Keith-CY/molecule-javascript
/src/struct/struct.spec.ts
2.515625
3
import { serializeStruct, deserializeStruct } from '.' import { serialize as serializeFixture, deserialize as deserializeFixture } from './fixture.json' describe('Test serialize struct', () => { const fixtureTable = serializeFixture.map(({ source, expected, exception }) => [source, expected, exception]) test.each...
d33e2d0b9b5715f967c01e9bb6af02f0595cb489
TypeScript
cristaltae/rome
/packages/@romejs/js-ast-utils/doesNodeMatchPattern.ts
3.078125
3
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import {AnyNode} from '@romejs/js-ast'; import getNodeReferenceParts from './getNodeReferenceParts'; // TODO make this accept mul...
63b568a7f03e2705ed7bedab64bbba0684fd1b8c
TypeScript
CaptainOfPhB/yuque-plugin
/src/actions/copyUrl.ts
2.515625
3
import copyToClipboard from '@/helper/copyToClipboard'; /** * Copy the current page url to markdown format * @returns {Promise<void>} */ async function copyUrl(): Promise<void> { const markdownLink = `[${document.title}](${location.href})`; await copyToClipboard(markdownLink, '页面链接'); } export default copyUrl;...
e6dfa99eabc0cbb7d8cce62e3ea7270c7a9c2097
TypeScript
KostiaSA/happylook-wms-obmen
/wms-import/processRequest.ts
2.703125
3
import { isNumber, isString } from "util"; import { stringAsSql } from './stringAsSql'; import { executeSql } from "./executeSql"; import { sleep } from "./sleep"; interface IAns { Ошибка: number, ТекстОшибки: string } function checkPackage(body: any): IAns { if (!body.НомерПакета) return { Ошибк...
ab7cfa0987791e5d49826cbdec6dcb062044d40f
TypeScript
JainUdit/todo-list
/src/redux-app/selectors/getFilteredTodos.ts
2.625
3
import { Filter } from "../enums"; import { ITodo, ITodoListGlobalState } from "../interfaces"; export const getFilteredTodos = (state: ITodoListGlobalState): Array<ITodo> => { switch (state.domain.filterType) { case Filter.ALL: return state.domain.todoList; case Filter.ACTIVE: ...
5e4901705584a28078b1e7a2a3841d4b232c3457
TypeScript
andigibson93/tnt-microsoft-wk1
/TypeScriptPractice.ts
4.03125
4
// 11111111111111 // basic dataTypes console.log("basic types and constants"); // constants const myNumber: number = 1; const myWord: string = "tree"; console.log(myNumber); console.log(myWord); // const vs let const constantNumber: number = 2; console.log(constantNumber); // To-do: constantNumber = 3; // const doesn'...
ddc5efb7f60c6b8f06303e49724fa4697de288b5
TypeScript
angular-package/property
/src/test/get-exist-property.spec.ts
3.328125
3
// Function to test. import { getExistProperty } from '../lib/get-exist-property.function'; // Object. import { OBJECT_ONE, OBJECT_TWO, ObjectOne } from './constants/object.const'; import { TRUE } from './constants/boolean.const'; /** * Test `getExistProperty()` function. */ describe(getExistProperty.name, () => { ...
87f6944fbed634672c770e6049fbe194f510f547
TypeScript
bcherny/mapf
/index.ts
3.421875
3
/** * Better than `Promise.all`. * * `const [a, b, c] = await mapf([1, 2, 3], async _ => await foo(_) )` */ export function mapf<T, U, V>(array: T[], cb: (this: V, t: T, index: number, array: T[]) => Promise<U>, thisArg?: V): Promise<U[]> { return Promise.all<U>(array.map(cb, thisArg)) }
607077b169f01b0b4ad21b37ed2a33ae8ec2f0e1
TypeScript
jimmy-e/visx-demo
/src/utils/scales/getXScale.ts
2.59375
3
import { scaleBand } from '@visx/scale'; import { BandScale, Data } from 'src/types'; interface Props { data: Data; index: string; xMax: number; } export default ({ data, index, xMax }: Props): BandScale => { const xScale = scaleBand<string>({ domain: data.map((datum) => String(datum[index])), padding...
2bd3a92599d2bf328e7d7daaf687cde1ed1dacd5
TypeScript
vuepress-theme-hope/vuepress-theme-hope
/packages/theme/src/client/composables/autoLink.ts
2.578125
3
import { useRouter } from "vue-router"; import type { AutoLinkOptions } from "../../shared/index.js"; import { resolveLinkInfo } from "../utils/index.js"; /** * Resolve AutoLink props from string * * @example * - Input: "/README.md" * - Output: { text: "Home", link: "/" } */ export const useAutoLink = ( item:...
2d08cb75e658d089c6b497258f264f55e1050148
TypeScript
dylanrenwick/Canvity
/src/Canvity/Aspect.ts
3.09375
3
import { Component } from "./Component/Component"; import { HashSet } from "./Util/HashSet"; export class Aspect extends HashSet<Component> { public Get<T extends Component>(c: new(id: number) => T): T { return this.filter(this.typeCheck<T>(c)).ToArray()[0] as T; } private typeCheck<T extends Comp...
95e4bcd10b516dbadc0f422e53f49239873c867d
TypeScript
DivineCross/DesignPattern
/ts/src/iterator/cat-family.ts
2.75
3
import { Cat } from './cat.js'; import { CatIterator } from './cat-iterator.js'; import { IIterable } from './i-iterable.js'; import { IIterator } from './i-iterator.js'; export class CatFamily implements IIterable<Cat> { #cats: Cat[]; constructor(cats: Cat[] = []) { this.#cats = cats; } getI...
a1ec8786704e79c8689005e4cfa8bb9cd7bb720a
TypeScript
coingaming/moon-design
/workspaces/base/src/private/helper/ServerOnlyContext.ts
2.734375
3
// @ts-ignore import { cache } from 'react'; export default <T>(defaultValue: T): [() => T, (v: T) => void] => { const getRef = cache(() => ({ current: defaultValue })); const getValue = (): T => getRef().current; const setValue = (value: T) => { getRef().current = value; }; return [getValue, setValue...
b8a76e5a4582476ca70a241867caaee7370ef2a2
TypeScript
lulijuner/bilibili-live-video-noty
/server/api/link.ts
2.578125
3
/** * Created by allen on 2016/6/29. */ import {httpGet} from './req'; import {parseString} from 'xml2js'; /** * getDownloadUrlByVideoId * 通过Video ID获取下载地址 * * @return {Promise<string>} 下载地址Promise对象 */ export function getDownloadUrlByVideoId(videoId:number):Promise<string> { /** * 以下请求会返回XML字符串, 该XML...
d7e0dd669cc3791291efebfd691f0816e237e4fc
TypeScript
zekroTJA/supercharge
/WebApp/src/app/shared/timeout.ts
3
3
/** @format */ export type Timer = ReturnType<typeof setTimeout>; export class Timeout { private timer: Timer; constructor(private delayMS: number) {} public cancel() { if (this.timer) { clearTimeout(this.timer); } } public schedule(cb: () => void) { this.cancel(); this.timer = setT...
3663174eef79eb6f4723ca4b88345bcfe19889e8
TypeScript
domoritz/encodable
/packages/encodable/test/typeGuards/Base.test.ts
3.3125
3
import { isDefined, isArray, isNotArray, isEveryElementDefined } from '../../src/typeGuards/Base'; describe('type guards: Base', () => { describe('isArray<T>(maybeArray)', () => { it('returns true and converts to type T[] if is array', () => { const x: string | string[] = ['abc']; // eslint-disable-n...
3f56e9ec62eea7d4fc71e33f10b92eb22ecc28b8
TypeScript
swarmbase/swarmbase
/packages/collabswarm/src/auth-provider.ts
2.59375
3
// Restrict access to those on ACL export type EncryptionResult = { data: Uint8Array; nonce?: Uint8Array; }; export interface AuthProvider<PrivateKey, PublicKey, DocumentKey = string> { sign(data: Uint8Array, privateKey: PrivateKey): Promise<Uint8Array>; verify( data: Uint8Array, publicKey: PublicKey,...
edbb41b4bcc54763b81340700b9a17d1fab204b9
TypeScript
ARGO2006/legends-of-zeldathe-master-maze
/main.ts
3.09375
3
scene.onOverlapTile(SpriteKind.Player, sprites.dungeon.stairNorth, function (sprite, location) { game.over(true) }) sprites.onOverlap(SpriteKind.Player, SpriteKind.Food, function (sprite, otherSprite) { mySprite2.setPosition(randint(1, 160), randint(1, 160)) info.changeScoreBy(1) mySprite.say("Yay", 100...
0530ccd8369dd0c38d2745e1acfddb9aa3396e75
TypeScript
amatiasq/discord-bots
/descord/structure/EditMessagePayload.ts
2.8125
3
import { RawEditMessagePayload } from '../raw/RawEditMessagePayload.ts'; import { MessageFlag } from '../enum/MessageFlag.ts'; import { Embed, wrapEmbed, unwrapEmbed } from './Embed.ts'; // https://discord.com/developers/docs/resources/channel#edit-message-json-params export interface EditMessagePayload { /** the ne...
14b7494e3a4d8cabc46e97f3d4c390703dceb132
TypeScript
mtgibbs/d3-source-sink
/src/d3-source-sink.ts
2.71875
3
/// <reference types="d3" /> (<any>d3).sourceSink = (): SourceSink => { let _nodeHeight: number = 24; let _nodeWidth: number = 24; let _nodePadding: number = 10; let _nodes: Array<INode> = []; let _links: Array<ILink> = []; const _sourceSink: SourceSink = {}; _sourceSink.nodeHeight = (h...
0553d5d09bb168973b645e00cf728f6afd77e6b4
TypeScript
Vovanisimous/gayaz-frontend
/src/hooks/useOrder.ts
2.578125
3
import {IOrder, IOrderRequestData} from "../entities/order.entity"; import {order} from "../database/order"; import {v4 as uuidv4} from 'uuid'; import {dealer} from "../database/dealer"; import {manager} from "../database/manager"; import {contract} from "../database/contract"; import {IDealer} from "../entities/dealer...
d4503f4d98257f9537012598855dc3a2a46e0d3a
TypeScript
Stdev17/nozomi
/src/__tests__/csharp.test.ts
2.984375
3
import { TSC } from '../compiler'; import { CSharpContext } from '../transform/csharp'; const csharpContext = new CSharpContext(); const tsc = new TSC({}, csharpContext); function assertType(code: string, expectType: string) { const ast = tsc.compile(code)!; const checker = tsc.checker; const node = tsc.getIdentif...
2111d5304b3644e3870aeda6725e16c65c4e6c39
TypeScript
web-liuyang/l-native-tools
/src/object/deepClone.ts
3.46875
3
import { typeOf } from "../common"; /** * 深拷贝 * @template T * @param {T} origin - 拷贝的源对象 * @return 拷贝后的对象 */ function deepClone<T = {} | any[]>(origin: T): T { let clone = (typeOf(origin) === "array" ? [] : {}) as T; if (typeOf(origin) === "object" || typeOf(origin) === "array") { for (const key in origin...
5b41b31ec65504a7da7315b284dbd59ee540911c
TypeScript
blind675/StocksImporter
/src/actions/importTickers.ts
2.515625
3
import {fetchTickers} from "../services/API/Polygon"; import Ticker from "../models/Ticker"; const cliProgress = require('cli-progress'); export async function importTickers() { console.log('Importer : Start fetch tickers'); // fetch ticker const tickers = await fetchTickers(); if(tickers) { ...
74d139cdb72afc734a656254473398b16e4a8905
TypeScript
Dvalmont07/Deck2Deck
/src/app/Classes/Deck.ts
3.484375
3
import { Card } from "./Card"; export class Deck { suits: string[] = []; cardValues: string[] = []; addCard({ myDeck, card }: { myDeck: Card[]; card: Card; }): boolean { try { myDeck.unshift(card); return true; } catch (e) { console.log('Error:', e); ...
40e00a6b36f5733de19f98fd77c2d661349d7ec9
TypeScript
00zhengfu00/svg-icon
/svg-generator/ast.ts
2.75
3
import { createModifier, factory, NodeFlags, SyntaxKind } from 'typescript'; import kebabCase from 'lodash.kebabcase'; import camelcase from 'camelcase'; interface Base { identifierName: string; iconName: string; } export function createStatement({ identifierName, svgContent, iconName }: Base & { svgContent: stri...
da91e4c0535482664069c88e3964777206eeff07
TypeScript
fkobon/Ivoiro.js
/dist/ivoiro.d.ts
3.1875
3
declare class Ivoiro { propertyGetter: Object; propertyType: String; property: any; /** * Constructeur de la classe prend en paramètre l'object * * @param propertyGetter */ constructor(propertyGetter: Object); /** * Initialisation du composant html servant à gérer les do...
dbbcb61fe8998e339f11d002ee7ff644f70db346
TypeScript
IceFrost925/greedy-snake
/src/modules/Snake.ts
3.25
3
/* * @Description: 蛇 * @Author: WaynePeng * @Date: 2021-08-26 23:14:20 * @LastEditTime: 2021-08-31 02:16:14 * @LastEditors: WaynePeng */ class Snake { head: HTMLElement // 蛇头 body: HTMLCollection // 蛇身-包括蛇头 element: HTMLElement // 蛇容器 isLive: Boolean = true // 是否存活 constructor() { this.element = doc...
0c4f3d3f2eb49d9885608702d2c3b9f5b8c6d9ba
TypeScript
hinogi/d3
/typescript/arrays/quantile.ts
3.203125
3
// R-7 per <http://en.wikipedia.org/wiki/Quantile> export default function quantile(values: Array<number>, p: number): number { let H: number = (values.length - 1) * p + 1, h: number = Math.floor(H), v: number = +values[h - 1], e: number = H - h; return e ? v + e * (values[h] - v) : v; }
a0bf319f5d6ba97820ae17d549f0cea71c971c91
TypeScript
alexlyul/WebpackCustomDeployPlugin
/src/types.ts
2.875
3
import { Schema } from 'schema-utils/declarations/validate'; export type TFileDeployer = (path: string[], fileContent: string) => Promise<void>; export type TMapping = { entry: string, path: string[], isProduction: boolean, }[]; // schema for config object. export const configSchema:Schema = { type: ...
a2c4e3c95bb1a1f5e90fa1bf9dcec1ee5db8fe74
TypeScript
river0825/gitlab-redmine-migrator
/src/App/Infra/MigrateRecordRepo.ts
2.59375
3
import {MigrateRepo} from "../../Migrate/Domain/MigrateRecord/MigrateRepo"; import {IssueInfo} from "../../Migrate/Domain/MigrateRecord/IssueInfo"; import {MigrateRecord, MigrateRecordProp} from "../../Migrate/Domain/MigrateRecord/MigrateRecord"; import * as fs from "fs"; import * as Path from "path"; export class Mig...
158e622e35d34da783870ec2494e757c90feabfa
TypeScript
GretaBerlin/harp.gl
/@here/harp-datasource-protocol/lib/Expr.ts
2.75
3
/* * Copyright (C) 2017-2019 HERE Europe B.V. * Licensed under Apache 2.0, see full license in LICENSE * SPDX-License-Identifier: Apache-2.0 */ import { ExprEvaluator, ExprEvaluatorContext, OperatorDescriptor } from "./ExprEvaluator"; import { ExprParser } from "./ExprParser"; import { ExprPool } from "./ExprPool"...
42c3c28d4340a7a74f1936fafdbb23fb596d5f81
TypeScript
aidenwallis/modclient2
/src/core/storage.ts
3.09375
3
export class CoreStorage { private static cache = new Map<string, unknown>(); private static storage = window.localStorage; public static get<T>(key: string, defaultValue: T): T { if (this.cache.has(key)) { return this.cache.get(key) as T; } let serializedValue: string | null = null; try {...
a40b746c472f1168e61557ae424441a422d5bb8e
TypeScript
isxam/shakely
/profiles-processor/src/lib/segment/service/ProfileManagement.ts
2.625
3
import { IDatabaseClient } from '../../db'; interface IProfile { id: string name: string } export default class ProfileManagement { private readonly client: IDatabaseClient; constructor(client: IDatabaseClient) { this.client = client; } async create(profile: IProfile): Promise<void> { const { db...
641df913d14752c422429cd959296db54e6fb1f2
TypeScript
sachila/react
/src/store/reducer.ts
2.921875
3
import { InitialState } from "./initialState"; import { AppActions, LOAD_CATEGORY, LOAD_CATEGORY_API, UPDATE_CATEGORY, } from "./types"; export const initialState: InitialState = { categories: [], categoriesApiData: [], }; const reducer = ( state: InitialState = initialState, action: AppActions ): Ini...
234c4983b62a34c2b235638810771fc17e95f9b1
TypeScript
bru02/neo-naplo
/src/helpers.ts
2.6875
3
import store from '@/store'; import linkifyHtml from 'linkifyjs/html'; import { getWeek } from './utils/evaluations'; const utc2date = (value: number | Date): Date => { return value instanceof Date ? value : new Date(value * 1000); }, day = (utc: number | Date): String => { return [ 'Vasárnap', ...
edbbeea6839017545fc66c745ec4aa9c7a097f78
TypeScript
Lite5h4dow/aleph.js
/framework/react/pageprops.ts
2.578125
3
import { ComponentType } from 'https://esm.sh/react@17.0.2' import { E400MissingComponent } from './components/ErrorBoundary.ts' import { isLikelyReactComponent } from './helper.ts' export type PageProps = { Page: ComponentType<any> | null pageProps: Record<string, any> | null } export function createPageProps(ne...
c801bc4b6c422c5366980af23c21f44420c33a83
TypeScript
nunof07/space-patrol
/src/weapons/pulse/PulseDynamicLevel.ts
2.96875
3
import { Position } from '@src/core/Position'; import { Bullet } from '@src/weapons/Bullet'; import { incWeaponLevel } from '@src/weapons/incWeaponLevel'; import { Pulse } from '@src/weapons/pulse/Pulse'; import { PulseLevel } from '@src/weapons/pulse/PulseLevel'; import { PulseLevel1 } from '@src/weapons/pulse/PulseLe...
b0da16531fe7c30e2659c7195a537fa8397895ca
TypeScript
nerjs/nlogs
/src/__tests__/logger.spec.ts
2.6875
3
import { PassThrough } from 'stream' import { TIME_END, TIME_LOG } from '../constants' import { testStandartLevels } from '../helpers/testHelpers' import { Logger } from '../logger' import { ConsoleOut } from '../utils/console.out' import { StringFormatter } from '../utils/string.formatter' import { AllowedList } from ...
07e02fb6dee326f7ef8feb6c8f70766c11a85599
TypeScript
seoj/seoj.github.io
/snake/src/direction.ts
2.84375
3
import { Point } from "./point"; export enum Direction { up = 1, down = 2, left = 3, right = 4, } export const offsets = { [Direction.up]: new Point(0, -1), [Direction.down]: new Point(0, 1), [Direction.left]: new Point(-1, 0), [Direction.right]: new Point(1, 0), }; export const opposites = { [Dire...
d6e9d8ae069f77be90425113abfe3907eb3901e5
TypeScript
IkarosKappler/ngdg
/src/esm/DildoMaterials.d.ts
2.96875
3
/** * A collection of materials and material making functions. * * @require THREE * * @author Ikaros Kappler * @date 2021-07-02 * @modified 2021-08-04 Ported to Typescript from vanilla JS. * @version 1.0.1 */ import * as THREE from "three"; export declare const DildoMaterials: { /** * Create a new mes...
0e61357f6cabea46f5c932ae27e20f72be06752c
TypeScript
MihaiGaidau/dream-trip-ui
/src/app/core/models/pageable.model.ts
2.828125
3
export class Pageable { public pageNumber = 0; public pageSize = 20; public numberOfElements = 1; public totalElements = 20; public first = true; public last = true; constructor(pageNumber?: number, pageSize?: number, numberOfElements?: number, totalElements?: number, first?: boolean, last?: boolean) { ...
f108bc965f7145f7fc6df8a89d404fd60849a134
TypeScript
uxland/uxl-routing
/src/helpers/get-only-url.ts
2.59375
3
import {isPushStateAvailable} from "./is-push-state-available"; export const getOnlyUrl = (url: string, useHash: boolean = false, hash: string = '#') =>{ let onlyURL = url, split; let cleanGETParam = str => str.split(/\?(.*)?$/)[0]; if (typeof hash === 'undefined') { // To preserve BC hash...
5ebe8870cc4a4a434e9b1d668f55d4fb81bb564e
TypeScript
PauloHSOliveira/estudos-ts
/src/AULA10-type-unknown/AULA10.ts
2.703125
3
let x: unknown x = 2 x = 'teste' x = false x = 1000 const y = 10 if (typeof x === 'number') console.log(x + y)
f61807786f8f43399419ef7e0eb0c5973e464ebc
TypeScript
JamilsonMello/gobarber
/backend/src/shared/container/providers/EmailProvider/fakes/FakeEmailProvider.ts
2.53125
3
import IEmailProvider from '../models/IEmailProvider'; import ISendMailDTO from '../dtos/ISendMailDTO'; class FakeEmailProvider implements IEmailProvider { private emailReceived: ISendMailDTO[] = []; public async sendEmail(message: ISendMailDTO): Promise<void> { this.emailReceived.push(message); } } export...
f3191d251a5fc156f2277e349790a134e380fd07
TypeScript
DanielSLucas/RPBackend
/src/modules/users/services/DeleteUserService.spec.ts
2.53125
3
import AppError from '../../../shared/errors/AppError'; import { UsersRoles } from '../infra/typeorm/entities/User'; import FakeHashProvider from '../providers/hashProvider/fakes/FakeHashProvider'; import FakeUsersRepository from '../repositories/fakes/FakeUsersRepository'; import CreateUserService from './CreateUserSe...
65e630a000f0d6ef13a369aced474d0c2b09b0f1
TypeScript
jchai28/jchai28.github.io
/index.ts
2.859375
3
//////// HELPING FUNCTIONS function randomBusinessName(): string { var adjectives: Array<string> = ["Blue", "Red", "Green", "Purple", "Orange", "White", "Trusty", "Speedy", "Enigmatic", "Fly", "Golden", "Sturdy", "Graceful", "Rapid", "Robust", "American", "British", "Asian", "European", "Indian", "Italian", "Australia...