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 |
|---|---|---|---|---|---|---|
5621f4a138fc45a89ad429a0276a29f5af78612b | TypeScript | visgl/deck.gl | /modules/geo-layers/src/geohash-layer/geohash-layer.ts | 2.6875 | 3 | import {AccessorFunction, DefaultProps} from '@deck.gl/core';
import GeoCellLayer from '../geo-cell-layer/GeoCellLayer';
import {getGeohashPolygon} from './geohash-utils';
const defaultProps: DefaultProps<GeohashLayerProps> = {
getGeohash: {type: 'accessor', value: d => d.geohash}
};
/**
* Properties of `GeohashLa... |
121d875c0bbd9c2157fc6ddce5eb5e2e254bfe10 | TypeScript | timjansen/jillian | /src/jel/types/Distribution.ts | 2.953125 | 3 | import Util from '../../util/Util';
import JelObject from '../JelObject';
import Runtime from '../Runtime';
import Context from '../Context';
import List from './List';
import Range from './Range';
import DistributionPoint from './DistributionPoint';
import ApproximateNumber from './ApproximateNumber';
import Numeric f... |
e7868c205b92185f916cd97872f1e96c5d3d8057 | TypeScript | Evasionn/mars-rover | /src/classes/objects/Coordinate.ts | 3.328125 | 3 | export class Coordinate {
xCoordinate: number;
yCoordinate: number;
constructor(xCoordinate: number, yCoordinate: number) {
this.xCoordinate = xCoordinate;
this.yCoordinate = yCoordinate;
}
toString = (): string => `${this.xCoordinate} ${this.yCoordinate}`;
}
|
27bb4eb8cba811d3dcc440ad3b3ea8fdf875256f | TypeScript | MajoGrance/reservas | /front-end-angular/src/app/models/categoria-producto.ts | 2.53125 | 3 | import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ServerResponse } from '../shared/interfaces';
import { CategoriaProductoService } from '../services/abm/categoria-producto.service';
const fb = new FormBuilder();
export class CategoriaProductoModel {
id: number;
nombre: string;
... |
ee001ac34a05116298181463e005d4154c275b05 | TypeScript | zengqinglei/creekdream-admin-ngzorro | /src/app/core/settings/models/app-info.ts | 2.65625 | 3 | /** 应用信息 */
export interface AppInfo {
[key: string]: any;
/** 应用名称 */
name?: string;
/** 描述 */
description?: string;
}
|
34b613256280ea1ef1a853f3688e49d7fbebe0f8 | TypeScript | InternB/internb-backend | /src/modules/users/services/ShowUsersService.spec.ts | 2.734375 | 3 | import 'reflect-metadata';
import AppError from '@shared/errors/AppError';
import ShowUsersService from './ShowUsersService';
import FakeUsersRepository from '../repositories/fakes/FakeUsersRepository';
import User from '../infra/typeorm/entities/User';
let fakeUsersRepository: FakeUsersRepository;
let showUsersServ... |
5699bfc2668ef820586fe6bed664d8dbd3b546a9 | TypeScript | Assasindie/fortniteBot | /src/command/TriggerableCommand.ts | 2.984375 | 3 | import Command from "./Command";
import Trigger from "action/Trigger";
import NikkuCore from "core/NikkuCore";
import IHasAction from "action/IHasAction";
import IHasTrigger from "action/IHasTrigger";
import OnMessageState from "state/OnMessageState";
export default class TriggerableCommand extends Command implements ... |
11f9a8978a23ee5505fd71b4feb08652cf4cd681 | TypeScript | chrisguttandin/standardized-audio-context | /src/factories/analyser-node-constructor.ts | 2.625 | 3 | import { IAnalyserNode, IAnalyserOptions } from '../interfaces';
import { TAnalyserNodeConstructorFactory, TAudioNodeRenderer, TContext, TNativeAnalyserNode } from '../types';
const DEFAULT_OPTIONS = {
channelCount: 2,
channelCountMode: 'max',
channelInterpretation: 'speakers',
fftSize: 2048,
maxDe... |
654ddd9f7b3dd5c85d3d61d8c47b083089704ed7 | TypeScript | shoNagai/react-virtuoso | /e2e/long-last-item.test.ts | 2.546875 | 3 | import { test, expect } from '@playwright/test'
test.describe('list with a long last item', () => {
test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:1234/long-last-item')
await page.waitForSelector('#test-root')
await page.waitForTimeout(300)
})
test('starts from the last item... |
9484ee39e49e4916a4d289762ccd6d7dde968a6e | TypeScript | ArkEcosystemArchive/platform-sdk | /packages/platform-sdk-http-axios/source/request.ts | 2.703125 | 3 | import { AbstractRequest, HttpResponse, RequestOptions, Response } from "@arkecosystem/platform-sdk-http";
import axios from "axios";
/**
* Implements HTTP communication through axios/axios.
*
* @see https://github.com/axios/axios
*
* @export
* @class Request
* @extends {Request}
*/
export class Request extend... |
6a92f4b18aa891ffee5c4e0121e457de1a3c0f7a | TypeScript | zcorky/koa-cache-hits | /src/index.ts | 2.765625 | 3 | import { Context } from 'koa';
import LRU, { LRU as ILRU} from '@zcorky/lru';
import { undefined as isUndefined, string as isString } from '@zcorky/is';
export type DB<K, V> = {
get(key: K): V | Promise<V>;
set(key: K, value: V): void | Promise<void>
[key: string]: any;
} & ILRU<K, V>;
export interface Options<K... |
711c058420fffd30a4cb213fe324766e25057dff | TypeScript | flekschas/regl-scatterplot | /src/types.d.ts | 2.65625 | 3 | type Hex = string;
type Rgb = [number, number, number];
type Rgba = [number, number, number, number];
type Color = Hex | Rgb | Rgba;
type ColorMap = Color | Array<Color>;
type Category = 'category' | 'value1' | 'valueA' | 'valueZ' | 'z';
type Value = 'value' | 'value2' | 'valueB' | 'valueW' | 'w';
type DataEncoding =... |
67ba36740b947fa67b504d3b413d11dbd58eb7dc | TypeScript | yayudev/ctci-js | /chapter-01/07-rotateMatrix/main.ts | 3.609375 | 4 | type Matrix2D<T> = Array<Array<T>>;
/*
Note for blogpost:
- matrix[row][col]; // top
- matrix[col][size - row]; // right
- matrix[size - row][size - col]; // bottom
- matrix[size - col][row]; // left
*/
export function rotateMatrix(matrix: Matrix2D<number>): boolea... |
8482b76d6accc182ae31805b26c90d66580a5e4b | TypeScript | brudil/kings-search | /frontend/src/utils.ts | 2.59375 | 3 | import { Result, SearchResultForm } from './types';
export function getForm(result: Result) {
if (result.link.startsWith('/organisation')) {
return SearchResultForm.StudentGroup;
}
if (result.link.startsWith('/news')) {
return SearchResultForm.News;
}
if (result.link.startsWith('/events')) {
ret... |
47deab720eb94a838f379f3f6de0f61886296848 | TypeScript | mrsimpson/abaplint | /src/file.ts | 3.125 | 3 | import { Token } from "./tokens/";
import { Statement } from "./statements/";
import Issue from "./issue";
export default class File {
private tokens: Array<Token> = [];
private statements: Array<Statement> = [];
private issues: Array<Issue> = [];
private raw: string = "";
private filename: string ... |
51fe7bfa41f8fe82ab3425f6457f302efce8032f | TypeScript | BlackspaceInc/typescript-microservices-template | /libs/logger/src/base.logger.ts | 3.078125 | 3 | import dateFormat from 'dateformat';
export enum LogLevel {
Off = 0,
Error,
Warning,
Info,
Debug,
Log,
}
export type LogOutput = (
source: string | undefined,
level: LogLevel,
message: string,
...data: any[]
) => void;
export abstract class BaseLogger {
static level = LogLevel.Log;
static out... |
bff3a10d92c14f702e0f2c677906a5b82765a56c | TypeScript | nicholasanthonys/distributed-database-demo | /server-jkt/models/RefreshToken.ts | 2.546875 | 3 | import {
Model,
Optional,
DataTypes,
} from "sequelize";
import sequelize from "database/sequelize";
// These are all the attributes in the RefreshToken model
export interface RefreshTokenAttributes {
id: Number;
refreshToken: String;
};
// Some attributes are optional in `RefreshT... |
243cb1a1ee08a560331fa753d0ef81782f82459f | TypeScript | equilcode/evtstore | /src/domain.ts | 2.578125 | 3 | import {
Event,
Aggregate,
Provider,
Domain,
Command,
CmdBody,
CommandHandler,
StoreEvent,
BaseAggregate,
ExecutableAggregate,
DomainOptions,
} from './types'
import { EventHandler } from './event-handler'
import { toMeta } from './common'
export function createDomain<Evt extends Event, Agg exten... |
f8d3c5c06a7feb66a57c4905078be3e8d24d302e | TypeScript | bcgov/jag-lcrb-carla-public | /cllc-public-app/ClientApp/src/app/services/feature-flag.service.ts | 2.578125 | 3 | import { Injectable } from "@angular/core";
import { FeatureFlagDataService } from "./feature-flag-data.service";
import { mergeMap } from "rxjs/operators";
import { of, Observable } from "rxjs";
@Injectable({
providedIn: "root"
})
export class FeatureFlagService {
private _featureFlags: Array<string> = []; // A ... |
c4af5205ab087c31ba8d4a45a548cedd484d45a2 | TypeScript | leiyangs/typescript-training | /Datatype/index.ts | 4.4375 | 4 | export {} // 可以防止变量名冲突(与其他文件变量名相同会报错)
/**
* 数据类型
*/
// 1.布尔类型(boolean) #
let married: boolean = false;
// 2.数字类型(number) #
let num: number = 10;
// 3.字符串类型(string) #
let str: string = 'yang';
// 4.数组类型(array)
let arr1: number[] = [1, 2, 3];
let arr2: Array<string> = ['1', '2', '3'];
let arr3: object[] = [... |
60a4575ea0df862f30702a813146fb30b0733031 | TypeScript | yuya373/manga-viewer | /src/actions/fileDialog.ts | 2.5625 | 3 | import { Action } from 'redux';
import { Types } from './types';
import { ThunkAction } from '.';
import { File, isFile } from '../types';
export interface FileDialogOpenAction extends Action {
type: Types.FILE_DIALOG_OPEN;
payload: {
name: string;
path: string;
files: Array<File>;
};
}
const fileDi... |
d5ff4375b66052082b349bca07f4000552973cb0 | TypeScript | mitto121/TypeScript-Assignments | /Desktop/106232_mitto/TypeScript Assignment/19_Arithmetic/Script/script.ts | 3.75 | 4 | class Airthmetic{
add = function (number1: number, number2:number) : number{
return (number1 + number2);
}
}
class Adder extends Airthmetic{
constructor(){super();}
}
function CalculateValues(){
let num1 =Number((document.getElementById("txtFirstNum") as HTMLInputElement).value);
let num2 =Number((document.get... |
91fb306c90a12d9632b0ed559f5c01b3525f4bad | TypeScript | Datawheel/olap-client | /src/interfaces/descriptors.ts | 2.546875 | 3 | /**
* These are objects constructed by the user to use as reference to an object
* in the Cube schema.
*/
import { Calculation, Comparison, Direction, TimePrecision, TimeValuePoint } from "./enums";
export interface CalculationGrowthDescriptor {
kind: "growth";
category: LevelDescriptor;
value: string;
}
ex... |
a9706da777a9ee00c1a5256fbf3690f1af02f081 | TypeScript | ChimeraX/common-web | /src/util/cookies.ts | 2.59375 | 3 | export interface Cookies {
[key: string]: string;
}
export function getCookies(): Cookies {
return document.cookie
.split(';')
.map((x) => x.trim().split('='))
.reduce((acc: Cookies, value: string[]) => {
acc[value[0]] = value[1];
return acc;
}, {});
}
|
ff40a12345a33c9b856d4d0ed0db6c6b0f772e1e | TypeScript | Just-Hosam/WannaBitly | /backend/db/queries/click-queries.ts | 2.75 | 3 | const db = require('../../lib/db.js');
interface Click {
id: number;
url_id: number;
timestamp: number;
}
const getClicks = (urlId: number): Promise<Click[]> => {
const query = `
SELECT *
FROM clicks
WHERE url_id = $1
ORDER BY id DESC;`;
const values = [urlId];
return db
.query(query, values)
.then(({ ... |
4b4dd8ce6235447955bc7d16a509c178b320f102 | TypeScript | AdamVig/personal-metrics | /src/environment/environment.provider.ts | 2.953125 | 3 | import { Injectable } from '@nestjs/common'
import { LogFactory, Logger } from '../logger/log-factory'
/**
* Environment variables.
* @description Must match `.env.example`.
*/
export interface Environment {
/** Environment the application is running in. */
NODE_ENV: string
/** Port to run the application on... |
b7cff1ab8a8c366fb4a0fda935987bba6f126ec7 | TypeScript | mrv1k/separating-the-books | /src/controllers/authors.ts | 2.671875 | 3 | import { NextFunction, Request, Response } from "express";
import AuthorModel, { Author } from "@/models/author";
import { REST } from "@/types";
import { createLocationUrl } from "@/utils/express-helpers";
class AuthorsController implements REST {
async getMany(req: Request, res: Response) {
const authors = aw... |
d0b0f8a1ccbcd42c244923edf32dadd490aea698 | TypeScript | karavaan/random-walker | /src/components/walker/helpers/edge.ts | 3.296875 | 3 | export interface Edges {
top: boolean;
left: boolean;
right: boolean;
bottom: boolean;
}
export const isEdge = (pos: number, size: number): Edges => {
return {
top: pos < size,
left: pos % size === 0,
right: (pos + 1) % size === 0,
bottom: pos >= size * (size - 1)
}
}
|
586029eeb82a36744059d75c45267fdfffe48d85 | TypeScript | turboka4/RedOwlTask | /RedOwl.UI/ClientApp/app/components/addproduct/addproduct.component.ts | 2.609375 | 3 | import { Component, Inject } from '@angular/core';
import { Http } from '@angular/http';
import { NgForm } from '@angular/forms';
@Component({
selector: 'addproduct',
templateUrl: './addproduct.component.html'
})
export class AddProductComponent {
private http: Http;
private baseUrl: string;
pu... |
dc85203b6f631d89fc6dc2a75aa1acab5df810cf | TypeScript | hakudev/nitro-emu | /src/database/daos/UserOutfitDao.ts | 2.65625 | 3 | import { Application } from '../../app';
import { UserGender } from '../../core';
import { UserOutfitEntity } from '../entities/UserOutfitEntity';
export class UserOutfitDao
{
public static async loadUserOutfits(userId: number): Promise<UserOutfitEntity[]>
{
if(!userId) return null;
co... |
8bc38c9df74bbd9ec0020e4c1bd301ece03bc65f | TypeScript | findawayer/chess-player | /app/features/chess/hooks/useChessGuides.ts | 3.03125 | 3 | import update from 'immutability-helper';
import { useCallback, useState } from 'react';
import { stringifySquare } from '~app/features/chess/utils';
import type {
ChessGuides,
ChessLegalMove,
ChessSquare,
} from '~app/features/chess/types';
/**
* Reducer hook to manipulate chess square highlights collectively... |
bebf62af9344e4aaaae1e203834339643e7c7b50 | TypeScript | Zweer/oroscopo-api | /lambda/utils/lambda/decorators.ts | 2.609375 | 3 | import 'reflect-metadata';
import { parseBody } from './request';
import { createSuccessResponse, createErrorResponse } from './response';
import { APIGatewayProxyEvent, SNSEvent } from 'aws-lambda';
type paramKey = string | Symbol | number;
type paramMetadata = {
paramKey: paramKey;
paramIndex: number;
};
const... |
91ba3f81cd01f12935a4f06ddf7a36a91145e048 | TypeScript | pip-services3-node/pip-services3-commons-node | /test/run/Parameters.test.ts | 2.84375 | 3 | let assert = require('chai').assert;
import { TestClass } from './TestClass';
import { ConfigParams } from '../../src/config/ConfigParams';
import { Parameters } from '../../src/run/Parameters';
suite('Parameters', ()=> {
test('Defaults', () => {
var result = Parameters.fromTuples(
... |
460461d455da06dd9a3e53df2cf658bbd829835c | TypeScript | jacintcodina/angular-avanzado-zoo | /src/app/admin/pipes/search.pipe.ts | 2.734375 | 3 | import { isNgTemplate } from '@angular/compiler';
import { Injectable, Pipe, PipeTransform } from '@angular/core';
@Pipe ({
name : 'search'
})
@Injectable()
export class SearchPipe implements PipeTransform {
transform (items:any, term:any) : any {
if(term == undefined){ //si el texte de buscqueda es... |
b7421931763c5d26ce1020df59f8093e6c3d177b | TypeScript | BinniPyx98/FullProject | /server/src/check/pageInQuery/page.ts | 2.578125 | 3 | import {Request, Response} from "express";
import {sendErrorMessage} from "../../errorMessage/sendErrorMessage.js";
export function checkPage(request: Request, response: Response) {
let pageNumber: Number = Number(request.query.page)
let pageStatus: boolean
if (pageNumber <= 3) {
pageStatus = true... |
a9e566d2905864d4249fa07727b1c8f7bc779671 | TypeScript | NicolasFkm/BankApp | /src/services/PaymentService.ts | 2.53125 | 3 | import { IPayment } from "@models/Payment";
import PaymentRepository from "@repositories/PaymentRepository";
export default class PaymentService {
public paymentRepository: PaymentRepository;
constructor(){
this.paymentRepository = new PaymentRepository();
}
async create(account: IPayment): ... |
21cb4ecdb12b7d669b11883bd42d6d34ec7d19db | TypeScript | Osbelkz/spotify_clone | /src/store/myLibrary-reducer.ts | 2.515625 | 3 | import {createAsyncThunk, createSlice} from "@reduxjs/toolkit";
import {spotifyWebApi} from "../api/spotify-web-api";
const initialState = {
myTopArtists: [] as SpotifyApi.ArtistObjectFull[]
}
export type MyLibraryStateType = typeof initialState
export const getMyTopArtists = createAsyncThunk("getMyTopArtists"... |
7d85acd8cfb62a4f46d6943aaed8d352fffcba91 | TypeScript | stwith/UniLogin | /universal-login-react/src/ui/hooks/useToggler.ts | 2.578125 | 3 | import {useState} from 'react';
export const useToggler = () => {
const [visible, setVisibility] = useState(false);
const toggle = (value?: boolean) => {
if (value === undefined) {
setVisibility(visible => !visible);
} else {
setVisibility(() => value);
}
};
return {visible, toggle};
}... |
fe3362fe69c7e41117738fec5b2c117e8f1a096b | TypeScript | YaoZeyuan/leetcode | /resolve/二刷/150.ts | 3.421875 | 3 | function evalRPN(tokens: string[]): number {
let stackList: number[] = []
for (let item of tokens) {
let stack1: number
let stack2: number
let result: number
switch (item) {
case '+':
stack2 = stackList.pop()
stack1 = stackList.pop()
... |
1935b2c59ae302e937ee80958633478ad58dc11c | TypeScript | LarryHPham/ang_batterup | /app/modules/share/share.module.ts | 2.5625 | 3 | import {Component, OnInit, Input} from '@angular/core';
import {ModuleHeader} from '../../components/module-header/module-header.component';
import {CircleImage} from '../../components/images/circle-image';
//Import needed interfaces
import {ModuleHeaderData} from '../../components/module-header/module-header.component... |
bd43787361d427264a4e0ff21a33860c55a54f12 | TypeScript | adityaU/AfterGlow | /frontend-v2/src/helpers/variableExtractor.ts | 2.515625 | 3 | import { fetchQuestionVariables } from 'src/apis/questions';
import { randomID } from './random';
class VariableExtractor {
allVariables: any;
variablesLocal: any;
resolve: any;
code: string;
noMatch: any;
constructor(code, existingVariables) {
this.allVariables = [];
this.variablesLocal = existing... |
19ed75500640aecdc66ae78b7cae08d32f989c5a | TypeScript | cborac/node-discord | /tests/api/guildChannel.api.ts | 2.609375 | 3 | 'use strict';
import { Bot } from '../../src/bot';
import { BotEvent } from '../../src/socket';
import { PermissionFlags, PermissibleType, Permission } from '../../src/structures/flags';
import config from '../config.json';
const bot = new Bot(config.token);
bot.connection.connect();
(async function (): Promise<void... |
e1e8416797d6dc51629421b3634bb9a2c3bcfed3 | TypeScript | sakuvaru/FitRockApp | /src/app/core/services/current-language.service.ts | 2.9375 | 3 | import { Injectable } from '@angular/core';
import { LanguageConfig } from '../models/core.models';
import { LanguageEnum, languageHelper } from '../../../lib/repository';
@Injectable()
export class CurrentLanguageService {
/**
* Default language
*/
private readonly defaultLanguage: LanguageConfig =... |
7fce2150ae6963bb83f72c41e387ff9df6f8dc41 | TypeScript | boosterlong/roguelikeautobattler | /data/modifiers.ts | 2.671875 | 3 |
type Modifier = {
position: 'prefix' | 'suffix'
text: string
}
const Grand : Modifier = {
position: 'prefix',
text: 'Grand'
}
const Reaper : Modifier = {
position: 'suffix',
text: 'of the Reaper'
}
const Seeking : Modifier = {
position: 'prefix',
text: 'Seeking'
}
|
3d69b5ce2b39c2ca1c9a0824b487ecfee426663b | TypeScript | ftmmohd2000/blog-app | /server/src/tests/fixtures/user.ts | 2.765625 | 3 | import faker from "faker";
export interface IUser {
email: string;
password: string;
firstName: string;
lastName: string;
}
export const createFakeUser = () => ({
email: faker.internet.email(),
password: faker.internet.password(),
firstName: faker.name.firstName(),
lastName: faker.name.lastName()
});
|
21c310eb738f40e9ff6fd9b0d352dcc3c425d49f | TypeScript | meanhive/voltron | /src/app/auth.service.ts | 2.59375 | 3 | import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { of} from 'rxjs/observable/of';
import {Subject } from 'rxjs/Subject';
import { User } from '../user';
import { Auth } from '../auth';
import { catchError, ma... |
ef3a27ced118c937b827202b59c86e3b487e49b5 | TypeScript | francisco-neto-fit/sistemas_comentarios_API | /src/middlewares/ensureAuthenticated.ts | 3.078125 | 3 | import { Request, Response, NextFunction } from "express";
import {verify} from 'jsonwebtoken'
interface IPayload{
sub:string;
}
export function ensureAuthenticated(request:Request, response:Response, next:NextFunction){
//Recupernaod o token na requisição
const authToken = request.headers.authoriza... |
5a94760177c28113d19d92ad8659f514dbee03d4 | TypeScript | lucasfloripa/bank-front | /src/store/reducers/banker.reducer.ts | 2.828125 | 3 | import { Reducer } from 'redux'
import { bankerTypes } from '../types'
const initialState: bankerTypes.State = {
banker: {
_id: '',
userType: '',
name: '',
email: '',
bank: '',
},
bankers: []
}
const bankerReducer: Reducer<bankerTypes.State, bankerTypes.ActionsTypes> = (
state = initialSta... |
90ed17f2971a42e390115ef916b147a47e4f67f9 | TypeScript | josandreu/Js-examples | /webpack/webpack-starter-kit/src/components/app.ts | 3.265625 | 3 | export class HelloWorld {
// hay que definir el tipo de dato de cada propiedad
name: string;
constructor(name: string) {
this.name = name;
}
greet(): string {
return `Hola mundo, Webpack con ${this.name}`;
}
}
|
7bbc288ec3c6b214ea40c6d8b7f88427126c331b | TypeScript | GalStan/minesweeper | /src/Solver/ListNode/index.ts | 2.921875 | 3 | export default class ListNode<T> {
public next?: ListNode<T>;
public prev?: ListNode<T>;
constructor(public value: T) {}
}
|
c0f83b1ad33da64ce5bb0b7983f337d38a7ceb40 | TypeScript | OU-CS/capstone-repo-group-4 | /backend/src/handlers/find-user-token.ts | 3.015625 | 3 | import { APIGatewayProxyEventQueryStringParameters, APIGatewayProxyHandler } from 'aws-lambda';
import { failedResponse, successResponse } from '../helpers/responses';
export type ParamProps = APIGatewayProxyEventQueryStringParameters | null;
export type UserTokenParams = {
userToken: string;
};
/**
* Validates... |
0c4fdea11ba75577a88559ddd77ddc3890bd9f65 | TypeScript | yujuiting/gaudi-editor | /src/ui/hooks/dnd/types.ts | 2.5625 | 3 | import { Blueprint } from 'gaudi';
import { ScaffoldId } from 'base/id';
export enum DnDType {
Blueprint = 'blueprint',
Scaffold = 'scaffold',
}
export class BlueprintDragData {
static of(blueprint: Blueprint) {
return new BlueprintDragData(blueprint);
}
constructor(public readonly blueprint: Blueprint... |
4809c8f80d4a1bb96200ba12e7a87fdcec2362c9 | TypeScript | ng-ui-libraries/forms | /test/Service/NestedSearcher.spec.ts | 2.75 | 3 | import {NestedSearcher} from "../../src/lib/Service/Impl/NestedSearcher";
import {Observable} from "rxjs/Rx";
class NestedSearcherShunt extends NestedSearcher {
shouldBeFound = true;
doesItemMatchSearch(item) {
return this.shouldBeFound;
}
}
describe('Module: Form', () => {
describe('Class: ... |
c88cf27af4f4d49e4f588d6a136add561bee5aaa | TypeScript | chrand90/DeathCauses | /death-causes-app/src/components/database/Deathcause.ts | 2.6875 | 3 | import RelationLinks from "../../models/RelationLinks";
import FrequencyTable, { FrequencyJson } from "./FrequencyTable";
import { RiskFactorGroup, RiskFactorGroupJson } from "./RickFactorGroup";
import { SpecialFactorTable, SpecialFactorTableJson } from "./RiskRatioTable";
export interface DeathCauseJson {
Age?: ... |
8bb7eaf72c448283368106979aeba21665215a1f | TypeScript | surendra20/sample-stock-market | /src/features/stock/stockReducer.ts | 2.609375 | 3 | import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { RootState } from '../../app/store';
import moment from 'moment';
import { getGeometricMean as mean } from '../../common';
export type TradeObject = {
stock: string;
type: string;
quantity: number;
price: number;
totalPrice: number;
time: str... |
d29fe6199c0781f0847abc5c49743088f94eac5f | TypeScript | decaffeinate/decaffeinate | /test/iife_test.ts | 2.546875 | 3 | import check from './support/check';
test('does not wrap in an IIFE by default', () => {
check(`a = 1`, `const a = 1;`);
});
test('wraps in an IIFE if requested', () => {
check(`a = 1`, `(function() {\nconst a = 1;\n}).call(this);`, { options: { bare: false } });
});
test('cannot be used with useJSModules', () =... |
d95d3a8a3397e9fc12661db948923a31934f520d | TypeScript | milesj/emojibase | /packages/generator/src/builders/buildVersionedData.ts | 2.78125 | 3 | import { log } from '../helpers/log';
import { readCache } from '../helpers/readCache';
import { writeCache } from '../helpers/writeCache';
import { loadData } from '../loaders/loadData';
import { loadSequences } from '../loaders/loadSequences';
import { loadZwjSequences } from '../loaders/loadZwjSequences';
import { E... |
d561c1f0219bca5ff9ee0b9243d68788a8f9df85 | TypeScript | pixel-pixel/chat-bucket | /server/src/Bots/Spam.bot.ts | 2.53125 | 3 | import { Message } from '../../../common/types/Message.type'
import { adjectives, animals, colors, Config, names, uniqueNamesGenerator } from 'unique-names-generator'
import Bot from './Bot'
export default class SpamBot extends Bot {
ids: number[] = []
constructor(id: number) {
super(
id,
'Spam bo... |
09510cbe31d435f9ed477661e92691e8045002f1 | TypeScript | johanrojas07/Votos | /src/app/votes/votes.component.ts | 2.703125 | 3 | import { Article } from './Article';
import { Component } from '@angular/core';
@Component({
selector: 'app-votes',
templateUrl: './votes.component.html',
styleUrls: ['./votes.component.css']
})
export class VotesComponent {
title: string;
articles: Article[];
constructor() {
this.title = 'Votes App';... |
eef95ae5f4441573af2f9ebe569ee5f3c7f7dd1c | TypeScript | kova1chuk/Blog-React.js-Next.js | /store/posts/reducer.ts | 2.9375 | 3 | import values from 'lodash/values';
import { IPostsState, CREATE_POST, UPDATE_POST, DELETE_POST, SET_POSTS, IPostActionTypes } from './types';
const initialState: IPostsState = {
posts: null,
};
export const postReducer = (state = initialState, action: IPostActionTypes): IPostsState => {
switch (action.type)... |
f8b41985529fd70eb7384cca19219f3f65ee54cc | TypeScript | elder-orm/core | /tests/integration/defining-models.test.ts | 2.890625 | 3 | import Elder, {
Model,
StringType,
type,
Adapter,
PostgresAdapter,
Collection
} from '../../src'
import * as Knex from 'knex'
import { development } from '../../knexfile'
import config from '../config'
beforeEach(async () => {
const knex: Knex = Knex(development)
await knex.seed.run(development.migra... |
9161ed5acdcb3b860d64b6e840f6a995eef7401a | TypeScript | anjrew/angular-schematics-playground | /src/utils/add-to-module-context.ts | 2.578125 | 3 | import * as ts from 'typescript';
/**
* @description
* The file add-to-module-context.ts gets a context class holding data for the planned modifications
*
* */
export class AddToModuleContext {
// source of the module file
source: ts.SourceFile;
// the relative path that points from
// the module file t... |
44d6737590b7b3a380d485c233027407c757646b | TypeScript | mohamedmagdy17593/proto3d | /src/utils/model.ts | 2.6875 | 3 | import { titleCase } from 'tiny-case';
import { Model, ModelTypes } from 'types/editor';
import { ApiModelStatus } from 'types/model';
let nameCounts: { [key: string]: number } = {};
export function getModelName(label: string) {
let count = (nameCounts[label] = (nameCounts[label] ?? 0) + 1);
let name = `${titleCas... |
f31c9d20d88c4c7852c514b166b26bbd8c49699b | TypeScript | chansen1988/acme-web | /server/src/helpers/domain-validation.helper.ts | 3 | 3 | import { Product } from "../models/product";
import productService from "../services/product.service";
interface DomainValidationHelper {
isRegistered(domain: string, customerId?: string): Promise<boolean>;
validate(tld: RegExp, product: Product): Promise<string>;
}
class DomainValidationHelperClass implement... |
47f458bd03cd3f0bfdac2aa5ca795271ab637083 | TypeScript | tung-dang/alfred-workflow-nodejs-next | /packages/sc-repo-search/src/actions/ProjectAction.ts | 2.578125 | 3 | import { AfItem, IAction } from '@alfred-wf-node/core';
import { CommandParams, ProjectActionArg } from '../types';
const DEFAULT_ICON = 'code.png';
export default class ProjectAction implements IAction {
getDesc?: ((arg: any) => string) | undefined;
isValid: (arg: any) => boolean;
toAlfredItem: (arg: any... |
3e69dfccd452494a0bc8d8846e7f1004b7f35e2f | TypeScript | Shakarbek/angular | /src/app/calculator/calculator.component.ts | 2.703125 | 3 | import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-calculator',
templateUrl: './calculator.component.html',
styleUrls: ['./calculator.component.scss']
})
export class CalculatorComponent implements OnInit {
currentNumber='0';
firstNumber=null;
secondNumber=null;
operator=null... |
e8c20ae55d4f8ad5ad4748cf341f03990a4971b0 | TypeScript | carolinamenezes/store-framework-course | /course/steps/pdp/index.ts | 2.640625 | 3 | export default {
tests: [
{
description: 'Getting the file',
failMsg: `You didn't provide a 'product.jsonc' file`,
test: async ({ ctx }) => {
ctx.pdp = await ctx.getFile('store/blocks/product.jsonc')
return true
},
},
{
description: 'Code compilation',
f... |
acd5aa2893b372228c76b4ba4ccc569657bb15d6 | TypeScript | BitGo/BitGoJS | /modules/sdk-coin-trx/src/lib/keyPair.ts | 2.59375 | 3 | import { bip32 } from '@bitgo/utxo-lib';
import { randomBytes } from 'crypto';
import {
AddressFormat,
DefaultKeys,
isPrivateKey,
isPublicKey,
isSeed,
KeyPairOptions,
Secp256k1ExtendedKeyPair,
} from '@bitgo/sdk-core';
import * as Utils from './utils';
const DEFAULT_SEED_SIZE_BYTES = 16;
/**
* Tron key... |
01af3710eb92bcd00abefb7496cdb2163c60d987 | TypeScript | gitsupportting/ReactNative_GraphQL | /apps/mobile-v1/src/lib/utils/redux/dateTransformer.ts | 2.859375 | 3 | import { parseISO, isValid } from 'date-fns';
import produce from 'immer';
import { createTransform } from 'redux-persist';
const convertDateToStringRecursive = <T extends { [key: string]: unknown }>(obj: T): T =>
produce(obj, (draft: any) => {
Object.keys(draft).forEach(key => {
const value = ... |
f67fe86496d466ab906152b9a2cda61165ff1dab | TypeScript | crabmusket/deno_pull_streams | /lib/types.ts | 4.0625 | 4 | /**
* A Source is a producer of values for a pull stream. It is a function that you
* may call in one of two ways:
* 1. Provide the first parameter, `end`, to signal that no more values will be
* requested from this source. This lets a consumer terminate a producer.
* 2. Provide the second parameter, `cont`, a ... |
f5625be8d573dcbbe915a431f440176b37ee6ccb | TypeScript | dev2team/ibzocr | /app_ocrweb/src/utils/json-http/json-http.ts | 2.609375 | 3 | import Jsonp from '../jsonp/jsonp';
/**
* 示例数请求对象
*
* @export
* @class AppSamle
*/
export default class JsonHttp {
/**
* 获取 Http 单例对象
*
* @static
* @returns {Http}
* @memberof SampleHttp
*/
public static getInstance(): JsonHttp {
return new JsonHttp();
}
/**... |
2631781354ee713d3df656dcf9ab3ded631cdc1b | TypeScript | PawelRadawiec/todo-frontend | /src/app/store/authentication/authorization.reducer.ts | 2.75 | 3 | import * as authorizationActions from './authorization.actions';
import {AuthorizationState} from '../state/app.state';
export const initialState: AuthorizationState = {
isAuthenticated: false
};
export function reducer(state = initialState, action: authorizationActions.AuthorizationActions) {
switch (action.type... |
3e636dfd0dd243f4f779ed02e0a637b6176e20ca | TypeScript | srghma/ramda-asserters | /src/assertNotNil.ts | 2.828125 | 3 | import { isNil } from 'ramda'
export default function assertNotNil<X>(x: X | null | undefined): X | never {
if (!isNil(x)) {
return x as any
}
const error = new Error(`Got unexpected ${x}`)
error.name = 'Assert not nil error'
throw error
}
|
53890fbd4532dec6a1ee305d0e90133f8c4a8fdf | TypeScript | 7affer/raycast | /src/scripts/controls.ts | 2.65625 | 3 | export class Controls {
public rotateleft: boolean = false
public rotateright: boolean = false
public forward: boolean = false
public backward: boolean = false
public run: boolean = false
public strafeleft: boolean = false
public straferight: boolean = false
public mouserotateleft: numbe... |
12c903edc765708f8ae1e0f05b29cabfe250477a | TypeScript | kimkanu/hyperbolic-minesweeper | /app/utils/cycle.ts | 4.03125 | 4 | export class Cycle<T> {
constructor(public inner: T[] = []) {}
get(index: number): T {
if (index < 0 || index >= this.inner.length) {
const remainder =
index - this.inner.length * Math.floor(index / this.inner.length);
return this.get(remainder);
}
return this.inner[index];
}
g... |
a091c8b214f46487afc734d15a100e3c08654214 | TypeScript | mojaloop/fraud_risk_management | /predicate-builder-service/src/services/kafka.service.ts | 2.546875 | 3 | import * as kafka from 'kafka-node';
import { config } from '../config';
export class KafkaService {
ready = false;
producer: kafka.Producer;
constructor() {
const kafkaClient = new kafka.KafkaClient({
kafkaHost: config.kafkaEndpoint,
});
this.producer = new kafka.Producer(kafkaClient, { parti... |
4685ca6a64a945e88dd12e2ba81df0f93283d230 | TypeScript | Joan1106web/component | /fileList/src/fileList/utils.ts | 2.53125 | 3 | // 公用方法
export const ImagesFormat = {
DOC: ['doc', 'docx'],
PNG: ['png', 'psd', 'gif'],
XLS: ['xls']
}
/**
* 获取带前缀类名
* @param {string} cls
* @param {string} prefix
* @returns {string}
*/
export function getPrefixCls(cls: string = '', prefix: string = 'file-list') {
return `${prefix}-${cls}`;
}
... |
0b98598d02caa4b6cda7627143e9ab1961d0c98d | TypeScript | nbever/grand-sumo-showdown | /src/app/services/banzuke.service.ts | 2.671875 | 3 | import {Injectable} from '@angular/core';
import isNil from 'lodash-es/isNil';
import isNan from 'lodash-es/isNan';
import RIKISHI_CARDS from '../data/rikishi_cards';
import Banzuke from '../model/banzuke';
import BanzukeEntry from '../model/banzukeEntry';
import Rank from '../model/rank';
import Bout from '../model/b... |
3c3965ef5fac9e8c8e46b047663d219beac924f2 | TypeScript | marcobrasci1986/angular-sandbox | /src/app/person/person.component.ts | 3.03125 | 3 | import {Component, OnInit} from '@angular/core';
export interface PersonProperties {
name: string;
age: number;
}
export class Person implements PersonProperties {
name: string;
age: number;
constructor(name: string, age: number) {
this.name = name;
this.age = age;
}
}
@Component({
selector... |
5493d980c231f55120df5a6c5f0103115767ebf6 | TypeScript | jovercao/lubejs | /src/orm/modeler/entity-builder.ts | 2.78125 | 3 | import { Scalar, Select } from "../../core";
import { Entity, EntityConstructor } from "../entity";
import { ColumnMetadata, EntityMetadata, HasManyMetadata, HasOneMetadata, IndexMetadata, KeyMetadata, TableEntityMetadata } from "../metadata";
import { DataTypeOf, ScalarDataType } from "../data-types";
import { selectP... |
c6d9df3b65cbb268eb6d54a3f575094601f4be73 | TypeScript | future4code/brunoPacheco | /semana12/aula3/exDaTarde/src/index.ts | 2.90625 | 3 | import { ResidencialClient } from './residencialClient';
import { TradeClient } from './tradeClient';
import { IndustryClient } from './industryClient';
import { ClientManager } from './clientManager';
//clientes residenciais
const client1 = new ResidencialClient("apartamento", "12345678912", "12345678", "bruno", 100... |
57a3821de7bdc997b29ecefee49ad6300d94af3b | TypeScript | bakuzan/sticky-fingers | /src/sudoku/isUnique.ts | 2.96875 | 3 | import { SudokuGrid } from './interfaces/SudokuGrid';
import solve from './solve';
export default function isUnique(grid: SudokuGrid) {
const input = grid;
const solved1 = solve(input, { chooseDigit: 'min' });
const solved2 = solve(input, { chooseDigit: 'max' });
for (const s in solved1) {
if (solved2[s]... |
3d9d8a9f004d94a2370085941f290c68aeeee75b | TypeScript | gunjankarun/just50words | /src/app/service/audio.service.ts | 2.53125 | 3 | import { Injectable, OnDestroy } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';
import { ConfigService } from './config.service';
/**
* This service handles audio related tasks. It is the central location to make global changes to audio events
*
* @export
* @class AudioService
*/
@Injecta... |
80eaa92ccc53e85a448549abe2d01faba9a2e843 | TypeScript | alexa/alexa-skills-kit-sdk-for-nodejs | /ask-sdk-core/lib/util/SsmlUtils.ts | 2.859375 | 3 | /*
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "... |
67490cfc8cfe3d972a5f834081c5d0cc81f59b86 | TypeScript | wwalpha/pocket-cards | /backend/nodejs/batch/src/func/scheduler.ts | 2.625 | 3 | import { SES } from '@aws-sdk/client-ses';
import moment from 'moment';
import { Learning } from '@queries';
import { DBHelper, Environments, Consts } from '@utils';
import { Tables } from 'typings';
const client = new SES({});
export default async () => {
// get teachers
const results = await DBHelper().scan<Tab... |
571e7974879640c01b335a4b2f7bc460da961ca8 | TypeScript | sedc-codecademy/mexn | /group2/angualr-class-01/src/app/notes/notes.component.ts | 2.75 | 3 | import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
class Note
{
}
@Component({
selector: 'app-notes',
templateUrl: './notes.component.html',
styleUrls: ['./notes.component.css']
})
export class NotesComponent implements OnInit
{
notes: Note = [{
id: 1,
title: "some note",... |
640eadf40d0f83de629e7d4abcda82c4783b7aa0 | TypeScript | turms-im/turms | /turms-client-js/src/util/input-file-reader.ts | 3.125 | 3 | export enum ErrorCode {
ELEMENT_IS_NULL = 1,
IS_NOT_FILE_LIST,
NO_FILES_SELECTED
}
export default class InputFileReader {
private static _reader: FileReader;
static readFileFromHTMLInputElement(element: HTMLInputElement, fileIndex = 0): Promise<string | Uint8Array> {
// element.files insta... |
2b346ad2f1c3ceb572ab2f4002a9743a9e200c9b | TypeScript | tezos-israel/tezos-react-hooks | /src/use-balance.ts | 2.578125 | 3 | import { useState, useEffect } from 'react';
import { useTezosContext } from './TezosContext';
import { BalanceHook } from './types';
import BigNumber from 'bignumber.js';
export function useBalance(address = ''): BalanceHook {
const { tezos } = useTezosContext();
const [balance, setBalance] = useState(0);
const... |
f4b0414c422409305703ca955abcf5e86cb00f7a | TypeScript | Jockele/istint | /src/utils/output.ts | 3.265625 | 3 | import { sprintf } from 'sprintf-js';
/**
* converts sec value in human readable string presentation
* @param t value in sec
*/
export const secAsString = (t : number) : string => {
const minutes = Math.floor(t / 60);
const seconds = Math.trunc(t - minutes*60)
return sprintf("%d:%02d", minutes, ... |
65f0f13dad0de80e11ba8917fc2436c94a867a4d | TypeScript | aleksBobrovs/Home_Task | /src/Policy.ts | 2.5625 | 3 | import IPolicy from "./interfaces/IPolicy";
import Risk from "./types/Risk";
import {Moment} from "moment";
class Policy implements IPolicy {
private _nameOfInsuredObject: string;
private _validFrom: Moment;
private _validTill: Moment;
private _premium: number;
private _insuredRisks: Risk[];
p... |
ac46e6379bea5d3cf6a411617ab93ba44a8330b6 | TypeScript | H4ad/omnistack | /frontend-react/src/services/api.ts | 2.6875 | 3 | //#region Imports
import axios, { AxiosError, AxiosResponse } from 'axios';
import { KeysEnum } from '../models/enums/keys.enum';
import { CreateIncidentPayload } from '../models/payloads/create-incident.payload';
import { CreateOngPayload } from '../models/payloads/create-ong.payload';
import { CreateUserPayload } f... |
59d062a46fd51c0e15ccdd645996e50d0fd8fef6 | TypeScript | xrts/TypeScript | /8.函数的类型.ts | 4.34375 | 4 | // 函数声明(Function Declaration)
function sum(x, y) {
return x + y;
}
// 函数表达式(Function Expression)
let mySum = function (x, y) {
return x + y;
};
// 函数声明 ts需要考虑输入和输出,输入多余或少于要求都报错
function sum(x: number, y:number): number {
return x + y;
}
// 函数表达式 ts
let mySum = function (x: number, y: number): number {
... |
7f0371c7e0b89d606ab87ced8c2a1183b548b8e8 | TypeScript | naspinall/studs | /src/operators/Operator.ts | 2.921875 | 3 | import { ParameterManager } from "../common/ParameterManager";
import { EntityMetadata } from "../metadata/metadata";
import { toSQLValue } from "../utility/encoding";
import { Primitive } from "../utility/types";
export interface OperatorConfiguration {
count?: number;
alias?: string;
column?: string;
metadat... |
d0205bfaaebf036ff9c756487666050f67f289c8 | TypeScript | DanielGiljam/ia-2-017-0-lodge-broker | /src/middlewares/resourceExtractor.ts | 2.6875 | 3 | import {Request, RequestHandler} from "express"
import {Model} from "mongoose"
import Advert, {IAdvert} from "../models/Advert"
import Booking, {IBooking} from "../models/Booking"
import Cabin, {ICabin} from "../models/Cabin"
import User, {IUser} from "../models/User"
type ResourceName = "user" | "cabin" | "advert" |... |
4c36a18745f0f1aa62dfc14add367b662c15f3e2 | TypeScript | andrewjoll/shipwreck | /src/app/components/Motion.ts | 2.75 | 3 | import { Entity } from '@/entities';
import { PositionProvider } from '@/components';
import { Vector3 } from 'three';
export default class Motion implements PositionProvider {
entity: Entity;
name: string = 'Motion';
position: Vector3;
velocity: Vector3;
target: Vector3;
targetEntity: Entity;
speed: num... |
1d3357010269bf24cdb3f7ca23834a5aa954081a | TypeScript | hhiraba/exercises | /deno/sample/gcd.ts | 3.21875 | 3 | function gcd(a: number, b: number): number {
if (a % b == 0) {
return b;
}
return gcd(b, a % b);
}
console.log(gcd(12, 3));
console.log(gcd(24, 12));
console.log(gcd(126, 34));
|
8a9ce52c93b8f03a7ea5d01b53e7b08cba743e6e | TypeScript | CoinbaseStablecoin/multi-sig-admin-dashboard | /src/models/Contract.ts | 2.75 | 3 | import { getTransactableFunctions, parseAbiJson } from "../util/abi";
import { AbiFunction } from "../util/AbiFunction";
import { toChecksumAddress } from "../util/address";
export interface MarshaledContract {
address: string;
name: string;
abi: string;
}
export class Contract {
public readonly address: stri... |
6d970207875834ccb7f1a7e3e3411f833b4aaf05 | TypeScript | Sound1ab/NoteHub.Frontend | /src/utils/daysToEvent.ts | 3.078125 | 3 | const MS_PER_DAY = 1000 * 60 * 60 * 24
export function daysToEvent(date?: string | null) {
if (!date) {
return null
}
const now = new Date()
const event = new Date(date)
const nowUTC = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
const eventUTC = Date.UTC(
event.getFullYear(),
ev... |
8d514563ac346d03e3ca16787ff08f176397e706 | TypeScript | vicjune/huit-sec | /src/utils/usePlayers.ts | 2.6875 | 3 | import { useCallback, useEffect, useMemo } from 'react';
import { v4 as genUuid } from 'uuid';
import { useGlobalState } from '../contexts/GlobalState';
import { storage, STORAGE_PLAYERS_KEY } from './storage';
export interface Player {
id: string;
name: string;
score: number;
nbrAnswered: number;
}
export co... |
f8b372f32e2d2525d4df7157789a66e6d715ad40 | TypeScript | Isabellalima86/estudandoTypeScript | /null.ts | 3.171875 | 3 | let altura: number | null = 1.63
altura = null;
type Contato = {
nome: String;
telefone1: string;
telefone2?: string | null;
}// ooperador ? diz que o valor é opcional
const contato: Contato = {
nome: 'Bell',
telefone1: '21 90965-2788',
telefone2: null,
}
|