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 |
|---|---|---|---|---|---|---|
957a47c89e69031839fae8404f3b83745cd89aa8 | TypeScript | widmogrod/notepad-app | /src/serialiser.ts | 2.84375 | 3 | import crdt from 'js-crdt';
import {OrderedOperations} from 'js-crdt/build/text';
type SerialisedOrder = Object
export type SerialisedOrderedOperations = {operations: Array<any>, order: SerialisedOrder}
export function serialiseOperations(oo: OrderedOperations): SerialisedOrderedOperations {
return oo.operations.... |
5ccc2c044204f16992d86d5a13eeaed44a39d29e | TypeScript | justusburger/expensetracker | /ExpenseTracker/ExpenseTracker.UI/ExpenseTracker/Services/ApiResource/ApiResourceService.ts | 2.640625 | 3 | module ExpenseTracker.Services.ApiResource {
export class ApiResourceService extends Component {
constructor() {
super();
}
public defaultOnError<T>(response: Models.IErrorResponse, defer: ng.IDeferred<T>, expectedErrorsTypes?: string[]): void {
if (angular.is... |
bddda4ce346ea92c8de510cce67fabdc02debf60 | TypeScript | kotov9/webpack-edu | /src/analitics.ts | 2.53125 | 3 | import * as $ from 'jquery';
const createAnalitics = (): object => {
let counter = 0;
let finished: boolean = false;
const countClicks = (): number => counter++;
$(document).on('click', countClicks);
return {
destroy() {
$(document).off('click', countClicks);
finished = true;
},
... |
c0c89c607ea1ecfcb822f5c5fd86953e5df0b5cd | TypeScript | heestand-xyz/texture.js | /sources/types/TEXResolution.ts | 2.65625 | 3 |
class TEXResolution {
width: number
height: number
static fullHD: TEXResolution = new TEXResolution(1920, 1080);
static ultraHD: TEXResolution = new TEXResolution(3840, 2160);
constructor(width: number, height: number) {
this.width = width
this.height = height
}
}
// mo... |
cdce7afc3a31d09dbf66376c0dc640342724d6e3 | TypeScript | Jellybooks/web | /shared/src/publication/epub/Presentation.ts | 2.828125 | 3 | import { Link } from '../Link';
import { Presentation } from '../presentation/Presentation';
import { EPUBLayout } from './EPUBLayout';
declare module '../presentation/Presentation' {
export interface Presentation {
layoutOf(link: Link): EPUBLayout;
}
}
/** Determines the layout of the given resource in this ... |
2fd954e7f7e64aaf0a3916a5219c656343adbb88 | TypeScript | drocha87/euyome-frontend | /rules.ts | 3.0625 | 3 | import { Rules } from './types';
const rules: Rules = {
required: (v: string) => !!v || 'Campo obrigatório',
text: (v: string) => /[A-zÀ-ú]*/.test(v) || 'Caracteres inválidos no texto',
email: (v: string) => /.+@.+\..+/.test(v) || 'E-mail inválido',
url: (v: string) =>
/^(https:\/\/)?[\w.-]+(?:\.[\w.-]+... |
f956d2139131ed1aeaede0a7f5f54de3ab878899 | TypeScript | yuki-tylar/ngx-widgets-form | /projects/form/src/lib/textfield-controller.ts | 3.015625 | 3 | import { FormItemController, IFormItemController } from "./form-item-controller";
export interface ITextfieldController extends IFormItemController{
value: string;
}
export class TextfieldController extends FormItemController implements ITextfieldController{
private _value: string = '';
get value(){ return th... |
f9accc5923c4532de7408c537460a97a193b4a2b | TypeScript | mikolalysenko/mudb | /src/socket/multiplex.ts | 2.640625 | 3 | import {
MuSocketServer,
MuSocketServerState,
MuSocketServerSpec,
MuSocket,
MuCloseHandler,
} from './socket';
export class MuMultiSocketServer implements MuSocketServer {
private _state = MuSocketServerState.INIT;
public state () : MuSocketServerState {
return this._state;
}
... |
23a6b814a2f5b1cfe0eea515a3f7cfa488c3c88f | TypeScript | HAFDIAHMED/IgniteTraning | /app/models/utilisateur/utilisateur.ts | 2.671875 | 3 | import { flow, Instance, SnapshotOut, types } from "mobx-state-tree"
import { ProductModel } from ".."
import { Api } from "../../services/api"
/**
* Model description here for TypeScript hints.
*/
export const UtilisateurModel = types
.model("Utilisateur")
.props({
name : types.optional(types.string,"ahmed"... |
ef42b848aab6365c830838e723dd35913100bdb5 | TypeScript | 3kraft/Knockout-Validation | /dist/knockout.validation.d.ts | 2.546875 | 3 | import * as ko from "knockout";
declare module "knockout" {
export namespace validation {
export type ValidationObservable<T> = ko.Observable<T> & ObservableValidationExtension;
export type ValidationComputed<T> = ko.Computed<T> & ObservableValidationExtension;
export type ValidationPureCom... |
c230c5653f772e45d720d4925336658e7ae21d7a | TypeScript | nguyer/aws-sdk-js-v3 | /clients/node/client-ec2-node/types/_KeyPairInfo.ts | 2.984375 | 3 | /**
* <p>Describes a key pair.</p>
*/
export interface _KeyPairInfo {
/**
* <p>If you used <a>CreateKeyPair</a> to create the key pair, this is the SHA-1 digest of the DER encoded private key. If you used <a>ImportKeyPair</a> to provide AWS the public key, this is the MD5 public key fingerprint as specified in s... |
98b13158836d16a0099c7027a31b44183d881bdd | TypeScript | damadrigal/TallerAngularGraphql | /backend/src/resolvers/Product/ProductResolver.ts | 2.609375 | 3 | import { Resolver, Query, Mutation, Arg, Int } from 'type-graphql'
import { Any } from 'typeorm';
import { Product } from '../../entities/Product'
import { ProductInput } from './productInput';
import { ProductUpdateInput } from './productUpdateInput';
@Resolver()
export class ProductResolver {
@Mutation(() => Pr... |
3e60e769c75e7ff95393a7cb5e426b2babd6ffe4 | TypeScript | Vadim-w/TodoList | /src/api/todolist-api.ts | 2.609375 | 3 | import axios from "axios";
const instance = axios.create({
withCredentials: true,
headers: {
'API-KEY': "0788c074-2a2b-400e-ae91-bcf1a7100923"
},
baseURL: 'https://social-network.samuraijs.com/api/1.1/'
})
//api
export const todoListApi = {
getTodoLists() {
return instance.get<Arra... |
fd2a57bd537ba3b9cb08c1a87eb4ca3d0d5a0fd7 | TypeScript | gitter-badger/owge | /game-frontend/projects/game-frontend/src/helpers/common-component-test.helper.ts | 2.875 | 3 | import { By } from '@angular/platform-browser';
import { AbstractCommonTestHelper, StatePrefix } from './abstract-common-test.helper';
import { ProgrammingError } from './../error/programming.error';
import { TestBed, TestModuleMetadata, ComponentFixture } from '@angular/core/testing';
import { DebugElement, Type, Simp... |
4be4865a70a4dfb1431d98b4125cfeb7706b9913 | TypeScript | talamaska/rxjs-angular2-examples | /keyboard-shortcuts/src/app/keyboard-shortcuts/keyboard-shortcuts.service.ts | 2.609375 | 3 | import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { default as keyCodeMap } from './keyCodeMap';
@Injectable()
export class KeyboardShortcutsService {
keyDowns: any;
keyUps: any;
keyEvents: any;
constructor() {
this.keyDowns = Observable.fromEvent(document, 'keydown')... |
a2633a98a079c0041a1d15b2634b0186d574ab74 | TypeScript | MrZhouZh/awesome-validator | /src/rules/uppercase.ts | 2.671875 | 3 | import { AbstractRule } from './abstract-rule';
export class Uppercase extends AbstractRule {
/**
* Validate.
*/
public validate(input: any): boolean {
return input === String(input).toLocaleUpperCase();
}
}
export default Uppercase;
|
d51c0aa90fd52e10a1e9f305caf8516aab8f1591 | TypeScript | bridgecrew-perf7/assignment-deployment-1 | /src/lib/command.ts | 3.390625 | 3 | import process from 'process';
type Args = {
[key: string]: string;
};
const noop = (a: any) => (a)
export default class Command {
private _options: string[];
private _values: string[];
//TODO: change any to specific type
private _args: any;
constructor() {
this._options= [];
const [, , ...rest... |
1c23630256900510319424868b75957ca2a7f95f | TypeScript | riansco14/project-react-1 | /backend/src/errors/AppError.ts | 2.734375 | 3 | class AppError {
public readonly message:string
public readonly statusCode: number
constructor (message:string, statusCode = 400) {
this.message = message
this.statusCode = statusCode
}
}
export default AppError
|
4d611c8cd8000a31f83d4679e9af64d58c357aa1 | TypeScript | suckerp/angular | /FrontendToDo/src/app/observabletest.ts | 3.3125 | 3 | import * as rx from 'rxjs'
import * as op from 'rxjs/operators'
const myObservable = rx.of(1,2,3)
const myObservable2 = rx.Observable.create((observer)=>{
let wiederhole = 1
while (wiederhole > 0.1){
wiederhole = Math.random()
if (wiederhole<0.75) observer.next(wiederhole)
e... |
add6149a24d91bb1833f559c7fdc916036c48f7f | TypeScript | minofrk/msf-pretty-print.js | /src/format/index.ts | 3.140625 | 3 | import { Option, some, none } from 'fp-ts/lib/Option';
import { Position, StringArray, Board } from './codecs';
import boardToString from './board-to-string';
export default function format(key: string, value: unknown): Option<string> {
if (typeof value === 'string' && /^\$\d+$/.test(value)) {
return some(... |
d7e370a9b91155e380575fe95cc7e05188d8ee28 | TypeScript | jduehring/opencast-editor | /src/redux/mainMenuSlice.ts | 2.984375 | 3 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import { MainMenuStateNames} from '../types'
export interface mainMenu {
value: MainMenuStateNames,
}
const initialState: mainMenu = {
value: MainMenuStateNames.cutting,
}
/**
* Slice for the main menu state
*/
export const mainMenuSlice = createSl... |
7d1cc59ab4662329172e6c81ec5de16a2e268649 | TypeScript | genk1/react-hook | /packages/cache/types/lru.d.ts | 2.828125 | 3 | export declare const lru: <Key = string, Value = any>(
maxSize: number
) => LRUCache<Key, Value>
export declare type LRUCache<Key = string, Value = any> = {
head: LRUNode<Key, Value> | undefined
size: number
forEach(fn: (key: Key, value: Value) => void): void
search(key: Key): LRUNode<Key, Value> | undefined
... |
48a3f7366d61500d796a01f643c11110789df7e2 | TypeScript | joshuafairchild1/websocket-chat | /src/client/state/reducer.tests.ts | 2.59375 | 3 | 'use strict'
import { default as reduce } from './reducer'
import { AppState } from './StateStore'
import { Actions, StoreAction } from './Action'
import RoomJoinedPayload from '../../shared/model/RoomJoinedPayload'
import ChatMessage from '../../shared/model/ChatMessage'
import { assert } from 'chai'
import Room from... |
f43f43eafdf87cdcbe2d580188a6ef78d82365e3 | TypeScript | yurialvesbrasil/auth_service_public | /src/index.ts | 2.515625 | 3 | import 'reflect-metadata';
import { SetupServer } from './server';
import logger from './logger';
enum ExitStatus {
Failure = 1,
Success = 0,
}
process.on('unhandledRejection', (reason, promise) => {
logger.error(
`O aplicativo está saindo devido a uma promessa não tratada: ${promise} em razão de: ${reason}... |
b19501ac1d274e8badbb82243ca3100eea759566 | TypeScript | gu-tum-gun-aeng/med4all-be | /tests/unit/services/patient/patient.validator.test.ts | 2.71875 | 3 | import { assertEquals } from "../../../../deps.ts";
import { ExternalRoutingDestination } from "../../../../src/models/enum/externalRoutingDestination.ts";
import { colinkValidator } from "../../../../src/models/patient/request/validator/colink.validator.ts";
import { wisibleValidator } from "../../../../src/models/pat... |
be7de9618fac25536ba1fda150ab33176739c171 | TypeScript | micheldpcarlos/angular-loader-service | /loader.service.ts | 2.671875 | 3 | import { Injectable } from "@angular/core";
import { BehaviorSubject } from "rxjs";
@Injectable()
export class LoaderService {
//public subject that controls a personalized loader
public showLoader: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
//counter to control multi calls
private loaderC... |
a56f561b4dece8243c18b5aff7529fb9695f371a | TypeScript | romannovojilov/simple-todo-list | /src/redux/reducers/todoReducer.ts | 2.953125 | 3 | import { ITask, EditableTask, TaskFilterStatus } from "../../types/task";
import { TodoAction } from "../actions/todoActions";
import { CREATE_TASK, SET_EDITABLE_TASK, UPDATE_TASK, REMOVE_TASK, SET_FILTER } from "../types/todoTypes";
export type TodoState = {
list: ITask[],
editableTask: EditableTask,
filter: Ta... |
02d36c9ce4f5e2228096ee1d2a7a625a4d0ad644 | TypeScript | DanielMarcosFuella/OOPReview | /Repaso3.1.ts | 2.859375 | 3 | import {Mobile} from "./Repaso2"
export class MobileLibrary{
private name:string
private location:string
private mobiles:Mobile[]
private totalPrice: number
constructor(name:string,location:string,mobiles:Mobile[]){
this.name=name
this.location=location
this.mobiles=mobiles
... |
8c2bd68dae56e23cc68b8c08c3fedd9c7d790d0c | TypeScript | noel-yap/science-test-grading | /Grade.ts | 3.03125 | 3 | import {Numbers} from './Numbers';
import {Properties} from './Properties';
import {ScientificNotation} from './ScientificNotation';
import {SIParser} from './SIParser';
/**
* @param exactMatch True if exact match only (eg no partial credit).
* @param points Number of full-credit points.
* @param observed ... |
766d025b3299f93753384b2eb535771010b9d410 | TypeScript | lucas-242/Round-Robin | /without-interruptions/roundRobin.ts | 3.5625 | 4 | /**Classe utilizada para definir os Processos */
class Process {
/**Nome do processo */
name: string;
/**Quantum necessário para a conclusão do processo */
quantum: number;
/**Prioridade do processo
* 0- Alta prioridade
* 1- Média prioridade
* 2- Baixa prioridade
*/
priority:... |
bde6a1f428a65219a0fcae63b5b1d73e1ef655a8 | TypeScript | maximopeoficiales/NODETS-CRUD | /src/models/Book.ts | 2.703125 | 3 | import mongosse, { Schema, model } from "mongoose";
//interfaz para validar los datos
export interface Book extends mongosse.Document {
title: string;
author: string;
isbn: string;
}
//esquema base
const BookSchema = new Schema({
title: String,
author: String,
isbn: String,
});
export default model<Book>("... |
fef97ad8bdf5e5aa95d1e8ad7eb07fb421e2f8e6 | TypeScript | Jumpaku/AsyncResult | /dist/Result.d.ts | 2.953125 | 3 | import { BaseError } from "make-error-cause";
import { AsyncResult } from "./AsyncResult";
export declare class ResultError<E> extends BaseError {
readonly name: string;
readonly detail: E;
constructor(error: E);
}
interface ResultTry {
<V>(tryFun: () => V): Result<V, unknown>;
<V, E>(tryFun: () => ... |
ac358a5895e63c32064632688da05e5ec21698b6 | TypeScript | davidruiz120/proyectoIonicPMDMulti | /src/app/services/garage.service.ts | 2.734375 | 3 | import { Vehiculo } from './../model/Vehiculo';
import { environment } from './../../environments/environment';
import { Injectable } from '@angular/core';
import { AngularFirestoreCollection, AngularFirestore } from 'angularfire2/firestore';
import { Observable, Subscription, interval } from 'rxjs';
@Injectable({
p... |
a88246ed2ba08606a359574768c2d9f35d6dd308 | TypeScript | my-open-source-pkg/open-source-tpl | /src/index.ts | 3 | 3 | function greeter (person: string) {
return 'Hello3, ' + person
}
const user = [0, 1, 2]
console.log(user, greeter('Lyman'))
|
c5c343a138d837c506fbfe22f3890f1a790a94b7 | TypeScript | Amend-Health/loop-development-kit | /ldk/javascript/src/whisper/index.ts | 2.796875 | 3 | import { mapToExternalWhisper, mapToInternalWhisper } from './mapper';
import { NewWhisper, Whisper } from './types';
export * from './types';
/**
* Whisper aptitude provides the ability to create a whisper.
*/
export interface WhisperAptitude {
/**
* Adds a new whisper to Olive Helps based on the configurati... |
384923e2ccc1846e95a60f400605c048e7ad3295 | TypeScript | morecchia/discogs-angular2-app | /client/app/reducers/release.ts | 2.90625 | 3 | import { DiscogsItem, DiscogsRelease } from '../models';
import * as release from '../actions/release';
import * as collection from '../actions/collection';
export interface State {
loaded: boolean;
loading: boolean;
id: number | null;
entity: DiscogsRelease;
};
const initialState: State = {
loaded: false,
... |
20fdf5904209b0093c0636c20bf9af1d9fb1b37e | TypeScript | DoLopes/clean-node-api | /Src/Shared/Lib/StrictMonapt/Some.ts | 2.578125 | 3 | import { Option } from "Shared/Lib/StrictMonapt/Option";
export class Some<A> extends Option<A> {
public get(): A {
return this.option.get();
}
}
|
2fb087f117bdd5aa2c9f272a2795982aa8e30917 | TypeScript | Jvvillasb/ds-sales | /front-web/src/core/utils/types.ts | 2.75 | 3 | export type Gender = 'MALE' | 'FEMALE' | 'OTHER';
export type SalesByDate = {
date: string;
sum: number;
};
export type ChartSeriesData = {
x: string;
y: number;
};
export type FilterData = {
dates?: Date[];
gender?: Gender;
};
export type SalesSummaryData = {
sum?: number;
min: number;
max: numbe... |
cd4c1aa37e239fe8c33891498e5b8f3a4bdce4ba | TypeScript | MauricioLudwig/philippides-server | /src/utils/message.ts | 2.90625 | 3 | import { v4 as uuid } from 'uuid';
import { IMessage } from './definitions';
export class Message {
id: string;
created: number;
constructor() {
this.id = uuid();
this.created = this.getTimestamp();
}
new(user: string, text: string): IMessage {
return {
id: this.id,
admin: false,
... |
d713f1596fedabf94421deb74faf63a087187798 | TypeScript | ManiukIvan/ui-diploma | /src/app/components/signup/signup.component.ts | 2.75 | 3 | import { Component, OnInit } from '@angular/core';
import {FormControl, FormGroup, Validators} from '@angular/forms';
@Component({
selector: 'app-signup',
templateUrl: './signup.component.html',
styleUrls: ['./signup.component.scss']
})
export class SignupComponent implements OnInit {
message: any;
registerF... |
2eab1a7bc5e351c7d07e70fec47f0899895f5298 | TypeScript | martinavesela/bachelors | /src/store.ts | 3.125 | 3 | import {configureStore} from '@reduxjs/toolkit'
export interface State {
userId: number
userName: string
}
const initialState: State = {
userId: 0,
userName: ""
}
export const appReducer = (state: State = initialState, action: any) => {
switch (action.type) {
case "setUserId":
return {...state, u... |
5f156a42816e8f28fabf713e12a8067230301a51 | TypeScript | acsl2r/acsl2r | /acsl2r/src/component/acslscript/pulseexpression.ts | 2.734375 | 3 | import { AcslType, Prec } from '../../enum';
import { IExpression } from '../../interface';
import { applyAcslTypesToExpression } from './objectmodel';
import { ExpressionBase } from './expressionbase';
export default class PulseExpression extends ExpressionBase
{
constructor(tz: IExpression, p: IExpression, w: IEx... |
ea2f5c48174ed846d5f61768630b8c4d69681362 | TypeScript | DakotaLarson/BattleTanks-Client | /src/DomEventHandler.ts | 3.15625 | 3 | type eventCallback = (data?: any) => any;
export default class DomEventHandler {
private static listeners: Map<any, eventCallback> = new Map();
public static addListener(context: any, obj: HTMLElement | WebSocket, event: string, callback: eventCallback, options?: AddEventListenerOptions) {
const liste... |
29ab09d2c3ee2652cd8d31589c948999a3371210 | TypeScript | date-fns/date-fns | /src/getWeekOfMonth/index.ts | 3.515625 | 4 | import getDate from '../getDate/index'
import getDay from '../getDay/index'
import startOfMonth from '../startOfMonth/index'
import type { LocaleOptions, WeekStartOptions } from '../types'
import { getDefaultOptions } from '../_lib/defaultOptions/index'
/**
* The {@link getWeekOfMonth} function options.
*/
export in... |
602df15145930c35c4fad588195d23100108984e | TypeScript | bal200/Space-Taxi | /src/dashboard.ts | 2.765625 | 3 | import { Person } from './person';
import { SpaceTaxiGame } from './app';
export interface Slot {
p: Person,
text?: Phaser.GameObjects.Text,
}
export class Dashboard extends Phaser.Scene {
info :Phaser.GameObjects.Text;
game: SpaceTaxiGame;
slots: Slot[] = [];
constructor( config ) {
super(config);
}
init(... |
fd580992eaca5081f3d532165e491226b6c86c0a | TypeScript | mientjan/EaselTS | /src/easelts/filters/Filter.ts | 2.9375 | 3 | /*
* Filter
* Visit http://createjs.com/ for documentation, updates and examples.
*
* Copyright (c) 2010 gskinner.com, inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
... |
5139064b347e3d0b8f480c3cfe63260e6bb2b64e | TypeScript | 931-ChristinaRuss-Chronicle/chronicle-front | /chronicle-front/src/app/components/login/login.component.ts | 2.609375 | 3 | import { Component, OnInit } from '@angular/core';
import firebase from 'firebase/app';
import 'firebase/auth';
import { Router } from '@angular/router';
import { AuthService } from 'src/app/services/auth.service';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.co... |
966068713f5825f27f31540f3e901035d1b1c938 | TypeScript | hoaipeter/react-dnd-task | /src/store/app-store.ts | 2.640625 | 3 | import { combineReducers, createStore, EmptyObject } from 'redux';
import throttle from 'lodash.throttle';
import seed from './initialize-store';
// Import reducers
import { boardReducers } from '../reducers/board-reducer';
import { cardReducers } from '../reducers/card-reducer';
import { listsReducers } from '../redu... |
631aa2bdd65d93781c6eccf0897e418dce2d49dd | TypeScript | harry502/CardGame | /client/src/core/controller/ViewController.ts | 2.625 | 3 | module core {
export class ViewController extends Controller {
private parent: egret.DisplayObjectContainer;
private viewLayerType: ViewLayerType;
private argList: Array<any>;
public constructor() {
super();
}
public destroy() {
this.parent = null;
this.argList = null;
this.viewLayerType = nu... |
15110fcac56190d6376edbc7fa09cd66c862e5b9 | TypeScript | guardian/liveblog-rendering | /src/liveBlock.ts | 2.609375 | 3 | // ----- Imports ----- //
import { Option, fromNullable } from '@guardian/types/option';
import { BlockElement } from '@guardian/content-api-models/v1/blockElement';
import { Block } from '@guardian/content-api-models/v1/block';
import { maybeCapiDate } from './capi';
// ----- Types ----- //
type LiveBlock = {
... |
da94b270c026c44f286413dab2afec24a57e6185 | TypeScript | sergio222-dev/nestjs-ddd-practice | /test/libs/First-aprox-lib/Courses/Domain/Events/CourseCreatedEventMother.ts | 2.734375 | 3 | import { CourseCreatedEvent } from "@libs/First-aprox-lib/Courses/Domain/events/CourseCreated.event";
import { UuidMother } from "../../../../Shared/Domain/UuidMother";
import { WordMother } from "../../../../Shared/Domain/WordMother";
import { Course } from "@libs/First-aprox-lib/Courses... |
42bcaea7f51d929adb2034fb68af0db4cd8ddde0 | TypeScript | xmano/TypeScriptCourse | /app/main.ts | 3.0625 | 3 | import { AppComponent } from './app.component';
let c = new AppComponent();
console.log(c.string);
interface product {
id?: any;
desc: string;
price: number;
}
let item: product = {
desc: "iPhone",
price: 60000
}
let anotherItem = {
id: '100',
desc: 'Merc C5',
price: 2000000
}
item = anotherItem;
... |
787b6928d007431c5df6299eb688051bbfb6b1db | TypeScript | harsilspatel/pong-breakout | /src/svgelement.ts | 3.671875 | 4 | /**
* a little wrapper for creating SVG elements and getting/setting their attributes
* and observing their events.
* inspired by d3.js (http://d3js.org)
*/
class Elem {
elem: Element;
/**
* @param svg is the parent SVG object that will host the new element
* @param tag could be "rect", "line",... |
27146ac5ef8f2eeaa34ba5942ffd6caaa685f910 | TypeScript | dariki1/Pong | /Client/Comm.ts | 2.765625 | 3 | class Comm {
public static send(type, message) : void{
jsSend(type, message);
}
public static addMessageListener(type, callback) : void {
jsAddMessageListener(type, callback);
}
public static init() {
this.addMessageListener('gameUpdate', function(msg) {
if (msg... |
6af1ed0959ceace56ead5b670beb423ebd5242fd | TypeScript | DNIStream/dni.website | /src/DNI.Web/src/app/components/shared/uriHelper.ts | 2.984375 | 3 | export class UriHelper {
public static getUri(path: string, parameters: { [key: string]: string } = null): string {
let uri = path.trim();
if (parameters) {
// Add other parameters
for (const p in parameters) {
if (parameters.hasOwnProperty(p) && parameters[p... |
4282538c10e20c1540d93661b590e529e2f4d7c2 | TypeScript | tpohl/flights | /functions/src/util/defaulttime.ts | 2.625 | 3 | import { Flight } from '../models/flight';
const defaultTimes = function(flight: Flight){
// if arrival and desitnation are empty
if (flight.departureTime === undefined && flight.date !== undefined) {
flight.departureTime = flight.date + 'T12:00:00Z' ;
}
if (flight.arrivalTime === undefined && flight.date... |
0b97bdd789614f2fd3713fb1216c07cd4c202235 | TypeScript | shokfake/SMS_Service | /src/module/student/repository/student.repository.ts | 2.59375 | 3 | import { InternalServerErrorException, Logger } from "@nestjs/common";
import { Repository, EntityRepository } from "typeorm";
import { CredentialDto, UserEntity } from "../../../auth/model/auth.model";
import { StudentEntity } from "../../../entities/EsPreadmission";
import { AdmissionDto } from "../dto/admission.dto"... |
d4c0e6d94fd8c623259fdbd782a7913284dc5fb8 | TypeScript | real-marshal/binance-hotkeys | /src/hooks/useHotkeys.ts | 2.703125 | 3 | import { useCallback, useEffect, useState } from 'react'
import { Optional } from '../common/utils'
import { v4 as uuidv4 } from 'uuid'
export interface HotkeyData {
id: string
key: string
handler: () => unknown
}
export default function useHotkeys(
node?: HTMLElement,
defaultHotkeys: HotkeyData[] = []
) {
... |
debfc32f71eb1ee491e7a9e4df25d50e50e9b61f | TypeScript | saiqulhaq/techcal.dev | /web/src/functions/getCalendarEvents.ts | 2.515625 | 3 | import type { Dayjs } from 'dayjs'
import type { GoogleCalendar } from '$types/GoogleCalendar'
export const getCalendarEvents = async (begin: Dayjs, end: Dayjs) => {
let resp: GoogleCalendar = await fetch(
`https://www.googleapis.com/calendar/v3/calendars/${
import.meta.env.VITE_CALENDAR_EMAIL
}/events... |
036dbbbfdb149990ec8ebad0b89a97ab8724e4dc | TypeScript | eschelkunov/crud_react_redux_saga_typescript | /src/saga/sagas.ts | 2.609375 | 3 | import { takeLatest, put, all, call, takeEvery } from "redux-saga/effects";
import {
fetchData,
addSinglePost,
editSinglePost,
removeSinglePost
} from "../api";
import {
ADD_POST_ASYNC,
IPostsActionType,
ISinglePostActionType,
REMOVE_POST_ASYNC,
IRemovePostActionType,
removePost,
EDIT_POST_ASYNC,
... |
3c9f5a1f764e71dbb80b07175d42900e0eb2db50 | TypeScript | derkaczda/Kouky | /src/core/rendering/buffer/IndexBuffer.ts | 3.0625 | 3 | namespace Kouky {
export class Index implements IBufferDataElement {
public index: number;
public constructor(index: number) {
this.index = index;
}
public toArray(): number[] {
return [this.index];
}
public toFloat32Array(): Float32Array {
... |
c0cd45f2f1f051c2caf9af71601063946c26ada9 | TypeScript | cornelg7/tippymaze | /src/app/utils/node.ts | 3.03125 | 3 |
export default class Node {
id: string;
placement: string;
text: string;
onClick: () => void;
onClickInt: () => void;
constructor(id: string, placement: string, text: string = id, onClick?: () => void, onClickInt?: () => void) {
this.id = id;
this.placement = placement;
this.text = text;
t... |
16ad2ccc486c4328f33b9ccb1eef4ffe654d6bd9 | TypeScript | blanck1945/React-control-form | /src/funcs.ts | 2.859375 | 3 | export const getEventMonth = (date: string) => {
const day = date.slice(5, 7);
const monthName = returnMontName(parseInt(day));
return monthName.toString();
};
const returnMontName = (num: number) => {
const months = [
"Enero",
"Febrero",
"Marzo",
"Abril",
"Mayo",
"Junio",
"Julio",
... |
a07b4a565e7af6487aca5c60a1eac59b0e15f17f | TypeScript | ddotx/rxjs-state | /libs/rxjs-state/src/lib/core/operators/coalesce.ts | 3 | 3 | import {
MonoTypeOperatorFunction,
Observable,
Operator,
SubscribableOrPromise,
Subscriber,
Subscription,
TeardownLogic
} from 'rxjs';
import {InnerSubscriber, OuterSubscriber, subscribeToResult} from 'rxjs/internal-compatibility';
import {generateFrames} from '../projections';
export interface Coalesci... |
2b931bd31a7d3b255168b8139317ec9b7c9fd4c2 | TypeScript | muhadbk0/file-storage-application | /server/src/middlewares/isAdmin.ts | 2.5625 | 3 | import {Request,Response,NextFunction} from 'express'
const isAdmin = (req:Request,res:Response,next:NextFunction )=>{
if( req.currentUser.role !=='admin' ){
const error = new Error('You not an admin user');
error["status"]=404;
throw error
}
next()
};
export default isAdmin; |
5260de2fffd952d2f54825832502b340d1034341 | TypeScript | fabien-h/url | /src/parseURL.ts | 2.921875 | 3 | import urlTestRegex from './urlTestRegex';
import { IURLParsed } from './types';
/**
* Parse an url to give an object
*
* @param url
*/
const parse = (url: string): IURLParsed | false => {
/**
* Manual check
*/
if (!url || typeof url !== 'string') {
return false;
}
/**
* Test if we have a val... |
3a93dc4f052c49426fbad794258f896ba3a2f04b | TypeScript | vishalmhatre56/Angular7TrainingDemos | /demo/angular7-demo/src/app/sizer/sizer.component.ts | 2.640625 | 3 | import { Component, EventEmitter, Input, Output, SimpleChanges } from '@angular/core';
@Component({
selector: 'app-sizer',
templateUrl: './sizer.component.html',
styleUrls: ['./sizer.component.scss']
})
export class SizerComponent {
@Input() size: number | string;
@Output() sizeChange = new EventEmitter<nu... |
b1af36e0ca50799ecfcd84a625245dc6437f1e52 | TypeScript | sldsrg/chesspector | /spec/moverecord.spec.ts | 3.078125 | 3 | import 'mocha'
import { expect } from 'chai'
import { MoveRecord, MoveFlags, Position } from '../src'
describe(`MoveRecord`, () => {
describe(`when constructed with LAN`, () => {
it('correct handle check sign', () => {
const rec = new MoveRecord(1, true, 'Qd8-d3+')
expect(rec.toString()).to.be.equal... |
7de21057e351c956f51494efc4693440260af6c0 | TypeScript | JordyBaylac/js-analyzer | /lib/analysis/analyzer/file_analyzer.ts | 2.78125 | 3 | import { IStrategy, IStrategyResult } from '../strategies/i_strategy';
import * as esprima from 'esprima';
import * as fs from 'fs';
import * as path from 'path';
export interface IFileAnalysis {
filePath: string,
strategiesResults: IStrategyResult[]
}
export class FileAnalyzer {
private fileToProcess: ... |
c73ebe354125bfeb13ef4cd7465582f5cbb2a3eb | TypeScript | PacktPublishing/Angular-2-Application-Development | /Learning Angular 2/chapter_02/examples/example_27.ts | 2.5625 | 3 | interface Vehicle {
make: string;
}
class Car implements Vehicle {
// Compiler will raise a warning if this property is not declared
make: string;
}
|
b49223f6435b1175c36ccec7fe4d773d8be69ba6 | TypeScript | stungkit/ignite | /boilerplate/app/models/helpers/withSetPropAction.ts | 3.703125 | 4 | import { IStateTreeNode, SnapshotIn } from "mobx-state-tree"
/**
* If you include this in your model in an action() block just under your props,
* it'll allow you to set property values directly while retaining type safety
* and also is executed in an action. This is useful because often you find yourself
* making... |
665bb564ab9a8a3db310fa8adc84b86692e5362b | TypeScript | Gharaibeh/lazy-web-app | /server/models/user.model.ts | 2.59375 | 3 | import * as mongoose from 'mongoose';
(<any>mongoose).Promise = Promise;
const Schema = mongoose.Schema;
const UserSchema = new Schema({
givenName: {type: String},
familyName: {type: String},
email: {type: String},
emailConfirmed: {type: Boolean, default: false},
timeRegistered: {type: Date, defaul... |
98d97a1febcb1420a7957d0224717fe02b22f850 | TypeScript | Sienkiewicz/launch_graphs | /helpers/useResizeObserver.ts | 2.6875 | 3 | import { useEffect, useState } from "react"
export const useResizeObserver = ref => {
const [dimensions, setDimensions] = useState<{
width: number
height: number
}>({ width: 500, height: 500 })
useEffect(() => {
const observeTarget = ref.current
const resizeObserver = new ResizeObserver(entries =... |
88b6963604b5cb7f03eed689e3f8acc2bd38befd | TypeScript | gingermusketeer/toy-robot | /src/robot.ts | 3.671875 | 4 | // Table is 5x5 so we limit the x and y to be between 0 and 4
const MAX_INDEX = 4;
const HEADINGS = ["NORTH", "EAST", "SOUTH", "WEST"];
enum Command {
MOVE = "MOVE",
LEFT = "LEFT",
RIGHT = "RIGHT",
REPORT = "REPORT",
PLACE = "PLACE",
}
enum Heading {
NORTH,
EAST,
SOUTH,
WEST,
}
type Position = [num... |
e6f4c452e83e83477234c6f8523bee181fdebf1b | TypeScript | Viktor19931/football-teams | /src/app/country/country.service.ts | 2.59375 | 3 | import { ICountry } from './country.interface';
export class CountryService {
countries: { [key: string]: ICountry };
constructor() {
console.log(this.getCountriesMetaData());
this.countries = this.getCountriesMetaData();
}
getCountriesMetaData(): {[key: string]: ICountry } {
return JSON.parse((<... |
83a5dade9b5dfc895978b059eacf2f33a0c01f7c | TypeScript | Chunwol/Ts_NoticeBoard_API | /database/models/User.ts | 2.765625 | 3 | import { Model, DataTypes, Sequelize } from 'sequelize';
import Board from './Board';
import Comment from './Comment'
class User extends Model {
public pk!: string;
public id!: string;
public password!: string;
public name!: string;
public readonly createdAt!: Date;
public readonly updatedAt!: Date;
pub... |
bd86646b480230e4f41110a2e745fae5946a1ac6 | TypeScript | sa77/exercism | /typescript/robot-name/robot-name.ts | 3.515625 | 4 |
export default class RobotName {
private static CHARACTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
private static NUMBERS = '0123456789';
private takenNames: string[] = [];
public name: string;
constructor() {
this.name = this.getRobotName();
}
resetName = (): string => this.name = this.... |
639474d8622701e46e9d734ba895270f53f4853c | TypeScript | markusbohl/fluent-ts-validator | /src/regression/Issue4.spec.ts | 3.46875 | 3 | /*
* Regression tests for https://github.com/markusbohl/fluent-ts-validator/issues/4
*/
import {AbstractValidator} from "../AbstractValidator";
describe("Issue 4", () => {
let validator: AbstractValidator<ClassA>;
beforeEach(() => {
validator = new ClassAValidator();
});
describe("Abstract... |
555e3bcb77bb754ecc3743d1bb8710344e29cef4 | TypeScript | colapiombo/link-station | /src/linkstation.ts | 3.546875 | 4 | /**
* Class use to calculate the suitable link station for a device at given point [x,y]
* @class
* @classdesc Class used to find the best link station for a device at given point in n-dimensional space
*/
export default class LinkPowerCalculator {
/**
* private variabile use to store the station
* @... |
39c4f922f19b8cb9817d7f19f6578c41aaa0e75f | TypeScript | fortil/get-users-github | /src/store/epics.ts | 2.578125 | 3 | import { combineEpics, ofType } from 'redux-observable';
import { of } from 'rxjs';
import { ajax } from 'rxjs/ajax';
import { Action } from 'redux';
import { mergeMap, map, catchError } from 'rxjs/operators';
import { Types, UserTypes } from './actions';
const gitHubUrl = 'https://api.github.com/users/';
interface I... |
e4e834148feaa3bb8b25b0fe729b6406627b10b7 | TypeScript | colyseus/schema | /test-external/MapSchemaMoveNullifyType.ts | 2.828125 | 3 | import { Schema, type, MapSchema } from "../src";
class State extends Schema {
@type({ map: "number" }) previous: MapSchema<number>;
@type({ map: "number" }) current: MapSchema<number>;
}
const state = new State();
let bytes: number[];
state.current = new MapSchema<number>();
state.current.set("0", 0);
state... |
cd4f9740b48cccd8b938b5b1de5ac7dd5177450a | TypeScript | DimitarGaydardzhiev/EmployeeSystem-Angular | /front-end/src/app/core/store/reducers/employee.reducers.ts | 2.9375 | 3 | import * as employee from '../actions/employee.actions'
import { Employee } from '../../models/employee/employee.model';
import { ProfileInfo } from '../../models/employee/profile-info';
export interface State {
currentEmployees: Employee[],
formerEmployees: Employee[],
profileInfo: ProfileInfo
}
const initialS... |
0a5628672e770571bb7c4ef17f7945f2c62f48a2 | TypeScript | makutamoto/online-judging-web-client | /src/actions/index.ts | 2.515625 | 3 | import axios from 'axios';
import { DispatchType } from '../';
import { StateType } from '../reducers';
export const StatusAC = 0;
export const StatusWA = 1;
export const StatusRE = 2;
export const StatusTLE = 3;
export const StatusCE = 4;
export type Page = 'home' | 'contest_list' | 'contest' | 'task' | 'explanatio... |
22e24243dc5184a0dea10fb8f1112fe4532207fb | TypeScript | lexdevel/PostFX | /src/platform/Buffer.ts | 2.8125 | 3 | import { AbstractPlatformEntity } from "./AbstractPlatformEntity";
import { GL } from "../core/GL";
/**
* The buffer class.
*/
export abstract class Buffer extends AbstractPlatformEntity<WebGLBuffer> {
protected target: number;
/**
* Constructor.
* @param target The buffer target
*/
public constructo... |
f20614ec7d774fb2d610bdaa4a8d37c8fa74f4b8 | TypeScript | stupidsongshu/chat | /src/utils/http.ts | 2.609375 | 3 | import axios, { AxiosRequestConfig, AxiosResponse, Method } from 'axios'
import qs from 'qs'
import { Message, Loading } from 'element-ui'
import { ElLoadingComponent } from 'element-ui/types/loading'
import router from '@/router'
import { baseURL, getTokenKey } from '@/utils'
type Headers = {
[key: string]: string
... |
09caa2c0a880a206df7f6dd0b8f55ecc7cff0165 | TypeScript | vanelo/hospital-backend-nestjs | /src/auth/user.entity.ts | 2.625 | 3 | import { Expose } from "class-transformer";
import { ClinicalSpecialty } from "src/clinical-specialty/clinical-specialty.entity";
import { Consultation } from "src/consultation/consultation.entity";
import { Exam } from "src/exam/exam.entity";
import { Column, Entity, ManyToMany, OneToMany, PrimaryGeneratedColumn } fro... |
79d1ff8d890df6161caf305f2cfb59bdaa241bae | TypeScript | comett2/ngDetect | /src/app/leftsidebar/delay/DelayComponent.ts | 2.515625 | 3 | import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';
import { DelayService } from './DelayService';
import { DelayType } from './DelayType';
@Component({
selector: 'sp-delay',
templateUrl: `DelayComponent.html`,
styl... |
25a9448ef8aff19d41e00c76ca1e9d030d070089 | TypeScript | AndersonKV/react-typescript-instagram-clone | /backend/src/controllers/SearchController.ts | 2.5625 | 3 | import { Request, Response } from "express";
import { currentDate, hoursFormated } from "../utils/util";
import User, { UserInterface } from "../models/User";
import Post from "../models/Post";
import Following, { FollowingInterface } from "../models/Following";
import Like from "../models/Like";
import {
GET_ALL_USE... |
bb722f215b89eb4c5b02515ffa82fd6b90ec1b12 | TypeScript | SinghDigamber/angular-template-driven-form | /src/app/app.component.ts | 2.625 | 3 | import { Component } from '@angular/core';
export class User {
public name!: string;
public email!: string;
public password!: string;
public hobbies!: string;
}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
m... |
07299333cc3ece45bf80975f196426b2f6d2422b | TypeScript | silviuaavram/leetcode-puzzles | /src/puzzles/strings/add-strings.ts | 3.78125 | 4 | /**
* https://leetcode.com/problems/add-strings/
*/
export function addStrings(num1: string, num2: string): string {
if (!num1.length) {
return num2
}
if (!num2.length) {
return num1
}
const input1 = num1
.split('')
.reverse()
.join('')
const input2 = num2
.split('')
.reverse... |
18012e44232ca67635dd3ef3865424932bec5d9c | TypeScript | galileopy/programando_con_react | /src/redux/reducers/tarea.ts | 2.515625 | 3 | import { Acciones } from "../actions";
import { IdsAcciones } from "../actionTypes";
import { EstadoLista, Estados } from "../../types/Tarea";
import { merge } from "remeda";
import { v1 as uuid } from "uuid";
import {
agregarTarea,
actualizarEstado,
actualizarDescripcion,
moverTarea,
eliminarFinalizadas,
e... |
cfe48c36408fdb3f5c368a97332e0b41421da060 | TypeScript | kk0917/javascript-design-patterns | /src/ConstructorPattern/Model.ts | 3.140625 | 3 | export type AddPropsType = {
obj: object;
}
export interface KeyIF {
value: string;
writable?: boolean;
enumerable?: boolean;
configurable?: boolean;
}
export interface CarIF {
model: string;
year: number;
miles: number;
}
export class Car implements CarIF {
model: string;
year: number;
miles... |
2b3a698e81e5960420a73fe2699d0fc6e893ad94 | TypeScript | anatoly-spb/ionic2-localdb | /src/providers/log-provider.ts | 2.78125 | 3 | import { Injectable } from '@angular/core';
import { DBProvider } from './db-provider';
import 'rxjs/add/operator/map';
enum LogLevel {
TRACE,
DEBUG,
INFO,
WARN,
ERROR
}
export class LogRecord {
id: number;
datetime: Date;
level: LogLevel;
msg: string;
}
@Injectable()
export class LogProvider {
... |
6a4deb59631d7592d410878d835f338e6ca46890 | TypeScript | meow-study/JavaScript-test | /src/Example/lib/ArrayRepeatedNumber.ts | 4.15625 | 4 | import { Sort } from "../../SortingArithmetic/Sort/lib/Sort.ts";
import { HashMap } from "../../DictionaryTest/lib/HashMap.ts";
/**
* 寻找数组中的重复数字
*
* 规则:
* 1. 给定一个长度为n的数组,数组中每个元素的取值范围为:0~n-1
* 2. 数组中某些数字是重复的,但是不知道有哪些数字重复了,也不知道每个数字重复了几次
* 3. 求数组中任意一个重复的数字
*/
export class ArrayRepeatedNumber {
private sort:... |
9b12f53d089c07b383e4ea0af7124c4fb317f86c | TypeScript | huaweicloud/huaweicloud-sdk-nodejs-v3 | /services/config/v1/model/AggregateComplianceDetailRequest.ts | 2.78125 | 3 |
export class AggregateComplianceDetailRequest {
private 'aggregator_id'?: string;
private 'account_id'?: string;
private 'compliance_state'?: AggregateComplianceDetailRequestComplianceStateEnum | string;
private 'policy_assignment_name'?: string;
private 'resource_name'?: string;
private 'reso... |
45803df507b7c1e66d03342723241a9427050fde | TypeScript | deepakparamesh/Drello | /frontend/src/app/app.service.ts | 2.546875 | 3 | import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
@Injectable()
export class AppService {
username: string = localStorage.getItem('username');
private usernameSource = new BehaviorSubject(this.username);
currentUsername = this.usernameSource.asObservable();
constructor() { }... |
5245ada57f87633165750b6d4cd0828afbb1d79f | TypeScript | jreyes72/Fanfilm | /src/app/Mock-Movies.ts | 2.75 | 3 | import {Movie} from './Movie'
export const MOVIES: Movie[] = [
{
id: 1,
title: "Joker",
plot: "Arthur Fleck works as a clown and is an aspiring stand-up comic. He has mental health issues, part of which involves uncontrollable laughter. Times are tough and, due to his issues and occupation... |
35b9fea0d420ea0501f9c06aadbe6e8096359e92 | TypeScript | sakuli/sakuli | /packages/sakuli-legacy/src/loader/legacy-project-properties.class.spec.ts | 2.734375 | 3 | import { LegacyProjectProperties } from "./legacy-project-properties.class";
describe("LegacyProjectProperties", () => {
let props: LegacyProjectProperties;
beforeEach(() => {
props = new LegacyProjectProperties();
});
describe("getBrowser", () => {
it("should return browser value if set", () => {
... |
fa9c07fac860edc0757e3407dc1eb411f675deec | TypeScript | geetchoubey/bd-backend-ts | /src/utils/helpers.ts | 2.671875 | 3 | import * as bcrypt from "bcrypt";
import {SNS} from 'aws-sdk';
export const encrypt = async (str: string | number): Promise<string> => {
const salt = await bcrypt.genSalt(10);
return await bcrypt.hash(str, salt);
}
export const compare = (source: string | number, encryptedString: string): Promise<boolean> => ... |
f085afd60eca47ac4797fc4cceb739022e883e31 | TypeScript | guardian/frontend | /static/src/javascripts/projects/common/modules/identity/cookierefresh.ts | 2.6875 | 3 | /**
* Once the Okta migration is complete and in front of 100% of users, we can delete this module.
*/
import { storage } from '@guardian/libs';
import {
isUserLoggedIn,
refreshOktaSession,
} from 'common/modules/identity/api';
const days30InMillis: number = 1000 * 60 * 60 * 24 * 30;
const shouldRefreshCookie: (
... |