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 |
|---|---|---|---|---|---|---|
71f2e545b27fbb3a927660c55c46a20cdcd19bcb | TypeScript | CodeLenny/irontest | /src/decorators/Test.ts | 2.625 | 3 | import "reflect-metadata";
import { TestInstance } from "../internal/TestInstance";
import { REGISTERED_TEST } from "../internal/constants";
import { TestClassInstance } from "../internal/TestClassInstance";
/**
* Mark a method as being a test. Stores metadata about the method.
*/
export function Test(): MethodDeco... |
9ca64916f1bbd072584b730da14d2968e4d53214 | TypeScript | ncodedude/web-api-nodejs | /src/repository/UsuarioRepositorio.ts | 2.5625 | 3 | import { Usuario } from "../schemas/UsuarioSchema";
import * as bcrypt from "bcrypt";
class UsuarioRepositorio {
constructor() {}
async verifyUser(email: string, password: string) {
let user = await Usuario.findOne({ email: email }).exec();
let senha = user ? user.get("senha") : "";
let validated = bc... |
f43bab928445ff61e210f14b027d4700018caddf | TypeScript | iKronyck/puzzle | /src/context/AppContext.ts | 2.625 | 3 | import {createContext} from 'react';
import type {TasksProps} from './types';
type TypeAppContext = {
tasks: Array<TasksProps>;
completedTasks: Array<TasksProps>;
unCompletedTasks: Array<TasksProps>;
favoriteTasks: Array<TasksProps>;
loading: boolean;
addTask: (task: TasksProps) => void;
actionTask: (id:... |
962fc7d0e5c88f377c125057ef982f08246cf6f2 | TypeScript | msheila1/layout-frontend-rdo-angular | /src/app/core/utils/date-utils.ts | 2.921875 | 3 | import { FormGroup, AbstractControl, ValidatorFn } from '@angular/forms';
export const dateLessThanValidator = (dateControl: AbstractControl): ValidatorFn => {
return (control: AbstractControl): { [key: string]: boolean } | null => {
if (control.value != null && dateControl.value != null && control.value > d... |
ee6bb6bc84c657c403b5d539190ec28d09c42a8f | TypeScript | isabella232/ota-analyzer | /src/services/echarts_data.ts | 3.0625 | 3 | /**
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
299f197dae610003df243fc18219498c62d723d8 | TypeScript | ZhangJinshan2233/improvee | /src/app/_helper/setIndicatorRecordFormatOfChart.ts | 2.8125 | 3 | import {
getDaysInMonth,
} from 'date-fns';
export function set_month_record_value(indicatorRecordArray, currentMonth) {
let daysOfMonth = getDaysInMonth(new Date(currentMonth));
let recordValues = new Array(daysOfMonth);
recordValues.fill(null);
indicatorRecordArray.forEach(indicatorRecord => {
... |
585221c19442fb91ca3a37ff00efd83049960f36 | TypeScript | gxy5202/zIndexController | /index.d.ts | 2.546875 | 3 | // 需要移动的层级对象
export interface IndexTarget {
id: string, // 组件id
index: number // 组件在当前层级的下标
}
// 扁平化组件对象
export interface ComponentItem {
index: number,
component: {
id: string,
children: any[]
},
pid: string
}
export interface FlattenComponentsObject {
[ke... |
cad9198ee12b8b5e7eb1d26d1b40a88b3f1b9c5c | TypeScript | Revature-Project2-Team1/Project2_FrontEnd | /Vaxify2/src/app/Validators/Date.ts | 2.71875 | 3 | import { FormControl } from '@angular/forms';
export class DateValidator {
static ptDate(control: FormControl): { [key: string]: any } {
let ptDatePattern = /^(0[1-9]|1[0-2])\-(0[1-9]|1\d|2\d|3[01])\-(19|20)\d{2}$/;
if (!control.value.match(ptDatePattern))
return { "ptDate": true };
... |
7bad46897e6f37af5c562af1951b2c755f12c280 | TypeScript | zeoneo/photo-gallery | /src/lib/components/Utils.ts | 2.578125 | 3 | export const getNewCarouselActiveIndex = (direction, items, activeIndex) => {
if (direction === 'prev') {
return activeIndex === 0 ? items.length - 1 : activeIndex - 1;
} else if (direction === 'next') {
return activeIndex === items.length - 1 ? 0 : activeIndex + 1;
}
};
|
d86428868359182f925091f6635b660aa9004453 | TypeScript | betbetterapp/authenticator | /src/utils/log.ts | 2.59375 | 3 | import chalk from 'chalk';
export namespace log {
export function header(message: string) {
console.log();
console.log(prefix() + ' ' + chalk.green.bold.underline(message));
}
export function info(...message: any[]) {
console.log(prefix() + chalk.bgBlue.black.bold('i') + chalk.whi... |
946b48fa40ac4774619bc2ba8fb892d884834acf | TypeScript | saitho/telegram-bot | /src/core/discord-client.ts | 2.828125 | 3 | import Discord, {Guild, GuildMember} from 'discord.js'
interface DiscordConnection {
bot_username: string;
receiver_id: string;
}
export class DiscordClient {
protected client: Discord.Client;
constructor() {
this.client = new Discord.Client()
}
public sendValidationMessage(discordNa... |
de215ecd8439c030e16cf6362693ca80c16567b5 | TypeScript | wan54/datahub | /datahub-web/@nacho-ui/core/addon/utils/lib/is-primitive.ts | 2.671875 | 3 | /**
* Non-deprecated version of the isPrimitive function available from 'util' library
*/
export default function isPrimitive(value: unknown): boolean {
return (typeof value !== 'object' && typeof value !== 'function') || value === null;
}
|
cf527529eece64571c290b57c8e1d0fe11567333 | TypeScript | weonyuan/dOgeS | /source/os/memoryManager.ts | 2.703125 | 3 | ///<reference path="../globals.ts" />
module DOGES {
export class MemoryManager {
constructor() {}
// Loads the program into memory
public static loadProgram(programInput, priority): void {
// Create a PCB
var newPcb = new Pcb();
// Find free memory to assign the base and limit regist... |
a1dfd88ca45992c91b80cc8c45fe60b089a48dd1 | TypeScript | pittst3r/playground | /happy-test/jherkin.ts | 2.953125 | 3 | import { InstructionList, Builtin } from "./vm";
import { Browser } from "./opcodes";
export interface IStep {}
export type StepDef<Args extends any[]> = (
args: Args,
offset: number
) => InstructionList;
export type Builder = (offset: number) => InstructionList;
export function feature(
description: string,
... |
fd76c3a2e1ea15e38826e8c530055fbfb82284a5 | TypeScript | Piket95/CarAnalytics | /src/app/maintenance-details/maintenance-details.component.ts | 2.5625 | 3 | import { DetailItem } from './maintenance-details-item';
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-maintenance-details',
templateUrl: './maintenance-details.component.html',
styleUrls: ['./maintenance-details.component.css']
})
export class MaintenanceDetailsComponent impleme... |
aac43941767690ae7d59b2da8f3c759855038f87 | TypeScript | dbrudner/bdom | /index.ts | 2.921875 | 3 | import { b, firstRender } from './lib/bdom';
// 1: Create a function that declares what the DOM should look like
function render(count) {
return b({
children: ['hey'],
tag: 'div',
attributes: {
style: {
textAlign: 'center',
lineHeight: 100 + count + 'px',
border: '1px solid red',
width: 100 +... |
125a5d3608cea477d4dc172f6ff28bd1ea07a10c | TypeScript | FabioAntunes/angular2-firebase-todo | /src/app/app.component.ts | 2.5625 | 3 | import { Component } from '@angular/core';
import { AngularFire, FirebaseListObservable } from 'angularfire2';
import 'rxjs/add/operator/map';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
text = '';
todos: FirebaseLi... |
a8d23bfab63178d7bcea39aacf73558f1e61c456 | TypeScript | joe-re/sql-language-server | /packages/sqlint/src/rules/columnNewLine.ts | 2.734375 | 3 | import { SelectStatement } from '@joe-re/sql-parser'
import { Rule, RuleConfig } from './index'
type Options = { allowMultipleColumnsPerLine: boolean }
const META = {
name: 'column-new-line',
type: 'select',
options: { allowMultipleColumnsPerLine: Boolean },
}
export const columnNewLine: Rule<SelectStatement, R... |
690493616ab4f2f1005e94643f9c6676fffe38a8 | TypeScript | hudsonssrosa/tdd-typescript | /ex_tictactoe/test/tictactoe.test.ts | 3.359375 | 3 | import { TicTacToe } from "../src/main/tictactoe";
describe("TicTacToe test", () => {
it("Should returns the position 1,1 in matrix for Player X", () => {
let tictactoe: TicTacToe = new TicTacToe();
const position = { posX: 1, posY: 1 }
const matrix = tictactoe.play('X', position)
expect(matrix[1][1... |
87627c03a06eafb0fe28e5f4fdbb41ed78af3cdf | TypeScript | Covicake/theam_test | /src/Repository/Customer-Repository.ts | 2.546875 | 3 | import { getManager, UpdateResult, DeleteResult } from 'typeorm';
import { Customer } from '../Entity/Customer';
export class CustomerRepository {
createCustomer(customer: Customer): Promise<Customer> {
return getManager().getRepository(Customer).save(customer);
}
getCustomersList(): Promise<... |
fcb03c636f429cfa934a2021c58792e2ede2b15f | TypeScript | AnuPoudyal/DailyLabCS445 | /lab3/exer2.ts | 3.921875 | 4 | /*Re-write the following code using TypeScript. Try to be as explicit as possible and
add Types to everything you can. When you are done, transpile the TS code to JS code
and inspect the JS code.
let bankAccount = {
money: 2000,
deposit(value) {
this.money += value;
}
};
let myself = {
name: "Asaad",
b... |
cf98044634a987b08a83a39d66ad2a58ac9bfd13 | TypeScript | shawvyu/deviceone | /ui/do_Label.d.ts | 3.046875 | 3 | /*
* @Author: shawvyu
* @Date: 2020-08-09 16:59:16
* @LastEditTime: 2020-08-09 17:08:09
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \deviceone\ui\do_Label.d.ts
*/
import { UiBasicInstance, FontStyle, TextFlag, TextAlign } from "../base/uiBase";
/**
* 一.iOS
* 1.hei... |
60cf2c9ed5a69d08ce4380085b8d314dbefc2d79 | TypeScript | DataHeaving/orchestration | /scheduler/src/tests/executor.spec.ts | 2.78125 | 3 | import * as common from "@data-heaving/common";
import test from "ava";
import * as spec from "../executor";
import * as events from "../events";
test("Job-specific event invoking works", async (t) => {
const globalEvents = createEventsTrackerObject();
const job1Events = createEventsTrackerObject();
const job2Ev... |
80eb2585a4547caa47b95e1247ab5f303a4a8b9b | TypeScript | buildcom/BossyUI | /src/bossy-ui/components/calendar/calendar.spec.ts | 2.5625 | 3 | import {BossyCalendarComponent} from './calendar.component';
let cal: BossyCalendarComponent;
describe('the calendar component', () => {
it('should display a date', () => {
const calendar = new BossyCalendarComponent();
const year = new Date().getFullYear();
const date = new Date(year, 5, 1);
calend... |
f2fb6b691c5db131ae6ed12fdb70e959dcb8338e | TypeScript | szczypiorofix/SpaceInvaders | /client/src/core/Spaceship.ts | 2.90625 | 3 | import { Animation, Bullet, Canvas, Enemy, GameState, SFX, Sprite, StateType} from './';
export class Spaceship {
private x: number;
private y: number;
private width: number = 32;
private height: number = 32;
private alive: boolean = true;
private shoot: boolean = false;
private shootMult... |
0eb0d30c4b630c2d6a85b6b723636013e6f484df | TypeScript | dubzzz/fast-check | /packages/fast-check/test/unit/arbitrary/_internals/helpers/TextEscaper.spec.ts | 3.015625 | 3 | import * as fc from 'fast-check';
import {
escapeForTemplateString,
escapeForMultilineComments,
} from '../../../../../src/arbitrary/_internals/helpers/TextEscaper';
describe('escapeForTemplateString', () => {
it('should not escape normal characters', () => {
expect(escapeForTemplateString('a')).toBe('a');
... |
2b27bd664343e36adfb11f9b4222543acb9f99c3 | TypeScript | apollo-elements/apollo-elements | /packages/hybrids/factories/query.ts | 2.515625 | 3 | import type { DocumentNode, TypedDocumentNode } from '@apollo/client/core';
import type { Descriptor } from 'hybrids';
import { controller } from './controller.js';
import {
ApolloQueryController,
ApolloQueryControllerOptions,
} from '@apollo-elements/core/apollo-query-controller';
/**
* Hybrids property descr... |
29da307943570cffbe4ef2f17291eb01727c7d28 | TypeScript | kamleshkrjha/LoginLogoutFlow | /client/src/app/_services/authentication.service.ts | 2.515625 | 3 | import { HttpClient, HttpBackend } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { map, catchError } from 'rxjs/operators';
import { Observable, of } from 'rxjs';
const config = {
apiUrl: 'http://localhost:8000'
};
interface Response {
success: boolean;
errorMessage: string;
da... |
9177db363531127e7f8a91df8e9d5474283e8893 | TypeScript | Tschrock/binaryformater-lib | /lib/Records/BinaryArrayRecord.ts | 2.9375 | 3 | import { BufferReader } from "../BufferReader";
import { ClassTypeInfo } from "../DataStructures/ClassTypeInfo";
import { Sequence } from "../DataStructures/Sequence";
import { BinaryArrayTypeEnumeration, BinaryArrayType } from "../Enumerations/BinaryArrayTypeEnumeration";
import { BinaryTypeEnumeration, BinaryType }... |
57c0bd2a6a0ebc16a90a4b4ea0f9bc69bb036889 | TypeScript | Junior-Dollar/thimble-bot | /src/lib/truncate.ts | 2.78125 | 3 | const truncate = (str: string, length: number) => {
return str.length - 3 > length
? `${str.slice(0, length)}...`
: str;
};
export default truncate;
|
7f12abe874a4d44049a405e660dc4971021cf203 | TypeScript | GalloDaSballo/token-allowance-checker | /src/utils/logEventVerifier.ts | 2.71875 | 3 | export const topicHashApprove =
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
export const eventABI = [
{
indexed: true,
internalType: 'address',
name: 'owner',
type: 'address',
},
{
indexed: true,
internalType: 'address',
n... |
fac358afff116b554f2c2c26d65b2974a6045b8d | TypeScript | Mopiiex20/RNWithCamera | /src/redux/redusers/loginReduser.ts | 2.6875 | 3 | // Initial State
const initialState = {
loginData: Object
};
// Redux: Counter Reducer
export const loginReducer = (state = initialState, action) => {
switch (action.type) {
case '@@LOGIN': {
const data = action.data;
return {
...state,
loginData... |
183a50c1d1a91f0dce77f1f874741e59d5e5dfcc | TypeScript | sindhiya1930/fsd-training-samples | /Employees/src/app/pipes/searchemployee.pipe.ts | 2.75 | 3 | import {Pipe,PipeTransform} from '@angular/core';
import {Employee} from '../modules/Employee'
@Pipe({
name:'searchemployee'
})
export class SearchEmployeePipe implements PipeTransform {
transform(employees: Array<Employee>, employeeName?: string) {
console.log(employees);
con... |
0212e3f71d5cb6a7726e36652790633ca369c839 | TypeScript | theabdulmateen/library-reg-pwa | /server/utils/auth-helpers.ts | 2.578125 | 3 | import { Response } from 'express'
import * as jwt from 'jsonwebtoken'
import constants from '../constants'
export const generateAccessTokenJWTToken = (userId: Number) => {
const expiresIn = '15m'
const payload = {
sub: userId,
iat: Date.now(),
}
const token = jwt.sign(payload, constants.PRIV_KEY, {
expires... |
d0104eed907c630f3189ef7b3effc2bb05781f9a | TypeScript | antanas-arvasevicius/elementtype-demo | /src/core/Page.ts | 2.53125 | 3 | ///<reference path='Component.ts'/>
///<reference path="Layout.ts"/>
module core {
export abstract class Page<T extends core.Layout<any>> extends Component<T> {
constructor() {
super(() => {
return this.createLayout();
}, (layout) => {
this.onInit(lay... |
07e42a0dda6412b0f403b06b4b8b1bb00986dec0 | TypeScript | tkmagesh/Cisco-Angular-Dec-2017 | /bug-tracker-app-promise/src/app/bugTracker/services/bugsApi.service.ts | 2.515625 | 3 |
import * as axios from 'axios';
import { IBug } from '../models/IBug';
import { BugOperationsService } from './bugOperations.service';
import { Injectable } from '@angular/core';
@Injectable()
export class BugsApiService{
private baseUrl = 'http://localhost:3000/bugs';
constructor(private bugOperations : BugOperat... |
5c64623d1b1d4124bb9a1beea361d0c8dee89e9a | TypeScript | fuath/vscode-lit-plugin | /src/extension.ts | 2.515625 | 3 | import * as vscode from "vscode";
const tsLitPluginId = "ts-lit-plugin";
const typeScriptExtensionId = "vscode.typescript-language-features";
const configurationSection = "lit-plugin";
interface Config {
disable: boolean;
verbose: boolean;
format: { disable: boolean };
htmlTemplateTags: string[];
cssTemplateTags... |
8bbd453ac821cc71c4f26bbe29e7750f8cdc3886 | TypeScript | step-ponomarev/data-base-course-project | /packages/decanat-client/src/apollo/requests/mutations.ts | 2.625 | 3 | import {DocumentNode} from 'graphql';
import {MutationOptions, TypedDocumentNode} from '@apollo/client';
import {gql, OperationVariables} from '@apollo/client/core';
import {DataType} from '../../data/data-type';
import {ValuedField} from '../../store/valued.fields.reducer';
const UPDATE_PEOPLE = (args: string) => gql... |
d3baf7f521556ee6a2eb91a83233c13a7e229349 | TypeScript | hellomac87/rgbchallenge-react-ts | /src/store/question/reducers.ts | 2.625 | 3 | import {
QuestionState,
CREATE_QUESTION,
SEND_USER_ANSWER,
ADD_SCORE,
RESET_GAME,
ACTIVE_ITEM,
QuestionActionTypes
} from "./types";
import { answer, problems } from "./actions";
// initialState
const initialState: QuestionState = {
answer: answer(),
problems: problems(),
activeItem: null,
userA... |
662529b4580f5d7635bf7bbd86eaf43704225960 | TypeScript | genki-sano/react-todo-app | /src/modules/taskModule/index.ts | 2.78125 | 3 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import { TaskState, Task } from 'types/todos'
import { getStrage, setStrage } from 'utils/tasks'
const taskInitialState: TaskState = {
tasks: [],
nextTaskId: 0,
focus: false,
}
const taskModule = createSlice({
name: 'todos',
initialState: getStra... |
886ddf445ffbcfe85c74d139c4a7e9564b07d069 | TypeScript | thorvaldursaemundsson/infinitedarkness | /src/components/skills/spells.ts | 3 | 3 | import { SkillTemplate, UseCase } from "../general/Skills";
const useCases: UseCase[] = [
{
name: 'cast spell',
attribute: 'willpower',
description: 'cast a spell, unless the spell description says otherwise it uses an action, does not restrict movement and has no visible somatic or verbal r... |
030f157e3dcc77ea32e14abbc6fb8eaf0dbdb42f | TypeScript | christianmalek/vuex-rest-api | /src/Resource.ts | 2.890625 | 3 | import axios, { AxiosInstance, AxiosRequestConfig } from "axios"
export interface ResourceAction {
requestFn: Function,
beforeRequest: Function,
onSuccess: Function,
onError: Function,
property: string,
dispatchString: string,
commitString: string,
axios: AxiosInstance,
}
export interface ResourceActi... |
c2c006c6c77428f69e0332a4486eb03043702f84 | TypeScript | ArneCools/best-practices | /src/todo/TodoList.ts | 2.984375 | 3 | import TodoService from './services/todoService';
import {askQuestion} from '../util';
export default class TodoList{
todoService: TodoService;
quit: boolean;
constructor() {
this.todoService = new TodoService();
this.quit = false;
}
async createNewItem(){
let quit = false;
console.log("Pl... |
0b20b9308d2f4c3bf253147577efd431b5369ceb | TypeScript | tewl/depot | /src/priorityQueue.ts | 3.296875 | 3 | import {CompareResult} from "./compare";
import {Heap} from "./heap";
interface IPriorityQueueItem<TPayload> {
priority: number;
payload: TPayload;
}
function comparePriority<TPayload>(
itemA: IPriorityQueueItem<TPayload>,
itemB: IPriorityQueueItem<TPayload>
): CompareResult {
if (itemA.priorit... |
675d31af7cadf6a1a0ffcb8032dbc62e31ee7158 | TypeScript | 07yali/vue3-vite2-ts-blog-h5 | /src/store/modules/label.ts | 2.515625 | 3 | import { apiGetLabelList } from "@/api/label";
import { labelModel } from "@/models/index";
type State = {
labelList: Array<labelModel>;
};
export default {
namespaced: true,
state: {
labelList: undefined,
},
mutations: {
setLabelList(state: State, data: Array<labelModel>) {
state.labelList = d... |
3efe59ffa1a192ca9530c2d7778d1a4f50795be3 | TypeScript | jrgenerative/bebop-bridge-shared | /flightplan.d.ts | 3.203125 | 3 | /// <reference types="node" />
import { EventEmitter } from 'events';
/**
* Waypoint.
*/
export declare class Waypoint {
latitude: number;
longitude: number;
altitude: number;
orientation: number;
radius: number;
constructor(latitude: number, longitude: number, altitude: number, ori... |
d24b6625ad280e5911379d3c9cd0f6a8bf965a34 | TypeScript | DACSoftware/pull-request-notifier-server | /lib/factory/project.ts | 2.703125 | 3 | import {Project} from "../model/project";
export class ProjectFactory {
static create(rawObject: any): Project {
const project = new Project();
if (rawObject.hasOwnProperty('uuid')) {
project.uuid = rawObject.uuid;
}
if (rawObject.hasOwnProperty('name')) {
... |
9bd449cc5060159a2e8f78c441e48ba3c73dba16 | TypeScript | VictorQueiroz/mff | /src/code-generator/comment-decorator-processor.ts | 3.234375 | 3 | export interface ICommentDecorator {
name: string;
args: string[];
}
/**
* Processes decorators that are set up through
* comments
*/
export default class CommentDecoratorProcessor {
/**
* Allowed characters in decorator or
* decorator argument
*/
private allowedCharacters = /[a-zA-Z0... |
4bca8f5c0993f1d0158ed2b6787a3f8ee148a7c8 | TypeScript | petervdn/musictime | /test/MusicTime.spec.ts | 3.34375 | 3 | import {expect} from 'chai';
import MusicTime, { stringIsValid } from "../src/lib/MusicTime";
describe('MusicTime', () => {
it('should not normalize bars', () => {
expect(new MusicTime(20,0,0).toString()).to.equal('20.0.0');
});
it('should normalize beats', () => {
expect(new MusicTime(0,16,0).toString(... |
06c106f8062b2400f6be61039456313e96d10d50 | TypeScript | Seikho/multimethods | /src/codegen/emit-selector-function.ts | 2.796875 | 3 | import {MMInfo, MMNode} from '../analysis';
import repeat from '../util/string-repeat';
import Emitter, {EnvNames} from './emitter';
// TODO: rewrite doc...
/**
* Generates a function that, given a discriminant, returns the best-matching route executor from the given list of
* candidates. The returned selector f... |
42cf7aad65b9d45d6cbcaaaaae6b7b18566917ec | TypeScript | joseluis8906/restaurantetic-gui | /src/app/notification/notification.service.ts | 2.875 | 3 | import { Injectable } from '@angular/core';
import { Subject, Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class NotificationService {
private messageSubject: Subject<string>;
public message$: Observable<string>
private messageType: string;
private timeout: number;
private timer: n... |
83756c35c32da202023f3d84c97617f373ca55c0 | TypeScript | WalterLeinert/libraries | /packages/server/src/lib/ts-express-decorators-flx/controllers/base/readonly-controller.ts | 2.515625 | 3 | // -------------------------------------- logging --------------------------------------------
// tslint:disable-next-line:no-unused-variable
import { getLogger, ILogger, levels, using, XLog } from '@fluxgate/platform';
// -------------------------------------- logging --------------------------------------------
// ... |
ee0278e4234276fab73a8522cd2131ccf1e969ae | TypeScript | hearingguo/blog-admin | /src/service/modules/article.ts | 2.625 | 3 | import { ax } from '../axios'
// post article
export function postArticle<T = undefined> (
params: IArticleItem
): Promise<Ajax.AjaxResponse<T>> {
return ax.post<Ajax.AjaxResponse<T>>('/article', params)
.then(res => res.data)
}
// get article
export function getArticle<T = undefined> (
id: string
): ... |
3201f2b84263e25f504d40b28ac84c0d4be7bc5c | TypeScript | BSH-Werkstatt/datatrain-server | /src/models/campaign.ts | 3.125 | 3 | export class Campaign {
id: string;
ownerId: string;
/**
* @isInt type
*/
type: CampaignType;
name: string;
urlName: string;
description: string;
taxonomy: string[];
image: string;
trainingInProgress?: boolean;
currentTrainingId?: string;
constructor(
id: string,
ownerId: string,
... |
f104b107d0bea6b3dde28044a8a54078b93573f6 | TypeScript | babel/babel | /packages/babel-types/src/validators/isScope.ts | 3.234375 | 3 | import {
isFunction,
isCatchClause,
isBlockStatement,
isScopable,
isPattern,
} from "./generated/index.ts";
import type * as t from "../index.ts";
/**
* Check if the input `node` is a scope.
*/
export default function isScope(node: t.Node, parent: t.Node): boolean {
// If a BlockStatement is an immediate... |
ae78dcbef080023a98f511ec31e448c87d175f3c | TypeScript | MyPureCloud/client-app-sdk | /src/utils/envSpec.ts | 3.03125 | 3 | import * as envUtils from './env';
export default describe('env utils', () => {
it('should provide the default environment', () => {
expect(envUtils.DEFAULT_PC_ENV.pcEnvTld).toBe('mypurecloud.com');
expect(envUtils.DEFAULT_PC_ENV.pcAppOrigin).toBe('https://apps.mypurecloud.com');
});
descri... |
3b6e2689d39dab97dc56732929df7d3b216132d2 | TypeScript | ialaminpro/ialaminpro.github.io.react | /src/Vendor/Functions/Core/ConvertDate.Function.ts | 3 | 3 | export function ConvertDate(inputFormat: any, format: 'dd-mm-yyyy' | 'yyyy-mm-dd' = 'dd-mm-yyyy') {
function pad(s: number) {
return (s < 10) ? '0' + s : s;
}
if (inputFormat !== null && inputFormat !== '') {
let d = new Date(inputFormat);
if (format === 'dd-mm-yyyy') {
... |
887750d2068e1753f2b5c950a5b154f3351fe7c2 | TypeScript | sandermaas/pastors-line | /src/store/modules/modals/reducers.ts | 2.640625 | 3 | import { AnyAction, combineReducers } from 'redux'
import types from './types'
const modalC = (state = {
open: false
}, action: AnyAction) => {
switch (action.type) {
case types.OpenC: return {
contact: action.payload.contact,
open: true
}
case types.Close: retur... |
b0cd613605d904d7280f35ee73ba6ae53e6cff63 | TypeScript | goeaway/workout-app-web | /src/state/actions/program-actions.ts | 2.59375 | 3 | import { ProgramsGetSuccessRequest, PROGRAM_GET, ProgramFailureRequest, PROGRAM_FAILURE, PROGRAM_SUCCESS } from "../requests/program-requests";
import { Program, WeekType } from "../../types";
import { Action } from "redux";
export function getProgramsForUser(userId: number) {
return async (dispatch: Function) => ... |
ae12a49f818746da18d02cc3df1885a3cfb1c7ea | TypeScript | jsz315/vue-ts-template | /src/as2ts/views/Food.ts | 2.84375 | 3 | export class Food{
color:string;
constructor($color:string){
this.color = $color;
}
show(){
console.log("color: " + this.color);
}
} |
3757f238cf4daa634f73f3ccfc567828809471b8 | TypeScript | dreamsaas/packages | /dsaas/packages/flow/src/flow/flow.ts | 2.890625 | 3 | import { Action } from '../action';
import { Application } from '../application/application';
import { EventEmitter } from 'events';
import { Transition } from '../transition/transition';
import { FlowActionDefinition, FlowDefinition } from './types';
import { ACTION_STATUS } from '../action/types';
import { Transitio... |
b66edd212ac4a4f1203f6cb8cedc8f67def3452c | TypeScript | crimx/observable-hooks | /packages/observable-hooks/src/use-observable-get-state.ts | 2.640625 | 3 | import { useDebugValue } from 'react'
import { Observable } from 'rxjs'
import { map } from 'rxjs/operators'
import { useObservableState } from './use-observable-state'
import { useObservable } from './use-observable'
/**
* Gets the value at path of state. Similar to lodash `get`.
* Only changes of the resulted valu... |
d2a31f2cfeeab9d5679a80b16a0ae6d3c844c059 | TypeScript | artalar/reatom | /packages/core-v2/primitives/createMapAtom.ts | 2.9375 | 3 | import { AtomOptions } from '@reatom/core-v2'
import { createPrimitiveAtom, PrimitiveAtomCreator } from '.'
export type MapAtom<Key, Element> = PrimitiveAtomCreator<
Map<Key, Element>,
{
set: [key: Key, el: Element]
delete: [key: Key]
clear: []
change: [map: (stateCopy: Map<Key, Element>) => Map<Ke... |
bf755af8b2e8b85297749f38431a9827a584df33 | TypeScript | darcros/appanino-backend-graphql | /src/validation/MaxPrecision.ts | 3.1875 | 3 | import { registerDecorator, ValidationOptions } from 'class-validator';
const countDecimals = (value: number) => {
if (Math.floor(value) === value) return 0;
return value.toString().split('.')[1].length || 0;
};
export const MaxDecimals = (maxDecimals: number, validationOptions?: ValidationOptions) => {
// esli... |
946020fabc8a3942d4fcd1097231a07ddc5167b9 | TypeScript | sethkasten/ts-lab2 | /tests/code-along.test.ts | 2.921875 | 3 | import { Player, Timer } from "../src/code-along";
describe("Player class", () => {
test("the constructor properly sets the name property", () => {
const result = new Player("Kyrie Irving", 11);
expect(result.name).toBe("Kyrie Irving");
expect(result.jersey).toBe(11);
});
});
describe("Timer Class", (... |
a07bc45795df96c4c50ac5b285be6ee07ca50506 | TypeScript | rauleddie/node-course-2-todo-api | /src/server/server.ts | 2.609375 | 3 | // Load Server Config
require('./config/config');
// Server dependencies
import express = require('express');
import bodyParser = require('body-parser');
import _ = require('lodash');
import {ObjectID} from 'mongodb';
// Database related dependencies
import mongoose from './db/mongoose';
import {Todo, Todotype} from ... |
209c49da7547a50384c9ee892f48cd7f9b506851 | TypeScript | cyclosproject/cyclos4-ui | /src/app/core/state-manager.ts | 2.765625 | 3 | import { Injectable, Optional } from '@angular/core';
import { AbstractControl } from '@angular/forms';
import { Router } from '@angular/router';
import { DataForFrontendHolder } from 'app/core/data-for-frontend-holder';
import { cloneDeep } from 'lodash-es';
import { BehaviorSubject, Observable, of as observableOf, Su... |
4e179e2a50347507ae81c246b434322c543de428 | TypeScript | tk2rush90/lean-mass-up | /src/app/utils/nutrition.util.ts | 2.875 | 3 | import {
CARBOHYDRATES_BACKGROUND_COLOR,
CARBOHYDRATES_COLOR,
CARBOHYDRATES_LABEL_EN, CARBOHYDRATES_LABEL_KO, FATS_BACKGROUND_COLOR,
FATS_COLOR,
FATS_LABEL_EN, FATS_LABEL_KO, PROTEINS_BACKGROUND_COLOR,
PROTEINS_COLOR,
PROTEINS_LABEL_EN, PROTEINS_LABEL_KO
} from '../constants/nutrition';
export interface ... |
2a4d18343ed3731b11093fdbbba0dbc8a8bec908 | TypeScript | ChatTriggers/website-frontend | /src/api/raw/modules.ts | 2.546875 | 3 | import { IModule, IModuleResponse, ModuleSorting } from '~types';
import { axios, BASE_URL, URLParams } from '../utils';
import { ApiErrors, validateStatusCode } from './ApiErrors';
const MODULES_URL = `${BASE_URL}/modules`;
const moduleIdUrl = (id: number | string): string => `${BASE_URL}/modules/${id}`;
const TAGS_... |
e50805fff2f563382354d19d4013aa55016133b1 | TypeScript | MeowType/Synph | /src/syntax/utils.ts | 2.890625 | 3 | import { ISyntax, syntax, lexical, group, option, range, item } from "./ref_all";
export type unset = (...v: ISyntax[]) => void
export function body_func_call(fn: BodyFunc, arr?: ISyntax[]) {
if (arr == null) arr = []
if (typeof fn !== 'function') return arr
const unsetlist: Set<ISyntax> = new Set
if (... |
03bf23c5eaca5df1d8351199f92a3247b3b61a2b | TypeScript | mogulla3/tidytab | /test/tabSorter.test.ts | 2.984375 | 3 | import { describe, expect, test } from '@jest/globals';
import { TabSorter } from "../src/tabSorter";
import { SortOrder } from "../src/sortOrder";
const defaultOptions = {
ignoreWwwSubdomainOnSorting: true,
preferTagGroupToTabOnSorting: true,
removeWwwSubdomainFromTabGroupName: true,
};
const buildTab = (props... |
7fe5b28569ee9fbadc33a005437cab9db7b9954e | TypeScript | bennbollay/asynctest | /src/index.ts | 2.53125 | 3 | import { startHooks, dumpRecords, IHookRecord, IHookRecords } from "./asynchooks";
import fs from "fs";
import async_hooks from "async_hooks";
import { fullTest } from "./test";
type IHookRecordKey = keyof IHookRecord;
const perfToFlame = (records: IHookRecords): object => {
let data: any = {};
let result = [];... |
fc1433520721dcddd5a52ecf11cb6d1fbef0d6e1 | TypeScript | munna/ApexSchool | /src/resolvers/PersonResolver.ts | 2.78125 | 3 | import { Arg, FieldResolver, Query, Resolver, Root } from "type-graphql";
import { personDatas, PersonData,studentsDatas,StudentData} from "../data";
import Person from "../schema/Person";
import Student from "../schema/Student";
@Resolver(of => Person)
export default class {
@Query(returns => [Person])... |
9543e5b57455ffbb324a535a467e344f3b0743f1 | TypeScript | noob0192/bluetooth-device | /src/index.ts | 3.046875 | 3 | import PCancelable from 'p-cancelable';
import noble, { Peripheral } from '@abandonware/noble';
import { after, before, debounce, retry, semaphore, timeout } from 'ts-async-decorators';
const DEFAULT_TIMEOUT_IDLE = 120000;
const DEFAULT_TIMEOUT_DISCOVERY = 30000;
const DEFAULT_TIMEOUT = 10000;
const DEFAULT_NUMBER_OF_... |
b88dc919e7843372af7fa65e08dc248c6f883b32 | TypeScript | Taha-1993/AutomationUI | /src/ngrx-store/reducers/error-handler.reducer.ts | 2.734375 | 3 | import { ActionReducer } from '@ngrx/store';
import * as types from '../actions/action-types';
import { ErrorHandlerActions } from '../actions';
export interface State {
errorHandlerObject: any;
}
const initialState: State = {
errorHandlerObject: null,
};
export const reducer: ActionReducer<State> = (state = in... |
14aa6b9017ac64562a9bee72689abb76d21a1458 | TypeScript | mjbryan10/chat-app | /src/shared/Api/__tests__/UserApi.test.ts | 2.71875 | 3 | import axios from 'axios';
import UserApi from '../UserApi';
import BaseApi from '../BaseApi';
jest.mock('axios');
describe('UserApi', () => {
afterEach(() => {
(axios.get as jest.Mock).mockClear();
});
const errorMessage = 'request rejected';
const userApi = new UserApi();
const baseApi = new B... |
20bf516e39edbde6286ade88b774fc96b211c94f | TypeScript | lelandmiller/micro-signals | /test/suites/promisify-suite.ts | 2.703125 | 3 | import test = require('tape');
import {LeakDetectionSignal} from '../lib/leak-detection-signal';
import {
ReadableSignal,
Signal,
} from '../../src';
export type PromisifyFunction
= <T>(resolveSignal: ReadableSignal<T>, rejectSignal?: ReadableSignal<any>) => Promise<T>;
export function promisifySuite(pre... |
f6c618b9ee368be63e35828e8865aa921f061da3 | TypeScript | andrii1509/08_algorithms_and_data_structures_1 | /src/helpers/sort-jobs.ts | 2.921875 | 3 | import {Job} from '../interfaces/job-interface';
export function sortJobs(jobs: Job[]): Job[] {
if (jobs.length < 2) return jobs;
let pivot = jobs[0];
const left = [];
const right = [];
for (let i = 1; i < jobs.length; i++) {
if (pivot.priority > jobs[i].priority) {
left.push(jobs[i]);
... |
8eb9a4e65dc67f79f9a05678f52f183342d7f89b | TypeScript | zeno60/tree-view-backend | /src/services/factoryService.ts | 2.625 | 3 | import { Factory } from "../models/Factory";
import { CreateFactoryRequest } from "../interfaces/CreateFactoryRequest";
import { getConnection } from "typeorm";
import { Tree } from "../models/Tree";
import { getRandomNumber } from "../utils/randomUtil";
export interface FactoryService {
addFactoryToTree(tree: Tre... |
7099c9d8350d55367629372ae762cc41d9349ddb | TypeScript | giorgospetkakis/vscode-write-good | /src/extension.ts | 2.53125 | 3 | 'use strict';
import { workspace, ExtensionContext, TextDocument, languages, Uri,
Diagnostic, DiagnosticCollection, TextDocumentContentChangeEvent } from 'vscode';
import { isNullOrUndefined } from 'util';
import { lintText } from './linter';
let diagnosticCollection: DiagnosticCollection;
let diagno... |
9ff0bd79a5961047cd4b283c78e75bc9482362a7 | TypeScript | Rokt33r/typed-remark | /packages/unist-util-stringify-position/src/lib/index.ts | 3.28125 | 3 | import { Point, Position, Node } from 'typed-unist'
export function stringifyPosition (position: Position): string {
return `${stringifyPoint(position.start)}-${stringifyPoint(position.end)}`
}
export function stringifyPoint (point: Point): string {
return `${point.line}:${point.column}`
}
export function string... |
30906c15987de1ca33481152cb2332d0686ad811 | TypeScript | sudhakar29495/React-with-TS-boiler-plate | /src/utils/storage.ts | 3.390625 | 3 | export interface IStorageObject {
key: string,
value: any
}
interface IStorageService {
setItem : (key: string, value: any) => void ,
setItems : (storageObjects: IStorageObject[]) => void
}
/**
* Util Class to handle storage services
* Localstorage, SessionStorage can be handled
*/
class StorageService imp... |
751fcc3137ebcc2556078c97220f3165470ee866 | TypeScript | ax1/a1-util | /src/util.ts | 2.9375 | 3 | import { promisify } from 'util'
import { exec, spawn } from 'child_process'
const execPromise = promisify(exec)
import { fileURLToPath, URL } from 'url'
type executeOptions = {
/** detach COMPLETELY by:1-new independent process, 2-stdout stderr are also different than the parent*/
unref?: boolean
}
/**
* See htt... |
d298e3ea4b4510965b4eac12c8f6000ce0a97cf5 | TypeScript | ISKCON-Cultural-Centre/eICS-ws | /client/src/app/shared/sdk/models/DevoteeAsrama.ts | 2.703125 | 3 | /* tslint:disable */
import {
AsramaMaster,
Devotee
} from '../index';
declare var Object: any;
export interface DevoteeAsramaInterface {
"devoteeId": string;
"asramaMasterId": string;
"entryDate": Date;
fkTable1AsramaMaster1rel?: AsramaMaster;
fkTable1Devotee3rel?: Devotee;
}
export class DevoteeAsrama... |
6d113bed819677961397836e80093ba046971ac2 | TypeScript | blackstrip/infinite-minesweeper | /src/Cell.ts | 3.046875 | 3 | /**
* Created by sisc0606 on 19.08.2017.
*/
export class Cell {
x: number;
y: number;
isOpen: boolean;
isMine?: boolean;
isFlagged: boolean;
constructor(
x: number,
y: number,
isFlagged: boolean = false,
isMine?: boolean
) {
this.x = x;
this.y = y;
this.isO... |
25701c46b6e9a6dddbffa386d16d4f93a102b711 | TypeScript | Super-Projetos-Engenharia-Unicesumar/card_game_on_terminal | /src/Game.ts | 2.953125 | 3 | import Input from "./Input.ts";
export default class Game {
start(): void {
Input.cleanScreen();
this.gameLoop();
}
private gameLoop(): void {
let isPlaying = true;
while (isPlaying) {
const result = this.mainMenu();
switch (result) {
case 1:
this.playGame();
... |
da48dccb51631db930e7db01a2941c3667066b9b | TypeScript | mingkaic/RocnnetViser | /app/electron.app.ts | 2.640625 | 3 | /// <reference path="../typings/index.d.ts" />
import { BrowserWindow, globalShortcut } from 'electron';
import { join } from 'path';
import { format } from 'url';
// app class
export default class ElectronApp {
static mainWindow: Electron.BrowserWindow;
static application: Electron.App;
static browserWindow;
st... |
c5af45ae80040b9705d3fd84ce044dd21020476e | TypeScript | jmerle/deskdocs | /src/common/config/BaseConfig.ts | 2.65625 | 3 | import ElectronStore from 'electron-store';
import { defaultConfig } from './defaults';
import {
ConfigEvent,
OnAnyChangeCallback,
OnAnyChangeEvent,
OnChangeCallback,
OnChangeEvent,
OnChangeKeyEvent,
} from './types';
export abstract class BaseConfig extends ElectronStore<any> {
protected eventChannel = ... |
f5b8c8cbc9b71ee564c530d95335b13759ef0031 | TypeScript | syfxlin/xkeditor-tiptap | /src/utils/nodeLinePasteRule.ts | 2.734375 | 3 | import { Fragment, Node, NodeType, Plugin, Slice } from "@/utils/prosemirror";
export default function(
regexp: RegExp,
type: NodeType,
getContent:
| ((
match: RegExpExecArray,
attrs: { [attr: string]: any },
childNode: Node
) => string | Node | null)
| Node
| string
... |
7248dbbe9933bf336698b421d15ffdeaa9664783 | TypeScript | warrenxxx/pruebagit | /global/common/src/utils/Validation.ts | 2.765625 | 3 | import validate from 'validate.js';
import {ValidationError} from '../errorHandling/Exceptions/validation.error';
import moment = require('moment');
import {ObjectId} from 'bson';
export async function Validate(x: any, constraint: any): Promise<any> {
try {
return isValid(x, constraint);
} catch (e) {
... |
02d83bcb3abc9b3afb8b0a1c97d8ba948d755eee | TypeScript | Dcivan226/my-games | /光的反射/RayLine/src/Mirrors.ts | 2.703125 | 3 | /*镜子*/
class Mirror extends egret.Sprite {
private _stage:egret.Stage;
private _mirror:egret.Bitmap;
private _mirrorLength:number=200;
public static POSITION_CHANGE:string="position_change";
private _line:Line;
public constructor(stage:egret.Stage) {
super();
this._stage=stage;
this._line=new Line();... |
1ae46a89db43a5e30ee8e6d12bb7a14aaee6c328 | TypeScript | KaushikShivam/sl-challenge | /src/api/models/card.model.ts | 2.546875 | 3 | export interface Card {
id: string;
name: string;
imageUrl: string;
count: {
total: number;
};
}
export interface EditCardDto {
name?: string;
imageUrl?: string;
}
|
475a4542ec2ab4cbb1fd3aa4920e81192ddb5462 | TypeScript | damducthoai/linksport | /backend-base/src/launcher.ts | 2.609375 | 3 | import * as events from 'events';
import * as fs from 'fs';
import * as winston from 'winston';
import { CoreVerticle } from './core-verticle';
export abstract class AppLauncher {
protected readonly config:any;
protected readonly globalEvents = new events.EventEmitter();
protected readonly verticles : Cor... |
97fc684b325204debc7cebdcab774af01f3d95b3 | TypeScript | Siusarna/Pichupido | /src/utils/passwords.ts | 2.65625 | 3 | import crypto from 'crypto';
import config from 'config';
const hash: { iterations: number, length: number } = config.get('crypto');
const salt: { length: number } = config.get('salt');
export const checkPassword = (
inputPassword: string,
passwordFromDb: string,
salt: string
): boolean => {
if (!inputPasswor... |
ab8367c8bc74bbc9e38de7851e05e089225e2d70 | TypeScript | MeowSound-Idols/bilibili-live-toolkit | /src/services/storage.ts | 3.03125 | 3 | import { get, set } from "lodash";
export default class Storage {
static getSetting<T>(
name: string,
defaultValue: string | boolean | number | undefined
): T {
const settings = localStorage.getItem("settings")
? JSON.parse(localStorage.getItem("settings") as string)
... |
8cd2139de6beb92885b4b40ad58e3d8f2c63af1a | TypeScript | theCodeCampus/tcc-cli | /src/utils/git.spec.ts | 2.75 | 3 | import { checkRepoStatus } from "./git";
import { SimpleGit, StatusResult } from 'simple-git/promise';
describe("checking repository status", function () {
describe("on a clean repository", () => {
it("should return a resolved promise", () => {
const repository: Partial<SimpleGit> = {
status: func... |
5dee29024a946e26baa569fe2b9e3ae9ac301989 | TypeScript | SongFuZhen/egret | /code/Time/src/Timer.ts | 2.671875 | 3 | class Timer extends egret.DisplayObjectContainer {
public constructor() {
super();
this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this);
}
private onAddToStage() {
this.showTimerGame().catch(e => {
console.log(e);
})
}
private n:... |
0001925a2fcf27bda0b6324c35dbffb69c22c1a8 | TypeScript | lysycyn/calendar | /src/typings/index.ts | 2.796875 | 3 | export interface DayInfo {
date?: string;
color?: string;
}
export interface MonthInfo {
month: number;
year: number;
}
export type DaysColorsInfo = Record<string, string>;
export enum MonthType {
PREV_MONTH = 'PREV_MONTH',
NEXT_MONTH = 'NEXT_MONTH'
}
|
bc72ee7d2d4896bc90bd92d45aab2b269eb2f1fb | TypeScript | brianhadley/rxjs_kata | /src/app/services/feature-request-service/feature-request.service.spec.ts | 2.859375 | 3 | import { TestBed, async } from '@angular/core/testing';
import { FeatureRequestService } from './feature-request.service';
import { FeatureRequest } from 'src/app/model/feature-request';
import { of, from, Observable, BehaviorSubject } from 'rxjs';
describe('FeatureRequestService', () => {
const feat1 = new Featur... |
40e7e8df519e569230452644dfd122f69ad71571 | TypeScript | dy51ex/c1-request-api | /$/reportsGet/reportData.ts | 2.578125 | 3 | import { components } from '../../types';
import c1request from '../base/c1request';
import LogAction from '../base/LogAction';
/**
* Возвращает данные отчета, с условиями фильтров, если передано
* @example $.reportsGet.reportData({ ReportMetadataId: uuid, { Дата: ['2020-01-01', '2020-01-30'], 'Тип дела':['Про... |