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
fe7e2bc40a7de9149e7759766cdba6f4ccea2c95
TypeScript
TGuoW/awesome-lab
/src/renderer/mainBrowserWindow/components/2048/ts/MatrixContainer.ts
3
3
let deepClone = (matrix) => matrix.map((ele) => ele.slice(0)) class MatrixContainer { matrix constructor (matrix) { this.matrix = deepClone(matrix) return this } push () { this.matrix = this.matrix.map((ele) => ele.filter((item) => !item.value) .concat(ele.filter((item) => item....
7f4f386d9fe4a7e145bf6134a0f007c836130c46
TypeScript
LupodeLupis/Angular
/Hooks/src/app/cockpit/cockpit.component.ts
2.578125
3
import { Component, OnInit, EventEmitter, Output, ViewChild, ElementRef } from '@angular/core'; import { stringify } from '@angular/compiler/src/util'; @Component({ selector: 'app-cockpit', templateUrl: './cockpit.component.html', styleUrls: ['./cockpit.component.css'] }) export class CockpitComponent implement...
154783d2f8c32e214b29c61b6f0757711d140661
TypeScript
clinwiki-org/clinwiki
/front/src/utils/siteViewHelpers.ts
2.546875
3
import { FilterKind} from '../services/site/model/InputTypes'; import { AggFilterInput } from 'types/globalTypes'; import { reject, filter, sortBy, isEmpty, indexOf, } from 'ramda'; import { SiteViewFragment } from 'services/site/model/SiteViewFragment'; export const preselectedFilters = ( view: SiteViewF...
fc885792328a8ac85d3214afb21b1d8de21c1dee
TypeScript
chrisbreiding/proxy
/lib/notion/weather.ts
2.875
3
import { compact } from '../util/collections' import { DayWeather, getWeatherIcon } from '../weather' import { makeTextPart } from './util' export function makePrecipPart (condition: boolean, info: string) { return condition ? makeTextPart(`(${info}) `, 'gray') : undefined } export function makeConditionParts (weat...
8f6f43d0af9c04122d0cf98430c92453577bb5d5
TypeScript
dukov777/timeseries
/app/Student.ts
3.140625
3
export class Student { full_name: string; constructor(public name:string) { this.full_name = name; } getName() : string { return this.full_name; } }
ac9f60d2e8d2d79785c428d93b371fe20e778587
TypeScript
kaaninel/TruthStack
/Truth/Core/Phases/File/Statement.ts
2.65625
3
import * as X from "../../X"; /** * */ export class Statement { /** * @internal * Logical clock value used to make chronological * creation-time comparisons between Statements. */ readonly stamp = X.VersionStamp.next(); /** * @internal */ constructor(document: X.Document, text: string) { cons...
aa6d1b98f856e82aca00a820a553ae1ea8e421e2
TypeScript
LeLuxNet/Wholesome
/src/error/base.ts
2.703125
3
/** The error class representing errors thrown by Wholesome */ export class WholesomeError extends Error { /** @internal */ constructor(name: string, message: string) { super(message); this.name = name; if (Error.captureStackTrace) { Error.captureStackTrace(this, this.constructor); } } }
501e04de7794630ba5ae81c1ab5c2ca6e937631f
TypeScript
vith/sample-chat-app
/src/mock/entities/conversations.ts
2.609375
3
import slugify from "@sindresorhus/slugify"; import faker from "faker"; import getRange from "get-range"; import randomInt from "random-int"; import randomItem from "random-item"; import randomN from "random-n"; import { ConversationType } from "../../entities/ConversationRecord"; import { createMessages, InMemoryMessa...
e98be23494fbb31a93276c1e15c33b698ef3d1e9
TypeScript
ayalakvo/hackaton21_gidon_group
/server/src/user/user.service.ts
2.59375
3
import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import { User } from './user.entity'; @Injectable() export class UserService { constructor( @InjectRepository(User) private usersRepository: Repository<User>, )...
c216a3c97e237ebfcc4e7dbe81c03d005ea3627c
TypeScript
gitter-badger/typescript-spy-decorator
/test/spy_decorator.spec.ts
2.859375
3
///<reference path="../typings/tsd.d.ts" /> import Spy = require("../source/spy"); import FunctionCall = require("../source/function_call"); import spy = require("../source/spy_decorator"); var expect = chai.expect; class Calculator { public sume(a : number, b : number) : number { return a + b; } public mu...
8f57ab6d144dc5ce56b36a5c447cdf172739fa80
TypeScript
HrvojeBumber/SpaceBalls
/ProjectOne/Scripts/managers/playerBulletManager.ts
2.609375
3
/// <reference path="../objects/playerbullet.ts" /> /// <reference path="../objects/player.ts" /> /*FileName: playerBulletManager.ts Authors: Kevin Donkers and Hrvoje Bumber Last Modified by: Kevin Donkers Description: This is the bullet manager that handles the player firing */ module managers { export class Bul...
af24d63b8424e021807959e03f49601d2c62a620
TypeScript
Sage/ez-streams
/src/devices/generic.ts
2.875
3
"use strict"; import { _ } from 'streamline-runtime'; import { Reader } from '../reader'; import { Writer } from '../writer'; /// ## Special streams /// /// * `ez.devices.generic.empty` /// The empty stream. `empty.read(_)` returns `undefined`. /// It is also a null sink. It just discards anything you would wri...
574e09a00d9507a5e7f8acddfd45fbadbcac9a10
TypeScript
Robertcl795/AuthEx
/server/models/User.ts
3.046875
3
import { Schema, model, Document } from 'mongoose' import brypt from 'bcryptjs' interface User extends Document { method: 'local' | 'google' | 'facebook', local: { email: string, password: string }, google: { id: string, email: string }, facebook: { id: s...
1f52cde2a018b1f542841ccc3fd0af430dabe726
TypeScript
beverts312/node-azure-face-sdk
/src/models/verify-res.ts
2.546875
3
/** * @class VerifyRes */ class VerifyRes { public isIdentical: boolean; public confidence: number; constructor(isIdentical: boolean, confidence: number) { this.isIdentical = isIdentical; this.confidence = confidence; } } export = VerifyRes;
de6ecae33b6627b23ec3d0d8d6e13e9e68ee49a4
TypeScript
calebfrieze/vanillas
/src/forIn.d.ts
3.15625
3
/** * A light wrapper around native `for .. in`, but will only iterate over an Object's own properties. * @param fn - A function to execute iteratively, which will receive the `key`, `value`, and `object` (respectively) * @param obj - An object whose keys will be iterated over */ export default function forIn(fn: (...
0befa463b84617edcb35fa774a2f854b9a0c99a6
TypeScript
swatikiran123/AngularSeedProject
/assets/app/messages/message.service.ts
2.671875
3
import { Message } from './message.model'; export class MessageService{ private messages: Message[] = []; addMessage(message: Message){ this.messages.push(message); console.log(this.messages); } getMessages(){ return this.messages; } deleteMessage(){ this.message.splice(this.message.indexOf(message),1); }...
020d0bbdba4f9e413bf3791f89d10e02ae2bbe55
TypeScript
QuentinNev/GlouGlou
/src/app/settings/settings.page.ts
2.546875
3
import { Component, OnInit } from '@angular/core'; import { SettingsService } from '../_services/settings.service'; import { ThemeService } from '../_services/theme.service'; @Component({ selector: 'app-settings', templateUrl: './settings.page.html', styleUrls: ['./settings.page.scss'], }) export class SettingsP...
1a7dafbde8a82850e59b83fbe60213fe3faa5032
TypeScript
robertopinho/Youtube-codes
/src/repositories/ProductRepository.ts
3
3
import Product from '../models/Product'; export default class ProductRepository { private products: Array<Product>; constructor() { this.products = []; } public findAll(): Array<Product> { return this.products; } public findByCode(code: number): Product | undefined { return this.products.fin...
3f62568e15f7151fc90966f1f7370e6aa0e1010a
TypeScript
kildevaeld/stickjs
/src/state.ts
2.5625
3
declare var require: any; import {NestedModel, NestedModelSetOptions} from 'collection'; import {DIContainer} from 'stick.di'; import * as utils from 'orange'; import * as decorators from './decorators'; const debug = require('debug')('stick:state'); function isObject(a: any): a is Object { return a === Object(a)...
11424506dbacb7fe0edceae667cac15c2f3883b1
TypeScript
fiuba-laboral-v2/validations
/test/validateCareerYear.test.ts
3.015625
3
import { NumberIsTooLargeError, validateCareerYear } from "../src"; import { NumberIsNaNError, NumberIsNotIntegerError, NumberIsTooSmallError } from "../src/Errors"; describe("validateCareerYear", () => { it("raises an error for negative numbers", () => expect(() => validateCareerYear(-23)).toThrow(NumberIsTooSm...
679ee44764906d1615fef739f9135d5c5d44f5dd
TypeScript
Sherbet339/TypeScript
/New folder/src/assign.ts
3.890625
4
interface employeeConfig { firstname?: string; lastname?: string; code?: number; age?: number; salary?: number; bonus?: boolean; } function createEmployee(config:employeeConfig): {firstname: string, lastname: string, code:number, age:number, salary:number, bonus:boolean,totalBonus: number} { ...
28ee8538f03202eb6f435cf3a41acb7e06dc1bc8
TypeScript
marcushultman/advent-of-code-2020
/7/1.ts
2.765625
3
import puzzle from '../util/puzzle.ts'; const lines = await puzzle(import.meta).strings(); const tree = {} as { [bag: string]: string[] }; function go(bag: string): boolean { return bag === 'shiny gold' || tree[bag].some(go); } if (import.meta.main) { lines.forEach(line => { const [_, bag, match] = line.mat...
5d0c322cf8125dc67a377f7aff489c7bb0146785
TypeScript
werthdavid/zxing-typescript
/src/core/common/reedsolomon/ReedSolomonDecoder.ts
2.640625
3
/* * Copyright 2007 ZXing authors * * 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 agreed ...
ee2f1e62579cf691f840550d56b7eae84760673d
TypeScript
MichaelKintscher/angular-material-table-demo
/demo-app/src/types/table-data.interface.ts
3.109375
3
// Create an interface for your data, so TypeScript knows what datatype to work with when // putting your data in the table. export interface TableDataInterface { Id: string; ColumnIndex: number; ColumnSpan: number; RowIndex: number; RowSpan: number; Cell: string; }
c7eaa35ff7bb69cc00d7af6318048f745e117f99
TypeScript
twy30/netizen-musou-original-ip-crowdfunding
/src/Abstracts/BackerCard.ts
2.671875
3
/// <reference path="Card.ts" /> abstract class BackerCard extends Card { constructor(name: string, description: string, savingThrows: DiceFace[], fund: number, progress: number) { super(name, description); this.savingThrows = savingThrows; this.fund = fund; this.progress = progres...
a0bc713a92dba412ba442d93a2a15dd80211b121
TypeScript
noru/utils
/lib/math.d.ts
3.421875
3
/** * Math.PI * 2, a whole radiant circle * * @export * @constant */ export declare const TAU: number; /** * Golden ratio * * @export * @constant */ export declare const PHI = 1.618033988749895; export interface Vector2D { x: number; y: number; } /** * Rotate a 2D vector by given a...
cd6381508f787bdb0ab64a45e6bda0914768efd8
TypeScript
Khan/wonder-blocks
/packages/wonder-blocks-data/src/components/data.ts
3.0625
3
import * as React from "react"; import { useHydratableEffect, WhenClientSide, } from "../hooks/use-hydratable-effect"; import type {Result, ValidCacheData} from "../util/types"; type Props< /** * The type of data resolved by the handler's fulfillRequest method. */ TData extends ValidCacheDa...
15561d9e3800925d0234123ad45fd365cc843a69
TypeScript
rabelloo/tamda
/src/set/union.spec.ts
3.15625
3
import { union } from './union'; describe('union', () => { it('should return an unique concatenation of arrayA and arrayB', () => { const arrayA = [1, 2, 3]; const arrayB = [2, 3, 4]; const fn = (n: number) => n; const results = [ union(arrayA, arrayB), union (arrayB) (arrayA), un...
3006a2299ad4f3063e0cc93d7c7291c81e1efe61
TypeScript
klazizpro/uproxy-lib
/src/arraybuffers/arraybuffers.d.ts
3.53125
4
declare module ArrayBuffers { // Byte-wise comparison. function byteEquality(b1:ArrayBuffer, b2:ArrayBuffer) : boolean; // String-to-array buffer conversion by character code. Does not behave well // with strings with high-valued character codes. function arrayBufferToString(buffer:ArrayBuffer) : string; f...
03369e2af63856f3b820d2419a8264b0ecdf7154
TypeScript
OrganizeRooms/NEW-FrontEnd-OrganizeRooms
/src/app/shared/_models/agendamento.ts
2.578125
3
import { Pessoa } from './pessoa'; import { Sala } from './sala'; import { Participante } from './participante'; import { ReservaEquipamento } from './reservaEquipamento'; export interface Agendamento { ageId: number, ageAssunto: string, ageDescricao: string, ageSala: Sala, agePesRespon...
ceb2443a89b378f0ad8bf2722f7a4be980de8973
TypeScript
prhegde/AngularJS_SampleApp
/app-workspace/projects/sample-app/src/app/main/counter/counter.actions.ts
3.375
3
import { Action } from "@ngrx/store"; export const ACTION_TYPES = { ADD: '[counter] increment', REMOVE: '[counter] decrement', RESET: '[counter] reset', }; /** * Every action is comprised of at least a type and an optional payload. Expressing actions as * classes enables powerful type checking in reduce...
41352cb2a3e313f3240a18542e3101dabdbb27ae
TypeScript
ak2ie/yodobashi-teikibin
/__tests__/background.spec.ts
2.515625
3
import { TeikiKonyu } from '../app/scripts/background'; import * as moment from 'moment'; import * as COMMON from '../app/scripts/common'; import * as storage from '../app/scripts/storage'; import { advanceTo, clear } from 'jest-date-mock'; const s = jest.mock('../app/scripts/storage'); describe('バックグラウンド', () => { ...
b8d68df59fdeb975152b3f15f001c26ca82871b9
TypeScript
pixelbar/slackbridge
/src/custom_replies/foodorder.ts
2.84375
3
import { ICustomReply } from "./interfaces"; import { IMessage, IChatInterface } from "../chat_connectors/interfaces"; import Manager from "../manager"; import * as fs from "fs"; export default class FoodOrder implements ICustomReply { private orders: IFoodOrder[]; constructor() { try { thi...
6f1c592f532ae9debe820f1886a7ac581cdd8494
TypeScript
CharlesYerts/meta
/src/0088.merge-sorted-array.88/0088.merge-sorted-array.88.ts
3.421875
3
/** Do not return anything, modify nums1 in-place instead. */ function merge(nums1: number[], m: number, nums2: number[], n: number): void { let index1:number = m-1; let index2:number = nums1.length-1; while(index1>-1){ nums1[index2--] = nums1[index1--]; } index1 = nums1.length-m; inde...
648e7741a80ebefb77f3da86be93e320ba037e97
TypeScript
strblr/mongoe
/src/utility.ts
2.875
3
import { ObjectId } from "mongodb"; export { ObjectId }; export function idify(str: null | undefined): null; export function idify(str: string): ObjectId; export function idify(str: string | null | undefined): ObjectId | null; export function idify(str: string | null | undefined): ObjectId | null { if (str === n...
a9ad5a2322d33c08b10f9d43dec3e23eedef16c6
TypeScript
integreat-io/integreat-adapter-form
/src/adapter/serialize.test.ts
2.921875
3
import test from 'ava' import serialize from './serialize' test('should serialize simple data object', async (t) => { const request = { method: 'MUTATION', data: { value: 1, text: 'Several words here' } } const expectedData = 'value=1&text=Several+words+here' const ret = await seriali...
fde9e6b1bf22d67b2f7411f5a7d04ceade82b0dd
TypeScript
geraldobraz/web-template-project
/backend/src/modules/examples/repositories/ExampleRepository.ts
2.953125
3
import Example from './entities/Example'; import IExampleRepository from './IExampleRepository' class ExampleRepository implements IExampleRepository { private _examples: Example[] = [ { id: '1', name: 'example1', age: 10, email: 'email1@email.com' }, { id: '2', name: ...
1fd5eb2580f4c47431c04685a431e91b1f6e10f9
TypeScript
Ayzrian/e-shop
/shop-api/src/product/models/characteristic-descriptor.model.ts
2.578125
3
import { AllowNull, BelongsTo, Column, ForeignKey, Model, Table, } from 'sequelize-typescript'; import { ProductType } from './product-type.model'; @Table export class CharacteristicDescriptor extends Model<CharacteristicDescriptor> { @AllowNull(false) @Column name: string; @AllowNull(true) @Col...
5e75a029d2ae904200fcfc03f74806f3ebc4d811
TypeScript
Julien-rtg/angular-php
/src/app/user.directive.ts
2.640625
3
import { Component, ElementRef, HostBinding, HostListener, Input } from '@angular/core'; @Component({ selector: 'user', template: ` <h3> {{firstName}} {{lastName}} </h3> <ng-content></ng-content> <p> {{age}} </p> <button (click)="onClickDelete()" >Delete</button> <input #newName type="text" pl...
943ec136c41bbbc4d64e8b8bebcc828f5281ee4a
TypeScript
meireliezer/memory-game
/src/app/core/memory-data.service.ts
2.6875
3
import { Injectable } from '@angular/core'; export interface ICardData { color: string; symbol:string; } export interface IPair { id: number; data: ICardData; } @Injectable({ providedIn: 'root' }) export class MemoryDataService { private _dataList: Array<ICardData> = [ {color: '#222222', sym...
25def7711d059e65ea01b35907b1c08cb81928c7
TypeScript
dtoloto/devires
/src/modules/types/repositories/ITypeRepository.ts
2.5625
3
import Type from '../infra/typeorm/entities/Type'; import ICreateTypeDTO from '../dtos/ICreateTypeDTO'; export default interface ITypesRepository { findAll(): Promise<Type[]>; findById(id: string): Promise<Type | undefined>; findByName(name: string): Promise<Type | undefined>; create(data: ICreateTypeDTO): Pro...
5269903646d644f86f7c16b704d89ef337362209
TypeScript
acdibble/aoc
/2020/ts/day22/part1.ts
3.21875
3
import { readFile } from "../utils.ts"; const [deck1, deck2] = (await readFile(import.meta.url)).split("\n\n") .map((deck) => deck.split("\n").slice(1).map(Number)); const calculateScore = (deck: number[]): number => { let result = 0; const { length } = deck; for (let i = 0; i < length; i++) { result += (...
0efd74327adff9697bb4d6a041e7683ef8ce3c5e
TypeScript
amourlanne/ent
/api/src/middlewares/AuthenticationInfoFromCookieMiddleware.ts
2.515625
3
import { ExpressMiddlewareInterface, Middleware } from 'routing-controllers'; import { NextFunction, Request, Response } from 'express'; import globalConfig from '../../config'; @Middleware({ type: "before", priority: 10 }) export class AuthenticationInfoFromCookieMiddleware implements ExpressMiddlewareInterface { ...
625774b8c93e47549e1d8086a0e92e9cee6ce496
TypeScript
Sevdariel/ANF
/PRECourse/TypeScript/Handbook/TypeManipulation/Conditional Types/inferring-within-conditional-types.ts
3.28125
3
type FlattenI<Type> = Type extends Array<infer Item> ? Item : Type; type GetReturnType<Type> = Type extends (...args: never[]) => infer Return ? Return : never; type NumI = GetReturnType<() => number>; type StrI = GetReturnType<(x: string) => string>; type Bools = GetReturnType<(a: boolean, b: boolean) => boolean[]>;...
fdce8dbe89a23e66418b613e4cc078c1c54fe528
TypeScript
ftonato/graphql-node-api
/src/interfaces/User.interface.ts
2.671875
3
import * as Sequelize from 'sequelize'; export interface UserAttributes { id?: number; name?: string; email?: string; password?: string; } export interface UserInstance extends Sequelize.Instance<UserAttributes>, UserAttributes { isPassword(encodedPassword: string, password: string): boolean; }
b58fc7e5318771bd0d4e7acd12ce68650d9b567f
TypeScript
gopendrajangir/howdoising
/src/actions/types.ts
2.53125
3
export interface NotificationUser { _id: string; name: string; photo: string; } export interface NotificationRecording { _id: string; title: string; } export interface RatingNotification { id: string; rating: number; recording: NotificationRecording; user: NotificationUser; } export interface Comme...
aba563339fe016c1d42acc0a632a1ffefed4ed68
TypeScript
aaronng91/rockPaperScissors
/src/app/player/player.component.spec.ts
2.546875
3
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { PlayerComponent } from './player.component'; import { SimpleChange } from '@angular/core'; describe('PlayerComponent', () => { let component: PlayerComponent; let element: any; let fixture: ComponentFixture<PlayerComponent>; be...
df014b2e23538972730336e1d7950e987a956a9a
TypeScript
forJihye/design-patterns
/assets/ts/facade.ts
3.390625
3
// 퍼사드패턴으로 전자레인지 만들기 /** * 만약 퍼사드패턴을 쓰지 않는다면, 우리는 직접 전원 스위치를 on 시켜야 합니다. * 먼저 쿨러를 작동시키고.. 마그네트론을 작동시키고.. 턴테이블을 돌린 다음에 타이머를 원하는 시간만큼 작동시킵니다. * 또 만약 정지시키려면 하나하나씩 모두 손수 스위치를 내려 줘야하죠. */ interface Switch { on(): void, off(): void } class Cooler implements Switch { on(): void { console.log('쿨러 작동 시작!') } ...
1ac93c1676db237edac445332d93b8b6f9dd1930
TypeScript
Keimeno/segno
/tests/validations/isMultibyte.test.ts
2.515625
3
import { test } from '../index.ts'; Deno.test('should validate multibyte strings', () => { test({ validator: 'isMultibyte', valid: [ 'ひらがな・カタカナ、.漢字', 'あいうえお foobar', 'test@example.com', '1234abcDExyz', 'カタカナ', '中文', ], invalid: ['abc', 'abc123', '<>@" *.'], }); }...
2bdc0c00a2be318e66608b35e696d0b5b54883ac
TypeScript
Turfjs/turf
/packages/turf-boolean-parallel/index.ts
3.5
4
import { Feature, Geometry, LineString, Position } from "geojson"; import cleanCoords from "@turf/clean-coords"; import lineSegment from "@turf/line-segment"; import rhumbBearing from "@turf/rhumb-bearing"; import { bearingToAzimuth } from "@turf/helpers"; /** * Boolean-Parallel returns True if each segment of `line1...
f2152962157aa82845675d0d9a9a4df15e0d7265
TypeScript
WaywardGame/tars
/src/objectives/other/EmptyWaterContainer.ts
2.71875
3
/*! * Copyright 2011-2023 Unlok * https://www.unlok.ca * * Credits & Thanks: * https://www.unlok.ca/credits-thanks/ * * Wayward is a copyrighted and licensed work. Modification and/or distribution of any source files is prohibited. If you wish to modify the game in any way, please refer to the modding guide: * ...
ac95a21b3860589754e6e47fc80e2838175b100b
TypeScript
bodinsamuel/konveyor
/src/Command.ts
2.8125
3
import type { CallbackBefore, Callback, CallbackAll, DependenciesPlan, } from './@types/command'; import type { ConfigDefault } from './@types/config'; import { Option } from './Option'; import { CommandUndefinedError } from './errors'; export interface CommandArgs<TConf extends ConfigDefault> { name: string...
58fbacdaf58591f3a3ee257b507c3df1f3369ff6
TypeScript
dan-sic/snake_game
/src/models/SnakeHead.ts
3.15625
3
import SnakeBlock from "./SnakeBlock"; import Cell from "./Cell"; import Direction from "./enums/Direction"; import Grid from "./Grid"; import Snake from "./Snake"; export default class SnakeHead extends SnakeBlock { private nextCell: Cell | null = null; constructor(cell: Cell, snake: Snake) { super(cell, sna...
891b0aef0b2d5a4e2197eb26cfe77c88ad438fea
TypeScript
toxic-johann/toxic-decorators
/src/watch.ts
2.515625
3
import { bind, isArray, isFunction, isObject, isPlainObject, isString } from 'lodash-es'; import { getDeepProperty } from 'toxic-utils'; import accessor from './accessor'; import applyDecorators from './helper/apply-decorators'; import { compressMultipleDecorators, getOwnKeys, warn } from './helper/utils'; import initi...
18415cf4c8fef405bdee877cde3b4cbbfffabe54
TypeScript
uxdm/uxdm
/packages/model-sketch/src/functions/fromSketchJSON.ts
2.59375
3
import { SketchFormat } from '../types'; import { Rectangle, Group } from '../layers'; /** * 将 单个 SketchJSON 对象 转换为 UXDM Sketch Model */ export const fromSingleSketchFormat = (json: SketchFormat.AnyLayer) => { switch (json._class) { case 'group': return Group.fromSketchJSON(json); // default: cas...
881ab4063d69f11c818658c0b513a6e4c6e32af6
TypeScript
phtn/i3
/src/observables/data.ts
2.578125
3
import { observable, action } from "mobx"; import { createContext } from "react"; import firebase, { provider, db } from "../firebase"; provider.addScope("repo"); class AppData { @observable uid: any = "" @observable user: any = ""; @observable photoURL: any; @observable connectionStatus: string = '...
1c6087a9aa6d93263c35b3ae0e5b15d0fb9afcef
TypeScript
SerhiiShvets/AngularApp
/src/app/shared/articles-data.service.ts
2.640625
3
import { Injectable } from '@angular/core'; export interface Article { id: number; heading: string; date: Date; author: string; shortDescription: string; content: string; sourceUrl: string; } @Injectable({ providedIn: 'root' }) export class ArticlesDataService { newId: number; newHeading: string;...
0012b9b39413ce4271d823fe4b3f7eb7ccd1f81e
TypeScript
nwt-team/nwt-back
/src/user/dto/create-user.dto.ts
2.6875
3
import { IsArray, IsDate, IsDateString, IsEmail, IsHash, IsMongoId, IsOptional, IsString, IsUrl, Matches, } from 'class-validator'; export class CreateUserDto { @IsUrl() @IsOptional() avatar?: string @IsString() @IsOptional() firstname?: string @IsString() @IsOptional() lastname?: stri...
982cced11e7314d12bae441c35bcf7137185eed1
TypeScript
gargigoyal-9602/okyd-pim-project
/packages/components/dist/components/src/CustomCheckBox.d.ts
2.578125
3
import PropTypes from 'prop-types'; import { Component } from 'react'; declare type MyProps = { testID: string; isChecked: boolean; onChangeValue?: (value: boolean) => void; }; declare type MyState = { isChecked: boolean; onChangeValue?: (value: boolean) => void; }; export default class CustomCheckB...
457f506bbdfded447a4e34acac1df3487562275c
TypeScript
techoi/typescript-next
/interfaces/index.ts
3
3
// You can include shared interfaces/types in a separate file // and then use them in any component by importing them. For // example, to import the interface below do: // // import User from 'path/to/interfaces'; export type User = { id: number name: string } export interface ICounterState { count: number; } ...
1ac9268bd8dd8df5d657342f031781ceba4fab46
TypeScript
zjayers/nest-dependency-injection-example
/src/cpu/cpu.service.ts
2.78125
3
import { Injectable, Logger } from '@nestjs/common'; import { PowerService } from '../power/power.service'; @Injectable() export class CpuService { private readonly WATTS: number = 15; private readonly logger = new Logger(CpuService.name); constructor(private readonly powerService: PowerService) {} public co...
df45babfa1657a20f92c42d011c8c7d1f0875fb8
TypeScript
higharc91/arc_udacity_nanodegree_prj2
/src/server.ts
2.828125
3
import express from 'express'; import bodyParser from 'body-parser'; import { Request, Response } from "express" import {filterImageFromURL, deleteLocalFiles} from './util/util'; type ImageReqQuery = { image_url: string; } (async () => { // Init the Express application const app = express(); // Set the net...
45f09a3a0c9b6a0e9ef385f3dd638192a45912d8
TypeScript
shnning/vue-cooler-lazyload
/src/types.ts
2.5625
3
export interface Border { top?: number; bottom?: number; left?: number; right?: number; } export interface LazyloadOptions { border?: Border; threshold?: number; cacheImage?: boolean beforeLoad?: LazyloadCallback; afterLoad?: LazyloadCallback; } export interface IntersectionObserverConfig { rootMa...
1752a41a6ddf5e9cbebb58e2f79d26da73cd62d2
TypeScript
euliveiras/myformapp-backend
/src/modules/users/infra/typeorm/repositories/UserRepository.ts
2.78125
3
import { getRepository, Repository } from "typeorm"; // import User from "../entities/User"; import IUserRepository from "../../../repositories/IUserRepository"; interface ICreateDTO { user: string; email: string; password: string; } export default class UserRepository implements IUserRepository { private orm...
ab2351b27d652e7b7cbabf57dae28ba76fe4bbd7
TypeScript
SR2k/leetcode
/6/283.移动零.ts
3.65625
4
/* * @lc app=leetcode.cn id=283 lang=typescript * * [283] 移动零 * * https://leetcode.cn/problems/move-zeroes/description/ * * algorithms * Easy (64.03%) * Likes: 1633 * Dislikes: 0 * Total Accepted: 788.6K * Total Submissions: 1.2M * Testcase Example: '[0,1,0,3,12]' * * 给定一个数组 nums,编写一个函数将所有 0 移动到数组...
e518e4c6810b75b621ced4e238f87fc190ba681d
TypeScript
FrederikWillem/mex-game
/angular2-front-end/app/successive-advice.pipe.ts
2.734375
3
import { Pipe, PipeTransform } from '@angular/core'; import { MEX } from './mex'; @Pipe({ name: 'successiveAdvice' }) export class SuccessiveAdvicePipe implements PipeTransform { /** * Transforms given amount of advice into the obvious follow up amount of advice. * @param value current given advice * @par...
9e175b0be3322c03103e52a0e285cfb1126f712c
TypeScript
danutzcodrescu/angular4-firebase
/src/app/shared/pipes/sentance-case.pipe.ts
2.75
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'sentanceCase' }) export class SentanceCasePipe implements PipeTransform { transform(value: string, args: string): string { const array = value.split(' '); if (array.length === 1 || args === "sentance") { return value.charAt(0).toUpperCase() ...
ea8ecb5d398fae688ec7b92748d43fb32d6b00ea
TypeScript
pwdrysdale/typeorm_typegraphql
/entities/Books.ts
2.578125
3
import { Field, ID, ObjectType } from "type-graphql"; import { BaseEntity, Column, Entity, ManyToOne, PrimaryGeneratedColumn, } from "typeorm"; import { Author } from "./Author"; import { Lazy } from "../types/Lazy"; @ObjectType() @Entity() export class Book extends BaseEntity { @Field(() => ID...
82ba46cadd6d2eac52857e04cd93f25cee619e51
TypeScript
origin1tech/facile-core
/dist/core/components.d.ts
3.40625
3
/** * Components Collection * @desc stores collection of components. * * @export * @class Components * @template T */ export declare class Collection<T> { /** * _components * * @desc contains map of components. * @member _components; * @private * @type {{ [name: string]: T }} ...
b0d4331e318abee3e8ef3d86e7b962b0e25d45b4
TypeScript
RKRohk/videostream_frontend
/src/hooks/useVideoPlayer.ts
2.75
3
import { useContext, useEffect, useLayoutEffect, useRef } from "react"; import { io } from "socket.io-client"; import { NickNameContext } from "../context/namecontext"; import { ActionTypes, Message } from "../reducers/messageReducer"; type ArgType = { timestamp?: Number }; let lock = false; function unlock() { setT...
5230fc6314fff391b78a0ba2d400d59a80280b4c
TypeScript
nymtech/nym
/ts-packages/mui-theme/src/theme/common.ts
3.015625
3
import { PaletteMode } from '@mui/material'; import { PaletteOptions } from '@mui/material/styles'; /** * This interface defines a palette used across Nym for branding */ export interface NymPalette { highlight: string; status: { success: string; info: string; }; light: string; dark: string; m...
9edb599e239bd1f468c5e0b5f974cdf631958243
TypeScript
racarlosdavid/MatrioshTS
/src/assets/MatrioshTS/src/TypeScript/Interpreter/Instruccion/Bloque.ts
2.6875
3
import { Instruccion } from "../Abstract/Instruccion"; import { Entorno } from "../TablaSimbolos/Entorno"; import { ErrorManager } from "../Reportes/ErrorManager"; import { StringBuilder } from "../Edd/StringBuilder"; import { NodoError, TipoError } from "../Reportes/NodoError"; import { Funcion } from "./Funcion"; imp...
7cc5046418c76fb50c10190f8c7eabddfb1ab939
TypeScript
nextools/metarepo
/packages/auto/core/src/prompt/prompt-log.ts
2.609375
3
import type { TReadonly } from 'tsfn' import type { TPackageBumpMap, TPackageBump } from '../bump/types' import type { TMessage, TLogReleaseType, TRequiredPrefixes, TGitMessageMap } from '../types' import { isResolvedReleaseType } from '../utils' import { log } from './log' export const promptLog = (packages: TReadonl...
f56d62045f1593ed9663dee67eed642a01bde435
TypeScript
chadoh/autark-challenge-fe-only
/app/utils/auth.ts
2.515625
3
const AUTH_CHANGE = 'AuthenticationChangeEvent'; // A "good enough" URL query parser; // can pull in an external lib later if needed, // but will replace auth logic with blockchain-based approach before then const parseUrlParams = (str: string): object => ( str.replace(/^\?/, "").split("&").reduce( (query, str):...
fc23fa5080047df43ef3b2a61185d06feb9bd19b
TypeScript
varunamachi/sparrow
/src/app/entity/entity.model.ts
2.71875
3
export interface Entity { _id?: string name: string type: string location: string ownerID: string variables?: Param[] readers?: string[] writers?: string[] tags?: string[] createdAt?: Date modifiedAt?: Date createdBy?: string modifiedBy?: string } interface Pair { ...
1f55243e360618b9b945fc973d46c6aa10c6ff78
TypeScript
SerhatyiSerhii/contact-book-angular
/src/app/components/contact-form/contact-form.component.ts
2.734375
3
import { AbstractControl, FormGroup } from "@angular/forms"; import { ContactItem } from "src/app/models/contac-item"; export abstract class ContactFormComponent { public updateForm: FormGroup; protected pattern: string = '^(?=.*[0-9])[- +()0-9]+$'; public contactFields: { name: keyof ContactItem; ...
dc2217bf700d83beae224b5c41845fd8e319ad17
TypeScript
igv7/CouponSystemAngularProj
/src/app/components/pipes/customer-filter.pipe.ts
2.640625
3
import { Pipe, PipeTransform} from "@angular/core"; import { Customer } from 'src/app/models/customer'; @Pipe({ name: 'customerFilter' }) export class CustomerFilterPipe implements PipeTransform { transform(value: Customer[], filterBy: string) : Customer[] { filterBy = filterBy ? filter...
efad7b2f30a999b2a7df212d2e38d1dda5131883
TypeScript
arnodt001/simple-dashboard
/dashboard-ui/src/app/components/pipes/byte-unit.pipe.ts
3.21875
3
import {Pipe, PipeTransform} from "@angular/core"; import {isNumeric} from "rxjs/internal-compatibility"; import {ByteUnitEnum} from "../../enums/byte-unit.enum"; @Pipe({ name: 'byteUnitConvertor' }) export class ByteUnitPipe implements PipeTransform { /** * This pipe transform the input value in bytes and tran...
8d62b2f58fc21babf94e76613e475b5672db78d9
TypeScript
CaesiumY/typescript-textbook
/src/chapter10/practice.ts
3.484375
3
/* eslint-disable @typescript-eslint/no-namespace */ // 1. 선언 합치기를 가지고 놀아보자 // 1-a. 6.3.4 컴패니언 객체 패턴에서 소개한 컴패니언 객체를 값과 타입대신 // 네임스페이스와 인터페이스로 재구현하자 interface Currency { unit: "EUR" | "GBP" | "JPY" | "USD"; value: number; } namespace Currency { export const DEFAULT: Currency["unit"] = "USD"; export function f...
c87bc6c3de8786aaebb8cf4e24431d3849df3adc
TypeScript
lifaon74/routes
/src/misc/helpers/is/IsObject.ts
2.984375
3
export function IsObject<T extends object = object>(value: any): value is T { return (typeof value === 'object') && (value !== null); }
141595f5e819873074afaf1bfbed7055aa870ec4
TypeScript
trufflesuite/truffle
/packages/codec/lib/format/types.ts
3.03125
3
/** * Contains the types for type objects, and some * functions for working with them. * * @category Main Format * * @packageDocumentation */ import debugModule from "debug"; const debug = debugModule("codec:format:types"); //type objects for Solidity types //these will just be defined as interfaces; there's n...
2e8a2dc06a61f3115020b802511db1a93114c6e8
TypeScript
qlonik-forks/matechs-effect-legacy
/packages/core/demo/demo23.ts
2.78125
3
import * as A from "../src/Array" import { pipe } from "../src/Function" import * as T from "../src/next/Effect" import * as S from "../src/next/Stream" const cancel = pipe( S.effectAsyncInterrupt<unknown, never, number>((cb) => { let i = 0 const timer = setInterval(() => { cb(T.succeed(A.range(0, i)))...
5ee88919c0ee577ab890e65a96041134b35c2c64
TypeScript
sjovanovic974/100AlgorithmsChallenge
/alphabeticShift/alphabeticShift.ts
3.796875
4
// My solution of the problem using String methodes function alphabeticShift(inputString: string): string { return inputString .split('') .map(l => { if (l === 'z') { return 'a'; } else if (l === 'Z') { return 'A'; } else { return String.fromCharCode(l.charCodeAt(0) +...
428127f9a59fbc4b58d1da1366b00625cbd5be91
TypeScript
MarcosSpessatto/Rocket.Chat
/apps/meteor/app/federation/server/lib/context.ts
2.546875
3
export const contextDefinitions = { ROOM: { type: 'room' as const, isRoom(event: { context: { roomId?: string } }): boolean { return !!event.context.roomId; }, contextQuery(roomId: string) { return { roomId }; }, }, defineType(event: { context: { roomId?: string } }): 'room' | 'undefined' { if (th...
cd2b0042c0ec65514372e119b5e34ad606b648ca
TypeScript
snayan/algorithm-demo
/Algorithm/排序-桶排序/index.ts
3.9375
4
/* 题目,对于一组0到5000之间的数,进行桶排序 */ import { quickSortOnArray } from '../排序-快速排序'; /* 思路:1. 将0到5000之间的数划分到100个桶里, 2. 0号桶里存[0,50]之间的数据,1号桶里存[51,100]之间的数据,2号桶里存[151,200]之间的数据。。。 3. 类似的,99号桶里存[4951,5000]之间的数据 4. 然后针对每个桶里数据单独使用快速排序进行排序, 5. 依次从0号桶,1号桶。。。99号桶取出数据,则数据就是有序的了 时间复杂度:O(n) ,当桶的数量接近数组长...
5448e9b482ee2d731dd3d7a08f4716ef3d2b5705
TypeScript
JohnVUgonabo/communication-ui-library
/packages/react-composites/tests/server/server.ts
2.515625
3
// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import express from 'express'; import { Server } from 'http'; import path from 'path'; let server: Server; const app = express(); export const createTestServer = (props: { appDir: string; serverUrl: string }) => // eslint-disable-next-line...
2afb8a6534c6f9fa5a5c615c229ebd810d879eaf
TypeScript
xDveGax/exo-frontend
/custom-elements/exo-exq/src/app/model/question.model.ts
2.671875
3
export interface Step { section: string; questions: Question[]; } export interface Question { name: string; options: Answers[]; section: string; pk: number; } export interface Answers { pk: number; value: string; } export interface Industry { pk: number; name: string; }
70899cd83a9dbe7b0645948407c04fb0096e0d45
TypeScript
nguoianphu/fra-phaser
/src/game/events.ts
3.0625
3
export class EventBus implements IEventDispatcher { private handlers: { type: GameEvent; func: Function }[] = [] public on(type:GameEvent,call:Function) { this.handlers.push({type:type,func:call}) } public raise( type: GameEvent, ...rest:any ) { // console.log(type,...rest) for ( let han...
48085741891e41140211b7a188315b2b593898dd
TypeScript
derozn/management-sdk
/src/field.ts
2.640625
3
import { ChangeItem, MigrationChange } from "./migration"; import { MutationMode } from "./util"; import { GraphQLBatchMigrationCreateEnumerableFieldInput, GraphQLBatchMigrationCreateRelationalFieldInput, GraphQLBatchMigrationCreateRemoteFieldInput, GraphQLBatchMigrationCreateSimpleFieldInput, GraphQLBatchMig...
71e33cf59498ad3996e35afbecc682412ef4fab5
TypeScript
AlessioVinci/Softwaredesign_NodeJS
/src/classes/Question.ts
2.734375
3
import { QuestionBuilder } from "./QuestionBuilder.ts"; import { Answer } from "./Answer.ts"; export class Question { title: string; answers: Answer[]; constructor(questionBuilder: QuestionBuilder) { this.title = questionBuilder.getTitle; this.answers = questionBuilder.getAnswers; } }
ef466a8f8484499154bfc3a8feef9e3fab85a93e
TypeScript
Splidejs/splide
/src/js/components/Layout/Layout.ts
2.671875
3
import { TTB } from '../../constants/directions'; import { EVENT_OVERFLOW, EVENT_REFRESH, EVENT_RESIZE, EVENT_RESIZED, EVENT_UPDATED } from '../../constants/events'; import { EventInterface, Throttle } from '../../constructors'; import { Splide } from '../../core/Splide/Splide'; import { BaseComponent, Components, Opti...
ee73f7c1278a4d077842d7adf1d74ed586798bbf
TypeScript
rui-watanabe/ts-second-app
/src/interface.ts
4.25
4
type addFunc = (num1: number, num2: number) => number; // interface addFunc { // (num1: number, num2: number): number; // } let addFunc: addFunc; addFunc = (n1: number, n2: number) => n1 + n2; interface NameAble { name?: string; nickName?: string; } const nameAble: NameAble = { name: 'Max', nickName: 'Ma' }...
aa73f9d0a9013feafb5bb4d420cb47f89f27775c
TypeScript
btoll/logger-ts
/src/interfaces.ts
2.53125
3
interface AbstractLog { prelog(name?: string): string; postlog(name?: string): string; } interface DefaultLogger { clear?(): void; debug?(...a: Array<any>): string; error?(...a: Array<any>): string; fatal?(...a: Array<any>): string; info?(...a: Array<any>): string; log?(...a: Array<any>...
42604167f96906724439ab86b9cc7c88c6007f79
TypeScript
adriancarriger/pv-site
/src/app/packages/filter/filter-options.ts
3.125
3
/** * @module HomeModule */ /** */ /** * Options used by the {@link FilterComponent}. */ export interface FilterOptions { items: FilterItems; searchFields: Array<string>; } /** * Supported filtering types */ export type FilterType = 'search' | 'select'; /** * Items used to filter * - Items can contain diffe...
80db3382621334eff1911b0726f845edbe2814fd
TypeScript
stephaneerard/shots-analysis.ts
/src/controllers/hello.controller.ts
2.671875
3
import {get, Request, ResponseObject, RestBindings} from '@loopback/rest'; import {inject} from '@loopback/context'; /** * OpenAPI response for hello() */ const HELLO_RESPONSE: ResponseObject = { description: 'Hello Response', content: { 'application/json': { schema: { typ...
960c5aa50d78846a1934e65d47d74ee155f7527d
TypeScript
maria-machine/mariamachine.io
/src/actionCreators/lang.ts
2.515625
3
export interface ISetLangLocale { type: 'SET_LANG_LOCALE'; payload: string; } export const setLangLocale = (locale: string): ISetLangLocale => ({ type: 'SET_LANG_LOCALE', payload: locale });
ba64eea8aa80819276afbf1ae8a2a663dfd9197c
TypeScript
guaiwola/secret
/server/middlewares/catchError.ts
2.890625
3
import assert from 'assert'; import { KoaContext } from '../../types/koa'; /** * 全局异常捕获 * 如果是通过 assert 主动抛出的异常, 则向客户端返回该异常消息 * 如果是其它异常, 则打印异常信息, 并返回 Server Error */ export default function catchError() { return async (ctx: KoaContext, next: Function) => { try { await next(); } catch...
236fda99a380429b11800c528bf5039eb2fb9b7a
TypeScript
comassky/vuejs-typescript-template
/src/services/AlbumsApiServices.ts
2.546875
3
import { AlbumInterface } from '@/Interfaces/AlbumInterface'; import Axios, { AxiosInstance } from 'axios'; export default abstract class AlbumsApiServices { private static rest: AxiosInstance = Axios.create(); static async getAllAlbumsOfUser(userId: number): Promise<AlbumInterface[]> { const respons...
981e0f1c3518d9225d7bd28b1174dd986e1d6395
TypeScript
PixelRPG/javelin
/packages/ecs/src/topic.spec.ts
2.84375
3
import { Topic, createTopic } from "./topic" describe("createTopic", () => { it("adds events to its list of events", () => { const topic: Topic = createTopic() topic.push({ inputs: [] }) expect(Array.from(topic).length).toBe(0) }) it("transitions messages to ready state when flush is called", () => ...
2db39ebc28fae6948841b51682b8aece03ef16e1
TypeScript
leenakh/Fullstack2021Osa9
/health-app/src/bmiCalculator.ts
3.625
4
type Message = 'Underweight (unhealthy weigth)' | 'Normal (healthy weight)' | 'Overweight (unhealthy weight)' | 'Obese (very unhealthy weight)'; /* interface CalculateValues { value1: number; value2: number; } */ /* const parseArguments = (args: Array<string>): CalculateValues => { if (args.length < 4) th...