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 |
|---|---|---|---|---|---|---|
92a5ffa3c0f770c630cd7b0b9808c3694bc4a87a | TypeScript | bakesaled/avocado | /src/services/coordinate.service.ts | 3.265625 | 3 | import { Vehicle } from '../models/vehicle';
import { Coordinate } from '../models/coordinate';
import { Direction } from '../models/direction';
export class CoordinateService {
public static moveVehicle(vehicle: Vehicle) {
vehicle.move(this.getNextCoordinate(vehicle.currentCoordinate, vehicle.currentDirection))... |
e319b080220706c48c3f8e3304c09442a7d1aa78 | TypeScript | pokatomnik/file-server | /src/server.ts | 2.53125 | 3 | // Imports
import type {
KindResponse,
Request,
Response
} from "./types.ts";
import {
serve,
serveTLS,
resolve, extname, join,
ms,
renderFileToString,
html
} from "./deps.ts";
import { Cache } from "./Cache.ts";
import { Logger } from "./Logger.ts";
import {
canRead,
fileType,
toReadableSize
} from "./util... |
5a5bff969b22336cf26028b55ec73464ef0660bb | TypeScript | hardfist/stackoverflow | /packages/typescript/src/polymorphism/ad_hoc/adt/expr.ts | 3.84375 | 4 |
type Expr = Add | Mult | Num
type Num = {
kind: 'num',
val: number
}
type Add = {
kind: 'add',
left: Expr,
right: Expr
}
type Mult = {
kind: 'mult',
left: Expr,
right: Expr
}
function add(left: Expr, right: Expr){
return {
kind: 'add',
left,
right
} as const;
}
function mult(left: Ex... |
679d37a8438ebcc6daed015916404b3396ccaa08 | TypeScript | cunvoas/ecoledirecte.js | /lib/accounts/Teacher.ts | 2.515625 | 3 | import { Account } from "./Account";
import { Session } from "../Session";
import {
loginResSuccess,
teacherAccount,
isTeacherAccount,
} from "ecoledirecte-api-types/v3";
import { getMainAccount, fetchPhoto } from "../util";
export class Teacher extends Account {
public type: "teacher" = "teacher";
private accou... |
2feb7bbae9597063455978a505522ef3a8bf4d11 | TypeScript | snewell92/newhotness | /public/src/app/app.component.ts | 2.609375 | 3 | import { Component, ElementRef, Type } from '@angular/core';
@Component({
selector: 'my-app',
template: `<h1>Hello {{name}}</h1><p>In angular world and we see this page is {{page}}</p>`
})
export class AppComponent {
name = 'Angular';
page: string;
constructor(elm: ElementRef) {
this.page = e... |
edeafe670e36348449a0a6358b839487091cb074 | TypeScript | abnerFCR/OLC2-P2 | /src/interprete/Expresion/AccesoTipo.ts | 2.9375 | 3 | import { Instruccion } from '../Abstracto/Instruccion';
import { Expresion } from '../Abstracto/Expresion';
import { Entorno } from '../Simbolo/Entorno';
import { Retorno, Tipo } from '../Abstracto/Retorno';
import { Type_ } from '../Objetos/Type_';
import { Error_ } from '../Errores/Error';
export class AccesoTipo ex... |
dfc569bd3afcfb05cab0274d8586551108935060 | TypeScript | ahmetikrdg/TypeScript-Tutorial | /1.3-Function/function.ts | 3.578125 | 4 | //Ortalama hesaplaması yapan fonksiyon
function getAverage(a:number,b:number,c:number):string{//dışarıdan a,b,c değerlerini number olarak aldım ve geriye bunları hesaplama sonucu string olarak dön dedim
const result=(a+b+c)/3;// gelen paremetre toplanır 3'e bölünür
return 'result: '+result;//daha sonra ise sonu... |
bd22b9981816ccb6b6c6bf7b1a417c624011b48b | TypeScript | rbuetzer/kinder | /src/redux/sagas.ts | 2.609375 | 3 | import { call, put, select, takeEvery } from "redux-saga/effects";
import { TActionType } from "./types";
import { nameListActions } from "./nameListStore";
import { getNameIdsInStack, stackStoreActions } from "./stackStore";
import { pickRandomElement } from "../utils/array";
import { Action } from "redux";
import { a... |
b55385b727916ea66d5e797458bb5d44b5ebd640 | TypeScript | AlogyStudy/v-ts | /src/utils/sha1.ts | 3.109375 | 3 |
// base64(sha1(base64(sha1($password)) + $salt))
function Encode(this: any) {
var _ = this;
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
// 内部使用
var _utf8_encode = function (string: any) {
string = string.replace(/\r\n/g, "\n");
var utftext = "";
... |
3d34e5dc5ad9d42426835e5d322520a9c90f7e26 | TypeScript | mayacoda/CS370 | /demo/common/gui.ts | 2.84375 | 3 | import {GameScene} from "../../engine-lib/data";
import {randomRangeInt} from "../../engine-lib/utilities";
import {createElement} from "./gui-util";
import {createHighScoreButton, createPausePlayButton, createRestartButton} from "./gui-footer";
let timeout: number;
export function initGui(scene: GameScene,
... |
51e4dacec8211055c0fead14cc46fbda8008152c | TypeScript | mshivam76/image-filter-starter-code | /src/server.ts | 2.984375 | 3 | import express from 'express';
import bodyParser from 'body-parser';
import {filterImageFromURL, deleteLocalFiles} from './util/util';
(async () => {
// Init the Express application
const app = express();
// Set the network port
const port = process.env.PORT || 8082;
// Use the body parser middleware fo... |
3ce90137d22883631048253d5502a0659c0b6abb | TypeScript | Alvin-MXK/TypeScript | /高级类型/4索引类型.ts | 3.984375 | 4 | let obj = {
a: 1,
b: 2,
c: 3,
};
// function getValue(obj: any,keys: string[]){
// return keys.map(key => obj[key]);
// }
// console.log(getValue(obj,["a","b"]));
// console.log(getValue(obj,["c","f"]));
// 使用索引类型
function getValue<T,K extends keyof T>(obj: T, keys: K[]): T[K][] { // T[k][]表示,返回值必须是obj... |
f14b084dcb2692ef25c148ac65331143586e58b2 | TypeScript | matheusmoreira12/TypeScript-LINQ | /Linq/OrderedEnumerator.ts | 3.203125 | 3 | /// <reference path="../_references.ts" />
namespace TS
{
export namespace Linq
{
/**
* @class TS.Linq.OrderedEnumerator<T, TKey>
*
* @description The 'TS.Linq.OrderedEnumerator' class is used by the Linq sort functions where every subsequent call
* to a sort function operate on the partitio... |
d811c1571e51e626ff2052498efa2ab2507d314b | TypeScript | ammobinDOTca/ammobin-classifer | /build/get-counts.d.ts | 2.640625 | 3 | /**
* parse a store listing to determine the item quantity
* @param {string} str
* @returns {number} determined quantity, returns 0 if not found
*/
export declare function getItemCount(str: string): number;
|
ec704bec9800c715da44db64bf502df7d9fb080c | TypeScript | dhmw/dynamo-easy | /src/decorator/impl/model/model.decorator.ts | 2.75 | 3 | /**
* @module decorators
*/
import * as DynamoDB from 'aws-sdk/clients/dynamodb'
import { kebabCase } from '../../../helper/kebab-case.function'
import { ModelMetadata } from '../../metadata/model-metadata.model'
import { PropertyMetadata } from '../../metadata/property-metadata.model'
import { SecondaryIndex } from ... |
b4bde34512635ee40b5858ca914646b8dcc68107 | TypeScript | kristerkari/observable-redux-json-api | /src/utils.ts | 2.765625 | 3 | import { __assign } from "./assign";
import { AjaxResponse, Observable } from "./rxjs-imports";
export { __assign }; // workaround to stop TS removing __assign import as unused
export const jsonContentTypes = [
"application/json",
"application/vnd.api+json"
];
export const apiRequest = (url: string, options = {}... |
f87d972cc5b4bdeb0fb0d7e20145036bc3f5e831 | TypeScript | IoanaLaz/Catalog-Online | /frontend/src/app/entry-details-student.ts | 2.640625 | 3 | export class EntryDetailsStudent{
constructor(public courseName:string, public teacherName:string, public grade:number){
this.courseName = courseName;
this.teacherName = teacherName;
this.grade = grade;
}
} |
b5f813e3324a2b391e1e4c8fc90afa5cb8e453d2 | TypeScript | otaviohenrique1/curso-javascript-school-of-net | /javascript_estrutura_de_dados/typescript_recursividade/fila_com_prioridade.ts | 3.921875 | 4 | class FilaComPrioridade {
private elementos: Array<any> = [];
// LILO
// O último a entrar é o último a sair
// Inserir no final do array
// Remover no ínicio
constructor() {
this.elementos = [];
}
public inserir(dado: any, prioridade: number) {
var elem... |
67ec9f4ab7e18af00a3bff06fe73ad2e90d1bb3a | TypeScript | lydiacupery/leet-code | /add-two-numbers/add-two-numbers.test.ts | 3.765625 | 4 | import {Solution, ListNode} from './add-two-numbers'
/*
You are given two non-empty linked lists representing two non-negative integers.
The digits are stored in reverse order and each of their nodes contain a single digit.
Add the two numbers and return it as a linked list.
You may assume the two numbers do not co... |
a02ec41253af73d1e55b361ba007e32a8fe5a30f | TypeScript | dhamotharang/filink-build3 | /src/app/business-module/trouble/share/model/trouble-areaCodes.model.ts | 2.625 | 3 | /**
* 批量指派责任单位区域集合
*/
export class TroubleAreaCodesModel {
/**
* 标识位
*/
public flag: boolean;
/**
* 区域code集合
*/
public areaCodes: string[];
constructor() {
this.flag = true;
this.areaCodes = [];
}
}
|
fc853aee93d8e22d4c47af27b6990aee979f7755 | TypeScript | gcali/duetto | /fe/src/services/auth.ts | 2.6875 | 3 | const baseUrl = "https://localhost:5001/api/auth"
export class AuthService {
public async login(username: string, password: string): Promise<boolean> {
const endpoint = `${baseUrl}`;
const response = await fetch(endpoint, {
method: "POST",
body: JSON.stringify({username, pass... |
00a44fce3c541e8844c79d786a85177704aea642 | TypeScript | silky/morpheus-graphql | /scripts/local/hie.ts | 2.640625 | 3 | import { join } from "path";
import { StackPackage } from "../lib/check-packages/types";
import { readYAML, writeYAML } from "../lib/utils/file";
type Pkg = { path: string } & StackPackage;
const getPath = (path: string, src: StackPackage["library"]) =>
"./" + join(path, src["source-dirs"]);
const scanSub = (
co... |
827399a4ac462ac28f5e8b40287a8ab2508c4546 | TypeScript | tsigel/waves-frontent-meetups | /2019-04-29/interface.d.ts | 3.03125 | 3 | export interface IToPairs {
<T extends Record<keyof any, any>>(data: T): Array<[keyof T, T[keyof T]]>;
}
interface IPipe {
<A, B, R>(cb1: (a: A) => B, cb2: (b: B) => R): (a: A) => R;
<A, B, C, R>(cb1: (a: A) => B, cb2: (b: B) => C, cb3: (c: C) => R): (a: A) => R;
<A, B, C, D, R>(cb1: (a: A) => B, cb2: ... |
6b23ee9c569db8382a40ff7851b6014dace5cf1d | TypeScript | ruffythepirate/the-octopus-battle | /packages/common/src/dtos/PlayerControls.ts | 3.078125 | 3 | import {PlayerAction, PlayerControlsEventDto} from "../logic/events/GameEventDto";
export class PlayerControls {
left: boolean = false;
right: boolean = false;
up: boolean = false;
down: boolean = false;
constructor() {
this.left = false;
this.right = false;
this.up = false... |
1ac4f86caa27baae2c1371a3e6fe354993f37b2c | TypeScript | XeroAPI/xero-node | /src/gen/model/payroll-au/payRun.ts | 2.59375 | 3 | import { PayRunStatus } from '././payRunStatus';
import { PayslipSummary } from '././payslipSummary';
import { ValidationError } from '././validationError';
export class PayRun {
/**
* Xero identifier for pay run
*/
'payrollCalendarID': string;
/**
* Xero identifier for pay run
*/
'payR... |
cc8341e9d178b5310cdcde75efc964bc8e9cb399 | TypeScript | CollaboratorsCoding/saas-express-ts | /src/models/user.model.ts | 3.015625 | 3 | import * as mongoose from "mongoose";
import { UserAttrs, UserDoc, UserModel } from "../interfaces/user.interface";
const userSchema = new mongoose.Schema({
email: {
type: String,
required: true,
},
password: {
type: String,
required: true,
},
});
userSchema.statics.build = (attrs: UserAttrs) ... |
8937dbb84a82fe69a3a7d7e8d45ab68786095cd9 | TypeScript | hijiangtao/LeetCode-with-JavaScript | /src/house-robber/res.ts | 3.3125 | 3 | function rob(nums: number[]): number {
if (!nums.length) {
return 0;
}
const dp: number[] = new Array(nums.length).fill(0);
for (let i = 0; i < nums.length; i++) {
if (i === 0) {
dp[i] = nums[i];
} else if (i === 1) {
dp[i] = Math.max(nums[i], dp[i-1]);
... |
da97e55240ee46859a7b03cc4aa30e124438212d | TypeScript | wwlee94/typescript-book-rental-assignment | /src/entity/Rental.ts | 2.71875 | 3 | import { BaseEntity, Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { Book } from './Book';
import { User } from './User';
@Entity()
export class Rental extends BaseEntity {
@PrimaryGeneratedColumn()
id!: number;
// Rental(*) <-> User(1)
@ManyToOne(type => User, u... |
b97d4f49894149ac6588f7c2f4ae88c7576509a0 | TypeScript | airhorns/superpro | /app/javascript/types/skip_list.d.ts | 2.875 | 3 | declare module "skip_list" {
class NodeData<T> {
key: string;
value: T;
level: number;
prevKey: string[];
nextKey: string[];
prevCount: number[];
nextCount: number[];
}
class Node<T> extends NodeData<T> {
constructor(key: string, value: T, level: number, prevKey: string, nextKey: ... |
7e1e1f86dbc9e8019bbd240efc90a87cf3175f25 | TypeScript | future4code/Joao-Moura | /semana15/projeto-backend-todolist/src/utils/utils.ts | 2.828125 | 3 | export enum STATUS {
"TODO" = "To_Do",
"DOING" = "Doing",
"DONE" = "Done"
}
export type user = {
id: number,
name: string,
nickname: string,
email: string,
}
export type task = {
id: number,
title: string,
limitDate: string,
creatorUserId: string,
status: STATUS
}
e... |
42baa923ab21d7779bbf33e4c155c6256bab371a | TypeScript | YonaBenReuven/socket.io-react | /hooks/useStateOn.ts | 2.703125 | 3 | import { useState } from "react";
import { useOn } from ".";
const useStateOn = (event: string, initialState: any): [any, React.Dispatch<any>] => {
const stateTuple = useState<any>(initialState);
const [, setState] = stateTuple;
useOn(event, (nextState: any) => {
setState(nextState);
});
... |
58ef14967d0a42bf79b7cef2f69f72897376e3a3 | TypeScript | falconmick/testable-typescript | /src/ManualDiMethod/AddressAutofillController.ts | 3.421875 | 3 | import { AddressSearchResult, AddressSearchType } from "./AddressSearchService";
import { UpdateAddressType } from "./AddressAutofillActions";
import { Address } from "./Address";
// All testable services are created with the following type
// type InjectableService = (...injectables: any[]) => (...args: any[]) => any... |
f7412dd19df4f46e63e52dfa250c4756b8a7b47b | TypeScript | marcusbalbi/study | /udemy/typescript-the-complete-developers-guide/server/src/controllers/LoginController.ts | 2.75 | 3 | import { Request, Response } from "express";
import { requireAuth } from "../middlewares/requireAuth";
import { get, controller, post, use, bodyValidator } from "./decorators";
@controller("")
export class LoginController {
// @get("/add")
// add(a: number, b: number) {}
@get("/")
main(req: Request, res: Res... |
832d2371de3b40822b02869ae38d4f21065ace69 | TypeScript | JessicaBunyan/todo-list | /back/todo-list/todo-list.service.ts | 2.890625 | 3 | import { TodoList } from "./todo-list.model";
import { mockData } from "./todo-list-mock-data";
export class TodoListService {
private static instance: TodoListService;
private lists: { [key: string]: TodoList } = mockData;
public static getInstance() {
if (TodoListService.instance) {
return TodoListS... |
0f748881a5083c663bb54ef6727f02f68265198c | TypeScript | wraith13/vertical-line-vscode | /src/extension.ts | 2.609375 | 3 | 'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';
/*
import localeEn from "../package.nls.json";
import localeJa from "../package.nls.ja.json";
interface LocaleEntry
{
[key : ... |
1952b0bd4f6b532447ae3e1ca90c8ac702a414f6 | TypeScript | iconic-king/chess-bet-functions | /functions/src/domain/ServiceAccount.ts | 2.546875 | 3 | export class ServiceAccount {
public id!: string;
public name!: string;
public accountId!: number;
public userId!: string;
public phoneNumber!: string;
public email!: string;
}
export interface ServiceAccountDTO {
userId: string,
email: string,
name: string,
phoneNumber: string,
servic... |
a71ec4b313d08fe147cc0ed6f7c9924b32a7fb6d | TypeScript | ChiantiYZY/hw06-city-generation | /src/Building.ts | 2.5625 | 3 | import { vec2, vec3, mat4, mat3 } from 'gl-matrix';
import Turtle from './Turtle';
import Expansion from './Expansion';
import Draw from './Draw';
import { readTextFile } from './globals';
import Mesh from './geometry/Mesh';
export default class Building {
cubeCount: number;
cubeHeight: number;
transl... |
bcee74895d5003cec5c931947c7d0e89b965f239 | TypeScript | dOrgTech/mutations | /packages/mutations/src/__tests__/mutations.test.ts | 2.5625 | 3 | import gql from 'graphql-tag'
import 'cross-fetch/polyfill'
import {
createMutations,
Mutations,
MutationContext,
MutationStates,
} from '../'
import { MutationStatesSubject } from '../mutationState'
const schema = `
type Mutation {
testResolve: Boolean!
secondTestResolve: Boolean!
dispatchState... |
04886d3016b0c564f6c053b1a8007f2ea7474d99 | TypeScript | sachinsinghsk13/The-Tech-Forums | /src/model/post.ts | 2.6875 | 3 | import User from "./user";
import Topic from "./topic";
import { getTime } from "../util/dateFormat";
export default class Post {
public prettyDate: string | undefined;
public postId: number | undefined;
public content: string | undefined;
public datePosted: Date | undefined;
public postedBy: User... |
ec29374a4fdddd715bb95240755dc2167a3d558f | TypeScript | xiaolilir/LayaMiniGameFrame | /src/dMyGame/ConfigProxy/SkinConfigProxy.ts | 2.734375 | 3 | import { SkinConfig } from "../_config/SkinConfig";
import BaseConfigDataProxy from "../../aTGame/Config/RootDataProxy";
/**
* 皮肤数据处理类
*/
export default class SkinConfigProxy extends BaseConfigDataProxy<SkinConfig.config> {
//
private static _instance: SkinConfigProxy;
/** 单例 */
public static get inst... |
9c7babf6b1f4104464a3a9274ed4feb64fe716eb | TypeScript | strongui/jodit | /src/core/helpers/normalize/normalize-css-value.ts | 2.90625 | 3 | /*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2023 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
import { isNumeric } from 'jodit/core/helpers/checker/is-num... |
0ad4efb09646b9ee040000f14b694653db155aa9 | TypeScript | LaKhDaR619/bangalore_challenge_backend | /src/features/timeLogs/controllers/timeLog.controller.ts | 2.625 | 3 | import { Request, Response, Router } from 'express';
import validationMiddleware from '../../../middlewares/dataValidator';
import Controller from '../../../shared/interfaces/controller.interface';
import AddTimeLogDTO from '../dtos/addTimeLog';
import TimeLogService from '../services/timeLog.service';
class TimeLogsC... |
458055167aa1df5108f10cd0f5a6bdcbc49cdc74 | TypeScript | trebler/Messenger | /authservice/src/utils/respondtext.ts | 2.515625 | 3 | import { STATUS_CODES } from 'http';
import type { ServerResponse } from 'http';
export const respondText = (
res: ServerResponse,
statusCode: number,
extraHeaders: Record<string, string> = {}
): void => {
const body = STATUS_CODES[statusCode];
return res
.writeHead(statusCode, {
... |
4ef47bae98f9612e7500c7f27d029a10f45d6da1 | TypeScript | pasqualintosh/react-redux-ts-caldaiapiatto | /src/domains/watches/type.d.ts | 2.828125 | 3 | export interface IWatch {
id: string;
name: string;
}
export interface IWatchState {
watches: Array<IWatch>;
}
export interface IWatchAction {
type: string;
wacth: IWatch;
}
export type DispatchType = (args: IWatchAction) => IWatchAction;
|
8e8367de8b46f452b2b57c158f5c6f7eef0dbb3a | TypeScript | blslade-neumont/agile-html5-game | /src/engine/audio-source-object.ts | 2.640625 | 3 | import { GameObject, GameObjectOptions } from './game-object';
import { GameScene } from './game-scene';
import { AudioT } from './utils/audio';
import merge = require('lodash.merge');
export interface AudioSourceObjectOptions extends GameObjectOptions {
shouldLoop?: boolean
}
export class AudioSourceObject exte... |
58d0911f37cc3ff8662f1ae735c9dbbbd03d47e6 | TypeScript | KranteshSingh/TypeScript | /04 Function Parameters/02RestParameter.ts | 3.078125 | 3 | let allPeopleIWantToInvite:string[] = []
let pushToPartyList = (...people:string[])=>{
console.log(people)
let newPeopleArray = people
allPeopleIWantToInvite = allPeopleIWantToInvite.concat(newPeopleArray)
console.log(allPeopleIWantToInvite)
return allPeopleIWantToInvite
}
pushToPartyList("Aditya"... |
46869b973075dc57208367dd58db368ecc806d2f | TypeScript | santhoshkumarch/addressCrud | /src/app/in-memory-data.service.ts | 2.875 | 3 | import { InMemoryDbService } from 'angular-in-memory-web-api';
import { Address } from './address';
export class InMemoryDataService implements InMemoryDbService {
createDb() {
const add_res = [
{ id: 1, firstname: 'Santhosh', lastname: 'Kumar', address1: '1299 Park Avenue', address2: 'Manhattan', city: 'N... |
fcc012664a9ff555f99600c6ab89848998a54ef8 | TypeScript | tarsupin/deno-sqlite | /mod.ts | 2.765625 | 3 | import { DB } from "./src/db.js";
import { Empty } from "./src/rows.js";
import { Status } from "./src/constants.ts";
import SqliteError from "./src/error.ts";
/**
* open
*
* Open a new SQLite3 database. The file at
* the path is read and preloaded into the database.
*
* ?> Unlike the SQLite3 C library, this wil... |
28b7822f829a3dcd91570c69665d7bcb0744dc89 | TypeScript | eoodin/shelf | /frontend/src/app/htmltext.pipe.ts | 2.5625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'htmltext'
})
export class HtmltextPipe implements PipeTransform {
private domPaser;
transform(value: any, args?: any): any {
if (value == null) { return ''; }
if (typeof value !== 'string') {
throw new Error('html text pipe cannot... |
23d7677e1df99cf6cef3509b230aefe30f9df5fd | TypeScript | map-c/koa-service | /src/utils/jwt.ts | 2.734375 | 3 | import Application from 'koa'
import jwtGenerator, {
SignOptions,
TokenExpiredError,
VerifyOptions
} from 'jsonwebtoken'
import { RouterContext } from 'koa-router'
class Token {
/**
* 令牌的 secret 值,用于令牌加密
*/
public secret: string | undefined
/**
* access token
*/
public accessExp: number = 60... |
b17d56b9c21bbaf0b543c153b0290f1cf3e6fd83 | TypeScript | ryepup/c4-lab | /src/core/codegen.ts | 2.78125 | 3 | import * as lz from 'lz-string'
import Viz from 'viz.js'
type elementCreator = (tagName: string) => HTMLElement
/**
* convert a graph from DOT text to SVG
*/
export const toSvg = (dot: string) => Viz(dot, { format: 'svg', engine: 'dot' }) as string
/**
* convert a text representation to an URI-encoded representat... |
4ea90867a665f5c4769008a3b78acccd55da4b63 | TypeScript | aiduc93/realworld-angular | /src/app/models/user.ts | 2.859375 | 3 | export interface User {
bio: string;
createdAt: string;
email: string;
id: number;
image: string;
token: string;
updatedAt: string;
username: string;
password?: string;
}
export class UserResponse implements User {
bio: string;
createdAt: string;
email: string;
id: n... |
894613232c89d836426bd4f63537a1f7484d8462 | TypeScript | bgruening/ngl | /dist/declarations/utils/netcdf-reader.d.ts | 2.859375 | 3 | /**
* @file Netcdf Reader
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @private
*
* Adapted from https://github.com/cheminfo-js/netcdfjs
* MIT License, Copyright (c) 2016 cheminfo
*/
import IOBuffer from './io-buffer';
export interface NetCDFRecordDimension {
length: number;
id?: number;
... |
e4c12e89b47171dcbcd77e570f7a0dee136ff8a3 | TypeScript | Auggustos/sistema-gestao-vidracaria | /projeto-vidracaria/backend/src/modules/products/services/CreateProductService.ts | 2.625 | 3 | import Product from '@modules/products/infra/typeorm/entities/Product';
import IStorageProvider from '@shared/container/providers/StorageProvider/models/IStorageProvider';
import AppError from '@shared/errors/AppError';
import { injectable, inject } from 'tsyringe';
import IProductsRepository from '../repositories/IPro... |
2c52281aa588372fa0f5aebf9468ee701bc24693 | TypeScript | Sid12869/mikaela | /src/commands/fun/lonely.ts | 2.640625 | 3 | import { Command } from '../../classes/Command';
const koroneLink =
'https://cdn.discordapp.com/attachments/702091543514710027/820638857396617226/Korone_you_are_lonely_lonely_lonely.mp4';
export const command: Command = {
name: 'lonely',
description: 'Posts a video of Korone telling you how lonely you are 😢... |
147b9adbe124fe05e5d5e489338f787dbdcd14d0 | TypeScript | samdiano/book-a-meal-api | /v2/src/orders/order.model.ts | 2.59375 | 3 | import { AllowNull, BelongsTo, BelongsToMany, Column, DataType, Default, ForeignKey, HasMany, IsUUID, Model, PrimaryKey, Table } from 'sequelize-typescript';
import { User } from '../users/user.model';
import { Meal } from '../meals/meal.model';
import { OrderItem } from './orderItem.model';
import { Notification } fr... |
fa1259320c08fc9eca7c7aa1375b1082e1e64307 | TypeScript | FunCloud/NodeRocket2 | /server/sys/util/stringUtil.ts | 3.203125 | 3 | /**
* 字符串处理工具类
* @author dapaer
*/
export default class stringUtil{
/**
*获取Action名称
*url url
**/
static getActionName(url) {
var expStr = url.split('!');
var tempArr = expStr[0].split('/');
return tempArr[tempArr.length - 1];
}
/**
*获取Action名称
*url url
**/
static getMethodName(url) {
var arr... |
e1ec73a71967128ac2e003754e7214d94ae7d067 | TypeScript | MrZhouZh/awesome-validator | /test/rules/contains.ts | 2.90625 | 3 | import { assert } from 'chai';
import { AbstractRule } from '../../src/rules/abstract-rule';
import { Contains } from '../../src/rules/contains';
describe('Contains', () => {
class Foo {
/**
* bar
*/
public bar: string = 'foobar';
}
it('is rule', () => {
assert.i... |
570c86590b06f5bf712cd7fa3756e6b2e7e328dd | TypeScript | wandyezj/standard-node | /src/lib/equivalentLists.ts | 3.84375 | 4 | /**
* checks if two lists have the same values in the same order using the default comparison operator.
* @public
* @param a - a list
* @param b - a list
* @returns true if both lists have the same values in the same order.
*/
export function equivalentLists(a: string[], b: string[]): boolean {
if (a.length !... |
ed8f2b2944938d159bad57cc25fbc083789a50d1 | TypeScript | Nesci28/PubAuCochonFume | /server/helpers/jwt.helper.ts | 2.765625 | 3 | import * as jwt from "jsonwebtoken";
import { User } from "../interfaces/user.interface";
const JWT_SECRET = process.env.JWT_SECRET;
class JWTHelpers {
constructor() {}
async getId(token: string): Promise<string> {
token = this.cleanToken(token);
return new Promise<string>((resolve, _) => {
resolve... |
815bdf66edaa40323206982a3a9e30baae1595bd | TypeScript | Li357/WHS | /packages/app/src/reducers/elearningPlans.ts | 2.53125 | 3 | import { ELearningPlansState, ELearningPlansAction, ELearningPlansActions } from '../types/store';
import { initialELearningPlansState } from '../constants/store';
export default function elearningPlansReducer(
state: ELearningPlansState = initialELearningPlansState,
action: ELearningPlansAction,
) {
switch (act... |
d8a2c8457cc7fc03bf742201a24a54ea70718727 | TypeScript | Aakashdeveloper/May_ang_mrng | /firstapp/src/app/shared/star.component.ts | 2.8125 | 3 | import { Component, OnChanges,
OnInit, OnDestroy, Input,
Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-star',
templateUrl: './star.component.html',
styleUrls: ['./star.component.css']
})
export class StarComponent implements OnChanges, OnInit, OnDestroy {
// ... |
8f3b0b9583ec23a2f8fe28bc4e5a29322f6f7f19 | TypeScript | fwpushan/fresh-forms | /packages/web/src/store/modules/student/student.ts | 2.984375 | 3 | export class StudentState {
profile!: StudentProfile;
}
export class StudentProfile {
name?: string;
age?: string;
birthdate?: string;
givenNames?: string;
lastName?: string;
email?: string;
emailVerified?: string;
familyName?: string;
gender?: string;
givenName?: string;
middleName?: string;
}... |
c7223d9fd4be4ebc2e9b5a78a3fc45f7bc26c816 | TypeScript | ndf1997/whentomeet | /frontend/src/types/Member.ts | 2.75 | 3 | import PropTypes from 'prop-types';
import { Day, DayPropType } from './Day';
import { days as d } from './constants';
export class Member {
meeting_id: string;
member_id: string;
name: string;
days: Day[];
pollingChoice?: number;
constructor(meeting_id: string = '', member_id: string = '', name: string ... |
cc2b48dc79b535557c279908d348213cacce421b | TypeScript | azael1412/angular-input-image | /src/app/hello.component.ts | 2.671875 | 3 | import { Component, forwardRef, HostBinding, Input, HostListener, ElementRef, OnInit } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
@Component({
template: ' <input class="file-input" type="file">',
selector: 'app-custom-input',
providers: [
{ provide: ... |
04ac8eec5cc68e4af92b9f602deebda744632a9b | TypeScript | AStaroverov/minesweeperonline | /lib/Renderer/examples/triangles/worker.ts | 2.5625 | 3 | import { scheduler, TaskQueue, Task } from '../../../Scheduler';
import { render } from '../../src/render';
import { TComponentData } from '../../src/types';
import { BaseComponent } from '../../src/BaseComponent';
import { createElement, withDeclarativeSetChildren } from '../../src/mixins/withDeclarativeSetChildren';
... |
dea47add6a46e357b353cc21d882c50b5b6486d5 | TypeScript | annapoliswu/CISC474-Backend | /backend/src/security/userModel.ts | 3.09375 | 3 | import bcrypt from 'bcrypt';
//represents a user in the system
export class UserModel{
id?='';
email = '';
private _password='';
favorites:Array<string> = []; //["test", "5eb5a1fbe2e28b1d9c2aafc2"]
listings:Array<string> = [];
//when user password is set through here, it is stored encrypted
... |
5705f88e1e8b82d961ab91b5637f72907ea41a5c | TypeScript | benhawley7/FUT-DB | /src/players/types.ts | 2.90625 | 3 | /**
* @file Contains types and constants relevant to the players
* @package fut-db
* @author Ben Hawley
* @copyright Ben Hawley 2020
*/
/**
* List of Numeric Fields for Player Objects
*/
export const numFields = [
"rating",
"pace",
"shooting",
"passing",
"dribbling",
"defending",
"ph... |
7aa83504098cbffa08d7883be411c1c20de9f8ba | TypeScript | LaserFlash/qcyc-usagemaintenancetracker | /src/app/core/constants/known-boats/known-boats.service.ts | 2.515625 | 3 | import { Injectable } from '@angular/core';
import { Boat, BoatID } from '../../objects/boat';
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/firestore';
import { Observable } from 'rxjs/Observable';
import { map } from 'rxjs/operators';
import { BehaviorSubject } from 'rxjs/Behavior... |
2957c5b049122f5a0b9ef6ad7d8f499b4fc61c19 | TypeScript | AlexCovizzi/vscode-sqlite | /tests/fixtures/index.ts | 2.53125 | 3 | import { join, basename } from "path";
import { randomString } from "../../src/utils/utils";
export namespace Fixture {
export const DATABASE_MAIN = "main";
export const DATABASE_EMPTY = "empty";
export interface Database {
name: string;
path: string;
tables: {
name: st... |
64ba8e245530b51674a840d9e043dfb3cc69240a | TypeScript | tracernz/igniter | /src/Renderer.ts | 2.8125 | 3 | import { Task } from './Library/Contracts/Task';
export default async (task: Task, refreshRate = 100) => {
const spinner = ['◜', '◠', '◝', '◞', '◡', '◟'];
const render = () => {
process.stdout.write('\x1Bc');
const spinnerChar = spinner.shift();
spinner.push(spinnerChar);
const... |
971113b2fa252f8d22af98e3e62b99950aedbfbf | TypeScript | SamuelDrews/wirvsvirus_diy_masks | /src/ts/react/pudos/formatDistance.ts | 2.53125 | 3 | export default (x: number) => {
if (x < 1) { return Math.floor(x * 1000) + ' m' }
return Math.floor(x * 10) / 10 + ' km'
}
|
39c1137c166cdffd36c969b266fcb748cfaac6a9 | TypeScript | Fice/jst | /src/encodeToken.ts | 3.625 | 4 | // The `encodeToken` function encodes a string for use as a JSON pointer token
// replacing the values '~' with '~0' and '/' with '~1'.
// ## Usage
//
// ```javascript
// import { encodeToken } from '@jdw/jst';
//
// encodeToken('~/home') // '~0~1home'
// ```
//
// **Arguments**
// - `token: string A string to encode
... |
aff7149bf062465998ace9e4f09368c51562af18 | TypeScript | dralc/ng-pipes | /src/app/sort.pipe.ts | 2.6875 | 3 | import { Pipe, PipeTransform, ElementRef } from '@angular/core';
import { ServerInfo } from './serverInfo.model';
@Pipe({
name: 'sort',
pure: false
})
export class SortPipe implements PipeTransform {
/**
* Sorts an Array of Objects by the object <key>'s value
* @returns The sorted <inputAr>
*/
transf... |
f95f836a7d6b7718746510e6f9edc73be7d00b7f | TypeScript | ksanman/bike-estimator | /src/app/part.service.ts | 2.578125 | 3 | import { Injectable } from '@angular/core';
import { Part } from './part';
import { BehaviorSubject, Observable, of } from 'rxjs';
@Injectable()
export class PartService {
private parts: Part[] = [
{id: 0, category: { id: 1, name: 'Frame'}, name: 'Santa Cruz Blur', price: '$2999.99', weight: '2700'}
];
priv... |
212013d93d59129d9c68f5b101e088103867992a | TypeScript | ecologylab/BigSemanticsJavaScript | /src/downloaders/ServiceRepoLoader.ts | 2.578125 | 3 | /**
* Helper for caching repository from BigSemantics web service.
*/
import * as Promise from 'bluebird';
import ParsedURL from '../core/ParsedURL';
import { Repository } from '../core/types';
import RepoMan, { RepoOptions } from '../core/RepoMan';
import { Downloader } from '../core/Downloader';
import { RepoLoade... |
1c5d2e089b8ecc5f61052a005f73627975d77d6c | TypeScript | cvimbert/reverted-template | /src/reverted-template.class.ts | 2.921875 | 3 | import {Expressions} from "./expressions.class";
import {TemplateGroup} from "./template-group.class";
import {GroupType} from "./group-type.enum";
export class RevertedTemplate {
private groups: TemplateGroup[] = [];
constructor(
templateText: string,
contentFormat: string = "([A-Za-z0-9]+)"... |
31309107857d5f58392f5a7266d3a0d3f8802e3e | TypeScript | Aszparuh/Design-Patterns | /StructuralPatterns/Facade/Player.ts | 3.140625 | 3 | import IPlayer from "./IPlayer";
import MediaEntry from "./MediaEntry";
class Player implements IPlayer {
private readonly playList!: MediaEntry[];
private currentIndex: number = 0;
constructor() {
this.playList = new Array<MediaEntry>();
}
Play(): void {
if (this.playList.length ... |
f7037555c946ede0d2d96aec972f9c7d2c7038b5 | TypeScript | zxhfighter/measure | /src/component/overlay/dynamic-component.service.ts | 2.75 | 3 | import {
Injector,
Injectable,
TemplateRef,
ViewRef,
ElementRef,
EmbeddedViewRef,
ViewContainerRef,
Renderer2,
RendererFactory2,
ComponentRef,
ComponentFactory,
ComponentFactoryResolver
} from '@angular/core';
import { ConnectionPosition } from './position.interface';
imp... |
85fed01ddc0e2888573059a8a781d28c2336f46a | TypeScript | MingZhang-PS/product | /src/app/actions/products.action.ts | 2.59375 | 3 |
import { Action } from '@ngrx/store';
import { Product } from '../models/Product';
export enum ProductsActionTypes {
LoadProducts = '[Products] LoadProducts',
AddProduct = '[Products] AddProduct',
AddProductSuccess = '[Products] AddProductSuccess',
DeleteProduct = '[Products] DeleteProduct',
Upda... |
e00f682f0fd978f0bb98260724da0e3ac55be23d | TypeScript | guryanov-a/d3-heat-map | /src/stores/HeatMapStore.ts | 2.640625 | 3 | interface MonthlyVarianceInterface {
year: number;
}
interface HeatMapDataInterface {
monthlyVariance: MonthlyVarianceInterface[];
baseTemperature: number;
}
class HeatMapStore {
data: HeatMapDataInterface;
}
export const heatMapStore = new HeatMapStore(); |
740d4f944e7ff4ee3c8190fd93e65882aa3b7aab | TypeScript | austinevov/sage-tour-studio | /src/packages/sage-tour/src/core/lod/LODManager.ts | 2.828125 | 3 | import LODNode from './LODNode';
export default class LODManager {
private isPreloaded: boolean;
private lod: LODNode;
private gl: WebGLRenderingContext;
constructor(id: number) {
this.lod = new LODNode(id, 512, 0, 5);
this.lod.next = new LODNode(id, 1024, 1, 5);
}
public initialize = (gl: WebGL... |
0a80463b2c2a1ce5299a8528341da6a115d76b06 | TypeScript | ShahriyarSheikh/Safe-quote-commenting | /Backend/src/model/request-models/user/userForgotPassword.model.ts | 2.796875 | 3 | import { IsEmail } from "class-validator";
export class UserForgotPassword {
@IsEmail()
private _email: string;
get email(): string {
return this._email;
}
set email(name: string) {
this._email = name.toLowerCase();
}
} |
d2faa224c4c2bd531aa428601c6fc3a17406810f | TypeScript | sunyang-629/the-movie-db-react | /src/client/actions/movies.ts | 2.828125 | 3 | import {
IAction,
IGetMoviesResponse,
IProcessedMoviesResponse,
} from '../interfaces/actions';
import fetch from '../../common/utils/fetch';
// action types
export const ERROR_RECEIVING_MOVIES = 'ERROR_RECEIVING_MOVIES';
export const GET_MOVIES = 'GET_MOVIES';
export const HANDLE_INPUT_CHANGE = 'HANDLE_I... |
8e17da3ea202e33f98ed8be902842b83d52b35bd | TypeScript | shk1993/DynamicUI | /src/util/NextQuestionParser.ts | 2.765625 | 3 | import { Grammar, Parser } from 'nearley';
import { IAnswers } from '../interfaces/answers';
import {
ICondition,
IConditional,
IDEIDFunction,
INextQuestion,
IQuestionReturn,
IQuestionValue,
} from '../interfaces/nextQuestion';
import { map } from '../state/stateHandler';
let grammar: Grammar;
let parser: ... |
dc9c6b5104840b4b42f8cb8e7c3cd1310fbcbe0f | TypeScript | dogstarYT/BeatBox | /TS/model.ts | 2.578125 | 3 |
let model = {
positions: [] as Array<{
x: number, y: number, fileName: string, beat: number
}>,
files: [] as Array<{ fileName: string, beats: Array<boolean>, audio: HTMLAudioElement }>,
lenght: 0,
steps: 0,
heightS: 0,
widthS: 0,
leftShift: 200,
reLoadModule: ((... |
6554b27aded39b1984994da944e5e8c59cd5c78b | TypeScript | ddaras/dropzone | /src/hooks/useApi.ts | 2.53125 | 3 | import { useMutation, useQuery } from '@apollo/client';
interface IOptions {
variables?: object;
hasInput?: boolean;
onSuccess?: (res: any) => void;
onCompleted?: (data: any) => void;
}
interface IResponse {
call: (options?: object) => any;
data?: any;
loading?: boolean;
}
const useApi = (mutationOrQuery: any... |
f295a5162ff3aa7fa55f252059e5c2c982277eae | TypeScript | luorixiangyang/Blog-code | /front_end/scheme/scheme_event_emitter/src/observable/index.ts | 3.015625 | 3 | import EventEmitter from '../emitter';
import { Observable, ObservableListener } from './interface';
/**
* 创建一个可观察对象
* 内部使用 Proxy 代理
* @param obj
* @returns
*/
const createObservable = <T extends Object>(obj: T): T & Observable<T> => {
const ON_DATA_UPDATE = 'ON_DATA_UPDATE';
const emitter = new EventEmitter<... |
c2acf25bf756f6f0a13dec1baeee532dc654707d | TypeScript | rands0n/hoje-tem-live | /src/services/lives.ts | 2.625 | 3 | import {chunk, removeDuplicates} from 'utils/array';
import {getRandomInt} from 'utils/number';
import {Genre, GenreMapping, Live, LivesHub} from 'schemas/api';
import {getBaseData} from 'services/_base';
// Utils
const mapLives = (allLives: Live[], allGenres: Genre[]) => {
// Featured Lives
const validLives = ... |
2c03412aa8ef6832804a8ad7ad0811c79e683264 | TypeScript | codestothestars/react-pivot-table | /src/aggregation/DefaultAggregators.ts | 2.578125 | 3 | import { Aggregator } from './Aggregator';
/**
* The default aggregators provided for use in the pivot table.
*/
export interface DefaultAggregators {
/**
* Sums numeric metrics.
*/
sum: Aggregator<number>;
}
|
cbefcafb7fd06e702f6f668f1e6c150d4e1cc5d2 | TypeScript | rafaneri/phychips-rcp | /lib/rcp-manager.ts | 2.546875 | 3 | import { Packet } from './packet';
import { Util } from ".";
import { EventEmitter } from 'events';
export class RcpManager extends EventEmitter {
private preamble: number = 0xBB;
private endMark: number = 0x7E;
private byteRxPkt: Buffer;
private rcpReceivedPacket: boolean;
private rcpReceivedPacke... |
0b6fd9f6b2854b7dd69d5ab1195f00b38bf9e109 | TypeScript | LucasAurelio/alocca | /alocca/src/app/requests/request-access/request-access.component.ts | 2.53125 | 3 | import { Component, OnInit } from '@angular/core';
import { FirebaseService } from '../../services/firebase.service';
import { Request } from '../request.model';
import { Router } from '@angular/router';
import { SnackbarService } from '../../services/snackbar.service';
@Component({
selector: 'app-request-access',
... |
cfc77cc3f83cce592e1a0bf859a2763808710d82 | TypeScript | oanaariana/office-portofolio | /src/app/office-portofolio/models/building-vm.model.ts | 2.71875 | 3 | // Interface for the buildings.
export interface Building {
address: string;
code: string;
id: number;
latitude: number;
longitude: number;
}
|
1d5a6d10198775b140ff47b56b0c7d448f179d32 | TypeScript | laogong5i0-2/turbox | /packages/reactivity/src/decorators/mutation.ts | 2.765625 | 3 | import { store } from '../core/store';
import { CURRENT_MATERIAL_TYPE, EMPTY_ACTION_NAME } from '../const/symbol';
import { bind, convert2UniqueString, isPromise } from '../utils/common';
import { Mutation, BabelDescriptor } from '../interfaces';
import { invariant, fail } from '../utils/error';
import { quacksLikeADec... |
e38ba2735c10595735b4d713b5407a1441d36e8d | TypeScript | fernandomiras1/UDEMY | /CLARO/guardias-angular/src/app/pipes/truncate.pipe.ts | 2.65625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'truncate'
})
export class TruncatePipe implements PipeTransform {
transform(str: string, limit = 10): string {
if(str.length > limit) {
str = str.substring(0,limit) + '...';
}
return str;
}
}
|
7c63320d9dff881a85bb738aabf4100538cfbb86 | TypeScript | bngesp/angular | /src/app/list-person/list-person.component.ts | 2.65625 | 3 | import { Component, OnInit } from '@angular/core';
// @ts-ignore
import {Personne} from '../classe/personne';
@Component({
selector: 'app-list-person',
templateUrl: './list-person.component.html',
styleUrls: ['./list-person.component.css']
})
export class ListPersonComponent implements OnInit {
personnes = [
... |
72e87e15cd483a1c61cb54092738b08293ceb0a4 | TypeScript | vicsmr/payment-gateway | /src/PGateway.ts | 2.671875 | 3 | import { PaymentMethod } from "../models/PaymentMethod";
import { Price } from "../models/Price";
export abstract class PGateway {
private price: Price;
private paymentMethod: PaymentMethod;
abstract pay();
abstract reimburse();
getPrice(): Price {
return this.price;
}
setPrice(... |
626a06bea449a14185c0f1ac6e9ace39cf72a592 | TypeScript | Sharky666/setClient | /src/app/common/interfaces/common.d.ts | 2.578125 | 3 | export interface ApiResponse <T> {
result: T;
error: string;
} |
c7f3d974ffb747ca2fba111f19d302a512d97fa6 | TypeScript | azizj1/advent-of-code | /src/2020/4b.ts | 2.890625 | 3 | import { timer } from '~/util/Timer';
import { getSimulations, Passport, Simulation } from './4';
interface Rule {
isValid(passport: Passport): boolean;
}
class YearRule implements Rule {
constructor(
private readonly key: string,
private readonly minYear: number,
private readonly maxYear: number
) ... |
4cb0668f30991e53454a7175485cf4adf5ed856b | TypeScript | IvanJosipovic/AutoSPInstallerOnlineGithubPage | /App/Directives/stringToNumberDirective.ts | 2.546875 | 3 | /// <reference path="../../typings/tsd.d.ts" />
(function () {
"use strict";
class StringToNumber implements angular.IDirective {
restrict = "A";
require = "ngModel";
link = (scope: angular.IScope, element: angular.IAugmentedJQuery, attrs, ngModelController: angular.INgModelController) => {
ngMod... |