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 |
|---|---|---|---|---|---|---|
76175c7cfe9a49c6b333a507ffacb268953a0af6 | TypeScript | Marcisbee/react-test-renderer-snapshot | /src/renderer.ts | 2.96875 | 3 | import { ReactTestRenderer, ReactTestRendererJSON } from 'react-test-renderer';
function depthToString(depth: number): string {
return Array(depth).fill(' ').join('');
}
function paramsToHtml(value: ReactTestRendererJSON, depth: number = 0): string {
if (!value.props) {
return '';
}
const depth1 = depth... |
ddb448eb66eef22a7a82eaa95e3be6f44b93f147 | TypeScript | fastify/under-pressure | /types/index.test-d.ts | 2.546875 | 3 | import fastifyUnderPressure, { fastifyUnderPressure as namedFastifyUnderPressure, TYPE_EVENT_LOOP_DELAY, TYPE_EVENT_LOOP_UTILIZATION, TYPE_HEALTH_CHECK, TYPE_HEAP_USED_BYTES, TYPE_RSS_BYTES } from "..";
import fastify from "fastify";
import { expectType } from "tsd";
const server = fastify();
() => {
server.registe... |
4efb23902dc2b1d94a77cc0f2bc318dbeb210bd8 | TypeScript | dhamotharang/armazemAngular | /src/app/classification/classification-requirement-item.ts | 2.640625 | 3 | import {ClassificationType} from './classification-type';
export class ClassificationRequirementItem {
static fromListData(
listData: Array<ClassificationRequirementItem>
): Array<ClassificationRequirementItem> {
return listData.map(data => {
return ClassificationRequirementItem.fromData(data);
}... |
6729a47dc2e552c7a230adb095058cb3f429c8e8 | TypeScript | davisbento/node-ts-boilerplate | /src/modules/user/user.repository.ts | 2.546875 | 3 | import { User, IUserModel } from '@/global/db/models/user';
import { addUserParams, IUserRepository } from './interfaces/user-repository';
export class UserRepository implements IUserRepository {
constructor(private readonly userModel: typeof User) {}
public async getAll(): Promise<IUserModel[]> {
return this... |
dd4ff6b1e2ae538a6bc7b03342c54d032b090dab | TypeScript | talapparasat/RateGov | /back/routes/verification/index.ts | 2.546875 | 3 | import verificationController from "@controllers/verification";
import router from "@routes/auth";
import isAuth from '@mw/validators/isAuth'
router.get('/send-sms', isAuth, async (req: any, res: any) => {
try {
const userId = req.user._id;
const phone = req.user.phone.mobile[0];
if(!pho... |
9b765861f1d276a6f5ffdf8060f32375a42feba8 | TypeScript | testerncoder/ea-coding-test-samples | /web/src/app/core/models/record-label.model.ts | 2.5625 | 3 | export interface Band {
name?: string;
festivals?: Array<string>;
}
export interface RecordLabel {
name: string;
bands?: Array<Band>;
}
|
801119a4806be1af0c5b1d9331b54e3604c70482 | TypeScript | fifiinart/Create-Datapack-TS | /src/Recipe.ts | 2.515625 | 3 | export interface RecipeObject {
type: string
group: string
}
export abstract class Recipe {
abstract toJSON(): object
} |
3be1c7f4258c7ce3aba0ef605a186bfafb89070e | TypeScript | DENNIS-CODES/VerifiedContracts | /src/models/profile.ts | 2.796875 | 3 | import mongoose from 'mongoose';
import { Profile } from '../types/profile';
const { Schema, Types } = mongoose;
// An interface that describes what attributes a profile model should have
interface ProfileModel extends mongoose.Model<ProfileDoc> {
build(attrs: Profile): ProfileDoc
}
// An interface that descibes ... |
5a220a1ea3f786e52a1036a5b33513825b9d14c5 | TypeScript | math-blocks/math-blocks | /packages/solver/src/solve/util.ts | 2.890625 | 3 | import * as Semantic from '@math-blocks/semantic';
const { NodeType } = Semantic;
// TODO: handle non-canonicalized terms
export const getCoeff = (
node: Semantic.types.NumericNode,
): Semantic.types.NumericNode => {
if (node.type === NodeType.Neg) {
return Semantic.builders.neg(getCoeff(node.arg));
}
if ... |
1ad1d652478416d3fd25c856ed653aa54b7e81e4 | TypeScript | T99/ampel-frontend | /js/ts/util/structures/implementations/tree/nodes/ts-binary-tree-node.ts | 3.109375 | 3 | /*
* Created by Trevor Sears <trevorsears.main@gmail.com>.
* 1:34 PM -- March 13th, 2019.
* Website: dashboard.ampelfeedback.com
*/
import TSTreeNode from "./ts-tree-node.js";
/**
* A node in a binary tree, potentially having a right and left child.
*
* @author Trevor Sears <trevorsears.main@gmail.com>
* @ver... |
355872d4b70e4040ff639da9fe612579addb90dc | TypeScript | Re44e/moovin | /src/schemas/usuarios.sch.ts | 2.71875 | 3 | import { Schema, model, Document } from 'mongoose'
interface UsarioInterFace extends Document{
nome?: string,
tipoConta?: string,
codigoConta?: number,
saldo?: number
}
const UsuarioSchema = new Schema({
nome: {type: String, required: true},
tipoConta: {type: String, required: true},
codig... |
ec277c539f96afda532ff642396c91d24e30a600 | TypeScript | fiw-burgerverein/fiw-buergerverein-frontend | /src/app/formService/response.model.ts | 2.53125 | 3 | export class Response {
body: Body;
headers: object;
status: number;
// message: string;
// result: Result;
constructor( body: Body, headers: object, status: number) {
this.body = body;
this.headers = headers;
this.status = status;
// this.message = message;
// this.result = result;
... |
70aecfae811fc3244d6d1d5f3da40ca7d5140f45 | TypeScript | awayjs/stage | /lib/utils/GradientAtlas.ts | 2.65625 | 3 | import { ITexture } from '../base/ITexture';
import { Image2D, _Stage_Image2D } from '../image/Image2D';
import { FilterUtils } from './FilterUtils';
interface IAtlasEntry {
hash: string;
index: number;
}
export class GradientAtlas extends Image2D {
public static assetType = '[image GradientAtlas]';
/* internal*... |
f19746d9bc4c37a7096a5c3322a5303644c5f52a | TypeScript | rawhat/creek | /src/benchmark.ts | 3.28125 | 3 | import * as stream from "./index";
function range(a: number, b: number) {
return Array.from(Array(b - a)).map((_, i) => i + a);
}
async function benchmark<T>(label: string, fn: () => Promise<T>, log = false) {
console.time(label);
const res: T = await fn();
if (log) {
console.log(`${label} result is`, res... |
67a54bead1e477a3b5522a6ea11dfe604265ed48 | TypeScript | lxs137/adb-broker | /broker/src/commands/host/disconnect.ts | 2.8125 | 3 | import { Command, ResponseCode } from "commands";
import { AdbServerConnection } from "adb-server/adbServerConn";
// Possible response:
// "No such device <deviceID>"
// ""
const RESPONSE_OK = /^$/;
export class DisconnectDeviceCommand extends Command {
private deviceID: string;
constructor(connection: AdbServerC... |
0a584363a0b5068d9ea59970334c1c58594e1d7a | TypeScript | jeanlauliac/mcb | /src/__tests__/Map-test.ts | 3.5625 | 4 | import Map from "../Map";
let map: Map<number, { value: number }>;
beforeEach(() => {
map = new Map(10, () => ({ value: 0 }), (num: number) => num);
});
it("return null for unknown keys", () => {
expect(map.get(3)).toBe(null);
});
it("stores a key-value pair", () => {
map.set(3).value = 1;
expect(map.get(3)... |
60af0acb043846ba2f4f5064e9423ffee1e50ddc | TypeScript | baidu/amis | /packages/office-viewer/src/parse/parseInsideBorders.ts | 2.890625 | 3 | import Word from '../Word';
import {parseBorder} from './parseBorder';
/**
* parseBorders 不支持 insideH 和 insideV,所以单独支持一下
* 实际显示时需要过滤掉第一列
*/
export function parseInsideBorders(word: Word, element: Element) {
let H;
const insideH = element.getElementsByTagName('w:insideH').item(0);
if (insideH) {
H = parseB... |
57d3984a634f971759615ed64de4dc7d8d8656cc | TypeScript | iagobruno/react-redux-typescript-sample | /src/store/ducks/todos.ts | 3.4375 | 3 | import { ActionShape } from '../types'
export type TodoSingleType = string
export type TodoStateShape = Array<TodoSingleType>
const INITIAL_STATE: TodoStateShape = [ 'number one angel' ]
/**
* Action Types
*/
export const Types = {
ADD_TODO: 'ADD_TODO',
REMOVE_TODO: 'REMOVE_TODO',
REMOVE_ALL_TODOS: 'REMOVE_A... |
a49389d2db0270ed96e6452843542a2496385eed | TypeScript | adawarp/adawarp.js | /src/adapter/Phoenix.ts | 2.921875 | 3 | /* vim: set ft=typescript expandtab sw=2 sts=2 ff=unix fenc=utf-8 : */
// Phoenix Channels JavaScript client
//
// ## Socket Connection
//
// A single connection is established to the server and
// channels are multiplexed over the connection.
// Connect to the server using the `Socket` class:
//
// let socket = n... |
5f5e70827add15c09a3c7626c8b3905febd11c68 | TypeScript | christianscott/ts_get_imported_files | /src/preconditions.ts | 3.359375 | 3 | export class Preconditions {
public static checkExists<T>(value: T | undefined | null): T {
if (value != null) {
return value;
}
throw new Error(`expected value to be non-null`);
}
}
|
f1fcf2e2944b459b3370636fac15ac36664de484 | TypeScript | Nash0x7E2/express-playground | /src/app.ts | 2.53125 | 3 | import express, { Application } from 'express';
import { applicationRouter } from "./route/application_router";
import { itemsRouter } from "./route/items_router";
let app: Application = express();
// Set up middleware json parsing
app.use(express.json());
app.use(function(_, res, next) {
res.header("Access-Cont... |
13889a8496f1d9c9f15a77759bd4a826369503dc | TypeScript | sschmeier/rna2drawer2 | /src/forms/fields/font/isBold.ts | 3.078125 | 3 | export function isBold(fontWeight: string | number): boolean {
if (typeof fontWeight == 'number') {
return fontWeight >= 700;
} else {
return fontWeight == 'bold';
}
}
|
b3ce75076a609e99a838495b467efe80a5ad3caa | TypeScript | gillchristian/fp-ts-workshop-playground | /src/03.box.ts | 3.8125 | 4 | // This is available as Markdown at
// https://gist.github.com/gillchristian/272eacdee75049831f09498c9bec4e2a
interface Box<Data> {
data: Data
}
// of :: a -> Box a
const of = <Data = unknown>(data: Data): Box<Data> => ({data})
// extract :: Box a -> a
const extract = <Data = unknown>(box: Box<Data>): Data => box.d... |
38294d426f768ebb141ffc1a49f5929c4264c194 | TypeScript | louis-sanna/hashCode2021 | /src/2021/scorer/score2.ts | 2.984375 | 3 | import _ from 'underscore';
import { Car, Input, Submission } from '../entities';
export function score2(submission: Submission, input: Input): number {
let score = 0;
let intersectionStates : Record<number, Record<string, Array<Car & {timeLeft:number}>>> = {};
input.cars.forEach(car => {
const st... |
38f1d743034d27f5f44a4f027225a1507a7cdf66 | TypeScript | poteat/type-it | /src/utility/types/generators/AsyncGeneratorFunction.ts | 3.109375 | 3 | /**
* The constructor of all asynchronous generators, convenient for checking and
* specifying the type associated with such.
*
* Used by downstream applications who need to check whether a function is an
* asynchronous generator.
*/
export const AsyncGeneratorFunction = async function* () {}.constructor;
|
855f99be32fb3bfb98025c45ae0d0034ca5fd047 | TypeScript | CastroM13/store-app | /src/main/webapp/app/entities/order-products/order-products.model.ts | 2.625 | 3 | import { IOrders } from 'app/entities/orders/orders.model';
import { IProducts } from 'app/entities/products/products.model';
export interface IOrderProducts {
id?: number;
idOrderProducts?: number | null;
idOrder?: number | null;
idProduct?: number | null;
orders?: IOrders[] | null;
products?: IProducts[]... |
faed1ebcebbd6e10246a9867fc6c9777c9945ba0 | TypeScript | jtanp/react-challenge | /src/actions.ts | 2.625 | 3 | import { Form } from "./types";
export const ADD_FORM = "ADD_FORM";
export const DELETE_FORM = "DELETE_FORM";
export const TOGGLE_SHOW_DETAILS = "TOGGLE_SHOW_DETAILS";
export type Actions =
| { type: typeof ADD_FORM; payload: Form }
| { type: typeof DELETE_FORM; payload: number }
| { type: typeof TOGGLE_SHOW_DE... |
9903e9c05d4858aebe01b956dda6267b017ff0ac | TypeScript | 944832260/react-tyepscript-antd | /src/store/reducers/user.ts | 2.625 | 3 | import {Action} from "../index"
const InitState: object = {};
export default function user(state=InitState, action: Action) {
let obj = JSON.parse(JSON.stringify(action));
delete obj.type;
switch (action.type) {
// 用户登录
case 'LOGIN_IN':
return obj;
// 用户退出
case 'SIGN_OUT':
return... |
ee15af757af40e68c2857207fa59e6d19544f0c4 | TypeScript | Aurailus/k9 | /src/Plugin/VoiceChat/VoiceChatPlugin.ts | 2.5625 | 3 | import * as Discord from 'discord.js';
import { BotConfig } from '../../Bot';
interface VoiceChatPluginConfig {
description: {
prefix?: string,
suffix?: string
}
channel: {
prefix?: string,
suffix?: string
}
}
export default class VoiceChatPlugin {
private channels: { [guild: string]: { [voice_id: strin... |
8d9b49bef723bd6d87d125a41d4f77ca227f0624 | TypeScript | andrelaf/klick-pages | /src/modules/clients/services/ListClientsServices.ts | 2.515625 | 3 |
import { injectable, inject } from 'tsyringe';
import IClientsRepository from '../repositories/IClientsRepository';
import IPaginationDto from '@shared/dto/IPaginationDto';
import IPaginationResultDto from '@shared/dto/IPaginationResultDto';
import Pagination from '@shared/infra/http/Pagination';
interface Request{
... |
8e8264906d0934f7718fef76c1ea37374184d68a | TypeScript | Elecweb/poc-electron-app | /src/services/auth/token.ts | 2.515625 | 3 | import jwt from 'jsonwebtoken';
const tokenKey = 'token';
export const getToken = () => localStorage.getItem(tokenKey);
export const setToken = (value: string) =>
localStorage.setItem(tokenKey, value);
export const removeToken = () => localStorage.removeItem(tokenKey);
export const getDataFronToken = () => {
t... |
90deefc5f6c7d8dc887d1724bca63de93fee9a97 | TypeScript | KiaraGrouwstra/typical | /src/util/Unknown.ts | 3.078125 | 3 | /**
* The type of all values; nothing is known about it a priori
* except that it exists. The same idea as Flow's `mixed` type.
* Borrowed from @pelotom's `type-zoo`
*
* @see https://github.com/pelotom/type-zoo/#unknown
* @see https://github.com/Microsoft/TypeScript/issues/10715
*/
export type Unknown = {} | und... |
d4ba28dfcc55e3f333ad132e94d1bf91049db894 | TypeScript | yuttasakcom/Cuckoo.Plus | /src/store/mutations/index.ts | 2.515625 | 3 | import { cuckoostore } from '@/interface'
const OAuthInfoMutations = {
updateClientInfo (state: cuckoostore.stateInfo, { clientId, clientSecret }) {
state.OAuthInfo.clientId = clientId
state.OAuthInfo.clientSecret = clientSecret
localStorage.setItem('clientId', clientId)
localStorage.setItem('clien... |
cc18df29e296191548868970bb372c332a542903 | TypeScript | hugomatheuss/omega | /src/proposta/dtos/create-proposta.dto.ts | 2.546875 | 3 | import { Carga } from '../entity/carga.entity';
import { IsNotEmpty, IsString, IsDateString, IsArray, IsIn } from "class-validator";
import { ApiProperty } from '@nestjs/swagger';
import { Usuario } from 'src/usuario/entity/usuario.entity';
export class CreatePropostaDto {
@IsNotEmpty({ message: "Data inicial é ob... |
dba94cfbc1b66974451548d696c3e7124d59797e | TypeScript | dkoerner/arcgis-js-api-3d-web-editing-demo | /src/ItemList.ts | 2.984375 | 3 | import {MapConstructor, SimpleEventDispatcher} from "./utils";
declare var Map: MapConstructor;
export interface Item{
label: string;
}
export interface ItemProvider<T extends Item>{
itemAdded: SimpleEventDispatcher<T>;
itemRemoved: SimpleEventDispatcher<T>;
itemUpdated: SimpleEventDispatc... |
4b351fa00f7cab8e5eddd45697225dff8534443f | TypeScript | pavelvlasov/customer_records | /src/common/test-utils.ts | 2.859375 | 3 | import { pipeline as _pipeline } from "stream";
import { Readable, ReadableOptions } from "stream";
class MockStream<TChunk> extends Readable {
private index: number = 0;
private chunks: TChunk[] = [];
constructor(chunks: TChunk[], opts: ReadableOptions) {
super(opts);
this.chunks = chunks;
}
_re... |
1d744b45988321c19aead478e9231f836e305257 | TypeScript | TinkeringAround/victoria | /src/game/Items.ts | 2.75 | 3 | import {TItem} from "../types/TItem";
import potion from "../assets/images/items/potion.png";
import pertersilie from "../assets/images/items/petersilie.png";
import zweig from "../assets/images/items/zweig.png";
import morgenstunde from "../assets/images/items/morgenstund.png";
import knochen from "../assets/images/i... |
ef38f493e54e730e0967467080927dd5196876a8 | TypeScript | islamailani/restrong-angular5 | /old-angular-app/src/app/shared/components/checkbox/checkbox.component.ts | 2.546875 | 3 | import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Util } from '../../util'
@Component({
selector: 'm-checkbox',
template: `<div (click)="toggleValue()" [ngClass]="{ 'checkbox': !inline, 'checkbox-inline': inline, 'toggle-btn': toggle, 'label-left': textAlign == 'left' }">
... |
3c4d86e0e2cf6715b2357d58edeaf00f078aae6e | TypeScript | jrwJunior/tracker | /src/utilities/helpers/sessionAuth.ts | 2.578125 | 3 | /* eslint-disable class-methods-use-this */
class SessionAuth {
hasAccess() {
return !!sessionStorage.getItem('[[access]]');
}
setAccessToken(token: string): void {
sessionStorage.setItem('[[access]]', token);
}
getAccessToken() {
return sessionStorage.getItem('[[access]]');
}
removeSession... |
52d72ae891a13b71ec8f7996508695bc79961467 | TypeScript | LLLLLamHo/zzc-design-mobile | /components/DatePicker/util/pickerData.ts | 2.71875 | 3 |
import { ListItem } from '../propsType';
import { resetDate } from '../../_util/resetDate';
export function setYearListData( minYear, maxYear, currYear, langData ): ListItem {
const totalYearCount = maxYear - minYear;
const yearListData: ListItem = {
className: 'year-list',
itemClassName: 'yea... |
78b9a690019c44482d816ab5744337913f079903 | TypeScript | nata502ly/js-api-project | /tests/pet.test.ts | 2.890625 | 3 | import {strict as assert} from 'assert'
import {PetController} from "../api/controller/pet.controller";
import {definitions} from "../.temp/types";
const pet = new PetController();
describe('User can', function () {
it('Receive pet by it id', async function () {
let body = await pet.getById(1);
a... |
5c7d71faed049428a52348adb30dd9e488002201 | TypeScript | theogravity/vault-tacular | /src/auth-methods/__tests__/TlsCertificateAuth.int-test.ts | 2.515625 | 3 | import { readFileSync } from 'fs'
import { join } from 'path'
import { TlsCertificateAuth } from '../TlsCertificateAuth'
const TEST_CERTS_DIR = join(__dirname, '..', '..', '..', 'test-certs')
// note - using the root CA for login because it worked for me at the time
// using the localhost cert/key would give
// "x509... |
96da188c131042fd19f417495707ce6a55de1538 | TypeScript | 1-corp/fixed-sized-numbers-ts | /tests/Autotest-Uint-SafeMath.test.ts | 2.9375 | 3 | import {DivisionByZeroError} from "../lib/errors";
import {assertErrorMsg, validateUint} from "./helpers";
import {getUints} from "./Autotest-config";
getUints().forEach((tc) => {
describe(`SafeMath tests for ${tc.name}`, () => {
it(`should return a ${tc.name} for all basic methods: Add`, () => {
... |
5bf508563fe4a6e12cd929002b9b8fe69197f5ed | TypeScript | Gandum2077/booru | /src/boorus/Derpibooru.ts | 2.640625 | 3 | /**
* @packageDocumentation
* @module Boorus
*/
import { BooruError, searchURI } from '../Constants'
import SearchParameters from '../structures/SearchParameters'
import SearchResults from '../structures/SearchResults'
import Site from '../structures/Site'
import Booru from './Booru'
/**
* A class designed for De... |
fc761e970b88dde7d2e7b2ae2d03c48c8910f72b | TypeScript | OleksandrKyrylyuk/EventList | /src/util.ts | 2.71875 | 3 | import faker from 'faker';
import { Client } from './Client';
import { Event } from './Event';
export const generateUser = (): Client => {
const name = faker.name.firstName();
const tel = faker.phone.phoneNumberFormat();
return new Client(name, tel);
}
export const generateEvent = () : Event => {
const name =... |
2420c19bad27d16f8d67f1e00ce1e8a3e700e21b | TypeScript | BlueFisher/DarkHouse | /lib/server/weapon.ts | 2.84375 | 3 | import * as config from '../shared/game_config';
import * as serverConfig from '../../config';
export class weapon {
readonly attackType: config.weapon.attackType;
readonly weaponType: config.weapon.weaponType;
readonly attackSightRadius: number;
readonly attackSightTimeOut: number;
readonly bulletFlyStep: number... |
16aa5d05b35ece3c54cb3c1a4fb10150b646c03c | TypeScript | andrzejkrawczyk/lectures | /biu/example-projects/wyklad_angular_intro/src/app/services/todo-mock-data.service.ts | 2.609375 | 3 | import {Injectable} from '@angular/core';
import {TodoItem} from '../models/TodoItem';
@Injectable({
providedIn: 'root'
})
export class TodoMockDataService {
private _todoItems: TodoItem[] = [
new TodoItem('First item', 'Ala ma kota'),
new TodoItem('Second item', 'Ala ma psa'),
new Tod... |
11ff60bf85fae7c56b923804eab967295a224d7a | TypeScript | DaveJump/create-todo-demo | /todo-vue3-setup-rfc-vite/src/utils/index.ts | 2.90625 | 3 | Array.prototype.shuffle = function () {
let input = this
for (let i = input.length - 1; i >= 0; i--) {
let randomIndex = Math.floor(Math.random() * (i + 1))
let itemAtIndex = input[randomIndex]
input[randomIndex] = input[i]
input[i] = itemAtIndex
}
return input
}
export function genUUID() {
r... |
76d5a7095d283e230bf50baa93c9275a1c7d06bc | TypeScript | technohippy/makewasm | /sample/ap01/src/core/instance.ts | 3.015625 | 3 | import {
ModuleNode, FuncTypeNode, CodeNode, InstrNode, BlockInstrNode,
LoopInstrNode, IfInstrNode, BrInstrNode, BrIfInstrNode,
CallInstrNode, I32ConstInstrNode, I32EqzInstrNode,
I32LtSInstrNode, I32GeSInstrNode, I32AddInstrNode,
I32RemSInstrNode, LocalGetInstrNode, LocalSetInstrNode,
} from "./node.ts"
im... |
de29693b8af0c249c270845d0c3a9fdeeef2d5a4 | TypeScript | ahm3tcelik/nextjs-realworld-example-app | /src/models/either.ts | 3.921875 | 4 | type IFoldCallback<T> = {
(data: T): void;
}
type IProps<L, R> = {
left?: L,
right?: R
}
// LEFT: ERROR
// RIGHT: DATA
export abstract class Either<L, R> {
left?: L | undefined;
right?: R | undefined;
constructor(props: IProps<L, R>) {
this.left = props.left;
this.right = prop... |
6ed2432a076da15f60d6c65d1234f1d8719bf1b6 | TypeScript | Leooff96/dotSimbler | /src/providers/memoria/memoria.ts | 2.609375 | 3 | import { Injectable } from "@angular/core";
@Injectable()
export class MemoriaProvider{
public memory:Map<number , any>;
private offset:number = 1;
constructor(){
}
clean(){
this.memory = new Map<number,any>();
this.offset = 1;
}
getKeys(){
return Array.from... |
877eee43c12e6351b4cad034065f6ca78e2d8d0c | TypeScript | AnyhowStep/type-mapping | /test/compile-time/input/decorator/method/rest.ts | 2.65625 | 3 | import * as tm from "../../../../../dist";
export class Clazz {
@tm.method(tm.finiteNumber(), ...[tm.string()])
exactTypeAllowed (_0 : number, ..._rest : string[]) {
}
}
export class ClazzSuperType {
@tm.method(tm.finiteNumber(), ...[tm.orUndefined(tm.string())])
superTypeNotAllowed (_0 : number, ... |
391f24db84cb1579f0a9fdfdcbac18c1d1b441b7 | TypeScript | chrisk8er/animation-editor | /src/flow/flowExpressions.ts | 2.5625 | 3 | import * as mathjs from "mathjs";
import { EvalFunction } from "mathjs";
import { FlowNodeState } from "~/flow/flowNodeState";
import { FlowNodeType } from "~/flow/flowTypes";
import { CompositionError, CompositionErrorType } from "~/types";
export function getFlowGraphExpressions(
actionState: ActionState,
graphId:... |
7f43bb8c195ba8b61a941fbabaa32098e4ded1a2 | TypeScript | ralphcallaway/bad-ass-salesforce-stack | /src/actions/todo.ts | 2.78125 | 3 | import { Todo, TodoFields } from "@src/generated/sobs";
import { Dispatch } from "redux";
import { PromiseThunk, TypeKeys } from "./";
// action reducer types
export interface AddTodoAction {
type: TypeKeys.ADD_TODO;
todo: TodoFields;
}
export interface RemoveTodoAction {
type: TypeKeys.REMOVE_TODO;
todo: Tod... |
d38e111bea24bd6a05af3b5dfeee4779bebf2975 | TypeScript | pro123908/nestjs | /src/products-remote/products-remote.service.ts | 2.59375 | 3 | import { Injectable, NotFoundException } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import { User } from 'src/users/users.model';
import { Product } from './products-remote.model';
@Injectable()
export class ProductsRemoteService {
constructor(
@Inje... |
5a14a7e2fa3e0c48d89ee7796cfda8cea7f97553 | TypeScript | Unleash/unleash | /src/lib/util/collect-ids.ts | 2.765625 | 3 | export const collectIds = <T>(items: { id?: T }[]): T[] => {
return items.map((item) => item.id);
};
|
7c832a8c58a438cd9b7a9b03f6ba9b2fd10610cc | TypeScript | jfamousket/SparkLand | /src/app/buying/store/reducers/order/order.reducer.ts | 2.921875 | 3 | import { OrderActions, OrderActionTypes } from "../../actions/order.actions";
export interface OrderState {
order: { [id: number]: { any } };
placedOrder: boolean;
placingOrder: boolean;
}
export const initialState: OrderState = {
order: {},
placedOrder: false,
placingOrder: false
};
export function Orde... |
2663d8a8b94b502670121908023bfc72897e5a88 | TypeScript | malcolm-kee/testing-hub-service | /src/permutation/permutation.dto.ts | 2.703125 | 3 | import {
IsMongoId,
IsNotEmpty,
IsObject,
IsString,
IsIn,
IsArray,
ValidateNested,
IsBoolean,
IsOptional,
} from 'class-validator';
import {
Permutation,
PermutationTemplate,
PermutationTemplateField,
} from './permutation.type';
import { Type } from 'class-transformer';
export class Permutatio... |
89f4f5ff43e08b42f999a64531843d0d2486fabb | TypeScript | courage173/bold | /server/src/services/profileService.ts | 2.65625 | 3 | import StudentProfile, { IStudentProfile } from '../models/student-profile';
import SponsorProfile, { ISponsorProfile } from '../models/sponsor-profile';
import UserService from './userService';
import { BadRequestError, InternalError } from '../utils/ErrorHandler';
import { JwtPayload } from '../interface/jwt-payload'... |
5afdf3f78ce5a5fff8b3597e490c2ce335a8a38c | TypeScript | usermuser/chelhack | /client/src/Http/Http.ts | 2.671875 | 3 | import Axios, { AxiosInstance } from 'axios';
export interface IHttpRequestConfig {
headers?: Record<string, string>;
}
export class Http {
private instance: AxiosInstance;
public constructor(baseURL: string) {
this.instance = Axios.create({
baseURL,
});
this.instance.defaults.headers.post['... |
5e2d952cb785e6aa1e790be1624d9bafaadfdc49 | TypeScript | arnavj05/mlmash | /src/animateLetter.ts | 2.75 | 3 | const setupBackgroundSVG = (bgSVGElement: Element) => {
const bgPaths = bgSVGElement.querySelectorAll("path");
for (let i: number = 0; i < bgPaths.length; i++) {
bgPaths[i].style.stroke = "#002D38";
}
};
const setupLetterSVGPath = (path: SVGPathElement, animatationTime: number) => {
const length: number = ... |
5e8d65eafb463bc6a8fc9a578d888bbcab654d2c | TypeScript | rachOS/Tests_ReactTS | /src/core/entities/Calculator.ts | 2.703125 | 3 | import ICalculator from '../contract/ICalculator';
export function performCalculator(
calculator: ICalculator,
number1: number,
number2: number
) {
calculator.add(number1, number2);
calculator.substract(number1, number2);
calculator.multiply(number1, number2);
calculator.divide(number1, number2);
retur... |
6e81bcd053c266d7adc654290ca29b732faad060 | TypeScript | tmh9x/password-manager | /src/cli.ts | 2.5625 | 3 | // import { printPassword } from './utils/messages';
import {
deleteCredential,
readCredentials,
writeCredentials,
} from './utils/credentials';
import {
askForCredential,
askForMainPassword,
chooseAction,
chooseCommand,
chooseService,
} from './utils/questions';
import {
isMainPasswordValid,
isServ... |
d6a5858e2cfa528892b89a403cb9f36aaac82480 | TypeScript | WooodHead/entity-routes | /packages/core/tests/response/Decorator.test.ts | 2.640625 | 3 | import { Container } from "typedi";
import { getRepository } from "typeorm";
import { DecorateFn, DecorateFnArgs, Decorator } from "@entity-routes/core";
import { wait } from "@entity-routes/shared";
import { closeTestConnection, createTestConnection } from "@entity-routes/test-utils";
import { User, getWriterTestEnt... |
1480c04b5b063ed66eb85ee685a42d0a6b1cc987 | TypeScript | dhruvalpatel/dagster | /js_modules/dagit/src/gantt/toGraphQueryItems.ts | 2.6875 | 3 | import {weakmapMemoize} from 'src/app/Util';
import {IGanttNode} from 'src/gantt/Constants';
import {GanttChartExecutionPlanFragment} from 'src/gantt/types/GanttChartExecutionPlanFragment';
/**
* Converts a Run execution plan into a tree of `GraphQueryItem` items that
* can be used as the input to the "solid query" ... |
f0ac70cd56e9988d569c4b11ac5d1047b1b04f01 | TypeScript | tkrajina/potres-app-mobile | /src/utils/utils.ts | 3.046875 | 3 | export function bindAllPrefixedMethods(that: any, prefix: string = "callback") {
if (__DEV__) {
const key = "__bound__" + prefix;
if (that[key]) {
console.error("bindAllPrefixedMethods called twice!");
return;
}
that[key] = true;
}
for (const name of Object.getOwnPropertyNames(Reflect.... |
07625c8aa04ebbe7a3d388936b6bf5be2bbbd8f1 | TypeScript | is51/catan | /src/main/resources/static/new/app/shared/alert/alert.component.ts | 2.765625 | 3 | import { Component } from 'angular2/core';
const MAX_LINE_LENGTH = 23;
@Component({
selector: 'ct-alert',
templateUrl: 'app/shared/alert/alert.component.html',
styleUrls: ['app/shared/alert/alert.component.css']
})
export class AlertComponent {
lines: string[] = <string[]>[];
close: Function = ()... |
79f0abbcd281af987b66841c66e2daaf7183dfd0 | TypeScript | exercism/typescript | /exercises/practice/spiral-matrix/.meta/proof.ci.ts | 3.515625 | 4 | export function ofSize(size: number): number[][] {
const spiral = Array(size)
.fill(Array<number>())
.map(() => Array<number>(size).fill(0))
const totalNumbers = size ** 2
let currentNumber = 1
let topLeft = 0
let bottomRight = size - 1
while (currentNumber <= totalNumbers) {
for (let x = topL... |
a5d594cff664d3d35b66e1b1126ee2bfe27aeb2c | TypeScript | shah/content-model-typescript | /transform-csv_test.ts | 2.546875 | 3 | import { artfPersist as ap, stdAsserts as a, inflect } from "./deps.ts";
import * as trCSV from "./transform-csv.ts";
Deno.test("Import from multiple CSVs and generate separate TypeScript modules", async () => {
const ph = new ap.InMemoryPersistenceHandler();
const transformer = new trCSV.TransformCsvContentToType... |
dd56827d99b4068bc228a8c34a1bf0bedf5f0a92 | TypeScript | JuVo1102/e2eProject | /src/app/services/db-data/db-data.service.ts | 2.703125 | 3 | import { Injectable } from '@angular/core';
import { DbService } from '../db-service/db-service.service';
@Injectable({
providedIn: 'root'
})
// Service to manage data from the database between routing
export class DbDataService {
private titles: string[];
private title: string;
private text: string... |
cc61a980ef8a8cf49a1a0d1557a1dcf784ed7f95 | TypeScript | dogedodge/doge-core | /spec/_tools/integer.spec.ts | 3.296875 | 3 | import { integer } from "./integer";
describe('integer()', () => {
it('generate a random integer within [min, max]', () => {
for (let i = 0; i < 100; i++) {
let min = Math.floor(Math.random() * 100);
let max = Math.floor(min + Math.random() * 100);
for (let j = 0; j < 10... |
e3a3dcc8577e9a0b59cfabe5112c3d1465329ca4 | TypeScript | andriussperque/forum-project | /frontend/dev/forum-project/src/app/login/login.service.ts | 2.546875 | 3 | import { Injectable } from "@angular/core";
import { Http, Headers} from "@angular/http";
@Injectable()
export class LoginService {
private BASE_URL = "http:\\\\localhost:8090"
private LOGIN_URL = this.BASE_URL + "\\login";
private SIGNUP_URL = this.BASE_URL + "\\signup";
private LOGOUT_URL = this.BAS... |
cdbd589a2e219efa854844c1b6c99b2d56b4e7e5 | TypeScript | sandstreamdev/std | /is/normal.test.ts | 3.203125 | 3 | /* eslint-env jest */
// @ts-ignore ambiguous import
import normal from "./normal.ts";
// @ts-ignore ambiguous import
import range from "../array/range.ts";
describe("normal", () => {
it("checks is a number in a normal range [0, 1]", () => {
expect(normal(0.5)).not.toBe(false);
expect(normal(0)).not.toBe(fa... |
8feacb86cf8c70fc143429e9d09fa6ed9b5bca7c | TypeScript | daricvn/cef-autoquit-app | /VueInterface/app-ui/src/lib/StringLib.ts | 2.671875 | 3 | export default class StringLib{
static format(source: string, ...args: string[]) {
return source.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};
} |
d8f1600d84801d904cb2e772b7b98cf2346b2343 | TypeScript | jessebuitenhuis/FlightJS | /app/keyboard.ts | 2.78125 | 3 | import { constants } from './constants';
interface KeyboardInterface {
start();
}
export class Keyboard implements KeyboardInterface {
public keyPressed: Object;
constructor() {
this.keyPressed = {};
}
public start() {
window.addEventListener("keydown", this._keyDownHandler.bind(this));
window.addEventLi... |
95ce03d924ee822ad83b240800c344859df29144 | TypeScript | MarkoRaich/ISA2020 | /frontend/src/app/models/PatientInfo.ts | 2.578125 | 3 | export class PatientInfo {
id: number;
username: String;
password: String;
firstName: String;
lastName: String;
phoneNumber: String;
address: String;
city: String;
points: number;
penalties: number;
constructor(id: number, username: String, password: String, firstName: String, lastName: String, p... |
b780aa8ab769a46cc57d678f9e7f9598c4732ac7 | TypeScript | eastbanctechru/right-angled | /projects/right-angled/src/lib/core/sort-parameter.ts | 3.3125 | 3 | /**
* Represents sort direction that applied as parameter by {@link SortParameter} class.
*/
export enum SortDirection {
/**
* Ascending sort order.
*/
Asc = 0,
/**
* Descending sort order.
*/
Desc = 1
}
export type SortDirectionStr = 'Asc' | 'Desc';
/**
* Represents sorting par... |
4a53d0b6999beb3eeea34aba22e31381de3cbb25 | TypeScript | jamesporter/solandra | /src/lib/__tests__/drawingSomething.test.ts | 2.734375 | 3 | import SCanvas from "../sCanvas"
import { Rect } from "../paths/Rect"
describe("Draw something with Solandra", () => {
it("should be able to draw a rectangle", () => {
const history: string[] = []
const pocFakeCanvas = new Proxy(
{},
{
get: function (target, property, receiver) {
... |
22db5c0b3c7b8b8b7dc7e65451a13e93e488250d | TypeScript | pinkfish/teamsfuse | /firebase/functions/ts/db/leagueteam/update.f.ts | 2.546875 | 3 | import * as functions from 'firebase-functions';
import * as algolia from '../../util/algolia';
import * as admin from 'firebase-admin';
import { createGameFromShared } from '../../util/creategame';
const db = admin.firestore();
// Handle the creation case as well, so if we create a game
// with a specific result we ... |
6a20b2c810678d41adb403c205a4f51176b36327 | TypeScript | DeiNile/crypto-viz | /src/modules/caesar/stores/CeasarCipher.ts | 2.71875 | 3 | import { ACTION_TYPE } from '../../../stores/EncryptionAlgorithm';
import { observable, action, computed } from 'mobx';
import { modulo } from '../../../utils/modulo';
import { RootStore } from '../../../stores/RootStore';
interface CeasarCipherStep {
inputTextIndex: number;
inputTextCharacter: string;
inputTextAl... |
513c2e1c8aef197efd4541efbedbd128efcd6091 | TypeScript | PatrickKoss/Snake | /api/src/routes/status.routes.ts | 2.6875 | 3 | import { Request, Response, Router } from "express";
// basic router for initialising the express app
const router = Router();
router.get("/status", (req: Request, res: Response) => {
const msg = {
message: "API is up and running.",
status: "200 OK"
};
res.setHeader('Access-Control-Allow-O... |
1c5eb899216a266515c36cfd2214b4de8dbb27bb | TypeScript | acadet/yimello | /app/system/node-webkit/NodeWindow.ts | 2.875 | 3 | /// <reference path="../../dependencies.ts" />
declare var gui : any;
/**
* A handler for node window events
*/
interface NodeWindowEventHandler {
() : void;
}
/**
* Supported events by node window
*/
class NodeWindowEvents {
/**
* Triggered when window loses focus
*/
static Blur : string = "blur";
/**... |
9cdef9b3b1a581f476804c2e4af41171069dc96a | TypeScript | douglasgc/olx_bot | /services/Queue.ts | 2.921875 | 3 | import * as Collections from 'typescript-collections';
export class Queue {
queue:any;
constructor() {
this.queue = new Collections.Queue();
this.loopController();
}
async loop() {
let result = this.queue.dequeue();
if (typeof result==='object') {
// console.log('Running');
(await result.... |
7f0539e8931259419343f7ba5cb635fba20673f5 | TypeScript | dotjpg3141/Strings | /src/Strings.Typescript/app.ts | 2.828125 | 3 | import * as ts from "typescript";
import * as fs from "fs";
async function main(args: string[]) {
if (args.length !== 2) {
console.error("Expected exactly two arguments: <input-file> <output-file>");
process.exit(1);
}
const fileOptions = { encoding: "utf8" };
const [inputListPath, outputPath] = args;
con... |
072a59d9128bb97727cd0b6d2e99092bb954601b | TypeScript | jernonmagcalas/chat | /src/server/models/File.ts | 2.71875 | 3 | import { Model, Collection, field, virtual, FieldTypes } from 'chen/sql';
export class File extends Model {
protected table = 'files';
protected collectionClass = FileCollection;
@field({ guarded: true })
public id: FieldTypes.Number;
@field()
public fileName: FieldTypes.String;
@field()
public nam... |
c2dfa2b6b4532c26b215e0b6d541af086d8e0966 | TypeScript | isabella232/polkadot-watcher-auctions | /src/utils.ts | 2.671875 | 3 | import fs, { WriteStream } from 'fs';
import { Logger } from '@w3f/logger';
import { Extrinsic, Event, ParaId, Balance, LeasePeriod } from '@polkadot/types/interfaces';
import { BidAcceptedInfo, CrowdloanContributedInfo, ExtrinsicBidInfo } from './types';
export const isDirEmpty = (path: string): boolean =>{
return ... |
c22885c1893bafb26bfa4ede39b6f2aa8f2c00aa | TypeScript | Geliogabalus/gamejam | /src/client/neon-game/level-builder.ts | 2.953125 | 3 | import type { Game } from 'core/game';
import { Vector2 } from 'three';
import { Map } from './map';
import { TileType } from './tile';
import { level1, level2, level3, level4, level5, level6, level7, LevelData } from '../data/levels';
const getSquareMap = (map: number[][]) => {
const newMap: string[][] = [];
for... |
f679cda94a13084f9420229b0fdf8b7f3dcfc8ad | TypeScript | zqsfuture/design | /src/ts.ts | 3.765625 | 4 | class People {
name
age
protected weight
constructor(name, age) {
this.name = name
this.age = age
this.weight = 120
}
eat() {
console.log(`${this.name} eat something`)
}
speak() {
console.log(`My name is ${this.name}, age ${this.age}`)
}
}
clas... |
9266e95e2bc45038f40b4d9ccc932e7cdfb685c5 | TypeScript | karayakar/sharepoint.apps | /Calendar/Calendar/Scripts/App.ts | 2.53125 | 3 | ///<reference path="typings/jquery/jquery.d.ts" />
///<reference path="typings/sharepoint/SharePoint.d.ts" />
'use strict';
var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();
// Этот код, запускаемый после готовности модели DOM, создает объект контекста, который требуется ... |
c1fb138e1fdc95dd87dff1f576043163f549fc53 | TypeScript | leeeandroo/talk | /src/core/server/graph/extensions/LoggerExtension.ts | 2.609375 | 3 | import { DocumentNode, ExecutionArgs, GraphQLFormattedError } from "graphql";
import {
EndHandler,
GraphQLExtension,
GraphQLResponse,
} from "graphql-extensions";
import GraphContext from "coral-server/graph/context";
import { createTimer } from "coral-server/helpers";
import logger from "coral-server/logger";
... |
0973a358625798e86e1bc96b22bf4c1525041245 | TypeScript | tarsusi/js-task | /src/services/api/baseApi.ts | 2.53125 | 3 | import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
export const get = (url: string, config?: AxiosRequestConfig) =>
axios
.get(url, config)
.then((result: AxiosResponse) => {
if (result && result.status === 201) {
return {
success: true,
data: result.data,
};
}
return {
... |
082d97452bd5f3f19227dc2c8dd0d407c16e0902 | TypeScript | clubito/server | /src/util/auth.ts | 2.71875 | 3 | import { Request, Response, NextFunction } from "express";
import { JWT_SECRET } from "@secrets";
import jwt from "jsonwebtoken";
import { IJWTInterface } from "@models/Interfaces/IJWTInterface";
import User from "@models/User";
const authenticateJWT = (req: Request, res: Response, next: NextFunction): void => {
... |
9f9ec84c3feeabf208fd05dd90e4650a28b00afb | TypeScript | sadie767/recipe-book | /app/app.component.ts | 2.6875 | 3 | import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<div class="container">
<h1>Recipe Book</h1>
<h3>Recipes as of {{currentTime}}</h3>
<h3>{{currentFocus}}</h3>
<hr>
<div>
<h5 [class]="ratingColor(currentRecipe)" (click)="haveMade(currentRecipe... |
8fa3779cd345ba08d3ffd2565a52e2a68e294cc0 | TypeScript | nico203/platziwebapp | /src/app/agregar-tarea/agregar-tarea.component.ts | 2.546875 | 3 | import { Component, OnInit } from '@angular/core';
import { TareasService } from '../services/tareas.service';
@Component({
selector: 'app-agregar-tarea',
templateUrl: './agregar-tarea.component.html',
styleUrls: ['./agregar-tarea.component.scss']
})
export class AgregarTareaComponent implements OnInit {
... |
a916c886df0ec59243151c12b57f9f1b41451930 | TypeScript | alexhruzd/nestjs-api | /src/product-categories/product-categories.service.ts | 2.53125 | 3 | import { Injectable, NotFoundException } from '@nestjs/common';
import { InjectRepository } from "@nestjs/typeorm";
import { ProductCategory } from "./product-categories.entity";
import { Repository } from "typeorm";
import { CreateCategoryDto, UpdateCategoryDto } from "./dto/product-categories.dto";
@Injectable()
exp... |
22a48dd53a28487b5625dd45731abcfed94a247c | TypeScript | JuanHoyosC/FrontEnd-Buzon | /src/app/pipes/ordenar.pipe.ts | 2.96875 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'ordenar'
})
export class OrdenarPipe implements PipeTransform {
transform(value: any[], opcion, index): any[] {
//Verifica si se quiere buscar por index y retorna el correo
if (index !== '') return value.filter(a => a.index === Number(ind... |
7eb26e0ec8da2b21b4b4674a6ce2a495e4b0473a | TypeScript | sneha1102/PostAPI_TypeScript_Rest | /model/comment.ts | 2.53125 | 3 | import { Document, Schema, model, Model } from "mongoose";
export interface CommentModel extends Document {
postId: Schema.Types.ObjectId;
comment: string;
commentedBy: Schema.Types.ObjectId;
}
//Comment Schema
const commentSchema: Schema = new Schema(
{
postId: { type: Schema.Types.ObjectId, ref: "Post" ... |
50c09a2b5aa510c9cc3cdfc8e2ad91bd6e83eb86 | TypeScript | wixplosives/file-services | /packages/test-kit/src/sync-fs-contract.ts | 2.59375 | 3 | import { expect } from 'chai';
import type { IFileSystemSync } from '@file-services/types';
import type { ITestInput } from './types';
const SAMPLE_CONTENT = 'content';
export function syncFsContract(testProvider: () => Promise<ITestInput<IFileSystemSync>>): void {
describe('SYNC file system contract', () => {
... |
b63476743f30e2c00f50970e8681abc2762b1942 | TypeScript | Thuta107/Intern-Management-System | /frontend/src/app/_services/upload-firebase.service.ts | 2.75 | 3 | import { Injectable } from "@angular/core";
import * as firebase from "firebase/app";
import { Observable } from "rxjs/Observable";
import { environment } from "../../environments/environment";
import { Url } from "url";
import { of } from "rxjs";
import { weekRows } from "../_models/weekrows";
@Injectable({
provide... |
bdce4d5d057fe539a43cbfede4ba8cf324cb96ad | TypeScript | amulrean/flights3d | /src/app/state/reducers/map.ts | 2.609375 | 3 | import { MapState } from './map';
import { TileSet, ICameraState, IRectangle } from '../../models/map';
import { MapActions, MapActionTypes } from '../actions/map';
import { createFeatureSelector, createSelector } from '@ngrx/store';
export interface MapState {
selectedTileSet: TileSet;
camera: ICameraState;
vie... |