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
5a8b1b975de48c490ab3c21da12ad5b0a8d59b29
TypeScript
manuth/ExtendedYoGenerator
/packages/extended-yo-generator/src/Components/Inquiry/QuestionBase.ts
3.234375
3
import { ChoiceCollection, KeyUnion, Question } from "inquirer"; import { GeneratorOptions } from "yeoman-generator"; import { IGenerator } from "../../IGenerator.js"; import { IGeneratorSettings } from "../../IGeneratorSettings.js"; /** * Represents a question. * * @template TSettings * The type of the settings o...
7515d3e9e71d24a7e5683f0cd0b29895a3598101
TypeScript
mamunhpath/leetcode
/src/lemonade-change/index.ts
2.921875
3
export const lemonadeChange = function(bills: number[]) { let five = 0 let ten = 0 for (let money of bills) { if (money === 5) five++ else if (money === 10) { if (five === 0) return false ten++ five-- } else { if (five === 0 || ten * 10 + five * 5 < 15) return false if (...
57ef64628f6915b2b0404c7417b6577dfde5499b
TypeScript
cm94242/ts-monads
/src/option.ts
3.875
4
export interface OptionMatch<T, T2> { some: (arg: T) => T2, none: () => T2 } export abstract class Option<T>{ abstract map<T2>(fxn: (arg: T) => T2) : Option<T2> abstract flatMap<T2>(fxn: (arg: T) => Option<T2>) : Option<T2> abstract filter(fxn: (arg: T) => boolean) : Option<T> abstract get() : T abstract is...
8bab6fee39b4ead80d2537c36fefddfc0db38cbe
TypeScript
Mikael-R/aziris
/src/utils/listItems.ts
3.171875
3
interface IListItems { (items: any[], pageActual: number, limitItems: number): any[] } const listItems: IListItems = (items, pageActual, limitItems) => { const itemsInPageActual = [] const totalPages = Math.ceil(items.length / limitItems) let count = pageActual * limitItems - limitItems const delimiter = cou...
0501b7227be859ed3f7b94cb7126cb21a6dfd0b9
TypeScript
future4code/Murilo-Oliari
/semana14/Aula44/src/exe03.ts
3.625
4
function arrayToObject (arrayDeNumeros: number[]): void { type objetoDaLista = { quantidadeDeNumeros: number, quantidadeDeImpares: number, somaDeTodosOsElementos: number } const impares = arrayDeNumeros.filter(el => el % 2 !== 0 ? true : false); const soma: num...
4ad3b8300c902374bb9700cb42f0185bb354813e
TypeScript
KnifeOnlyI/AgileMind
/src/main/webapp/app/entities/release.entity.ts
3.0625
3
/** * Represent a release * * @author Dany Pignoux (dany.pignoux@outlook.fr) */ export class Release { /** * Constructor * * @param id The ID * @param name The Name * @param description The description * @param date The date * @param stories The stories * @param project The project */ ...
a22a180991528bce8d94494501e54bad373bcbb7
TypeScript
majidbop/Assignment
/src/finders/athletes.ts
2.609375
3
import { Filter } from '../models/interfaces' import { Athlete } from '../models/database/athlete' import log from '../logger/log'; import { getAthleteBySkill, getAthleteByCompetition, getAthleteIdsByFilter, getAthleteById } from '../drivers/athletes'; import { AthletesPresenter } from '../models/presenter'; export as...
3ba9ba94957c0f7fde19fd60a5b245234740df64
TypeScript
irosvall/chatbuds-client
/src/app/services/error-handler/error-handler.service.ts
2.890625
3
import { Injectable } from '@angular/core' import { Observable, of } from 'rxjs' @Injectable({ providedIn: 'root' }) export class ErrorHandlerService { constructor() { } /** * Handle Http operations that failed. * * @param operation - Name of the operation that failed. * @param result - Optional v...
afda553464ba8cf3174e80c93b40992cbc67fa2f
TypeScript
ahiatt14/gallformers
/pages/api/source/index.ts
2.640625
3
import { pipe } from 'fp-ts/lib/function'; import * as O from 'fp-ts/lib/Option'; import * as TE from 'fp-ts/lib/TaskEither'; import { NextApiRequest, NextApiResponse } from 'next'; import { Err, getQueryParams, sendErrResponse, sendSuccResponse, toErr } from '../../../libs/api/apipage'; import { SourceApi, SourceWithS...
6e12e0db188e8f6c739be9f2c6bd9b1118f51229
TypeScript
TakyiuLo/angular-temp-auth
/src/app/data-share.service.ts
2.84375
3
import { Injectable } from "@angular/core"; import { BehaviorSubject } from "rxjs/BehaviorSubject"; /* DataShareService interfaces start here */ export interface Action { readonly type: string; readonly payload: any; } /* DataShareService interfaces ends here */ @Injectable({ providedIn: "root" }) export class...
f371d3240d74b2fd601d57f34fd1682266f885fc
TypeScript
JonathanWilbur/preql
/source/normalizeError.ts
3.40625
3
/** * This function exists to solve two problems: * * 1. In older versions of Serverless, Serverless crashes when it encounters * an unusually structured `Error` type. See * [the issue](https://github.com/serverless/serverless/issues/6267). * 2. The `Ajv` library, which is used for JSON validation, th...
605781a3a9460404d36ed6117bc527f9ceed9b06
TypeScript
dotkom/hacktoberfest-code-golf
/src/storage.ts
3.109375
3
import { SetStateAction, Dispatch, useEffect, useState } from 'react' const getLocalStorageState = <T>(key: string, orElse: T): T => { try { const data = localStorage.getItem(key) if (data) { return JSON.parse(data) } else { return orElse } } catch {} return orElse } const setLocalSt...
b9641cbc1fad0cd92c5a97bebf9408f433c049ab
TypeScript
confuego/Math
/tests/matrix3.spec.ts
3.203125
3
import { Matrix3, Vector3 } from "../src"; import { expect } from "chai"; import "mocha"; describe("Matrix3", () => { it("should create", () => { const mat = new Matrix3([1, 2, 3], [4, 5, 6], [7, 8, 9]); expect(mat).to.not.be.null; }); it("should get cells", () => { const mat = new Matrix3([1, 2, 3], [4, 5,...
69c70beda325cbabcd9e988643946ec77df9879b
TypeScript
flode/Tarot
/src/datastructure/responses.ts
2.78125
3
import {IData} from '../interfaces/IData'; type Jeu = { jeuId: number; active: boolean; joueurs: string[]; }; export type ServerResponse = { type: typeof ServerResponses.JEU; jeu: ResponseJeu | null; moi: number } | { type: typeof ServerResponses.JOUEUR_JOINT; joueurs: string[]|null; jeux: Jeu[]; ...
1f28d7c05ddebc3b7b12cb224eff3faee31c390c
TypeScript
end5/CoCWebOld
/build/Game/Items/Consumables/PurePearl.ts
2.71875
3
import { Consumable } from './Consumable'; import { ConsumableName } from './ConsumableName'; import { DisplayText } from '../../../Engine/display/DisplayText'; import { Character } from '../../Character/Character'; import { PerkType } from '../../Effects/PerkType'; import { ItemDesc } from '../ItemDesc'; export class...
2ed82160b0353ace405ef984fbb6d6086da7efcd
TypeScript
artem6/board_games
/src/games/pearsToPears/cards.ts
3.0625
3
export const getGreenCard = () => { return greenCards[Math.floor(Math.random() * greenCards.length)]; }; export const getRedCard = () => { return redCards[Math.floor(Math.random() * redCards.length)]; }; export const getNewHand = () => { const cards: string[] = []; for (let i = 0; i < 5; i++) cards.push(getRedC...
1abd10f40d3ce3b707d8fefca51562f607e33525
TypeScript
tai-deng/chicken
/chicken/assets/script/gamecore/.svn/pristine/1a/1abd10f40d3ce3b707d8fefca51562f607e33525.svn-base
2.5625
3
const {ccclass, property} = cc._decorator; /** * 定义位置常量 */ export enum GameCoreLocation { //顶部居中 TOP_CENTER = "TC", //顶部靠左 TOP_LEFT = "TL", //顶部靠右 TOP_RIGHT = "TR", //底部居中 BOTTOM_CENTER = "BC", //底部靠左 BOTTOM_LEFT = "BL", //底部靠右 BOTTOM_RIGHT = "BR" }
8c266923d19f194977754da21b27c3bdc840ffe4
TypeScript
crainsaw/SmartHeater
/src/heating/logic/trainItemGenerator.ts
2.890625
3
import { EnvironmentProvider, Environment } from '../../environment/environmentProvider'; import { TrainingItem } from './heatTimePredictor'; import HeaterController from './heaterController'; export type TrainItemListener = (item: TrainingItem) => void /** * Creates training items */ export default clas...
c855491943f77848597fc7a738f2ab3d336f72f1
TypeScript
kentico-anthonym/kontent-delivery-sdk-js
/test-browser/setup/observable-factory.ts
2.65625
3
import { Observable, zip } from 'rxjs'; import { map } from 'rxjs/operators'; import { IDeliveryClient, IQueryConfig } from '../../lib'; import { AllTestObjects, Movie } from './models'; export class ObservableFactory { private readonly movieCodename: string = 'warrior'; private readonly taxonomyCodename: st...
2edad4dc89660cf3b03bd5c3e2efe0c95ec22914
TypeScript
Esteban-Rocha/codefights
/js/src/century/century.ts
3.421875
3
// @ts-check /** * JavaScript Century Challenge * @author Esteban Rocha * @link https://github.com/Esteban-Rocha */ /** * @param year number * @return number */ function centuryFromYear(year: number) { // Get param and calculate it's century const result: number = Math.trunc((year + 99) / 1...
feebcc07f6368a0369193f4ebe9ec1c39b3be710
TypeScript
PRNDcompany/canvas-object
/src/graphics/Circle.ts
3.1875
3
import { DisplayObject, DisplayObjectOptions } from './DisplayObject'; const PI2 = Math.PI * 2; export interface CircleOptions extends DisplayObjectOptions { radius: number; startAngle?: number; endAngle?: number; } export class Circle extends DisplayObject { public radius: number; public startAngle: numbe...
6acb7fb8b973bd55784ff31e63a82d1e00106a11
TypeScript
varundhariyal/Typescript-Class
/index.ts
2.71875
3
console.log('Youtube Class Section') // youtube class class YoutubeVideo { // fields/properties with public access modifier videoTitle: string; numberOfViews: number; youtubeChannel: string; videoDescription: string; numberOfLikes: number; numberOfDislikes: number; numberOfSubscriber: nu...
a7b9d98a138b5b069951f804f137bef65860eeba
TypeScript
Kuroko5/syndicate-web-app
/src/app/pipes/name-format.pipe.ts
3.015625
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'nameFormat' }) export class NameFormatPipe implements PipeTransform { /** * Capitalize the string * @param str The string to captitalyze */ private capitalize(str: string): string { return str[0].toUpperCase() + str.slice(1); } ...
67e1ace1c24585636295b181ceca8034da7f5eea
TypeScript
Paulotx/ignite-tests-challenge
/src/modules/users/useCases/createUser/CreateUserUseCase.spec.ts
2.671875
3
import { InMemoryUsersRepository } from "../../repositories/in-memory/InMemoryUsersRepository"; import { CreateUserError } from "./CreateUserError"; import { CreateUserUseCase } from "./CreateUserUseCase"; let inMemoryUsersRepository: InMemoryUsersRepository; let createUser: CreateUserUseCase; describe("CreateUserU...
21919d6c83c207131a0f7a8e77d4452f5ea02688
TypeScript
ravisharmabhattarai/angular-component-architecture
/src/app/common-data/widgets.service.ts
2.578125
3
import { Injectable } from '@angular/core'; import { Widget } from './widget.model'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { of } from 'rxjs/observable/of'; import { UUID } from 'angular2-uuid'; const MOCK_WIDGETS = [ { "id": 1, "name": "Red Widget", ...
348d897f345732ec7004847b5e4a9ab522ac5a1a
TypeScript
we-do-good-tech/wave2-project3
/src/saga/users/actions.ts
2.703125
3
import { usersTypes } from '../types'; import { IUsersState } from './reducer'; const loadUsers = () => { return { type: usersTypes.LOAD_USERS, }; }; const updateUser = (name: string, id: string) => { return { type: usersTypes.UPDATE_USER, payload: { name, id }, }; }; const setAdmin = (id: string...
18deaf91f39988097724a648e05db3a48444113b
TypeScript
Rainboylvx/pcs
/_src/frontEnd/src/utils.ts
2.96875
3
//[JavaScript 函数防抖的实现](https://www.freecodecamp.org/chinese/news/javascript-debounce-example/) export function debounce(func:any, timeout = 300){ let timer:any; return (...args) => { clearTimeout(timer); timer = setTimeout(() => { func.apply(this, args); }, timeout); }; }
3666cbbe4a12c171fab8039fd3933317f3cb0a2c
TypeScript
cloudfoundry/stratos
/src/frontend/packages/store/src/entity-catalog/entity-catalog.store-setup.ts
2.71875
3
import { IRequestTypeState } from '../app-state'; export function getDefaultStateFromEntityCatalog<T = any>(entityKeys: string[], defaultState: T, initialState: IRequestTypeState) { return entityKeys.reduce((currentState, entityKey) => { if (currentState[entityKey]) { return currentState; } return ...
2405cd518e3c99461775d64b53dee3427e774189
TypeScript
agolomazov/react-hooks-ts
/src/features/todo/ducks/reducer.ts
2.984375
3
import { uuidv4 } from '../../../common/utils'; import { TodoState, TodoActionTypes, TodoAdd, Todo, TodoCompleted, TodoRemove, Todos, TodoSearch, TODO_ADD, TODO_COMPLETED, TODO_REMOVE, TODO_SEARCH, TODO_FETCH_START, TODO_FETCH_STOP, TodoFill, TODO_FILL, } from '../types'; export const ...
e9a67950a50b8675374cd0b0924d02bac007761d
TypeScript
PineappleFinance/cheeseswap-api
/src/v2/summary.ts
2.546875
3
import { getAddress } from '@ethersproject/address' import { APIGatewayProxyHandler } from 'aws-lambda' import { createSuccessResponse, createServerErrorResponse } from '../utils/response' import { getTopPairs } from './_shared' interface ReturnShape { [tokenIds: string]: { last_price: string; base_volume: string; ...
111d6df817f6867878adb83151fdd1938e63509c
TypeScript
jo9182/daud
/Game.Engine/wwwroot/src/camera.ts
2.875
3
import { Vector2 } from "./Vector2"; import { Dimension2 } from "./Dimension2"; import * as PIXI from "pixi.js"; export class Camera { distance: number; lookat: number[]; size: Dimension2; fieldOfView: number; viewport: { rectangle: PIXI.Rectangle; scale: number[] }; aspectRatio: number; co...
6843c4f5658417a0d9665a631e4abdb82e4ab5f4
TypeScript
Isur/isomorphic-react-app
/src/Server/Modules/Sessions/session.service.ts
2.515625
3
import { Inject, Service } from "typedi"; import { Config } from "../../Config"; import SessionRepository from "./session.repository"; import { SessionObject } from "@shared/Interfaces/session.interface"; @Service() class SessionService { @Inject() private readonly _config: Config; @Inject() private readonly ...
fa559e49aeb6beb14f7fa8692b839513d5a5753e
TypeScript
romefar/musify-frontend
/src/utils/calculateDuration.ts
2.9375
3
export const calculateDuration = (duration: number | undefined, ms = true) => { const diff = ms ? 60000 : 60; const appr = ms ? 1000 : 1; const minutes = duration ? Math.floor(duration / diff) : null; const seconds = duration ? (duration % diff) / appr : null; if (!minutes || !seconds) { return 'N/A'; ...
b4b33df368320662f25ea0401c9685324eee2610
TypeScript
ryanroundhouse/version-finder-standalone
/src/Dependency.ts
2.90625
3
import Family from './Family'; export class Dependency { id: number; version: string; supported: boolean; family: Family; dependencies: Dependency[]; constructor(id: number, family: Family, version: string, supported: boolean, dependencies: Dependency[]) { this.id = id; this.family = family; t...
87d407053cdc547cc9a4a41336c36f3b3cc7f67c
TypeScript
thesaikat/fiddle
/src/utils/focused-editor.ts
2.53125
3
import { Editor } from '../renderer/state'; /** * Returns the currently focused editor. * * @returns {(MonacoType.editor.IStandaloneCodeEditor | null)} */ export function getFocusedEditor(): Editor | null { const { editorMosaic } = window.ElectronFiddle.app.state; for (const editor of editorMosaic.editors.val...
7998a5c1dbf627d00093dd424b491ff881ab6d6a
TypeScript
4cadia-foundation/janus
/packages/indexer-core/src/Infra/Helper/ArrayHelper.ts
3.609375
4
export default class ArrayHelper { public static Merge<T>(array1, array2): T[] { const array = array1.concat(array2); return this.Unique(array); } public static Unique<T>(array): T[] { const a = array.concat(); for (let i = 0; i < a.length; ++i) { for (let j = i + 1; j < a.length; ++j) { ...
279a3e42bb4c7aaeaa6b3900e19a4f83d37fee98
TypeScript
kvwillian/vimob
/src/models/Block.ts
2.609375
3
import DevelopmentReference from './DevelopmentReference'; export default class Block { development: DevelopmentReference; externalId: number; name: string; deliveryDate?: Date constructor( development: DevelopmentReference, externalId: number, name: string, deliveryDate?: Date ...
0d4202cb9ddb3db34641e6dff38ae16ea2e7af94
TypeScript
eboninger/MySpotifyBillboard
/angular/src/app/user/user.model.ts
2.5625
3
export class User { Id: number; AccessToken: string; TokenType: string; DisplayName: string; Scope: string; ExpirationTime: Date; RefreshToken: string; Email: string; SpotifyId: string; constructor (at, dn, e, et, id, rt, s, si, tt) { this.Id = id; this.AccessTok...
fff485c4474e39480a91d47db3b38e9eb0922103
TypeScript
taehwanno/instagram-shortcut-extension
/src/internal/node-to-html-element.ts
3.65625
4
/** * Convert DOM Node to HTMLElement * * Based on DOM specification, HTMLCollection is a collection of object that extend an Element. * In Chrome and Firefox both, those objects are HTMLElement. * So I use an explicit type cast with 'as' keyword. * @See https://dom.spec.whatwg.org/#htmlcollection * * @param {N...
f0f0ca3e4afe720b2033be1a80a5787021f7f944
TypeScript
sebgroup/frontend-tools
/src/CookieStorage/CookieStorage.ts
3.25
3
export interface SetItemOptions { /** Expiration Date */ expires?: Date; /** Maximum age in seconds */ maxAge?: number; } /** * CookieStorage is a handler for reading and writing cookies in Javascript * Usage is similar to `localStorage` and `sessionStorage` */ export class CookieStorage implements S...
fb7bead56ec3328d603afce4d2cd82ff43af3c6b
TypeScript
balloon-chat/balloon-react
/src/data/redux/topic/slice.ts
2.53125
3
import { createSlice } from '@reduxjs/toolkit'; import { EditTopicModes, EditTopicStates, topicStateName, TopicStates, TopicStateType, } from 'src/data/redux/topic/state'; import { editTopicReducer, finishEditTopicReducer, setTopicsReducer, } from 'src/data/redux/topic/reducer'; import { createTopic, ...
7725490aca7334ab463b4e1df7276427278b1030
TypeScript
huiXinYiJi/rxjs
/observable_operator.ts
2.984375
3
import { Observable, from as ObFrom } from 'rxjs'; // 首先npm install --save rxjs-compat@6 向后兼容,再引入map和reduce import 'rxjs/add/operator/map'; import 'rxjs/add/operator/reduce'; let persons = [ { name: 'Dave', age: 34, salary: 2000 }, { name: 'Nick', age: 37, salary: 32000 }, { name: 'Howie', age: 40, salary: 26000...
98b9a8ebd4021244dbd1f5f6702923796569e789
TypeScript
liurongqing/phaser3-tutorial-memory-match
/src/controllers/StartModal.ts
2.71875
3
import { TextureKeys } from '~/consts/index' enum ModalState { IDLE, ENTERING, EXITING } export default class StartModal { private scene: Phaser.Scene private panel: Phaser.GameObjects.RenderTexture private startText: Phaser.GameObjects.Text private state = ModalState.IDLE get isExiting() { return...
480956e6b818bfcb6a9596665cbaf576c8c1bf94
TypeScript
thanhbm-teko/showroom-app
/app/service/serviceProvider/pl/SearchRequestBuilder.ts
2.671875
3
export class SearchRequestBuilder { searchRequest: PL.API.SearchRequest; constructor(channel: PL.Channel, terminal: string, visitorId: string) { this.searchRequest = { channel, terminal, visitorId, _page: 1, _limit: 10 }; } setPage(page: number): SearchRequestBuilder { this.searchRequest._page = page;...
9a6947d276ff597737e1865ad8e2673ede3eb77e
TypeScript
spark-js/spark
/src/lib/common/types.ts
3.046875
3
import { VNode } from '../vdom'; export type Constructor<T> = new (...args: any[]) => T; /** * Definition of Spark elements */ export interface SparkElementDefinition<T = object> { /** * Name of the custom element */ is: string; /** * Properties that are decorated with `ObserveAttribute` a...
56057c979f27b113ffd45d95a39e8ff7eafbbdaa
TypeScript
iricwang/TypeScriptToLua
/src/lualib/declarations/global.d.ts
2.6875
3
/* eslint-disable no-var */ /** @noSelfInFile */ declare var __TS__sourcemap: Record<number, number> | undefined; declare var __TS__originalTraceback: | ((this: void, thread?: any, message?: string, level?: number) => string) | undefined; // Override next declaration so we can omit extra return values declare...
08c2b87c644c8bfd3e287611966619c6922242d8
TypeScript
Alexintosh/frontend
/src/config/types.ts
2.53125
3
export type PoolId = string; // je celkem jedno, co konrétně to bude, ale mohla by to být např. adresa chytrého kontraktu. Stejně jako např. na Balanceru v url: např. https://pools.balancer.exchange/#/pool/0x59a19d8c652fa0284f44113d0ff9aba70bd46fb4/ export interface InputInterface { address: string; // '0x2bb66572...
c9f3d6ae015e8a975a173482cc8e89e8a67bfdf5
TypeScript
gabrielsimongianotti/wta
/backend/src/modules/merit/infra/typeorm/repositories/MeritRepository.ts
2.640625
3
import { getRepository, Repository } from 'typeorm'; import IMeritRepositoty from '@modules/merit/repositories/IMeritRepository'; import ICreateMeritDTO from '@modules/merit/dtos/ICreateMeritDTO'; import Merit from '@modules/merit/infra/typeorm/entities/Merit'; class MeritRepository implements IMeritRepositoty { pr...
c556c74fd958fb51356232c6554741fdab3f03ed
TypeScript
tincapo/tech-test-ts
/src/utils.ts
3.234375
3
import { Comment, Post, User } from "./types"; export class Utils { /** * Method that will assing posts to relevant users object. * * @param users * @param posts */ assignPostsToUsers(users: User[], posts: Post[]): void { for (const user of users) { user.posts = posts.filter(post => po...
11dd5b8fa44d18261f2d14929546b2384b5bab7a
TypeScript
abdallanayer/ng-bcomponents
/bcomponents/badge/badge.bcomponent.ts
2.71875
3
import {Component, Directive, Input, Output, EventEmitter, SimpleChange, ElementRef} from '@angular/core'; import {BComponent, BComponentInputs} from '../bcomponent'; export class BadgeBase extends BComponent { @Input() value: number = 0; @Output() change: EventEmitter<this> = new EventEmitter<this>(); ...
6b163a92ecc37037abd0c28ed828f72b3e4712e4
TypeScript
amirulabu/aoc2020
/2/script2.ts
2.8125
3
import * as fs from "fs"; import { promisify } from "util"; const readFile = promisify(fs.readFile); (async () => { const data = await readFile("input.txt"); const cleanedData = data.toString("utf-8").split("\n"); // console.log(cleanedData); const correctPasswords = cleanedData .map((v: string) => { ...
873caea5b0d5a74e58865c980c2a4d0df6af004a
TypeScript
Khan/wonder-blocks
/packages/wonder-blocks-i18n/src/functions/i18n-boxes.ts
2.984375
3
import type {IProvideTranslation} from "./types"; // c.f. http://www.alanflavell.org.uk/unicode/unidata25.html // hollow (white) square; also try \u25a0 or \u25aa+b export const BoxChar = "\u25a1"; const AlphaNumRegex = /\w/g; export default class Boxes implements IProvideTranslation { translate(input: string): ...
46d03f95018888a5d52bda81b9065f85e10ca870
TypeScript
maddalax/Logicful
/frontend/app/src/util/Nav.ts
2.90625
3
export function nameToInitials(name: string) { if (!name) { return undefined; } const split = name.split(" "); let result = ""; split.forEach((s) => { result += s[0]; }); return result; }
62be53c3532da336de3cf08714929bad785e4c64
TypeScript
Reggino/adventofcode
/src/2019/08/index.ts
3.125
3
import { readFileSync } from "fs"; import { join } from "path"; const digits = readFileSync(join(__dirname, "./input.txt"), { encoding: "utf-8" }) .trim() .split("") .map(digit => Math.floor(parseInt(digit, 10))); interface ILayer { digits: number[]; count0: number; count1: number; count2: number; } c...
2a6521dfc6dc8bf15a55e3da8e2a78ede2ea8361
TypeScript
sharegit/sharegit
/web/src/util/LocalStorageDictionary.ts
3.203125
3
import Dictionary from "util/Dictionary"; export default class LocalStorageDictionary<T = any> { private storageName: string; constructor(storageName: string) { this.storageName = storageName; } private open(): Dictionary<T> { const dictionary = localStorage.getItem(this.storageName) ...
72f35516c2e477172f8dbffac4e5c0917d00f2a0
TypeScript
Justin-ZS/bow
/src/modules/table.ts
2.640625
3
import { ITable, TableData, GroupDescription, FieldDescription, TableDescription, AggregateDescription, AggregateType, } from 'Typings'; import { pick, omit } from 'PureUtils'; import { makeFieldDesc } from 'Utils'; import { getGroupDesc } from './group'; import { getIndexSet } from './filter'; import { g...
6ad4a3279a502c01e0e2dd73310b36c3dedeae18
TypeScript
elylucas/thinkster-nest-exercises
/section3/exercise3-solution/src/data/speaker.entity.ts
3.265625
3
// Exercise: // Add decorators from class-validator to make sure that: // 1) There is a value provided for name, that it is a string, and it is not empty // 2) There is a value provided for hasSpokeBefore, and that it is a boolean // 3) IF there is a value passed in for bio, make sure its a non-empty string // (hin...
c4b872002fa252db16438ef0461bdff33a967b8f
TypeScript
iloveivyxuan/vectorious
/src/core/multiply.ts
2.9375
3
import { get_type } from '../util'; import { NDArray } from './'; let nblas: any; try { nblas = require('nblas'); } catch (err) {} NDArray.multiply = <T extends NDArray>(x: T | ArrayLike<any>, y: T | ArrayLike<any>): T => NDArray.array<T>(x).multiply(NDArray.array<T>(y)); NDArray.prototype.multiply = function<T...
591f1603e69dcc70b644ce1d8a557f65671af623
TypeScript
gradientK/angular_todolist
/src/app/components/todo-item/todo-item.component.ts
2.6875
3
import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; import { TodoService } from '../../services/todo.service'; import { Todo } from 'src/app/models/Todo'; @Component({ selector: 'app-todo-item', templateUrl: './todo-item.component.html', styleUrls: ['./todo-item.component.scss'] }) ex...
9ef8699f4a0b8f5f86e6ec35d526d710dc7a0d28
TypeScript
testnavot/theatre
/theatre/core/src/projects/initialiseProjectState.ts
2.546875
3
import type {Studio} from '@theatre/studio/Studio' import delay from '@theatre/shared/utils/delay' import {original} from 'immer' import type Project from './Project' import type {OnDiskState} from './store/storeTypes' import globals from '@theatre/shared/globals' /** * @todo this could be turned into a simple deriva...
e3e2914d64299477a97b4f9fdf81cd3ab71f0d47
TypeScript
edges-games/escape
/assets/framework/components/gimmicks/ECRoundDetailEventData.ts
2.59375
3
import ECDetailEventData from "./ECDetailEventData"; import ECRoundItem from "./ECRoundItem"; const {ccclass, property} = cc._decorator; @ccclass export default class ECRoundDetailEventData extends ECDetailEventData { @property([ECRoundItem]) items:ECRoundItem[] = []; @property([cc.Integer]) passwords:number...
c1436670f04fdd31e083a41e5c4d8d74c1691bf8
TypeScript
ArcticZeroo/canvas-simulation
/src/util/DrawUtil.ts
3.0625
3
import Vector from '../Vector'; import RandomUtil from './RandomUtil'; export default abstract class DrawUtil { static createShapePath(context: CanvasRenderingContext2D, points: Vector[]): void { if (!points || !points.length) { return; } console.log(points); const [st...
44a8dfdde58aeace61a44cfcbaec68a99d3dfad1
TypeScript
kashif-ali-khan/credit-card-app
/src/app/validators/expirydate.validator.ts
2.890625
3
import { AbstractControl, ValidationErrors } from '@angular/forms'; export class ExpiryDateValidator { static expiryDate(control: AbstractControl): ValidationErrors | null { const input = control.value; if (input.match(/^(0\d|1[0-2])\/\d{2}$/)) { const {0: month, 1: year} = input.split(...
d91b218c52861ca9822f13b7a3562b631e11c4d9
TypeScript
ecanro/Curso_TypeScript
/src/section2/variables.ts
2.796875
3
//Declarar let myVar; //Inicializar myVar = true; //Declarar e Inicializar let team = "Barcelona" //Constantes const pi = 3.14;
22562c8cce57fead60775730e451ef8ff0d46d49
TypeScript
LouisRvlE/codeflix.prelude.01
/ex26.ts
3.140625
3
function isAlpha(str= ''): boolean { for (let char of str) { if (!char.match(/[A-Z,a-z]+/g)) { return false } } return true } console.log(isAlpha("Chopper")) console.log(isAlpha("Chopper!")) console.log(isAlpha("Chopper and Usopp"))
cadd7ac72bbf6f3b3afd8cce1c1a2a049f39d61a
TypeScript
khanglqse/jobfinder
/src/app/shared/services/scroll-to-element/scroll-to-element.service.ts
2.703125
3
import { Injectable } from '@angular/core'; @Injectable() export class ScrollToElementService { constructor() { } scroll(element, to = 0, duration = 500) { const start = element.scrollTop; const change = to - start; let currentTime = 0; const increment = 20; const animateScroll = () => { ...
f7c5c54eb2abe7992e653ad65c062efe594e9147
TypeScript
ericgio/react-bootstrap-typeahead
/src/utils/defaultFilterBy.ts
3.1875
3
import isEqual from 'fast-deep-equal'; import getOptionProperty from './getOptionProperty'; import { isFunction, isString } from './nodash'; import stripDiacritics from './stripDiacritics'; import warn from './warn'; import type { LabelKey, Option } from '../types'; interface Props { caseSensitive: boolean; filt...
f5b77bd804afcda4e3f4f0c6f47cf6d01c52232e
TypeScript
AnnaKuvarina/js_ts_features_examples
/enums.ts
3.75
4
type PizzaSize = 'little' | 'medium' | 'large'; enum PizzaSize2 { small = 's', medium = 'm', large = 'l', } console.log(PizzaSize2); function cookPizza(size: PizzaSize2): string { switch (size) { case PizzaSize2.small: return 'One person pizza'; case PizzaSize2.medium: return 'Usual pizz...
c754ce96d3316e124ead98964baa0f088af1b771
TypeScript
Andrew4d3/typescript-maxi-course
/sections/section07/native/main.ts
4.0625
4
// With TS Generics we are able to create a component that can work over a variety of types rather than a single one // Arrays and Promises are some primitive types where we can use this feature // TS will know we are defining an Array of strings here const myArray: Array<string> = ["foo", "bar"]; // this is equivalen...
5d236978f41ea93b5bde1cef28705d8d8bec25e7
TypeScript
kimanhou/Shoreditch
/src/model/Place.ts
2.765625
3
import Social, { SocialMediaPlatform } from "./Social"; import Tag from "./Tag"; export default class Place { name : string; socialMedia : Social[]; tags : Tag[]; description : string; shortName : string; photoPlaceUrl : string; photoFoodUrl : string; constructor(name : string, socialM...
f4b349c69bd1a6243e5aecd81359d11962a9abdf
TypeScript
hbadri1/Ionic3_Ebook_MuhammedInTheBible
/src/pages/debook/debook.ts
2.515625
3
import { Component } from '@angular/core'; import { NavController, MenuController } from 'ionic-angular'; import { StatusBar } from '@ionic-native/status-bar'; import { AlertController } from 'ionic-angular'; @Component({ selector: 'page-debook', templateUrl: 'debook.html' }) export class DeBookPage { booktitle...
2493b2ea6ca5a1968f5505939331036c7771d625
TypeScript
SergNosov/DocRepoNG
/src/app/service_rest/impl/DoctypesServiceImpl.ts
2.96875
3
import {Observable} from "rxjs"; import {CommonMessage} from "../../model/Common-message"; import {Injectable} from "@angular/core"; import {DoctypesService} from "../interface/DoctypesService"; import {DoctypesDaoImpl} from "../../dao/impl/DoctypesDaoImp"; import {Doctype} from "../../model/Doctype"; @Injectable({ ...
840047ab15fda936136d9452fd6e66a5af50d345
TypeScript
cmarcio/bookstore-api
/src/services/BookService.ts
2.6875
3
import { ObjectID } from 'mongodb'; import { ApplicationError, ErrorCode } from '../models/ApplicationError'; import { IBook } from '../interfaces/IBook'; import { BookDao } from '../models/BookDao'; const bookDao = new BookDao(); /** * Save a new book document in the database */ const insertBook = async (newBook: ...
3bc311e41c9f78b27682566f4ae890e8ecc07969
TypeScript
NotJackDaniels/SportDiary
/source/services/StorageService/StorageService.ts
2.59375
3
import AsyncStorage from '@react-native-community/async-storage'; import StorageServiceInterface from './StorageServiceInterface'; export default class StorageService implements StorageServiceInterface { SaveInStorage = async (exercise: any) => { let exercises: any = await AsyncStorage.getItem('Exercises'); ...
c4e748fde9edfa915a02a55956b059ab30b9eb15
TypeScript
artalar/bacon.js
/test/eventstream.ts
3.296875
3
import * as Bacon from ".."; import { expect } from "chai"; import { expectStreamEvents, testSideEffects, once, deferred } from "./util/SpecHelper"; describe("EventStream constructor", () => it("Provides a way to create a new EventStream", function() { const values: string[] = []; const subscribe = function...
de857f8d457c60a6e9842f3c34f5792ad97d7d0f
TypeScript
ionous/en-inflectors
/src/adjective/regexp_rules.ts
3.65625
4
const syllablesNum = (str: string) => str.split(/[aiouy]+e*|e(?!d$|ly).|[td]ed|le$/).length; export default [ // delicious => more delicious { test: (str: string) => syllablesNum(str) > 3 && !(syllablesNum(str) < 5 && /y$/.test(str)), comp: (str: string) => "more " + str, supr: (str: string) => "most ...
c6b41fe3b65609c65280c5ce3fe76f1bdec84c39
TypeScript
xTCry/bwLoader
/src/AppReader.ts
2.671875
3
import cheerio from 'cheerio'; import axios from 'axios'; import { sleep } from './tools'; export type ChunkFiles = { [key: string]: string }; export interface IExtrStr2Obj { names: ChunkFiles; hashes: ChunkFiles; result: ChunkFiles; } export default class AppReader { constructor(public url: string) ...
e9f765b0f701c313b510b2a20fdfbc780288710a
TypeScript
omni360/Wonder.js
/src/event/handler/DomEventHandler.ts
2.53125
3
/// <reference path="../../filePath.d.ts"/> module wd { export abstract class DomEventHandler extends EventHandler{ public off(eventName:EventName):void; public off(eventName:EventName, handler:Function):void; public off(uid:number, eventName:EventName):void; public off(target:GameOb...
f6f9e08553b5f788a46359bbce8ace2df270dc6d
TypeScript
jitendrapanwar/todolist-angular4
/src/app/services/storage.service.ts
2.765625
3
import { TodoModel } from "../todolist/TodoModel"; import { LoginModel } from '../login/LoginModel'; export class TodoStorage { constructor(){} LOGINDATA = "logindata" TODOITEMS = 'todoitems'; USERLOGGED = 'userlogged' getTodos (): TodoModel[] { return JSON.parse(localStorage.getItem...
24adb574d4ab65f15ed59ffc682ea12608ea7ead
TypeScript
Seaviello/sharelist-backend
/src/resolvers/Mutation.ts
2.578125
3
import * as bcrypt from 'bcryptjs'; import * as jwt from 'jsonwebtoken'; import { MutationResolvers } from '../generated/graphqlgen'; export const Mutation: MutationResolvers.Type = { ...MutationResolvers.defaultResolvers, async signup(parent, args, ctx, info) { const {name, email: rawEmail, password:...
8d9158af74a02a7991404736919f7b1b9b1387c6
TypeScript
MTG-Paradox-Engine/mtg-paradox-engine
/src/Paradox/GameAction/BeginUpkeepStep.ts
2.953125
3
import { Game } from "../Game"; import { TurnPhase, TurnStep } from "../GameState"; import { ChangeTurnStep } from "./ChangeTurnStep"; export class BeginUpkeepStep extends ChangeTurnStep { readonly phase: TurnPhase.Beginning; readonly step: TurnStep.Upkeep; actOnImpl2(game: Game): void { // 503. U...
a8726d1c4222f9ae2eaf2e581c19f9eb5d2f1715
TypeScript
Sinabro-DSM/MiniTwit-Back-End
/src/controller/user/controller.ts
2.515625
3
import { Request, Response, NextFunction } from "express"; import * as mail from "../../config/mailConfig"; import * as query from "./query"; import { mkAccess, mkRefresh } from "./mkToken"; export const emailSend = async ( req: Request, res: Response, next: NextFunction ) => { const email = req.body.email; ...
7d31135e69dd0b433e75216072f11c543cefb485
TypeScript
thegoncharoffs/angular-sandbox
/src/app/examples/interval/interval.component.ts
2.53125
3
import {ChangeDetectionStrategy, Component, OnDestroy, OnInit} from '@angular/core'; import {interval, Subscription} from 'rxjs'; @Component({ selector: 'app-interval', templateUrl: './interval.component.html', styleUrls: ['./interval.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush })...
2560674c34fab382c53892e47893a4e37bd432b0
TypeScript
tmxkwkfgka/modoo_server_public
/src/api/Place/GetDailyDistance/GetDailyDistance.resolvers.ts
2.703125
3
import Whichi from "../../../entities/Whichi"; import { GetDailyDistanceResponse } from "../../../types/graph"; import { Resolvers } from "../../../types/resolvers"; import privateResolver from "../../../utils/privateResolver"; import { Between } from "typeorm"; import Place from "../../../entities/Place"; const moment...
fdcaae242d5ca110d9fbe9ecae9ea36e189c0d7f
TypeScript
artsy/eigen
/src/app/Scenes/SellWithArtsy/SubmitArtwork/UploadPhotos/utils/calculatePhotoSize.ts
3.015625
3
import { Photo } from "app/Scenes/SellWithArtsy/SubmitArtwork/UploadPhotos/validation" import { transformBytesToSize } from "app/utils/transformBytesToSize" const TOTAL_SIZE_LIMIT_IN_BYTES = 30000000 // calculates a photos size from Bytes to unit and return updated photo export const calculateSinglePhotoSize = (photo...
8359c011bb4499fb8179b8ffc13cd3f6b2ff5455
TypeScript
acateland/collectable
/packages/sorted-set/tests/functions/add.ts
3.125
3
import {assert} from 'chai'; import {modify, isMutable, isImmutable} from '@collectable/core'; import {SortedSetStructure, add, has, size} from '../../src'; import {fromStringArray} from '../test-utils'; suite('[SortedSet]', () => { suite('add()', () => { suite('when the item already exists in the set', () => { ...
5a147e0e1063ed9929ece43f142130f0bb8ef18a
TypeScript
palexcast/foos-rating
/src/app/shared/services/history.service.ts
2.515625
3
import {Injectable} from '@angular/core'; import {AngularFirestore, AngularFirestoreCollection} from '@angular/fire/firestore'; import {HistoryModel} from '../models/history.model'; import {combineLatest, Observable} from 'rxjs'; import {TeamHistoryModel} from '../models/team-history.model'; import {GenericHistoryModel...
876af6a48051ebc300b3a1d13a5d46c4c90588bf
TypeScript
ValeryiaMIRON/english-for-kids
/english-for-kids/src/components/switch/switch.ts
2.734375
3
import './switch.scss'; import { BaseComponent } from '../base-component'; import { store, getMode } from '../../store/store'; import { Mode } from '../../types/types'; export class Switch extends BaseComponent { onClickHandler: (mode: Mode) => void; pushSwitch: () => void; constructor(onClickHandler: (mod...
8d85c2595e2a36215aa1c377013364e1e935dc48
TypeScript
Santiago1934/compuStore-ecommerce
/api/src/models/Review.ts
2.640625
3
import { Association, DataTypes, Model, Optional, Sequelize, //BelongsToOne Model, BelongsToGetAssociationMixin, BelongsToSetAssociationMixin, BelongsToCreateAssociationMixin, } from 'sequelize'; import { Product } from './Product'; import { User } from './User'; export interface ReviewAttributesI { ...
405bbd731b0436e90d18cba4cea66fce71f3ab11
TypeScript
nkint/umbrella
/packages/transducers/src/xform/converge.ts
3.140625
3
import { Predicate2, SEMAPHORE } from "@thi.ng/api"; import { Reducer, Transducer } from "../api"; import { compR } from "../func/compr"; import { $iter } from "../iterator"; import { ensureReduced } from "../reduced"; /** * Transducer which for each input `x` (apart from the very first one) * applies given predicat...
d9db46f04461be8e0518642cfcfef41c6368dbf9
TypeScript
Muhitori/Shop
/apps/server/src/database/migrations/20201215price.migration.ts
2.65625
3
import { MigrationInterface, QueryRunner, Table, TableForeignKey } from 'typeorm' import { Country } from '../../entities/country.entity' export class PriceMigration20201215235634 implements MigrationInterface { private tableName = 'Prices' async up(queryRunner: QueryRunner): Promise<void> { await quer...
6b1798639feccecbb356ae32ffc64e087e462843
TypeScript
Vadorequest/ejs-locals
/app/lib/Block.ts
3.125
3
///<reference path='./../lib/def/defLoader.d.ts'/> export class Block { public html: any = new Array(); /** * Convert HTML to string. * @return {string} */ public toString() { return this.html.join('\n'); } /** * Append a new HTML block. * @param more */ ...
957f1dc8f3e286ee424b953e851bddc9c4f79287
TypeScript
MakersExtia/DispoBox
/Ionic2App/src/utilities/Utils.ts
2.921875
3
export class Utils { static ISODateString(d) { function pad(n) { return n<10 ? '0'+n : n } return d.getUTCFullYear()+'-' + pad(d.getUTCMonth()+1)+'-' + pad(d.getUTCDate())+'T' + pad(d.getUTCHours())+':' + pad(d.getUTCMinutes())+':' + pad(d.getUTCSeconds())+'Z'; } st...
2392899dc6a9380e5f9c1b48b9405430ae972553
TypeScript
theramidev/Music_Reproductor_App
/src/app/database/SongController.ts
2.96875
3
import {SQLiteDatabase, ResultSet} from 'react-native-sqlite-storage'; import {ISong, MSong} from '../models/song.model'; import {IReproduction, MReproduction} from '../models/reproduction.model'; import fs from 'react-native-fs'; class SongController { private tableSong: string = 'song'; private tableReproduction...
8064efdb49722e2342c7c1f0ac8f6cc83da4e367
TypeScript
ofuangka/prop-messages
/ui/src/app/arrow/arrow.component.ts
2.578125
3
import { Component, AfterViewInit, Input, ElementRef, ViewChild } from '@angular/core'; const DEFAULT_WIDTH = 5, DEFAULT_HEIGHT = 10, DEFAULT_THICKNESS = 2, DEFAULT_COLOR = '#999999'; @Component({ selector: 'arrow', template: '<canvas #arrowCanvas></canvas>', styleUrls: ['./arrow.component.css'] }) export class...
0a54206c5e9215ddea8e58aa502a3acac999b4da
TypeScript
dwjohnston/geoart-take-100
/src/PureModel/DrawMakers/DotMaker.ts
2.65625
3
import { IDrawMaker } from "../AbstractModelItem"; import { Circle } from "../Drawables/Circle"; import { AbstractValueMaker } from "../ValueMakers/AbstractValueMaker"; import { PossiblePositionMakers } from "../ValueMakers/PositionMakers"; export class DotMaker implements IDrawMaker { private p1: AbstractValueMaker...
7aee24f8079250bd1603ed427529d800bd497f17
TypeScript
trungphancode/learn-rxjs
/src/operators/pipe_if.ts
2.96875
3
import {ObservableInput, UnaryFunction} from 'rxjs/src/internal/types'; import {defer} from 'rxjs'; /** * Conditionally selects pipe for the stream. The condition is evaluated at * subscription time. */ export function pipeIf<T, R>( condition: () => boolean, truePipe: UnaryFunction<T, R>, falsePipe: Un...
30f3433deb6349fae1c36bd6e365a105303c901b
TypeScript
kaylinpham/simple-todo-nestjs
/src/todo/dto/todo.dto.ts
2.59375
3
import { ApiProperty } from "@nestjs/swagger"; import { IsBoolean, IsNotEmpty, IsOptional, IsString } from "class-validator"; export class CreateTodoDto { @IsNotEmpty() @IsString() @ApiProperty() title: string; @IsNotEmpty() @IsString() @ApiProperty() userId: string } export class Upd...
be9f05a4aa2cfdabbc04889510df7024224fb2e9
TypeScript
BenChung/GradualComparison
/examples/strongscript/4.ts
3.09375
3
class A { foo() : !number { return 1 } } class B { foo() : !string {return "meh"} } class D { ref : !A anyref : any main() : !B { this.ref = new A() this.anyref = this.ref return this.anyref } }
f527807209f0f45ac3bf7180b636d018d390f069
TypeScript
spinnaker/deck
/packages/core/src/cluster/ClusterRuleMatcher.spec.ts
2.875
3
import type { IClusterMatcher, IClusterMatchRule } from './ClusterRuleMatcher'; import { DefaultClusterMatcher } from './ClusterRuleMatcher'; describe('CustomRuleMatcher', () => { let matcher: IClusterMatcher; const account = 'test'; const location = 'us-east-1'; const stack = 'stack'; const detail = 'detai...