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 |
|---|---|---|---|---|---|---|
2bc9619b2774b11cb12baba4eeab440cef5006ac | TypeScript | MarioACo/Sueldo | /sueldo.ts | 3.015625 | 3 | class sueldo{
public nombre:string = (<HTMLInputElement>document.getElementById("nombre")).value;
public sueldom:number = parseFloat((<HTMLInputElement>document.getElementById("sueldo")).value);
public horas:number = parseInt((<HTMLInputElement>document.getElementById("horas")).value);
public hextras:nu... |
35e04611c5f832ac8a1c85c6d8ac97e39bff6b46 | TypeScript | G3F4/moxy-proxy | /server/infrastructure/sockets-client/SocketsClient.ts | 2.671875 | 3 | //@ts-ignore
import * as WebSocket from 'ws';
import { ClientAction, ServerEvent } from '../../../sharedTypes';
import { logError } from '../../utils/logger';
export default class SocketsClient {
sockets: WebSocket[] = [];
clientMessageHandlers: Record<
string,
(payload: unknown) => Promise<void>
> = {};... |
994341c9e3ba3c900133d83b29e54186ed2d7813 | TypeScript | cuatromedios/nequ | /backend/src/store/store.service.ts | 2.578125 | 3 | import {HttpException, Injectable} from '@nestjs/common'
import * as crypto from 'crypto'
import * as AWS from 'aws-sdk'
@Injectable()
export class StoreService {
async put(file): Promise<string> {
let hash = crypto.createHash('sha1')
hash.setEncoding('hex')
hash.write(file.buffer)
hash.end()
con... |
153ad4a0ebb45c053196fc75af4174040ce54fc9 | TypeScript | robcrocombe/monzo-calendar-react | /src/monzo/auth.store.ts | 2.609375 | 3 | import { createContext } from 'react';
import { observable, computed, action } from 'mobx';
class AuthStore {
public readonly REDIRECT_URL = process.env.REDIRECT_URL;
@observable public CLIENT_ID = process.env.CLIENT_ID || localStorage.getItem('auth.clientId');
@observable
public CLIENT_SECRET = process.env.CL... |
aebdb0d6cb0f013f00de68860ef12fbe6c7a93db | TypeScript | COMP30022-Russia/COMP30022_Server | /controllers/notification/index.ts | 2.859375 | 3 | import send from '../../helpers/notifications';
import {
getFirebaseTokensHelper,
replaceFirebaseToken,
removeFirebaseToken
} from './actions';
export { updateFirebaseToken, getFirebaseTokens } from './actions';
/**
* Builds an Firebase android notification message.
* @param title Title of message.
* @p... |
7a0da85a03c52dbafdf4ffc64dae22fa9a22881f | TypeScript | xiel/use-location-state | /src/packages/use-location-state/src/useQueryState/test/method-push.test.ts | 2.5625 | 3 | import { renderHook } from '@testing-library/react-hooks'
import { useQueryState } from '../../use-location-state'
import {
asyncAct,
unwrapResult,
} from 'use-location-state-test-helpers/test-helpers'
import { cleanup } from '@testing-library/react'
// reset jest mocked hash
beforeAll(() => {
window.location.ha... |
e97d722be66681fbafa169f8f37e40cab1b06c4e | TypeScript | geoblink/lodash-mixins | /test/unit/fromPairsMap.spec.ts | 2.640625 | 3 | import fromPairsMap from '../../src/fromPairsMap'
import { expect, use as chaiUse } from 'chai'
import sinonChai from 'sinon-chai'
import * as sinon from 'sinon'
chaiUse(sinonChai)
describe('fromPairsMap', function () {
it('should return an object', function () {
const array = ['a', 'b', 'c']
const expectedR... |
3fd17f31564a495a295f6ff786cf0ae751e02402 | TypeScript | Ahryman40k/typescript-fhir-types | /src/R4/Resource/RTTI_ClinicalImpression_Investigation.ts | 2.9375 | 3 | import * as t from 'io-ts';
import { RTTI_Extension, IExtension } from './RTTI_Extension';
import { RTTI_CodeableConcept, ICodeableConcept } from './RTTI_CodeableConcept';
import { RTTI_Reference, IReference } from './RTTI_Reference';
export interface IClinicalImpression_Investigation {
/**
* A name/code for the gr... |
c3ec9304a9c3e88e2038b38b917ba7683af0dee7 | TypeScript | sergejmigun/ShopEngine.Frontend | /Frontend/Scripts/core/lib/objects/enumerable.ts | 3.3125 | 3 | class Enumerable<T> {
private $iterate: (func: (x: T) => any) => void;
private utils;
constructor($iterate: (func: (x: T) => any) => void, utils) {
this.$iterate = $iterate;
this.utils = utils;
}
public where(predicate: (x: T) => boolean) {
var self = this;
return... |
4e927e535adb0b3875651e21916cc65d85ab14c7 | TypeScript | cevaris/api-cli | /tests/index.integration.ts | 2.875 | 3 | import { exec } from 'child_process';
import { EOL as NEW_LINE } from 'os';
import { promisify } from 'util';
import { shuffle } from './helper';
const execPromise = promisify(exec);
describe('advice api', () => {
it('test ids are not numbers', async () => {
const response = await execPromise('./bin/advic... |
deb41113137bb1634f4eb526584bf29e44450398 | TypeScript | cococoquito/AdminFree-frontend | /AdminFree/src/app/dtos/english/serie.dto.ts | 2.625 | 3 | import { SeasonDTO } from "./season.dto";
/**
* DTO para mappear las series
*
* @author Carlos Andres Diaz
*/
export class SerieDTO {
/** identificador de la serie */
public id: number;
/** Es el nombre de la serie */
public name: string;
/** Es la URL de esta serie */
public url: string;
/** es ... |
46cd14c746580303749e731de3cb455c1c56f819 | TypeScript | dongsu8142/dongz.ml | /util/index.ts | 2.546875 | 3 | import matter from 'gray-matter'
export async function getAllPosts(){
const context = require.context('../_posts', false, /\.md$/)
const posts = []
for(const key of context.keys()){
const post = key.slice(2);
const content = await import(`../_posts/${post}`);
const meta = matter(con... |
c68b897bf8ec5eafffa4c7ae228bb95edf589018 | TypeScript | nori-dot-eco/ethql | /src/__tests__/core/block.test.ts | 2.59375 | 3 | import { testGraphql } from '../utils';
const { execQuery } = testGraphql();
test('block: select single block by number', async () => {
const query = `
{
block(number: 12345) {
hash
}
}
`;
const expected = { data: { block: { hash: '0x767c2bfb3bdee3f78676c1285cd757bcd5d8c272cef2eb30d... |
c718e4f65bf98299a808b9791cd436c2d6223701 | TypeScript | rwp-anonymous/HyproDoc-API-V2 | /src/items/pipes/store-location-validation.pipe.ts | 2.859375 | 3 | import { PipeTransform, BadRequestException } from "@nestjs/common";
import { StoreLocations } from "../store-location.enum";
export class StoreLocationValidationPipe implements PipeTransform {
readonly allowedStoreLocation = [
StoreLocations.UGANDA,
StoreLocations.SRI_LANKA,
];
transform(... |
82f630e4275527343bd8ec4b5e4b0f76ae019ead | TypeScript | VikaBondareva/hotel-api | /src/models/client.model.ts | 2.625 | 3 | import DataTypes, { Model } from 'sequelize';
import { StatusUsersArray, Validate, CountAttempt } from '../enums';
export class Client extends Model {
public clientId!: number;
public name!: string;
public surname!: string;
public phoneNumber!: string;
public email!: string;
public phoneCountryId!: number;... |
6772ac982c4d0797606311a70772ad09ae8505bf | TypeScript | nstranquist/apps | /pages/api/apps/[id].ts | 2.890625 | 3 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'
import { connectToDatabase } from "../../../util/mongodb";
type Data = {
message: string
}
export default async function handler(
req: NextApiRequest,
res: NextApiResponse<Da... |
78e18f73fd11b236078196639bd331f50bdd57f1 | TypeScript | tonngw/leetcode | /typescript/0901-online-stock-span.ts | 3.46875 | 3 | class StockSpanner {
private stack: { price: number; spanDays: number }[];
constructor() {
this.stack = [];
}
next(price: number): number {
let span = 1;
while (
this.stack.length > 0 &&
this.stack[this.stack.length - 1].price <= price
) {
... |
96a650b2953d70178c52ac7f940d003c5edb232c | TypeScript | anton-nagornyi/math | /src/vectors/floats.ts | 3.109375 | 3 | import {INumber2, INumber3, INumber4} from "./numbers";
export abstract class AVectorData
{
abstract value: Float32Array;
}
export class Float2 extends AVectorData implements INumber2
{
value = new Float32Array(2);
get x(): number
{
return this.value[0];
}
get y(): number
{
... |
4cafb775f7a3d59ff87399ee8b8c073f76b6c5ef | TypeScript | SAanajamil/bootCamp2021 | /version-7/src/index.ts | 3.078125 | 3 | //Removing completed task
import { TodoItem } from "./todoItem";
import { TodoCollection } from "./todoCollection";
import * as inquirer from 'inquirer';
let todos: TodoItem[] = [
new TodoItem(1, "Buy Flowers"),
new TodoItem(2, "Get Shoes"),
new TodoItem(3, "Collect Tickets"),
new TodoItem(4, "Call Joe", true),
n... |
5827678357757547d005afe66c659033a282370b | TypeScript | lee-dalais/pacman-game | /index.ts | 2.640625 | 3 | import * as shell from 'shell'
import { Packman } from './models/packman'
const app = new shell();
let packman;
app.configure(function() {
app.use(shell.router({shell: app}));
app.use(shell.error({shell: app}));
});
app.cmd('PLACE :x,:y,:direction', function(req, res) {
if (!packman) {
packman ... |
b5b4fdbb2bc1fea3d1ef1ab1ce7175b143888aff | TypeScript | logscl/nicobot-persistence | /src/common/model/Error.ts | 2.859375 | 3 | import { ErrorItem } from "./ErrorItem";
export class Error {
private errors : Array<ErrorItem> = new Array();
hasError() : boolean {
return (this.errors.length == 0) ? false : true;
}
addFieldError(fieldName:string, errorMessage:string) {
this.errors.push(new ErrorItem(fieldName, err... |
c4155ab1a99685e488292430a5fa7b08dae059d4 | TypeScript | ruchirathakare/Algorithms-JS | /nthFromEnd-LinkedListTS.ts | 3.9375 | 4 | class Node {
constructor(public data: number, public next: null | any = null) {}
}
class Linkedlist {
head: null | any;
constructor() {
this.head = null;
}
nthFromEnd(n: number): void {
let firstNode = this.head;
let secondNode = this.head;
for (let i = 0; i < n; i++) {
secondNode = s... |
753e78bbeefcf6fa9d63ddf5f691fbd5d789556f | TypeScript | AmitPr/insci | /src/app/component/ButtonState.ts | 2.546875 | 3 | import { Cell, Cells, Plugin } from 'insci-notebook';
import { App } from '../App';
@Plugin
class ButtonState {
cellTypes: string[]=[];
postNotebookInit() {
Object.keys(Cells.builtins).forEach(key => {
this.cellTypes.push(key);
});
Object.keys(Cells.plugins).forEach(key => {
... |
4ab54af82eb0bd040c2ae01a44e5cef0b3ebac3c | TypeScript | divasilevski/mrbeam | /utils/fem/calculate.ts | 2.796875 | 3 | import { CalculateOptions, Skeleton } from './types/calculate'
import { Element } from './types/element'
import { Unit } from './types/unit'
import { fragmentation } from './core/fragmentation'
import { multiply, solve } from './core/algebra'
import { createGraph } from './core/graph'
import { parse } from './core/par... |
965fa4c4edde13df7cdff28fd5b02b315ec092bf | TypeScript | gabsouza1/trabalhoTypeScript | /src/exercicio2.ts | 3.46875 | 3 | // Crie uma classe Veiculos com os atributos modelo, marca, ano, valorLocacao e
// quantidade de dias. Crie os getters e setters. No setters crie validações para não
// aceitar modelo, marca, ano, valorLocacao e quantidade em branco ou com valor
// zero. Crie um método passeio para receber a quantidade de dias e o v... |
5abbfcdb650677d10d8dbcdd281404ebe9f4feee | TypeScript | boopathi/atomic | /src/visitor/list.ts | 2.578125 | 3 | import { Visitor, Node } from "./visitor";
export default class ListVisitor extends Visitor {
async visit({ name }: Node) {
console.log(">>>", name);
await new Promise(resolve => {
setTimeout(() => resolve(name), 1000);
});
}
}
|
e24b215acf03379201ba4dfeb21033f1e439f3fd | TypeScript | luchkonikita/rushy | /src/reporters/html.ts | 2.546875 | 3 | import * as path from 'path'
import * as pug from 'pug'
import BaseReporter from './base_reporter'
// We're resolving from '/dest/src/reporters' to '/templates'
const template = path.join(__dirname, '../../../templates', 'html.pug')
export default class HTMLReporter extends BaseReporter implements Reporter {
write(... |
a75a7d8f333089c3b782afc173d583a1cdbca62f | TypeScript | kristupas21/react-ts-app-starter | /src/state/app/appReducer.ts | 2.703125 | 3 | import { ActionType, Reducer } from 'typesafe-actions';
import { AppState } from './appModel';
import { SET_APP_LOADING } from './appConstants';
type Action = ActionType<typeof import('./appActions')>;
type State = Readonly<AppState>
const initialState: State = {
isLoading: false,
};
const appReducer: Reducer<Sta... |
aeaa8fcc2b8a62d1448628ffff59c67bd6816a38 | TypeScript | LeeMoonki/WallahNode | /servers/fastify/src/routes/login.ts | 2.546875 | 3 | import { FastifyInstance } from '../types';
import { apiOptions } from './lib/apiOptions';
import bcrypt from 'bcrypt';
interface IBody {
id: string;
password: string;
}
async function routes(fastify: FastifyInstance): Promise<void> {
fastify.post<{ Body: IBody }>('/', async (request, reply) => {
const { id... |
5303c005c9be4e448b1654fd0849713917b0faf6 | TypeScript | bitmovin/bitmovin-player-ui | /src/ts/spatialnavigation/seekbarhandler.ts | 2.59375 | 3 | import { RootNavigationGroup } from './rootnavigationgroup';
import { NodeEventSubscriber } from './nodeeventsubscriber';
import { Action, Direction } from './types';
import {getBoundingRectFromElement} from './navigationalgorithm';
const DefaultScrubSpeedPercentage = 0.005;
const ScrubSpeedClearInterval = 100;
const ... |
cf5f569e895945f7d737c12d3a31279cc83447f5 | TypeScript | artsy/positron | /src/client/components/draft/paragraph/utils/utils.ts | 2.78125 | 3 | import { getDefaultKeyBinding, KeyBindingUtil } from "draft-js"
import Immutable from "immutable"
import React from "react"
import { StyleElements, StyleMap } from "../../typings"
/**
* Helpers for draft-js Paragraph component setup
*/
/**
* blockRenderMap determines how HTML blocks are rendered in
* draft's Edit... |
d44cbf1aa299d10087274e2ffef078ea8aa93995 | TypeScript | Arveymenon/node_design_patterns | /src/design_patterns/singleton/singleton.ts | 3.015625 | 3 | import { Database, MockDB } from "./services/database_service";
export class Singleton{
database: MockDB
constructor(){
let db: MockDB = {
url: 'test',
type: "mongo"
}
this.database = Database.getInstance(db)
}
}
export class Singleton2{
database: MockDB... |
573adb509dc114d3d3a8a7ab9b3ba433ce311eb2 | TypeScript | oselvar/connector | /packages/connector-core/src/types.ts | 3.609375 | 4 | /**
* The primary representation of a Work Item for use in *analysis*.
*
* This type is serialisable to CSV, which is also Oselvar's basic data format for connecting
* to external sources.
*/
export type WorkItem<Stage extends string> = {
id: string
name?: string
} & StageTimestamps<Stage>
export type StageTi... |
2a254b65d39805e3c73ea31837f149cca8f02421 | TypeScript | nguyer/aws-sdk-js-v3 | /clients/node/client-sagemaker-node/types/_GitConfig.ts | 2.96875 | 3 | /**
* <p>Specifies configuration details for a Git repository in your AWS account.</p>
*/
export interface _GitConfig {
/**
* <p>The URL where the Git repository is located.</p>
*/
RepositoryUrl: string;
/**
* <p>The default branch for the Git repository.</p>
*/
Branch?: string;
/**
* <p>Th... |
61e40eb27927b2caa7df1c937413d4eb5834c61d | TypeScript | danmin20/deal-12 | /client/src/lib/router.ts | 2.609375 | 3 | import { isClass } from './util';
type RouterType = {
$app: any;
routes: Route[];
fallback?: string;
};
type Route = {
path: string;
redirect?: string;
component?: any;
middlewares?: any;
};
class Router {
$app: HTMLDivElement;
routes: {
[key: string]: Route;
} = {};
fallback: string = '/';
... |
d79fe40f69305a49bb04b01b365a2aa42de8ed17 | TypeScript | JDevbois/anabolicavote-frontend | /anabolicavote/src/app/_models/vote.model.ts | 2.90625 | 3 | import { Candidate } from './candidate.model';
export class Vote {
private _candidate: Candidate;
private _id: number;
private _code: String;
constructor(
candidate: Candidate, code: String
) {
this._candidate = candidate;
this._code = code;
}
static fromJSON(json: ... |
3e486667427ea894909cf4e43cd6a033727d94c5 | TypeScript | himanshu-dixit/signoz | /frontend/src/actions/traces.ts | 2.703125 | 3 | import { ActionTypes } from './types';
import tracesAPI from '../api/tracesAPI';
import { Dispatch } from 'redux';
import { GlobalTime } from './global';
// PNOTE
// define trace interface - what it should return
// define action creator to show list of traces on component mount -- use useEffect ( , []) -> Mounts whe... |
16eceb0e2f57581a9b8347366036f51da28900f7 | TypeScript | ant-design/ant-design | /components/steps/useLegacyItems.ts | 2.609375 | 3 | import * as React from 'react';
import toArray from 'rc-util/lib/Children/toArray';
import type { StepProps } from '.';
import warning from '../_util/warning';
function filter<T>(items: (T | null)[]): T[] {
return items.filter((item) => item) as T[];
}
export default function useLegacyItems(items?: StepProps[], chi... |
fb8b468106b11347148112a5257c82b7673337e2 | TypeScript | bakaproject/angular-persistence | /lib/tests/persistence.container.spec.ts | 2.96875 | 3 | import { PersistenceService, StorageType, IPersistenceContainer } from '../src/index';
describe('Persistent Container Test: Memory', () => {
let service: PersistenceService;
let container: IPersistenceContainer;
beforeEach(() => {
service = new PersistenceService();
container = service.cre... |
5825d7b8f886b3168437d8433f950c06765b53eb | TypeScript | rasmus-storjohann/fixMyMusic | /src/businessObjects/fixers/details/parserDetails.ts | 3 | 3 | export function toString(from, field: string): string | undefined
{
return isString(from[field]) ? from[field] + "" : undefined;
}
export function isString(s: any): boolean { return s && s + "" === s; }
export function toNumber(from, field): number | undefined
{
return isNumber(from[field]) ? from[fie... |
053050f1b055c00055cc66bf81394c62ae33db9f | TypeScript | iChris96/movies-app | /src/models/Movies.ts | 2.59375 | 3 | import { Schema, model } from 'mongoose';
export interface IMovie {
id: number;
adult: boolean;
backdropPath: string;
genreIds: Array<number>;
originalLenguaje: string;
originalTitle: string;
overview: string;
popularity: number;
releaseDate: string;
title: string;
video: bo... |
ffaca1190e4545212a9eaf50af9145e3feb55adc | TypeScript | DoctorMcKay/node-websocket13-jsonrpc | /src/classes/WsRpcOutgoingConnection.ts | 2.6875 | 3 | import {WebSocket} from 'websocket13';
import WsRpcConnection from './WsRpcConnection';
const ACTIVE_SUBPROTOCOL = 'jsonrpc-2.0';
export default class WsRpcOutgoingConnection extends WsRpcConnection {
/**
* Establish a new outgoing connection.
* @param {string} url
* @param {object} [options]
*/
constructo... |
53920656c71dd71553882f9fde72931b34c3d90d | TypeScript | innogames/dr-json | /src/domain/context/data/filter/bySearch.ts | 2.71875 | 3 | import {DataEntry} from '../../../states/objects/editor/DataEntry';
export function bySearch(search: string): (entry: DataEntry) => boolean {
if (!search) {
return () => true;
}
search = search.toLowerCase();
return (entry: DataEntry) => {
const haystack = entry.toJson().replace('\\',... |
d5cabd4148407260a446633aff90677aaed543b5 | TypeScript | chevre-jp/factory | /src/place/screeningRoomSection.ts | 2.546875 | 3 | import * as PlaceFactory from '../place';
import { PlaceType } from '../placeType';
import { IPlace as ISeat, IPlaceWithOffer as ISeatWithOffer } from './seat';
/**
* セクション
*/
export interface IPlace extends Pick<
PlaceFactory.IPlace,
'project' | 'typeOf' | 'branchCode' | 'name' | 'containedInPlace' | 'conta... |
3ea2ba21b1f31910581b5291af90bd2d13c8f034 | TypeScript | tolym/life-helper-web | /src/app/core/services/logger.ts | 3.640625 | 4 | /**
* @todo
* 先简单弄一个,后面再优化
*/
import { environment } from 'src/environments/environment'
export interface LoggingOptions {
type: 'debug' | 'info' | 'warn' | 'error'
message: string
}
/**
* 日志服务(非单例服务)
*
* @description
* ```js
* // 必须使用以下方式导入,这里是特意设定成非 DI 的方式使用的
* const logger = new Log... |
e03d541d5bce45ba45f41367811499f1333e89b3 | TypeScript | liangchunn/typescript-node-scripts | /src/scripts/migration/tslint-to-eslint/hash.ts | 2.625 | 3 | import crypto from 'crypto'
import * as fs from 'fs'
export function getFileHash(path: string) {
return new Promise((resolve) => {
const hash = crypto.createHash('sha256')
const input = fs.createReadStream(path, { encoding: 'utf-8' })
input.on('readable', () => {
const data = input.read()
if ... |
66ee5bd3b438cb37baf2a9bcdd96fa7c90336193 | TypeScript | designunit/uray | /src/reducers/userSettingsReducer.ts | 2.609375 | 3 | import {
ACTION_LAYER_FILTER_TREE_SET_CHECKED_KEYS,
ACTION_USER_SETTINGS_LAYER_MAKE_CURRENT,
ACTION_USER_SETTINGS_SET_LAYER_CLUSTER,
ACTION_USER_SETTINGS_SET_LAYER_VISIBLE,
} from '../app/actions'
import { IUserSettings, LayerId } from '../app/types'
export function userSettingsReducer(state: IUserSett... |
e7e4ce4d4e326de5f0d1229dc9ee47430e79e8f8 | TypeScript | dreiv/ng-test | /src/app/service/languages.service.spec.ts | 2.515625 | 3 | /* tslint:disable:no-unused-variable */
import { TestBed, inject } from '@angular/core/testing';
import { LanguagesService } from './languages.service';
describe('LanguagesService', () => {
let service: LanguagesService; // to access properties and methods
// setup
beforeEach(() => {
TestBed.configureTe... |
c661738b328d501092194315ffbc55bdcafe72f2 | TypeScript | TheLox95/expert-platform-frontend | /src/tools/uploadManager/UploadFile.ts | 2.5625 | 3 | import { HttpFun } from "requests/http"
const uploadFile = <F>(http: HttpFun, file: File, onProgress: (v: number) => void) => {
const data = new FormData()
data.append('files', file)
return () => {
return http<F[]>({
disableGlobal: true,
url: `${process.env.REACT_APP_BACKEN... |
83dcc26f0d461c17fa99693465d99153facb17d9 | TypeScript | tech-espm/labs-eventos | /models/palestranteResumido.ts | 2.75 | 3 | import Sql = require("../infra/sql");
import Empresa = require("./empresa");
import Evento = require("./evento");
import Palestrante = require("./palestrante");
import TipoEmpresa = require("./tipoEmpresa");
import emailValido = require("../utils/emailValido");
export = class PalestranteResumido {
public id: number;... |
4eb2e0ed0f23fa9e3d08726e578e053cfa750274 | TypeScript | theniteshsingh/next-auth | /packages/next-auth/tests/middleware.test.ts | 2.6875 | 3 | import { NextMiddleware, NextRequest } from "next/server"
import { NextAuthMiddlewareOptions, withAuth } from "../src/next/middleware"
it("should not match pages as public paths", async () => {
const options: NextAuthMiddlewareOptions = {
pages: { signIn: "/", error: "/" },
secret: "secret",
}
const req... |
eb36785519b502c47017ad33511d33fe88cd2d6f | TypeScript | jedielson/kong-playground | /microservices/catalog/src/utils/test/authors/author.spec-builder.ts | 2.6875 | 3 | import * as Factory from 'factory.ts';
import * as Faker from 'faker';
import { Book } from '../../../modules/bookstore/book/book.entity';
import { Author } from '../../../modules/bookstore/author/author.entity';
import { IBuilder } from '../common/IBuilder';
export class AuthorBuilder implements IBuilder<AuthorBuilde... |
17b149799f043549f42dd1a6a33ed23f895a9c63 | TypeScript | jgretz/pghbeer | /site/app/services/loadDataForEvent.ts | 2.8125 | 3 | import * as R from 'ramda';
import type {Beer, EventItemData} from '~/Types';
import {DATA_URL} from '~/constants';
function projectBeers(data: EventItemData[]) {
return data.map((d) => d.beer);
}
const groupBeersByBrewery = R.groupBy(function (beer: Beer) {
return beer.brewery.name;
});
function sortBreweriesBy... |
7a9012c1060c5202d7fe7597923752248fa8ce70 | TypeScript | serverless-tencent/serverless-warmer | /src/warm.ts | 2.609375 | 3 | import { program } from 'commander';
import ora from 'ora';
import chalk from 'chalk';
import assert from 'assert';
import { Sls } from './components/sls';
import { Faas } from './components/faas';
import { Credential, WarmOptions } from './typings';
const getCredential = (): Credential | null => {
const { TENCENT_S... |
7095e2cfbdb9f087d0fe285c75c126b630430d6a | TypeScript | Sabai-Technologies/simple-object-validator | /ts/typings/folktale/data.validation.d.ts | 3.734375 | 4 | // Type definitions for data.validation
declare interface SemiGroup {
concat(c:SemiGroup):SemiGroup;
}
declare class Validation {
// -- Constructors -----------------------------------------------------
/**
* Constructs a new `Validation[α, β]` structure holding a `Failure` value.
*
* @sum... |
693eaafb5d2afa8af2feed74bd9f15dc982cc99f | TypeScript | nicky-lenaers/mogr | /src/pagination/types/query-options.spec.ts | 2.546875 | 3 | import { GraphQLObjectType, GraphQLString, GraphQLNonNull, GraphQLSchema } from "graphql";
import { QueryOptionsType } from "./query-options";
import { mockServer } from "graphql-tools";
import { base64Encode } from "../utils";
describe('QueryOptionsType', () => {
it('should construct a correct GraphQL Input Object... |
bd10eef7145b937d4a3086d4d88c202dba8df0ee | TypeScript | veeqtor/microservices-with-node-js | /nats-test/src/events/base-publisher.ts | 2.59375 | 3 | import { Stan } from "node-nats-streaming";
import { Subjects } from "./subjects";
interface IEvent {
subject: Subjects;
data: any;
}
abstract class Publisher<T extends IEvent> {
abstract subject: T["subject"];
constructor(private client: Stan) {}
publishEvent(data: T["data"]): Promise<string> {
retur... |
7c0d343746cefadcf8820c4187d00a1512080a7f | TypeScript | Kezzo/aika-server | /src/utility/is-mail.ts | 2.6875 | 3 | import _ = require('underscore');
export default function isMail(stringToCheck: string) {
if (!stringToCheck) {
return false;
}
if (stringToCheck.length > 320) {
return false;
}
const stringSplitByAt: string[] = stringToCheck.split('@');
// @ is missing.
if (stringSplitByAt.length < 2) {
r... |
70ea472bc7406c74236519985337481ee7458ca6 | TypeScript | arunbaswar/HolaAngular4 | /src/app.component.ts | 2.5625 | 3 | import { Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { Observable } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { EmployeeService } from './services/employee.service';
import { Employee } from './classes/employee';
@Component({
selector: 'a... |
2e1961792a3faeca20b90d7ce4677dc1d0dfaf3a | TypeScript | UnnamedXAer/rn-like-music | /utils/storage/externalStorage.ts | 2.6875 | 3 | import RNFS from 'react-native-fs';
import Dir from '../../models/dir';
import { DirStat } from '../../models/dirStat';
import Playable from '../../models/playable';
import showToast from '../showToast';
import { isFilePlayable } from './isFilePlayable';
import { extractPrettyPathPrefixes } from './prettyPathPrefixes';... |
7a587abc6408348db68e76af150d24b352d64950 | TypeScript | thomaspoignant/scim2-parse-filter | /test/flatten.test.ts | 2.984375 | 3 | import { eq, and, or } from "./test_util";
import { Filter, parse, flatten } from "../src";
import { assert } from "chai";
function to_s(f: Filter): any {
switch (f.op) {
case "or":
case "and":
return `${f.op}(${f.filters.map(to_s).join(" ")})`;
case "eq":
return `${f.attrPath}=${f.compValue}... |
4b6846355ddaa5fe552b305c53d61cee547e47c2 | TypeScript | Parsa33033/Adjust | /backend/Adjust/src/main/webapp/app/entities/move/move.reducer.ts | 2.625 | 3 | import axios from 'axios';
import { ICrudGetAction, ICrudGetAllAction, ICrudPutAction, ICrudDeleteAction } from 'react-jhipster';
import { cleanEntity } from 'app/shared/util/entity-utils';
import { REQUEST, SUCCESS, FAILURE } from 'app/shared/reducers/action-type.util';
import { IMove, defaultValue } from 'app/share... |
92dc8456caa98b086d96af98a0761d234d1c6f86 | TypeScript | LBrenac/pptx-automizer | /src/helper/xml-pretty-print.ts | 2.953125 | 3 | // Thanks to https://github.com/aishwar/xml-pretty-print
// Alternative: https://github.com/riversun/xml-beautify
type PrettyPrintToken = {
match: string;
tag: string;
offset: number;
preContent: string;
};
export class XmlPrettyPrint {
xmlStr: string;
TAB: string;
constructor(xmlStr: string) {
thi... |
7a243aa89d4f154466e1343410dba0aafc262e21 | TypeScript | GeeksHacking/GeekHub-Frontend | /components/app/TokenContext.ts | 2.75 | 3 | import {createContext, useContext} from "react";
const TokenContext = createContext<{ token: Nullable<string> }>({
token: null
})
export const useToken = () => {
const context = useContext(TokenContext)
console.log(context.token)
return context.token || ""
}
export default TokenContext
|
da650a0cdbb7e2fb845dc81b5d240f1850592c92 | TypeScript | Irwing-Herrera/rxjs | /src/observables/09-from-avanzado.ts | 3.390625 | 3 | import { of, from, Observable } from "rxjs";
/**
* of = toma argumentos y genera una secuencia
* from = array, promise, iterable, observable
*/
/**
* Respuesta de observer
*
* @property {any}
*/
const observer = {
next: (val) => console.log("next:", val),
complete: () => console.log("complete"),
};
const mi... |
d056a15dda46ad5b503f60d601603d981ba17a6f | TypeScript | SeesePlusPlus/velma | /src/utils/astWalker.ts | 2.71875 | 3 |
// NOTE: This file was copied/ported to TypeScript from the ethereum/remix project at https://github.com/ethereum/remix
// History of modifications made from Remix are not captured in this repository. See https://github.com/seeseplusplus/remix/tree/introduce-sdb for history
// Remix (and therefore this file) is under ... |
5cef8222184853df0bf8092c00d20ce6d51da9e0 | TypeScript | spacejack/vdom-timeline | /src/timeline/delays/playtimeline.ts | 2.8125 | 3 | import Emitter from '../emitter'
import PromiseToken from '../promise-token'
import {TimelinePromise, DelayFactory} from '../timeline-factory'
/**
* Creates a cancelable, pausable/resumable delay.
* Accepts a Timeline.
*/
const PlayTimeline: DelayFactory<TimelinePromise<any>> = function(
canceled: Promise<void>, p... |
d6a3e0854f2be031c8f76c43f1091bc952c5150a | TypeScript | BodyaNets/api-repo | /src/models/shoe.ts | 2.578125 | 3 | import { IDomainEntity, thanksTypescript } from "@codiac.io/codiac-common";
import { CriteriaBase, StringFilter } from "@codiac.io/codiac-common/contracts";
export class Shoe implements IDomainEntity {
constructor(public size: number, public brand: string, public model: string, id?: string) {
this.id = id;... |
30e1c7f571436302cceca674d34b94ebff0e7c36 | TypeScript | CosmosContracts/ts-relayer | /src/binary/ibc-setup/commands/keys-generate.spec.ts | 2.5625 | 3 | import fs from 'fs';
import test from 'ava';
import sinon from 'sinon';
import { Options, run } from './keys-generate';
const fsWriteFileSync = sinon.stub(fs, 'writeFileSync');
const consoleLog = sinon.stub(console, 'log');
test.beforeEach(() => {
sinon.reset();
fsWriteFileSync.returns();
});
test('generates ... |
be89da26d5cf7aa0dc430a0224e3b710c11fde14 | TypeScript | eps1lon/mesh-ooc-projection | /src/off/nodesToText.ts | 3.1875 | 3 | import {
Face,
Format,
Meta,
Node,
Vertex,
ColoredVertex,
isColoredVertex
} from './nodes';
export default function toText(node: Node): string {
switch (node.type) {
case 'vertex':
return vertex(node);
case 'face':
return face(node);
case 'format':
return format(node);
... |
9ec3d4cafafdf7aa4232b83bbae445f6d5fd66b6 | TypeScript | NirvanaChow/team | /src/devkit/command/command_handler.ts | 2.859375 | 3 | import {InjectionToken } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { concatMap, map } from 'rxjs/operators';
import { FrameContext } from '../frame/index';
import { VariableParseService } from '../variable/index';
import { Command } from './command';
import { Command... |
8ea167cba14f7e615a87e143208e78d7db54941e | TypeScript | seebees/aws-sdk-js-v3 | /packages/json-parser/src/index.ts | 2.75 | 3 | import {BodyParser, Decoder, Member, SerializationModel} from "@aws-sdk/types";
import {toDate} from "@aws-sdk/protocol-timestamp";
type Scalar = string|number|boolean|null;
interface Json {
[index: string]: Scalar|Json|JsonArray;
}
interface JsonArray extends Array<Scalar|Json|JsonArray> {}
type JsonValue = Js... |
2c222ecd4cfecc658cba19512616748d9058f844 | TypeScript | futantan/RegExp-Builder | /src/__tests__/index.spec.ts | 2.765625 | 3 | import { RegexBuilder } from '../index';
describe('RegexBuilder', () => {
it('should matchBegin', () => {
expect(new RegexBuilder().matchBegin().toString()).toBe('/^/');
});
it('should matchEnd', () => {
expect(new RegexBuilder().matchEnd().toString()).toBe('/$/');
});
it('zeroOrMoreOf', () => {
... |
b89051cf085e53221a00470691d4c8360db0ed66 | TypeScript | roberto14118927/front | /src/app/services/api/api.service.ts | 2.53125 | 3 | import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { API } from '../../../config/config'
const httpOptions = {
headers: new HttpHeaders({
// 'Content-Type': 'application/json' ,
'Authorization': 'Token c5bbe96... |
364dab02a838302105aade47832026b9f7cb805d | TypeScript | SapphireDb/sapphiredb-js | /projects/sapphiredb/src/lib/collection/prefilter/count-prefilter.ts | 2.828125 | 3 | import {IPrefilter} from './iprefilter';
export class CountPrefilter<T> implements IPrefilter<T, number> {
prefilterType = 'CountPrefilter';
execute(values: T[]) {
return values.length;
}
public hash() {
return `${this.prefilterType}`;
}
}
|
76815096e99bf2cf3fca8b31189b3bded69d5d83 | TypeScript | arpitnath/name-generator | /src/services/names.services.ts | 3.25 | 3 | export const generateRandomNames = (arr: string[]): string[] => {
if (arr.length === 0) {
return ['Error']
}
const randomNames: string[] = []
const names = new Map()
const maxLimit = 5
while (names.size < 5) {
let index = Math.ceil(Math.random() * arr.length)
if (index >= arr.length) {
i... |
b6ad13d9041071a0f4e66bac987a0e34cfaa544c | TypeScript | yerim926/COMP229-Assignment2 | /Server/Controllers/business.ts | 2.765625 | 3 | import express, { Request, Response, NextFunction } from 'express';
import Business from "../Models/business";
export function DisplayBusinessListPage(req: Request, res: Response, next: NextFunction): void
{
//mongo db - find method to return all the business collection
Business.find(function(err,businessColl... |
da1ff9255d6de863b1d3dcc291d08577102cccc7 | TypeScript | plusxp/recoil-table | /packages/recoil-table/src/atoms/sort.ts | 2.703125 | 3 | import { atomFamily, selectorFamily } from 'recoil';
import { columnSortAtom } from './columns';
import { guardRecoilDefaultValue } from './helpers';
export interface Sort {
columnId: string;
isDesc: boolean;
}
/**
* Stores the id of the actively sorted column.
**/
const sortColumnIdAtom = atomFamily<string, s... |
f8013f1d69b96e266b972074aea0004c69b182be | TypeScript | Binyame/lotic.ai | /__test__/models/hcProviderInvite.test.ts | 2.5625 | 3 | import { factory } from '../utils';
describe('Model - HCProviderInvite', () => {
let clinician, clinicians;
beforeAll(async () => {
clinician = await factory.create('Clinician');
clinicians = JSON.stringify([clinician.toJSON()]);
});
test('should create a HCProviderInvite', async() => {
const rec... |
bee7e330f5cd8880316bb36b4087d8d53d08049e | TypeScript | ULL-ESIT-INF-DSI-2021/ull-esit-inf-dsi-20-21-prct06-generics-solid-alu0101166247 | /tests/ejercicio-2-spec/ejercicio-2.spec.ts | 2.671875 | 3 | /* eslint-disable max-len */
import 'mocha';
import {expect} from 'chai';
import {forceUnits, Fuerza} from '../../src/ejercicio-2/fuerza';
import {lengthUnits, Longitud} from '../../src/ejercicio-2/longitud';
import {Masa, massUnits} from '../../src/ejercicio-2/masa';
import {Temperatura, temperatureUnits} from '../../... |
1e349f82b740031daa623c1d2619147872fcaecb | TypeScript | ted-piotrowski/puppeteer-camera | /src/chrome_extension/S3StreamerInput.ts | 2.53125 | 3 | import * as AWS from 'aws-sdk';
export interface S3StreamerInput {
recorder: MediaRecorder;
bucket: string;
key?: string;
}
export class S3Streamer {
private recorder: MediaRecorder;
private bucket: string;
private key: string;
private s3: AWS.S3;
private uploadId: string;
private ... |
b89f5c76becf392c5a5361cac12fe25a1b2cfaaf | TypeScript | cafreeman/generator-mobx-react | /generators/app/templates/src_ts/Store.ts | 2.640625 | 3 | import { observable, computed, action } from 'mobx';
class Store {
name: string = '<%= name %>';
description: string = '<%= description %>';
@observable numClicks: number = 0;
@computed get oddOrEven(): string {
return this.numClicks % 2 === 0 ? 'even' : 'odd';
}
@action clickButton(): void {
thi... |
afd1f731e1166189bbfe36fbe418e003ca181c04 | TypeScript | itanex/nasa-picture-of-the-day | /src/app/shared/functions/date-to-stuct.fn.ts | 2.6875 | 3 | import { NgbDateStruct } from '@ng-bootstrap/ng-bootstrap';
/**
* Converts a Native Date object to the ngbDateStuct object
* @param date Date to convert; If not provided, generates a current date
*/
export function dateToStuct(date?: Date): NgbDateStruct {
let d = date || new Date();
return {
year:... |
10a7e69fc113aea0e1f3e9dc135f844efcb02f3b | TypeScript | PaulyWolly/redux-form-demo | /src/app/actions/index.ts | 2.609375 | 3 | import { Action } from "@ngrx/store";
import { ICountry, ICity } from "../state/application-state";
export const FORM_NAME_CHANGED = 'FORM_NAME_CHANGED';
export const FORM_SET_VALIDITY = 'FORM_SET_VALIDITY';
export const LOAD_COUNTRIES = 'LOAD_COUNTRIES';
export const COUNTRIES_LOADED = 'COUNTRIES_LOADED';
export cons... |
4806db7330e0137c192d002371b3f18a185be99a | TypeScript | amm297/big-data-v | /src/app/pages/appartment/services/apartment_adapter.ts | 2.703125 | 3 | import { Appartment } from '../domain/appartment'
import { AppartmentDetails } from '../domain/appartment_details'
import { Location } from '../domain/location'
import { Price } from '../domain/price'
import { Review } from '../domain/review'
import { PropertyType } from '../domain/property_type'
import { BedType } fr... |
291e43f53b7c3a0fbd612c325cfd31b7d25346b6 | TypeScript | DefinitelyTyped/DefinitelyTyped | /types/db-hafas-stations-autocomplete/index.d.ts | 2.8125 | 3 | // Type definitions for db-hafas-stations-autocomplete 2.0
// Project: https://github.com/derhuerst/db-hafas-stations-autocomplete
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = autocomplete;
/**
* Search & autocompletio... |
fd389907aa7e5c17fe4d54e8f10f309c3f24a177 | TypeScript | headintheclouddev/typings-suitescript-2.0 | /N/file.d.ts | 3.140625 | 3 | export interface File {
description: string;
encoding: string;
fileType: Type;
folder: number;
readonly id: number;
isInactive: boolean;
isOnline: boolean;
readonly isText: boolean;
name: string;
readonly path: string;
readonly size: number;
readonly url: string;
save... |
1c147be6601157c74e72bf7cc88bff8d2f54dc75 | TypeScript | shanelonergan/typescript-practice | /index.ts | 2.796875 | 3 | // Import stylesheets
import './style.css';
function greeter(person) {
return person + " is a huuuuuuuuge idiot lmao";
}
let user = "Sukrit";
const appDiv: HTMLElement = document.getElementById('app');
appDiv.innerHTML = `<h1>${greeter(user)}</h1>`; |
411ea7c1714ba4b43b9996cb0135df793629fb2e | TypeScript | alirahal22/employee-dashboard | /src/utils/encrypt.ts | 2.515625 | 3 | /** Performs RSA public key encryption to string payload */
export const rsaEncrypt = (key: string, clearText: string): string => {
const CryptoJs = require("hybrid-crypto-js");
const crypt = new CryptoJs.Crypt();
return crypt.encrypt(key, clearText);
};
|
ae6d37d08ab907875f05e96d5632234c21098a4c | TypeScript | mk-hill/nd9990-c3-microservices-v1 | /project/filter/src/validation/error.ts | 3.0625 | 3 | import { Response } from 'express';
export enum ErrorMessages {
READ = 'Unable to read image URL, please ensure resource exists.',
FILTER = 'Unable to filter image.',
SAVE = 'Unable save image.',
MISSING_IMAGE_URL = 'Image URL required.',
}
export const handleErrorResponse = (res: Response, message: string) =... |
3b129e91e9be16443778d9bad1054e216ccb2cfe | TypeScript | tuplo/envsubst | /src/index.ts | 2.546875 | 3 | /* eslint no-template-curly-in-string:off */
import { includeVariable } from "./include-variable";
const varNames = "[a-zA-Z_]+[a-zA-Z0-9_]*";
const placeholders = ["\\$_", "\\${_}", "{{_}}"];
const envVars = placeholders
.map((placeholder) => placeholder.replace("_", `(${varNames})`))
.join("|");
const rgEnvVars = ... |
d6245d65a50854f716efd01a331e3c67ae5ba24b | TypeScript | neotek/nuget-tree | /src/main.ts | 2.859375 | 3 | import { NuGetTree } from "./nuGetTree";
import { ISettings } from "./settings";
import { IPackage } from "./interfaces/package";
export function init(settings: ISettings): Promise<IPackage[]>
{
return new NuGetTree(settings).run();
}
export async function initMany(solutions: string[]): Promise<IPackage[]>
{
... |
63965935e0781cd1f7bfc375a2d9c27d769d80be | TypeScript | Duclearc/MEAN-forum | /MEAN-forum-client/src/app/auth/auth.service.ts | 2.515625 | 3 | import { Injectable } from "@angular/core";
import { User, UserLoginData, UserProfileData } from './user.model';
import { HttpClient } from "@angular/common/http";
import { Router } from "@angular/router";
import { BehaviorSubject } from "rxjs";
@Injectable({ providedIn: 'root' })
export class AuthService {
priva... |
72cef156ac2c066ebe4765d4d02396a3fe929581 | TypeScript | maliquan/game | /game1/src/view/cfg/ObjCfg.ts | 2.625 | 3 | /**
* Created by maliquan on 16/4/22.
*/
class ObjCfg{
// public static objCfg:number[][] = [
// //[maxHp, minAtt, maxAtt, def, speed]
// [100, 10, 20, 1, 1]
// ];
public static getObjCfg(name:string):ObjectVo{
var level:number = (Math.random()*10 +1 + 10 * FightScene.curMapLevel)>>... |
a02db923bbadb737d6881e051271f80818266726 | TypeScript | runem/lit-analyzer | /packages/lit-analyzer/src/test/parser/dependencies/parse-dependencies.ts | 2.609375 | 3 | import { parseAllIndirectImports } from "../../../lib/analyze/parse/parse-dependencies/parse-dependencies.js";
import { isFacadeModule } from "../../../lib/analyze/parse/parse-dependencies/visit-dependencies.js";
import { prepareAnalyzer } from "../../helpers/analyze.js";
import { tsTest } from "../../helpers/ts-test.j... |
a260fcaed6f8b7bc65d31fbf790e25ad96a7074b | TypeScript | murphym215/angular-tour-of-heroes | /src/app/in-memory-data.service.ts | 2.921875 | 3 | /**
* Created by MatthewMurphy on 7/4/2017.
*/
import { InMemoryDbService } from 'angular-in-memory-web-api';
export class InMemoryDataService implements InMemoryDbService {
createDb() {
const beers = [
{id: 0, name: 'Belgian', description: 'A beer that varies in alcohol strength, regular, dubbel, tripe... |
c3df2e605348e8ba59840e397edcaaca1dcf964f | TypeScript | damiensawyer/dcapjs | /src/maths.ts | 3.578125 | 4 | /**
* Takes two numbers and returns their sum
* @param a first input to sum
* @param b second input to sum
* @returns sum of a and b
*/
export function sum(a: number, b: number) {
return a + b;
}
export function multiply(a: number, b: number) {
return a * b;
}
export function divide(a: number, b: number) {... |
d7ddcf619f3f635e704406dc6cd967552298f01b | TypeScript | pablomayobre/Dewyll | /src/Moves/Util.ts | 3.09375 | 3 | import { Board, getDirection } from '../Base/Pieces'
export interface Action<M> {
from: number
to: number
eats: number | null
continues: M
}
export type Overlay = Array<Action<MoveType> | null>
export type MoveOverlay<T, P> = (
board: Board<T, P>,
from: number,
) => Overlay | null
/*
0..3 = (Bishop, ... |
61511ffd17a8ec53855f9bd8efc60e56f688b41a | TypeScript | jeffersonshibuya/moveit | /src/models/User.ts | 2.625 | 3 | import Adapters from 'next-auth/adapters'
import { EntitySchemaColumnOptions } from 'typeorm'
export default class User extends (<any>Adapters.TypeORM.Models.User.model) {
constructor(name, email, image, emailVerified) {
super(name, email, image, emailVerified)
}
}
type UserSchema = {
name: string
target:... |
9987ef1a109cea4ab76ab34a2d97ed24ad8a1ff1 | TypeScript | cmdo/server | /src/Database/Mongo.ts | 2.875 | 3 | import { MongoClient } from "mongodb";
import { EventEmitter } from "../Utils";
export class Mongo extends EventEmitter {
public name: string;
public client: MongoClient;
/**
* Create a new mongodb node.
*
* @param name - Database name to run queries against.
* @param uri - Database connection end... |