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 |
|---|---|---|---|---|---|---|
27e57a8513af85e3996ec7cdcee71928fd58b009 | TypeScript | bcgov/embc-ess | /pdf-service/src/api/middleware.ts | 2.546875 | 3 | import { Request, Response, NextFunction, Express } from 'express';
import bodyParser from 'body-parser';
import { MAX_PAYLOAD_SIZE, ENABLE_CORS } from '../config';
import { sysdebug } from '../lib/utils';
export const applyMiddleware = (app: Express) => {
if (ENABLE_CORS) {
sysdebug('Applying CORS middleware.')... |
df10e1c740362128273c844528ac209bac3e19ae | TypeScript | TarVK/model-react | /src/model/dataSources/ExecutionState.ts | 3.125 | 3 | import {handleHookError} from "../../tools/hookErrorHandler";
import {IDataHook} from "../_types/IDataHook";
import {isDataLoadRequest} from "../_types/IDataLoadRequest";
import {IDataSource} from "../_types/IDataSource";
import {AbstractDataSource} from "./AbstractDataSource";
/**
* A class to keep track of executin... |
c7374ce9e1cca0aacebabeea60a671a3e71dd9b4 | TypeScript | team-gu/service | /FE/store/stickySlice.ts | 2.8125 | 3 | import { createSlice, PayloadAction } from '@reduxjs/toolkit';
interface SectionOffset {
top: number;
height: number;
offset: number;
endOffset: number;
}
interface StickyState {
isFixed: boolean;
translateY: number;
offsets: SectionOffset[];
}
const initialState: StickyState = {
isFixed: false,
tr... |
70a5a77d1804ed080606d4e19e0f6cad3aac3495 | TypeScript | Enhmunh-E/tsparticles | /engine/src/Updaters/Roll/RollUpdater.ts | 2.953125 | 3 | import type { IDelta, IParticleUpdater } from "../../Core/Interfaces";
import type { Particle } from "../../Core/Particle";
import { colorToHsl, getRangeValue } from "../../Utils";
import { AlterType } from "../../Enums";
function updateRoll(particle: Particle, delta: IDelta): void {
const roll = particle.options.... |
460c292e8304fbd69e8ddd8823b0d9581b6b746b | TypeScript | gabrielDevlog/uml-online | /src/plantuml-proxy/shared/dtos/diagram.ts | 3.015625 | 3 | import { IsString, IsNotEmpty } from "class-validator";
/**
* A diagram
*/
export interface DiagramDTO {
id: string;
title: string;
data: string;
}
/**
* Data needed to create a diagram
*/
export class DiagramCreateDTO {
@IsString()
@IsNotEmpty()
title: string;
@IsString()
@IsNotEmpty()
data: s... |
2d256d354ce7465df3f80b1bf5d13f3a96018927 | TypeScript | supabase/supabase | /supabase/functions/common/tokenizer.ts | 2.71875 | 3 | import { init, Tiktoken } from 'https://esm.sh/@dqbd/tiktoken@1.0.2/lite/init'
import { ChatCompletionRequestMessage } from 'https://esm.sh/v113/openai@3.2.1'
const encoderResponse = await fetch('https://esm.sh/@dqbd/tiktoken@1.0.2/encoders/cl100k_base.json')
const cl100kBase = await encoderResponse.json()
await init... |
c1c49f404eb01c0d833ec6fad83fd8996952c9ee | TypeScript | stephensmitchell-forks/minimatrix | /test/compare.spec.ts | 2.796875 | 3 | import { expect } from 'chai';
import { Compare } from '../src/index';
const EPS = 1e-14;
describe('Compare Functions', () => {
it('should test if number is close to zero', () => {
expect(Compare.isZero(2e-14, EPS)).to.be.false;
expect(Compare.isZero(0.7e-14, EPS)).to.be.true;
});
it('should test if num... |
a1c28458d892f94459889b9d0f06c8058e43223d | TypeScript | lksmangai/PMOAngular-development | /src/app/models/viewTimesheet.model.ts | 2.59375 | 3 | export interface IViewTimesheet {
id?: number;
projectId?: number;
employeeId?: number;
projectName?: string;
loghours?: number;
notes?: string;
}
export class ViewTimesheet implements IViewTimesheet {
constructor(public id?: number, public projectId?: number, public employeeId?: number, pu... |
65a102fd5f0f5e48195803e61bbc0bebe362061b | TypeScript | abas619/react-recontext | /src/utils.ts | 2.65625 | 3 | const loggerStyle = "font-weight: bold";
const actionNameToTypes = (actionName: string) => {
return actionName
.replace(/([A-Z])/g, "_$1")
.trim()
.toUpperCase();
};
const printDebugInfo = (
currentAction: string,
state: object,
params: object,
nextState: object
) => {
console.log(
`---> AC... |
1bdb2cd9027498c1df23ff0b68342f1439871d93 | TypeScript | chriscastaneda/blog-restfulAPI | /server/src/daos/author-dao.ts | 3.109375 | 3 | /* istanbul ignore file */
import { dbConnection} from '../daos/db';
import { Author, AuthorRow } from '../models/Author';
/**Database query logic */
//Retrieve all
export function getAllAuthors(): Promise<Author[]> { //Promise<Author[]> returning promise
const sql = 'SELECT * FROM authors'; //Query database
... |
9ed330bead364658603be24c8518a1c118de31c0 | TypeScript | wpflying/05_utils | /src/utils/judgers/inArray.ts | 3.890625 | 4 | /**
* 判定目标值是否包含在目标数组中
* @param val 需要判定的值
* @param arr 数组(可能包含目标值)
* @example
* inArray(2, [1, 2, 3]) // true
* inArray('hello', ['hello', 'world']) // true
*/
export default function inArray<T extends unknown>(val: T, arr: T[]) {
return arr.includes(val)
}
|
83766910f720d588f69ce514fa520a79465c4a53 | TypeScript | aches/component-dm | /src/renderer/store/BaseStore.ts | 3.140625 | 3 | import {Log} from "../util/Log";
/**
*数据存储类
*@since 2.0
*@author zhiguo
*@Date 2018/6/28 9:37
*/
export class BaseStore {
private getData(key: string) {
return localStorage.getItem(key);
}
/**
* 查询数据并转换为对象
* @param {string} key
* @returns {any}
*/
public getDataObj(... |
aca6fc912f262baf1e1405c5ee286cd9d3c1b891 | TypeScript | leelhn2345/chatbot-engine | /src/messenger/axios-client.ts | 2.609375 | 3 | import axios, { AxiosInstance } from "axios";
import { HTTPClient } from "../type/client";
/** Create a default HTTP client using axios */
export function createAxiosClient(axiosInstance: AxiosInstance = axios) {
const client: HTTPClient = {
communicate: async (request) => {
const { url, headers, maxConten... |
7a81bbf77f0086fbe49df81d014bb500a4fa7adc | TypeScript | kobishiamka/server | /actionControllers.ts | 2.671875 | 3 |
import "reflect-metadata";
import { Controller, Body, Post, Res } from "routing-controllers";
import { Response } from 'express'
import { protfolio } from "./model/protfolio";
import { history } from "./model/history";
@Controller()
export class actionControllers {
//Realization of the buy function
@Post("/buy"... |
55e8268cc67eb416a0093e4555e651d1ec7f60b8 | TypeScript | adiostone/one-table-api | /src/modules/database/RedisConnector.ts | 2.578125 | 3 | import Redis, { Redis as IORedis } from 'ioredis'
export default class RedisConnector {
private static _instance: RedisConnector
private _conn: IORedis
/**
* Get singleton instance
*
* @constructor
*/
public static get I(): RedisConnector {
if (this._instance === undefined) {
this._inst... |
3b7b91c2d4a68929d4fdeb74cff6855312727efb | TypeScript | logoss233/LayaPandaRun | /src/object/item/eatItem/Coin.ts | 2.671875 | 3 | class Coin extends EatItem{
speed=15 //被磁铁吸引的速度
magnent_distance=800 //吸引的范围
constructor(){
super()
this.poolTag="Coin"
var ani=new Animation()
this.addChild(ani)
ani.loadAnimation("CoinAnimation.ani")
ani.play(0,true,"ani1")
this.setBounds(new Recta... |
5c65a76d10f388a1bff4cda24ec946b39e908da4 | TypeScript | DJAPavlik/ionicAuth | /src/app/user.service.ts | 2.65625 | 3 | import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { User } from '../models/user';
// 3. Create a JSON header to be attached to outbound post requests
const httpOptions = {
headers: new HttpHeaders({ 'Content-Type': 'a... |
6f2b90008550de4be380c69c51e025f26693a1b5 | TypeScript | bmancini55/algorithms | /src/BinarySearchTree/Recursive/PeekMin.ts | 3.71875 | 4 | export class Node<T> {
public key: T;
public left: Node<T>;
public right: Node<T>;
public parent: Node<T>;
constructor(key: T) {
this.key = key;
this.parent = null;
this.left = null;
this.right = null;
}
}
/**
* Finds the min value in the tree staring at the root.
* Executes in θ(height) which has ave... |
738f3125aef4fd78c2b7970cbbf2a110077dd208 | TypeScript | ygortavela/TabelaBrasileirao | /frontend/src/store/teams/types.ts | 2.71875 | 3 | export interface TeamState {
pending: boolean;
error: any;
teams: Team[];
selectedTeam: Team;
formType: 'CREATE' | 'EDIT' | null;
}
export const FETCH_TEAMS_PENDING = 'FETCH_TEAMS_PENDING';
export const FETCH_TEAMS_SUCCESS = 'FETCH_TEAMS_SUCCESS';
export const FETCH_TEAMS_ERROR = 'FETCH_TEAMS_ERROR... |
b4bb86aebd08bf2f6fd98e0f1ee27a47367bf83a | TypeScript | paraslov/irx-test1-soc-net | /src/n7-helpers/cookie.ts | 2.703125 | 3 | export function set_cookie(name: string, value: string) {
const cookie_string = name + '=' + escape(value)
document.cookie = cookie_string
}
export function delete_cookie(cookie_name: string) {
const cookie_date = new Date()
cookie_date.setTime(cookie_date.getTime() - 1)
document.cookie = cookie_n... |
44cd61bfd8187a5dc80014e322d28fad6b5cb4c7 | TypeScript | shamilsun/crypto-quote-watcher | /common/models/events/eventsProps.ts | 2.53125 | 3 |
export interface IEventsStack {
[actionKey:string]: {
setterKey:string
event: (arr:any)=>void
}[]
} |
42451831ba8b2ec9162c89fbb2e6a7e0403162af | TypeScript | tyankatsu0105/types-gridsome | /dist/pages.d.ts | 2.8125 | 3 | export interface CreatePagesActioons {
/**
* Use the `createPages` hook if you want to create pages.
* Pages created in this hook will be re-created and garbage collected occasionally.
* Use the `createManagedPages` below to have more control over when pages are updated or deleted manually.
* @p... |
c1f13c6c94c036e76db09eaffa76290202d3ee6c | TypeScript | hllfmy/jira-ci-cd-integration | /src/utils/logger.ts | 2.53125 | 3 | let logger = {
debug: console.debug,
info: console.info,
error: console.error,
}
export function setLogger(newLogger: typeof logger): void {
logger = newLogger
}
export function getLogger(): typeof logger {
return logger
}
|
0934ff68c52f42ea25049ca268d6cab5a7f9b8d0 | TypeScript | iamkirabond/middle.messenger.praktikum.yandex | /src/utils/validation.ts | 2.921875 | 3 | export function validationForm(inputContent: string, type: string):boolean{
const expression = {
name: /(^[A-Z]{1}[a-z]{1,29}|(^[А-Я]{1}[а-я]{1,29}$))/,//
login: /^[a-zA-Z]([a-zA-Z0-9_-]{1,29})$/,
email: /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/,
password: /(?=.*[A-Z]+)(?=.*[!@#\$%]+)/,
... |
beeb1dc95f815d9834859258ca9f20d35769c6ec | TypeScript | Shrilekha1995/CD | /frontend/demo-app/src/app/services/location.service.ts | 2.515625 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable,Observer } from 'rxjs';
interface Location{
latitude:number;
longitude:number;
ip:any;
}
@Injectable({
providedIn: 'root'
})
export class LocationService {
constructor(private http:HttpClient)... |
11b6b93e64caa6b8074e08e1e6625a645ca70bdc | TypeScript | Denis101/screeps | /src/creep/component/DropComponent.ts | 2.53125 | 3 | import { component } from "inversify.config";
import { timed } from "processor/Processor";
import { CreepComponent, TYPE_CREEP_COMPONENT, CreepComponentInput } from "./CreepComponent";
const TYPE: string = 'DropComponent';
@component<CreepComponent>(TYPE_CREEP_COMPONENT, TYPE)
export default class DropComponent impl... |
1f3a6e0fa0b2160dd68c9f5f688c5142db495622 | TypeScript | emonddr/loopback4-mixins-example | /src/models/book.model.ts | 2.5625 | 3 | import {model, property} from '@loopback/repository';
import {AddCategoryPropertyMixin} from '../mixins/category-property-mixin';
import {BaseEntity} from './base-entity';
@model()
export class Book extends AddCategoryPropertyMixin(
BaseEntity,
) {
constructor(data?: Partial<Book>) {
super(data);
}
@prop... |
93af41f39b226967ed28d21fd593386595eafcba | TypeScript | JohnstonCode/svn-scm | /src/ignoreitems.ts | 2.734375 | 3 | import * as path from "path";
import { QuickPickItem, Uri, window } from "vscode";
import { Repository } from "./repository";
export class IgnoreSingleItem implements QuickPickItem {
constructor(public expression: string, public recursive: boolean = false) {}
get label(): string {
const text = this.recursive ... |
75ca1c5d7c065f4f09d1972c21e52841cbf2a040 | TypeScript | marjisound/dotcom-rendering | /apps-rendering/src/themeStyles.ts | 2.625 | 3 | // ----- Imports ----- //
import * as palette from '@guardian/src-foundations/palette';
import type { Theme } from '@guardian/types';
import { Pillar, Special } from '@guardian/types';
// ----- Types ----- //
interface ThemeStyles {
kicker: string;
inverted: string;
liveblogBackground: string;
liveblogDarkBackgr... |
537a721df7aaba4a35dc3be2019a9b594da4b937 | TypeScript | gruberchris/OneSourceConsole | /src/result-messages/Message.ts | 2.953125 | 3 | import IResultMessage from "./IResultMessage";
class Message implements IResultMessage {
public readonly type: string;
public readonly eid: string;
public readonly message: string;
constructor(eid: string, message: string) {
this.type = 'onMessage';
this.eid = eid;
this.message... |
d27b5c016d264359e9f3c24efe4c40f8efe55ee6 | TypeScript | Irega97/Seminari1EA | /src/models/user.ts | 2.8125 | 3 | //Interfaces
import mongoose, { Schema, Document} from 'mongoose';
import Course, { ICourse } from './course';
//Interfaz para tratar respuesta como documento
export interface IUser extends Document {
nombre: string;
apellidos: string;
edad: number;
correo: string;
telefono: number;
grado: stri... |
c0da73b8d40136b2efa4d8fcac9b9d693de6381f | TypeScript | OurSonic/OurSonicTyped | /client/src/app/game/level/sonicImage.ts | 2.765625 | 3 | export class SonicImage {
Bytes: number[];
Palette: number[][];
Width: number;
Height: number;
constructor(bytes: number[], palette: number[][], width: number, height: number) {
this.Bytes = bytes;
this.Palette = palette;
this.Width = width;
this.Height = height;
}
}
|
c3345c324375b1ac8ca2d6c280168f6669cd9eb2 | TypeScript | benibowalson/angularTest | /src/app/heroes/heroes.component.ts | 2.78125 | 3 | import { Component, OnInit } from '@angular/core';
import {Hero} from '../hero';
/*import {HEROES} from '../mock-heroes'; */ /*//No longer this import since service will be used now */
import {HeroService } from '../hero.service';
@Component({
selector: 'app-heroes',
templateUrl: './heroes.component.html',
s... |
fa7f6f89061294bd620d938824aa2401353e880f | TypeScript | drakedey/money-graphql-backend | /src/entity/MoneyAccount.ts | 2.53125 | 3 | import {
Entity, Column, PrimaryGeneratedColumn, OneToMany,
} from 'typeorm';
// eslint-disable-next-line import/no-cycle
import { MoneyAccountUser } from './MoneyAccountUser';
enum CurrencyType {
Usd = 'USD',
Cop = 'COP',
Vef = 'VEF'
}
@Entity({
name: 'money_account',
})
class MoneyAccount {
@PrimaryGene... |
5377d6e0dd8b73f451dd8b90ce24498643585f9a | TypeScript | FlipSs/flipss-common-types | /tests/caching/cache/SlidingExpirationCache.spec.ts | 2.59375 | 3 | import {testCache} from "./common";
import {SlidingExpirationCache} from "../../../src/caching/internal";
import {TimeSpan} from "../../../src/time/internal";
import {usingAsync} from "../../../src/common/functions";
describe('SlidingExpirationCache', () => {
testCache(SlidingExpirationCache);
it('Should remo... |
deece270bf980b0c5b2cc12a5fe49fd66f67fc3d | TypeScript | BookAdda/booksResale | /BooksFrontend-master/src/app/pipes/pricee.pipe.ts | 2.59375 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'pricee'
})
export class PriceePipe implements PipeTransform {
transform(value: any, filterMax : string, propName : string): any {
if(value.length == 0 || filterMax === '' || filterMax == null || filterMax === 'Max price'){
return v... |
1323f7e2f0d8352247d6589ff61b765452bead0e | TypeScript | latticework/jali | /packages/@jali-ms/util/src/argument-empty-string-error.ts | 3.53125 | 4 | import { default as ArgumentFalsyError } from './argument-falsy-error';
/**
* Represents that an argument erroneously has an empty string value.
*
* Throw this {@link Error} if a parameter must be a non-empty string.
*
* @example <caption>The argument for the parameter lastName is an empty string.</caption>
* th... |
08554a9540c772cdddea73e2ef0e50e28c2984a9 | TypeScript | Ruddickmg/js-wars | /front/javascript/src/browser/menu/screen/title.ts | 2.890625 | 3 | import {isDefined} from "../../../tools/validation/typeChecker";
import validator, {Validator} from "../../../tools/validation/validator";
import createElement, {Element} from "../../dom/element/element";
export default (function() {
const {validateString}: Validator = validator("title");
return function(initialTi... |
80f04e35954c77238e8d77071236f33f09fbe59d | TypeScript | andymed-jlp/easymoney | /packages/money/src/calculator/calculator.ts | 3.234375 | 3 | import { fromNumber } from "../number";
import { customRound } from "./round";
import { assert } from "@easymoney/core";
import { CalculatorBase } from "./types";
export function createCalculator(): CalculatorBase {
const instance = {
compare,
add,
subtract,
multiply,
divide,
ceil,
absol... |
2a797e5178f48185f0293585e245f57f7c7a6e1b | TypeScript | arturgieralt/CanonGame | /src/Builders/BallBuilder.ts | 2.625 | 3 | import { injectable, inject, interfaces} from "inversify";
import { TYPES } from "../IoC/types";
import { IBall } from "../Models/Ball/IBall";
import { IBallBuilder } from "./IBallBuilder";
import { IBallConfiguration } from "../Configurations/IConfiguration";
@injectable()
export class BallBuilder implements IBallBui... |
d89caead29d9ea7c4aa37144cf282ad787f16e17 | TypeScript | ankhaa8/cs572-onlineMarket | /src/controllers/user.ts | 2.59375 | 3 | import {ApiResponse} from '../utils/response';
import {Product} from '../models';
export const updateCart = async (req, res, next) => {
try {
const user = req.user;
const productId = req.body.productId;
const quantity = req.body.quantity;
await user.updateCart(productId, quantity);
res.status(200... |
d14c444230845e3e875b342586df97aab44ac3ed | TypeScript | forgng/pin-cli | /src/commands/search.ts | 2.59375 | 3 | import { Command, flags } from '@oclif/command';
import { getPinList } from '../utils';
const { prompt } = require('enquirer');
const chalk = require('chalk');
const execa = require('execa');
export default class Search extends Command {
static description = 'Search for a pin';
static examples = [`$ pin search`];... |
6fc3d23fcbb9337cd11e8e93cf00dccb2d46ee1f | TypeScript | samuba/pairing-timer | /src/common.ts | 3 | 3 | export const localStoragePut = (key: string, value: boolean) => localStorage.setItem(key, `${value}`)
export const localStorageGet = (key: string, defaultValue: boolean) => {
const val = localStorage.getItem(key)
if (val === null) return defaultValue
else return val == "true"
} |
197c5b3cf44c19aed0dea067f7c1200e5bfc3a0d | TypeScript | icalder/holdingbuddy | /modules/controls.ts | 2.96875 | 3 | import { lightTheme, darkTheme } from './themes';
type ValueChangedHandler<T> = (old: T, cur: T) => void;
export class Controls {
private track: number = 0;
private trackChangedHandlers: ValueChangedHandler<number>[] = [];
private lefthand: boolean = false;
private lefthandChangedHandlers: ValueChang... |
c2ad93fdf3344a8bc810bb2600b8f46d1718b825 | TypeScript | jsyang/360viewer | /src/index.ts | 2.65625 | 3 | import {
WebGLRenderer, Scene, Mesh, TextureLoader,
Texture, SphereBufferGeometry, MeshBasicMaterial,
PerspectiveCamera, Vector3, Math as THREEMath
} from 'three';
let camera, scene, renderer;
let isUserInteracting = false;
let lastClientX = 0;
let lastClientY = 0;
let lon = 0;
l... |
2e551908d57e880dfd77151a2722a780a42403b5 | TypeScript | KkevinLi/nativescript-plugin-firebase | /src/app/auth/index.ts | 2.671875 | 3 | import * as firebase from "../../firebase";
import { FirebaseEmailLinkActionCodeSettings, LoginType, User } from "../../firebase";
export module auth {
export class Auth {
private authStateChangedHandler;
public currentUser: User | undefined;
public languageCode: string | null;
public onAuthStateCha... |
afdeb8c286197d785555b890af4ba28c6e705d50 | TypeScript | yeongjet/demo_shopping_mall | /src/member/controller/member.controller.ts | 2.515625 | 3 | import { Controller, Get, Param } from '@nestjs/common'
import { Member } from '../interface/member.interface'
import { MemberService } from '../service/member.service'
import { MemberIdPipe } from '../pipe/member.id.pipe'
@Controller('member')
export class MemberController {
constructor(private readonly memberS... |
910b05dae796ccf759308468869d6adc5133635f | TypeScript | brechtbilliet/typescript-mockify | /src/mock/spec/testClass/Bar.ts | 2.5625 | 3 | import {IBar} from "./IBar";
export class Bar implements IBar {
public foo: string;
public bar(): string {
return "just a string";
}
} |
41a3be3483bfb060ccd885939c081d50f33ce7fd | TypeScript | fe2-gingggg/week11-q9-ts-react-github_profile-submit | /src/modules/todos/reducer.ts | 3.125 | 3 | import { createReducer } from 'typesafe-actions'
import { ADD_TODO, REMOVE_TODO, TOGGLE_TODO } from './actions'
import { TodosAction, TodosState } from './types'
const initialState: TodosState = []
// typesafe-actions 사용 x
// export default function todos(
// state = initialState,
// action: TodosAction,
// ): To... |
c2eef4e75b766557702896c588863686b28842fe | TypeScript | organicinternet/oauth2-firebase | /src/utils/crypto.ts | 2.890625 | 3 | import * as crypto from "crypto";
import {Configuration} from "./configuration";
export class Crypto {
static encrypt = (text: string): string => {
const iv = crypto.randomBytes(16)
const cipher = crypto.createCipheriv(
"aes-256-cbc",
Buffer.from(Configuration.instance.crypto_auth_token_secret_k... |
428bc358ccbdf2fd3278db772cc55b9e57dcf9b6 | TypeScript | Ed-Fi-Exchange-OSS/Student360 | /SMCISD.Student360.Web/ClientApp/src/app/components/data-grid/grid-helper.ts | 2.71875 | 3 | import { Grid, GridHeader } from "./data-grid.component";
export function calculateOrderByForRequest(grid: Grid) {
var result = [];
var sortedHeaders = grid.headers.slice().sort((a, b) => {
if (a.orderNumber > b.orderNumber)
return 1;
if (b.orderNumber > a.orderNumber)
return -1;... |
23e56f6d6a5fb7aa1a0db9c170705bee1d0b2b51 | TypeScript | souppower/clean-architecture-todo-frontend | /src/interface/repository/todo.ts | 2.84375 | 3 | import { Todo } from "domain";
import { TodoRepository as ITodoRepository } from "usecase/repository";
import Persistor from "./persistor";
export default class TodoRepository implements ITodoRepository {
constructor(private persistor: Persistor) {}
findAll(): Todo[] {
return this.persistor.getAll();
}
... |
44645967e55687b99f8135ab671f250cab4ff650 | TypeScript | eatski/confusers_webFront | /model/logic.ts | 3.046875 | 3 | import { recur } from "../libs/util";
import { Address, Card, CardBody, CARDS, CardUse, Cell, Direction, DIRECTIONS, MoveCardBody, MoveCardUse, SYMBOLS, SymbolType, Token } from "./types";
const rnd = (num: number) => Math.floor(Math.random() * num);
const pickRnd = <T>(array: T[]): [T, T[]] => {
if(!array.length)... |
8d52b65cb7070776cff70986a366fad5108242c9 | TypeScript | gitalez/webAviatel | /src/app/services/info-pagina.service.ts | 2.875 | 3 | // al colocar root , ya no hace falta cargar este servicio en el app.module
// para que se vea el console.log o cualquier otra cosa
// tenemos que inyectar este servicio en algun componente
// por ejemplo lo inyectamos en el constructor del app.component.ts
// aqui leemos el json
// necesito un modulo http
impor... |
e81eca6457ba4a4ff16ad036ec9f5f47db303b5a | TypeScript | zxch3n/blog | /twice_linear/solve.ts | 3.25 | 3 | import { LinkedList } from "https://deno.land/x/mighty_promise@v0.0.1/mod.ts";
const ans: number[] = [1];
// 2 * x + 1
const a: LinkedList<number> = new LinkedList([3]);
// 3 * x + 1
const b: LinkedList<number> = new LinkedList([4]);
export function solve(index: number) {
if (ans.length > index) {
return ans[in... |
f258d7aec84a03358f26b64a64e5a0bdfc9ce026 | TypeScript | seyfarash/side | /SideScroller/Scripts/states/menu.ts | 2.671875 | 3 | /// <reference path="../objects/gameobject.ts" />
/// <reference path="../objects/cloud.ts" />
/// <reference path="../objects/island.ts" />
/// <reference path="../objects/ocean.ts" />
/// <reference path="../objects/plane.ts" />
module states {
export function menuState() {
ocean.update();
plan... |
980867d2ee321e64888262cbafb3cb45a94e09ac | TypeScript | MrMory/boardgamegeekjsclient | /test/unit/client/BggClients.test.ts | 2.59375 | 3 | import fs from 'fs';
import path from 'path';
import { BggFamilyClient, BggThingClient } from '../../../src/client';
import { BggFamilyDtoParser, BggThingDtoParser } from '../../../src/dto';
import { TextFetcher } from '../../../src/fetcher';
import { GenericBuilder } from '../../../src/query';
import { IFamilyRequest,... |
029c1f350208a1cd48eda8ed4e65a043e475762e | TypeScript | DanielRamosAcosta/rxjs-marble-testing | /src/01-simple-interval/basic-map.ts | 2.5625 | 3 | import { Observable } from 'rxjs'
import { map } from 'rxjs/operators'
export const numTwoTimes = (obs: Observable<number>) =>
obs.pipe(map((x: number) => x * 2))
|
171047dd72116835a0b8d0e79460137d4e8540ce | TypeScript | lsqaisen/micro-frontend | /login/src/components/form/checks.ts | 3.265625 | 3 | export function checkPassword(rule: any, value: any, callback: Function) {
let pattern1 = /[^\!\@\#\$\%\^\&\*\(\\\)\-\=\_\+\,\.\?\/\:\;\{\}\[\]\~\w]/g;
let pattern2 = /[a-z]+/;
let pattern3 = /[A-Z]+/;
let pattern4 = /[0-9]+/;
let pattern5 = /[\!\@\#\$\%\^\&\*\(\\\)\-\=\_\+\,\.\?\/\:\;\{\}\[\]\~]+/;
// let ... |
959786d19c710d9e22fefe2345b33fcaef5f3996 | TypeScript | MarcusViniciusCavalcanti/flex-template | /src/app/theme/component/icon/icon.ts | 2.546875 | 3 | import { FlexFontIconPackParams, FlexIconPackParams } from './icon-pack';
export interface FlexIconOptions {
[name: string]: any;
}
export interface FlexIcon {
getClasses(options?: FlexIconOptions): string[];
getContent(options?: FlexIconOptions): string;
}
export class FlexFontIcon implements FlexIcon {
co... |
067114da7434d24648da62d359a1f415eedf7458 | TypeScript | AdithyaBhat17/stripe-metered-subscriptions | /client/src/utils/pricing.ts | 2.609375 | 3 | export const price = {
vm: 10,
o365: 5,
csp: {
aws: 1,
azure: 1,
gcp: 2,
},
};
export function totalPrice(
vm?: string,
o365?: string,
csp?: keyof typeof price["csp"] | undefined
) {
let vmCost = vm ? Number(vm) * price.vm : 0;
let o365Cost = o365 ? Number(o365) * price.o365 : 0;
let cs... |
2e0e96dcc7d67a68d942b4645df3156914eb67ee | TypeScript | BM-laoli/TodoMaxRn | /src/modules/TestModule1/Store/Todo.ts | 2.5625 | 3 | import { action, observable } from 'mobx';
class TodoStore {
@observable
count = 1;
// 设置值
@action
setCount = () => {
this.count++;
}
@action
getCount = () => {
return this.count
}
// 如果有副作用的话请在这里处理
// 如果涉及到多播操作也在这里处理
}
export default TodoStore
|
406bcad4dc4b4cf7d20f47af7b719a5d4b676ae3 | TypeScript | JarnDev/axis-todo | /src/shared/validators/businessRules.ts | 2.84375 | 3 | import { BadRequestException } from '@nestjs/common';
import { ValidDateRule } from './dateValidator';
export default function businessRulesValidator(name: string, date: string) {
if (name.length < 8 || name.length > 16) {
throw new BadRequestException('Name must have size 8-16');
}
const dateValidator = new... |
d2d41d32ff1d0b840be328cff5b95a0270e284f4 | TypeScript | andrelmlins/previsao-ondas | /src/entities/State.ts | 3.171875 | 3 | import City from './City';
/**
* Estado
* @typedef {object} State
* @property {string} abreviatura - Abreviatura do estado
* @property {string} url - Url de detalhes do estado
* @property {array<City>} cidades - Lista de cidades do estado
*/
class State {
abreviatura: string;
url: string;
cidades?: City[];... |
eeb9dd66aab757bab1d406219816323ed7b60243 | TypeScript | mfarfanr/Angular-proj003 | /src/app/app.component.ts | 2.828125 | 3 | import { Component } from '@angular/core';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = "Angular-proj003";
degreesControl = new FormControl(... |
a9fed4272b4f94e6cb3330561031352ace4fc3b7 | TypeScript | bgoonz/UsefulResourceRepo2.0 | /MY_REPOS/WEB-DEV-TOOLS-HUB/MAIN/2_web-dev-util-pkg/mout/src/string/trim.ts | 2.8125 | 3 | import toString from '../lang/toString';
import WHITE_SPACES from './WHITE_SPACES';
import ltrim from './ltrim';
import rtrim from './rtrim';
/**
* Remove white-spaces from beginning and end of string.
*/
function trim(str, chars?: string[]) {
str = toString(str);
chars = chars || WHITE_SPACES;
return ltr... |
2e8a48d68936b3db785af042b3a4740bf1f5337d | TypeScript | avakumov/yandex-map-taxi | /src/api/index.ts | 2.921875 | 3 | import _ from "lodash"
import { v1 as uuidv1 } from "uuid"
import { getDistance } from "../utils"
export interface CrewI {
crew_id: string
car_mark: string
car_model: string
car_color: string
car_number: string
driver_phone: string
driver_name: string
lat: number
lon: number
distance: number
}
inter... |
968d948ea72347f5a4a8efe9f08c290b8c4b6a84 | TypeScript | nadavsinai/session-heartbeat | /src/app/shared.interfaces.ts | 3 | 3 | export interface ISessionTransport {
clientId: string;
dispatchAction(action: any): void;
addEventListener(onMessage: (action: any) => void): void;
getPlayerID(): Promise<any>;
}
export class HeartBeatSessionAction {
readonly type = "HEARTBEAT";
constructor(public hasBeenActive: boolean) {
... |
c60ef8e13c4e61b90d74492cf1ef6a7e3183126d | TypeScript | basedalexander/steam-trade-app | /server/application/services/session-provider.ts | 2.765625 | 3 | import * as uuid from 'node-uuid';
export interface ISession {
username: string;
}
export class SessionProvider {
static sessions: Map<string, ISession> = new Map<string, ISession>();
static get(id: string): ISession {
return SessionProvider.sessions.get(id);
}
static set(session: ISessi... |
6fce52e68e3c4cf12547f889f802e475646d3817 | TypeScript | dev-bas/CrazyCabman | /src/parser.ts | 3.375 | 3 | /**
* This class is part of the "Zorld of Wuul" application.
* "Zorld of Wuul" is a very simple, text based adventure game.
*
* This parser reads user input and tries to interpret it as an "Adventure"
* command. Every time it is called it reads a line from the terminal and
* tries to interpret the line as a t... |
76a46e17216f580c37cfe7a2579901f0962cb6ab | TypeScript | discoveranirban/TS-Sort-Design-Pattern | /src/index.ts | 3.90625 | 4 | import {Sorter} from './Sorter';
import {NumbersCollection} from './NumbersCollection';
import {CharacterCollection} from './CharacterCollection';
// // way 1
// class Sorter {
// constructor(public collection: number[]) {}
// sort(): void {
// const {length} = this.collection;
// for(let i=... |
fc909521825d217b5272ed5e06c18e9d42d09505 | TypeScript | DimensionDev/MaskWebAuthn | /src/api/index.ts | 2.578125 | 3 | /// <reference path="./global.d.ts" />
import type {
PublicKeyAuthenticatorProtocol,
_FederatedAuthenticatorProtocol,
_PasswordAuthenticatorProtocol,
} from '../types/interface'
export interface CreateCredentialsContainerOptions {
publicKeyAuthenticator?: PublicKeyAuthenticatorProtocol
federatedAut... |
baf161648d4272ac580146c1215b0cb73c880b9b | TypeScript | JackBister/ts-roguelike | /src/Entity.ts | 2.890625 | 3 | import * as ROT from "rot-js";
import { GameMap } from "./GameMap";
import { RenderOrder } from "./RenderOrder";
export class Entity {
public static distanceTo(from: Entity, to: Entity) {
return Entity.distanceToPos(from.x, from.y, to.x, to.y);
}
public static distanceToPos(fromX: number, fromY: ... |
cb388822ab7b7ff9743ff7d638e2814136a3351d | TypeScript | dmitriypereverza/gatsby-blog | /src/libs/filter/rules/filterFieldIsEmptyArray.ts | 2.53125 | 3 | import { path } from "ramda";
import { FilterFuncInterface } from "libs/filter";
export const filterFieldIsEmptyArray = ({
filterField,
}: {
filterField: string;
}): FilterFuncInterface =>
function (filter: any) {
const filterValue = path(filterField.split("."), filter);
if (!Array.isArray(filterValue))... |
f17e4fa9db56035965682d363237ec6e72ef4148 | TypeScript | typescript-fastcampus/rxjs-for-you | /lib/test-source.ts | 2.75 | 3 | import {from} from "rxjs/observable/from";
import {concatMap, delay, timeout} from "rxjs/operators";
import {of} from "rxjs/observable/of";
export interface Point {
id: string,
x: number,
y: number
}
const points1: Point[] = [
{id: '0', x: 1, y: 1}, {id: '1', x: 1, y: 2}, {id: '2', x: 1, y: 2}, {id: '3', x: 1... |
0d013912ae45b3ef77783a76f6e6e9b554c4a44c | TypeScript | microsoft/FluidFramework | /examples/apps/presence-tracker/src/FocusTracker.ts | 2.53125 | 3 | /*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
import { Signaler } from "@fluid-experimental/data-objects";
import { IEvent } from "@fluidframework/common-definitions";
import { TypedEventEmitter } from "@fluidframework/common-utils";
import { I... |
9f07742b3f01f917d495b35fc3f3d627a313c812 | TypeScript | NooMiD96/Rails | /CoreVueTypeScript/ClientApp/src/components/fetchdata/IFetchdata.ts | 2.65625 | 3 | export interface WeatherForecast {
id: string;
dateFormatted: string;
temperatureC: number;
temperatureF: number;
summary: string;
}
export interface IState {
forecasts: WeatherForecast[];
pending: Boolean;
}
|
5be92d52d46336ca81aa9d2bd5666896f940c35d | TypeScript | Ciaxur/Athens-Central | /src/ServerInterfaces/Requests.ts | 2.953125 | 3 | // Interface for RGB Data
export interface RGB {
r: number,
g: number,
b: number
}
// Available Node Actions
export type NodeAction = 'setPower' | 'blink' | 'rgb' | 'setCold' | 'setWarm';
// Node Event Execution Request
export interface NodeEventExec { // Event Execution Object
action: NodeActi... |
69fbb6a746c4f6bf17aa763dff2ee0e6a3c6633f | TypeScript | olegbevz/TaskTracker | /TaskTracker/ClientApp/app/models/task.ts | 2.984375 | 3 | import * as moment from "moment";
import { Moment, Duration } from "moment";
export type TaskStatus = 'active' | 'completed';
export type SortOrder = 'name' | 'priority' | 'added' | 'duration';
export class Task {
public id: number;
public name: string;
public description: string;
public ... |
18cbad4df522f6cc2476751f255103c33b451282 | TypeScript | sillsdev/web-languagedepot-api | /src/routes/api/v2/projects/[projectCode]/user/[username]/index.ts | 2.515625 | 3 | import type { RequestHandler } from '@sveltejs/kit';
import { Project, defaultRoleId } from '$lib/db/models';
import { dbs } from '$lib/db/dbsetup';
import { missingRequiredParam } from '$lib/utils/commonErrors';
import { onlyOne } from '$lib/utils/commonSqlHandlers';
import { addUserWithRoleByProjectCode, removeUserFr... |
bfe4bb77b3ea556631946af9d6b5936abcf0d235 | TypeScript | Frikki/typed | /packages/list/src/update/types.ts | 2.671875 | 3 | import { List } from '../types'
export type UpdateArity3 = {
<A>(index: number, value: A, list: List<A>): Array<A>
(index: number): UpdateArity2
<A>(index: number, value: A): UpdateArity1<A>
}
export type UpdateArity2 = {
<A>(value: A, list: List<A>): Array<A>
<A>(value: A): UpdateArity1<A>
}
export type ... |
86868d4f1dbaa93c371674704aa2548a3f7d9ef2 | TypeScript | Knuddels/typescript-building-blocks | /packages/std/test/LocaleId.test.ts | 2.640625 | 3 | import { expect } from 'chai';
import { LocaleId } from '../src';
describe('LocaleId', () => {
it('basics', () => {
const en = new LocaleId('en');
expect(en.localeCode).to.equal('en');
expect(en.language).to.equal('en');
expect(en.country).to.be.undefined;
const enUS = new LocaleId('en', 'us');
expect(en... |
5c2e840bd58ea3c66269258f3f6be94f42d82a74 | TypeScript | torounit/firebase-chat | /src/store/messages/saga.ts | 2.53125 | 3 | import { call, cancelled, ForkEffect, put, take, takeEvery, takeLatest } from "redux-saga/effects"
import { Action } from "typescript-fsa"
import { Message } from "./state"
import { database } from "../../firebase"
import { receive } from "./actions"
import { eventChannel } from "redux-saga"
const messageChannel = (th... |
dc856d93f57c71969de3102879213b329335e88b | TypeScript | ryo4004/rts | /client/src/Types/FileInfo.ts | 2.8125 | 3 | type SenderInfo = {
// Sender用プロパティ
// 読み込み状態
load: boolean
// receiverへfileInfo送信フラグ
preSendInfo: boolean
// ファイル送信フラグ
send: number | null
// packet追加用
idBuffer: Uint8Array
// packetCount
sendPacketCount: number
// 送受信処理終了フラグ
receiveComplete: boolean
// 送受信結果
receiveResult: boolean
}
exp... |
5b14263c9e79b294973aa943ed2962ce3b96a29c | TypeScript | Youmenomi/catch-first | /src/index.ts | 3.15625 | 3 | export const CatchFirst = {
caught: 1,
done: 2,
} as const;
export function safeAwait<T>(promise: Promise<T>) {
return promise
.then((data) => {
return [null, data] as [null, T];
})
.catch((error) => {
return [error] as [unknown];
});
}
export function safeCall<T extends any[], R>(
... |
6e7ca70535ba113f2e2cd93a08282d8fb60f6aaa | TypeScript | origamirobot/inventory | /server/models/router/table.model.ts | 3.09375 | 3 | import { Chain } from './chain.model';
/**
* Tables are files that join similar actions. A table consists of several chains
*/
export class Table {
public chains: Chain[] = [];
constructor(init?: Partial<Table>) {
Object.assign(this, init);
}
}
/** The Filter table is the most frequently used one. It acts a... |
268ca6e49930ba2c992823a59ae2877b326d16c5 | TypeScript | dragonmaster-alpha/smarthealth | /smarthealth-javascript/EntityUpdateList.d.ts | 2.578125 | 3 | import EntityType from './EntityType';
/**
* Transfer object created from Java object au.com.smarthealth.server.rest.data.EntityUpdateList
*
* A list of entities to update
*
* Generated by Maven. See Java class GenerateTypeScript.
*/
interface EntityUpdateList<T> {
/** List entries need to correspond to the E... |
1867873e35e0816ffe20337820b0dfcfeb1314e0 | TypeScript | ArkEcosystem/core | /packages/core-snapshots/src/repositories/abstract-repository.ts | 2.671875 | 3 | import { Repositories } from "@arkecosystem/core-database";
import { ObjectLiteral } from "typeorm";
interface WhereExpression {
where: string;
parameters: ObjectLiteral;
}
export class AbstractRepository<TEntity extends ObjectLiteral> extends Repositories.AbstractRepository<TEntity> {
public async fastCo... |
dc2690f14b0d320abece820bcd3d57751bc3573d | TypeScript | hararm/RxJs_Course | /main_07.ts | 3.4375 | 3 | import * as Rx from "rxjs";
import {createSubscriber} from "./util/util";
/*
function arrayMap(array, projection) {
const returnArray = [];
for (let item of array) {
const projected = projection(item);
returnArray.push(projected);
}
return returnArray;
}
arrayMap([1, 2, 3], a => a * a)... |
2475aeac5a2a4764637464406c802130460f152d | TypeScript | juliethaguti/LaboratorioIII | /ClaseTypeScript/Perro.ts | 3.265625 | 3 | namespace animal{
export class Perro implements Animal{
private nombre:string = ""; //Por defecto público //si es privado hacer getter setter
//No existe la sobrecarga se haria el constructor con parametros y ?
constructor(nombre?:string){
if(nombre != undefined){
... |
caf8fc1ffb99c7c00100c5d549af2c216f764d3b | TypeScript | taiyokato/tsnode-template | /src/helpers/index.ts | 2.609375 | 3 | import * as crypto from 'crypto';
import { IRequestData } from '../interfaces/index';
export async function encodeUserData(userdata: IRequestData): Promise<string> {
try {
const shasum = crypto.createHash('sha1');
shasum.update(`${userdata.username}${userdata.password}`);
const dig... |
a0a8c2d538ac35915fb687eb2dfaf618e257dc2f | TypeScript | tmalahie/neo4j-workbench | /electron/storage.ts | 2.546875 | 3 | import * as storage from "electron-json-storage";
export const getItem = <T>({ key, defaultVal }): Promise<T> => new Promise((resolve, reject) => {
storage.has(key, (error, hasKey) => {
if (error)
reject(error);
resolve(hasKey);
});
}).then((hasKey) => new Promise<T>((resolve, reject) => {
if (!has... |
657aa525de113dc04cd533ca12e75097d01d2a75 | TypeScript | ilyachenko/Functional-TypeScript | /src/averageSalary_3.ts | 3.390625 | 3 | import Employee from './Employee';
type Predicate = (e: Employee) => boolean;
function and(predicates: Predicate[]): Predicate {
return (e) => predicates.every(p => p(e));
}
export default function averageSalary(employees: Employee[], conditions: Predicate[]): number {
let total = 0;
let count = 0;
... |
7b0078501520cdc392f21ca6f626cf6070ea6186 | TypeScript | talohana/remote-client-extension | /src/content_script.ts | 2.640625 | 3 | import { Messages } from "./models/messages.model";
let fps;
const times = [];
(function fpsHandler() {
window.requestAnimationFrame(() => {
const now = performance.now();
while (times.length > 0 && times[0] <= now - 1000) {
times.shift();
}
times.push(now);
fps = times.length;
fps... |
e9a78446e7b8aa197684044e22adfc7ee0c14701 | TypeScript | ZeeEssDoubleU/mathe | /src/utils/abbreviate.ts | 2.984375 | 3 | export const abbreviate = (input: string): string => {
switch (input) {
case "GRAMS":
return "g"
case "KILOGRAMS":
return "kg"
case "OUNCES":
return "oz"
case "POUNDS":
return "lb"
default:
return input
}
}
|
c97d62a6ff845d90f16d9c06361e26bdf3c9f137 | TypeScript | kidchenko/angular-typescript | /src/common/services/websiteService.ts | 2.515625 | 3 | /// <reference path="../../_app.d.ts"/>
module WebsiteService {
export class WebsiteItems {
static $inject = ['localStorage'];
constructor(public localStorage: StorageService.localStorage) {
}
// website model
website_items = this.localStorage.get("website_items") || [];... |
0971f4db42a4a2030d312356fba1dae43cf7621f | TypeScript | quantumalexa/BookWorks | /maxTS/courseWorkspace/typescript-complete-course/app_section5.ts | 3.84375 | 4 | // class Person {
// name: string;
// private type: string = 'default'; //from within the object
// protected age: number = 27; // accessible from inheritors of this class
//
// constructor(name: string, public username: string) {
// this.name = name;
// }
// printAge() {
// con... |
6a183975afa11306a103742569e7ef540d8147f5 | TypeScript | hieuxlu/typescript-questions | /bowling/bowling.ts | 3.046875 | 3 | import { Frame, FRAME_COUNT } from './frame';
export default class Bowling {
/**
* Acknowledgement: I have never played bowling
*/
constructor(private rolls: number[]) {}
score(): number {
if (!this.rolls) {
throw new Error('Rolls can not be null or empty');
}
let index = 0... |
681a000380836c3c51f1aa894c5a5c84756910a9 | TypeScript | David--K/WED2-testat | /src/services/todoStore.ts | 2.6875 | 3 | import Datastore = require('nedb');
import Todo = require('../models/todo');
const db = new Datastore({ filename: './data/todo.db', autoload: true });
class TodoStore {
add(todo: Todo, callback: (err: Error | null, newDoc: Todo) => void) {
console.log('add todo');
db.insert(todo, function (err: Error | null,... |
e2c06e3dae7884ef5a5cad8f55d226e0a8e944db | TypeScript | TOnodera/chatterman | /app/server/Domain/Message/MessageEditor.ts | 2.765625 | 3 | import AuthenticationException from '../../Exception/AuthenticationException';
import Exception from '../../Exception/Exception';
import Datetime from '../../Utility/Datetime';
import IMessageRepository from './Interface/IMessageRepository';
import MessageRepositoryFactory from './Factory/MessageRepositoryFactory';
imp... |