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 |
|---|---|---|---|---|---|---|
e7c9ef37d3a49d5fd78a37da664d35fd2d82e57f | TypeScript | maaqoul/typescript-exertion | /difference-of-squares/difference-of-squares.ts | 3.4375 | 3 | export default class Squares {
squareOfSum:number;
sumOfSquares:number;
difference:number;
constructor (public number: number) {
this.SquareOfSum();
this.SumOfSquares();
this.Difference();
}
public SquareOfSum = (): number => {
let sum:number = 0;
for (let i... |
8e053de07a4e5b9c77d2cbd06bc5405d02333464 | TypeScript | Mikhail-Hursky/rsclone | /src/script/appliation/games/menu/PauseMenu.ts | 2.53125 | 3 | import * as Phaser from 'phaser';
// @ts-ignore
import Memory from '../Memory.ts';
// @ts-ignore
import CustomButton from '../buttons/CustomButton.ts';
const style = {
fontFamily: 'Pixel',
color: '#fff',
fontSize: '39px',
};
export default class PauseMenu extends Phaser.Scene {
private title: Phaser.GameObjec... |
5802113b7f1269538b3743b5edb5a0450afb474f | TypeScript | aino-gautam/CanvasBenchTest | /canvasBenchTest/src/main/webapp/CanvasTestJs/app.ts | 2.71875 | 3 | /// <reference path="./fabricjs.d.ts" />
module App {
export class myApp {
//public resizeOnMove: boolean;
public createBasicVisual(canvasId: string, numberOfElements: number, radiusSize: number = 5): Visual {
return new Visual(canvasId, numberOfElements, radiusSize);
}
... |
9acad8a0d5b6c8538d318a376bd2ceafb665f171 | TypeScript | hdt3781/CSIA-AnuglarFrontend | /src/app/services/filter-sort.service.ts | 3.09375 | 3 | import {Injectable} from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class FilterSortService {
localSearch = null;
constructor() {
}
// Create function GetSortorder with parameter prop.
GetSortOrder(prop) {
// Creates two objects, a and b.
return (a, b) => {
if (a[prop] > b[pr... |
fa6689ad7acabb30eac3c8f539df5594074ba762 | TypeScript | real-marshal/binance-hotkeys | /src/common/utils.ts | 2.671875 | 3 | // Make some fields of T optional
export type Optional<T, K extends string> = Omit<T, K> & Partial<T>
|
4691796981e83993cbc6ed50875aa76fb4f2f922 | TypeScript | arjit95/routi | /packages/routi-core/src/server/request.ts | 2.5625 | 3 | import { IncomingMessage } from 'http';
export type NextFunction = (...args: unknown[]) => void;
export interface Request extends IncomingMessage {
next?: NextFunction;
[key: string]: unknown;
// Native request object for the framework
readonly root: unknown;
}
|
acbe39b2689ea3cac2092ae593fb7473090f1686 | TypeScript | Polanco10/configurable-form | /src/app/field.interface.ts | 2.578125 | 3 | export interface Validator {
name: string;
validator: any;
message: string;
}
export interface FieldConfig {
label?: string; //Label del campo
name?: string; //Nombre de formControl
inputType?: string; //Tipo de input (text, email, password)
options?: string[... |
5b33ae874b29495af71d87831f538fd99c2e9928 | TypeScript | 1337programming/leviathan | /kiosk/app/src/common/services/random.service.ts | 2.953125 | 3 | import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/interval';
@Injectable()
export class Random {
private static getRandomIntInclusive(min: number, max: number): number {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math... |
409b279a48187c82fc1395ccf1304fa09e676b91 | TypeScript | ElLuchoMan/SanyuFront | /src/app/Shared/models/rol.ts | 2.828125 | 3 | //Interface que permite concer los tipos de dato que contiene un Rol
export interface Rol {
estadoRol: string,
idRol: number,
nombreRol: string,
}
|
5fb9c77152276cf0db016af58c30f4e6f0bad934 | TypeScript | stencila/encoda | /src/codecs/types.ts | 2.84375 | 3 | import { Jesta } from '@stencila/jesta'
import schema from '@stencila/schema'
import { fromFiles } from '../util/media/fromFiles'
import { resolveFiles } from '../util/media/resolveFiles'
import { toFiles } from '../util/media/toFiles'
import { reshape } from '../util/reshape'
import * as vfile from '../util/vfile'
co... |
8d088c7b22f88ce8c7bb5dde008191c4e736fd57 | TypeScript | tbknl/specified | /src/constraint.ts | 3.09375 | 3 | export const Constraint = {
generic: {
oneOf: <T>(...options: T[]) => {
return {
version: 1 as 1,
definition: {
name: "oneOf",
settings: { options }
},
eval: (value: T) => {
... |
051b9e63dc72347b7624fdd2c4fa40fa66cb7338 | TypeScript | BinPar/legendPrototype | /test/tests/legends/avoidCrossingLegendsStress.ts | 2.734375 | 3 | import generateRandomLegends from '../../../utils/generateRandomLegends';
import removeCrossingLines from '../../../utils/removeCrossingLines';
import {
marcCrossingLines,
haveCrossingLines,
} from '../../../utils/detectCrossingLines';
/**
* Test to check if the system can fix all the crossing segments
* situati... |
792a73339223017628f929acb871065c1ebb8375 | TypeScript | zys-contrib/examples | /solutions/mint-nft/helpers/constant.helpers.ts | 2.59375 | 3 | type SupportedNetworks = "0x1" | "0x4"
// this example would work on ethereum mainnet but Rinkeby is used to showcase. For main network change to "0x1"
export const NETWORK_ID = "0x4"
export const ChainLabelMap: Record<SupportedNetworks, string> = {
"0x1": 'Ethereum',
"0x4": 'Rinkeby',
}
export const currentChai... |
c536d46eeb4a488a608ef47fd83bbb0fd6b5fa23 | TypeScript | ravi221/met-gpr | /src-31052018-currently-working/app/ui-controls/services/tooltip.service.ts | 2.796875 | 3 | import {Injectable, OnDestroy} from '@angular/core';
import {ITooltip} from '../interfaces/iTooltip';
import {TooltipContentComponent} from '../components/tooltip/tooltip-content.component';
import {Guid} from '../../core/utilities/guid';
import {isNil} from 'lodash';
import {Observable} from 'rxjs/Observable';
import ... |
2c8672388b0da01b489b143fdac63a133ea2cd52 | TypeScript | MaorZ/JackSyncJS | /src/patchOperations/operations/addOperation.spec.ts | 2.765625 | 3 | import { AddOpertaion } from "./addOperation";
let addOperation: AddOpertaion;
describe("Add Operation spec", () => {
beforeEach(() => {
});
it("should add a title", () => {
let actual = {
name: "My Name"
};
let expected = {
name: "My Name",
title: "My Title"
};
addOpera... |
71ba18d250c7717287174982906b0d6b169c4029 | TypeScript | WhiteMIron/TodoList-Nest.js-backend | /src/todo/entities/todo.entity.ts | 2.515625 | 3 | import { ApiProperty } from '@nestjs/swagger';
import { IsString } from 'class-validator';
import { Common } from 'src/common/entities/common.entity';
import {
Column,
CreateDateColumn,
Entity,
PrimaryColumn,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
@Entity()
export class Todo extends Co... |
befb38b2fbab0495ffe87015f407f7c03558f7b8 | TypeScript | andyfangdz/d3-openord | /src/Node.ts | 2.890625 | 3 | /**
* Created by andy on 7/12/16.
*/
export default class Node {
public id: number;
public fixed: boolean;
public x: number;
public y: number;
public subX: number;
public subY: number;
public energy: number;
constructor(id: number) {
this.id = id;
this.fixed = false;
... |
90faa946df16cd712a77623687f1597827224f0c | TypeScript | ziggy6792/homage-reservations | /packages/lambda-gq-resolver/src/utils/utility.ts | 2.546875 | 3 | import getEnvConfig from 'src/config/get-env-config';
import { commonUtils } from '@alpaca-backend/common';
import { CreatableClassType } from 'src/types';
import Creatable from 'src/domain/interfaces/creatable';
import CreatableService from 'src/services/creatable.service';
const envConig = getEnvConfig();
export co... |
9efd1cbac99081432f80b8731eb37e3f8cf2948d | TypeScript | horvathgyozo/progenv-v3-proba-typescript | /src/services/authStore.ts | 2.546875 | 3 | import { action, computed, observable } from 'mobx';
export class AuthStore {
@observable private authenticated: boolean = false;
@computed get isAuthenticated(): boolean {
return this.authenticated ? true : false
}
@action.bound
public authenticate() {
setTimeout(action(() => this.authenticated = ... |
73c985cacfd56d630fe9479684563b25a4695da3 | TypeScript | HossamElharmeil/soduko | /src/utils/indetify-square/index.ts | 3.1875 | 3 | import { GRID, GRID_INDEX, SQUARE } from 'typings'
interface IInput {
col: GRID_INDEX
grid: GRID
row: GRID_INDEX
}
/**
* A function that returns a soduko square from inside a soduko grid given a cell identified by a row and column
* @param input The column index, the actual grid and the row index
*/
function... |
895b9b7dcda231b201e25c8f90388308d500c991 | TypeScript | cesschneider/currency-converter-netjs-react-app | /nest-app/src/app.controller.ts | 2.546875 | 3 | import { Controller, Get, Query, HttpException } from '@nestjs/common';
import { CurrencyService } from './currency.service';
@Controller('currency')
export class AppController {
constructor(private readonly currencyService: CurrencyService) {}
@Get('/quote')
async getQuoteForPair(
@Query('inputCurrency') i... |
e7acb13a38e8fa3fc1a4acd6e0395e91da1bc8fb | TypeScript | sanen/sitdown | /packages/core/src/service/Node/isBlank.ts | 2.609375 | 3 | import isVoid, { voidElements } from '../../util/isVoid';
import { Node } from '../../types';
var voidSelector = voidElements.join();
function hasVoid(node: Node) {
return node.querySelector && node.querySelector(voidSelector);
}
export default function isBlank(node: Node) {
return (
['A', 'TH', 'TD', 'IFRAME'... |
a22503f68b026368a05e916ce0e9044065354ef1 | TypeScript | wwags33/JavaScript30 | /09 - Dev Tools Domination/typescripts.ts | 3.46875 | 3 | /**
* JavaScript30 by Wes Bos, https://javascript30.com/
* TypeScript implementation by Will Wager
* Project: Dev Tools Domination
* Concepts: Console methods
* Key takeaways: Lots of options to log effectively; grouping, counting, and timing is simple
* Sidenotes: DOM Mutation Breakpoints did not work for me in... |
648252c8dbcd205740fe168e83c10cf0efbe6b46 | TypeScript | hzzlyzz/zodash | /packages/signature/src/wechat/jssdk.ts | 2.8125 | 3 | import sha1 from '@zodash/sha1';
export interface IData {
url: string;
jsapi_ticket: string;
noncestr: string;
timestamp: number;
}
export function sign(data: IData) {
// 1. 按照字段名的ASCII 码从小到大排序(字典序)
const _data = [
'url',
'jsapi_ticket',
'noncestr',
'timestamp',
].sort((a, b) => a.locale... |
5f330cee66da07cffe0c3be8316b746cd49d898b | TypeScript | viniciuslj/busca-publicacoes | /webapp/src/main/webapp/app/shared/model/quadro.model.ts | 2.78125 | 3 | export interface IQuadro {
id?: number;
nome?: string;
nomeLongo?: string;
}
export class Quadro implements IQuadro {
constructor(public id?: number, public nome?: string, public nomeLongo?: string) {}
}
|
73915a0b50bf730ace1db2d3fb140d2a39654e24 | TypeScript | zhylmzr/word-pinyin | /test/word-pinyin.test.ts | 2.890625 | 3 | import PinYin from "../word-pinyin";
test("get first letter", () => {
expect(PinYin.getFirstLetter("孙先生")).toBe("SXS");
});
test("get word's pinyin", () => {
expect(PinYin.getPinyin("孙先生")).toBe("sun xian sheng");
});
test(`get word's pinyin to use ", "`, () => {
expect(PinYin.getPinyin("孙先生", ", ")).toB... |
6f5f3620c3b69b52676de812c53e2f92e8fa7879 | TypeScript | hsnks100/acmicpc | /tsc.ts | 3.796875 | 4 |
function append(str1:string,
str2:string):string{
return str1 + str2;
}
var str:string = append('hello',
' Typescript!!');
class Greeter{
greeting:string;
constructor(message: string){
this.greeting... |
9c6b320cbcc5fa2ff7cfd43126b08872325dc551 | TypeScript | CaptainLiao/wechat-mini | /week-star-lite/src/utils/validate.ts | 3.3125 | 3 | // 验证邮箱
function validateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
// 验证中文字符
function validateCnText(str) {
var pattern = /^([\u4E00-\u9FA5]|[\uFE30-\uF... |
9ad8c12cf770a8906c4606946d8e40c1add55430 | TypeScript | DSE-AB/angular-gantt | /src/plugins/dependencies/dependenciesChecker.factory.ts | 2.546875 | 3 | export default function () {
'ngInject'
/**
* Creates a new DependenciesChecker object.
*
* @constructor
*/
let GanttDependenciesChecker = function (manager) {
function handleTaskConflict (conflictsList, task) {
if (!(task.model.id in conflictsList) && task.$element) {
task.$element... |
ae52510aa0d9a5f59cd2448fe6e6531732b0c269 | TypeScript | zhoujian521/showcase | /app/service/github.ts | 2.71875 | 3 | import { Service } from "egg";
export default class GitbubService extends Service {
checkSuccess(result) {
const { ctx } = this;
const { status, data } = result;
if (status !== 200) {
const errorMsg =
data && data.error_msg ? data.error_msg : "unknown error";
ctx.throw(status, errorMs... |
dbd58a2689285929defbc7b7cad9b8154426d679 | TypeScript | Blackbaud-JaminQuimby/skyux2 | /src/modules/list/helpers.spec.ts | 2.890625 | 3 | import {
getData
} from './helpers';
describe('list helpers', () => {
it('gets data based on a standard selector', () => {
let data = {
myResult: 'something',
otherResult: 'nothing'
};
let result = getData(data, 'myResult');
expect(result).toBe('something');
});
it('shifts data appr... |
0c74868dbc22acc17495b7d44a37f8545930572c | TypeScript | BenTels/Roundtrip | /roundtrip-client/src/app/click-listener.service.ts | 2.609375 | 3 | import { Injectable } from '@angular/core';
import { Observable, Observer, Subject } from 'rxjs';
import { AnonymousSubject } from 'rxjs/internal/Subject';
@Injectable({
providedIn: 'root'
})
export class ClickListenerService {
private subject: Subject<string> | null = null;
constructor() { }
public connect... |
c539635e7e9f9955d0835a5432c34c7b4992a28d | TypeScript | ralonsodeniz/react-typescript-basic-maps-app | /src/models/Map/index.ts | 2.703125 | 3 | import { Mappable } from '../common';
export class Map {
private readonly googleMap: google.maps.Map;
constructor(
private mapElement: Element,
private mapOptions: google.maps.MapOptions,
) {
this.googleMap = new google.maps.Map<Element>(mapElement, mapOptions);
}
addMarker(source: Mappable): vo... |
bbc603d51b693b8dbd6611d685aae2d53ddba9c0 | TypeScript | ianstormtaylor/slate | /packages/slate/src/utils/get-default-insert-location.ts | 3.046875 | 3 | import { Editor, Location } from '../interfaces'
/**
* Get the default location to insert content into the editor.
* By default, use the selection as the target location. But if there is
* no selection, insert at the end of the document since that is such a
* common use case when inserting from a non-selected stat... |
ee92156eb5d6ba6101f3c65f3ac6604d642297fe | TypeScript | braivs/iti_js_ts | /src/09_ref_mutab/09_01.test.ts | 3.65625 | 4 | function IncreaseAge(u: UserType) {
u.age++;
}
type UserType = {
name: string
age: number
address: {title: string}
}
test('reference type test', () => {
let user: UserType = {
name: 'Briws',
age: 34,
address: {
title: 'Querim'
}
}
IncreaseAge(user)
expect(user.age)... |
ec43c4462c28459f1962b6ba24f3c82036b86386 | TypeScript | y2bd/magnum-dork | /src/api/search.types.ts | 2.515625 | 3 | export interface SearchResults {
results: SearchResult[];
limit: number;
offset: number;
total: number;
}
export interface SearchResult {
result: ResultEnum;
data: Data;
relationships: Relationship[];
}
export interface Data {
id: string;
type: DataType;
attributes: DataAttributes;
}
export inter... |
6bdc0b9e17f039fa05d57f5d104d0439ff30edd1 | TypeScript | willingtonortiz/agro-demo | /src/app/services/coordinate-converter.service.ts | 2.71875 | 3 | import { Injectable } from '@angular/core';
import * as Leaflet from "leaflet";
@Injectable({
providedIn: 'root'
})
export class CoordinateConverterService {
constructor() { }
public coordinatesToLatLngBounds(coordinates: Array<Array<number>>): Leaflet.LatLngBounds {
let lonMin: number = coordinates[0][0];... |
c0a755e5c12a86b2570088a5b5f04bc09af2c782 | TypeScript | yogevizhak/BerryForms | /client/angular/components/fieldTypes/fieldTypesRegistry.ts | 2.578125 | 3 | /// <reference path="../../../extensions/arrayExtensions.ts" />
/// <reference path="../../interfaces/components/fieldTypes/IFieldType.ts" />
/// <reference path="../../interfaces/components/fieldTypes/IFieldTypesRegistry.ts" />
var _global:any = this;
_global.Components = _global.Components || {};
_global.Components.... |
a2ef2a65c949ed2643d884a390dc5ff9a44ff7d1 | TypeScript | nitincp/supreme-octo-disco | /src/getRow.ts | 2.859375 | 3 | import { Column, Position, Cell, Range } from "./index";
export interface Row<T> {
cells: Cell<T>[];
outlineLevel?: number
}
export type Rows<T> = Row<T>[];
export interface RowsWithRange<T> {
rows: Rows<T>,
range: Range
}
export function getRow<T>(item: T, columns: Column<T>[], startAt: Position): RowsWit... |
fff1bff759a5dcef22a83d7336e23d3eb0e33ee4 | TypeScript | nielsjani/phaserrpg_typescript | /src/classes/util/ObjectAmountMap.ts | 3.0625 | 3 | export class ObjectAmountMap {
private oaMap:Map<any, number>= new Map();
constructor(private equalsFunction: any){}
set(key: any, value: number){
if(this.has(key)){
this.oaMap.set(this.getRealKey(key), value);
} else {
this.oaMap.set(key, value);
}
}
... |
a01e06e2c30be53568f62e7ccfbcedcc7a70ac75 | TypeScript | LazarPetrovic1/newstackbasic | /src/messages/messages.controller.ts | 2.515625 | 3 | import { Body, Controller, Delete, Get, Param, Post, Put } from '@nestjs/common';
import { Message } from 'src/entities/Message';
import { CreateMessageDTO } from './dto/create-message.dto';
import { MessagesService } from './messages.service';
@Controller('messages')
export class MessagesController {
constructor(pr... |
d4329e33b3c02d480ca5af7d78b2bc8f1eb9b515 | TypeScript | marcosavalle/gifts-frontend | /src/features/provinces/store/provinces.reducer.ts | 2.703125 | 3 | import { Reducer } from 'redux';
import {
ProvincesState,
ProvincesActionTypes,
ProvincesActions,
} from '../models/provinces.model';
export const initialState: ProvincesState = {
loading: false,
data: [],
error: undefined,
isFetchCompleted: false,
};
const reducer: Reducer<ProvincesState> = (
state =... |
c139ef9b88c151dfb47410723ece725852855666 | TypeScript | gameforks/Incremental | /Technomancy/locations/sharks/marine.ts | 2.59375 | 3 | ({
"unlocked": function () { return true; },
"go_again_text": "Dive",
"encounters": [
({
"condition": function () { return true; },
"types": [],
"weight": 1,
"title": "Deep Sea Casino",
"run_encounter": function casino () {
... |
2b1f864aff3f03b84d687948cdb84009ea58f7a2 | TypeScript | felippeefreire/redis-gui | /renderer/core/services/ConnectionService.ts | 2.515625 | 3 | import {IConnection} from "../interfaces/IConnection";
const connections = [
{
id: '1',
name: 'example'
}
];
export class ConnectionService {
static list(): IConnection[] {
return connections;
}
static async delete(connection: IConnection): Promise<void> {
}
}
|
08b1fb5261ac05eff6630e1d23f1980cbbd30b7f | TypeScript | amyaim99/Casino-TypeScript | /ts/Deck.ts | 3.21875 | 3 | /// <reference path="Card.ts" />
class Deck{
cards:Card[] = []
constructor(){
for(let i=0; i<4; i++){
var suitArray: Suit[] =[Suit.CLUB, Suit.DIAMOND, Suit.HEART, Suit.SPADE]
for(let j=0; j<13;j++){
var rankArray: Rank[] = [Rank.ACE, Rank.TWO, Ra... |
4ffca07af8040a230bfa8e0d24407cb211959013 | TypeScript | ZITOUNIMED/tuto-share-app | /src/app/shared/loading.actions.ts | 2.5625 | 3 | import {Action} from '@ngrx/store';
export const START_LOADING_ACTION_TYPE = 'START_LOADING_ACTION_TYPE';
export const STOP_LOADING_ACTION_TYPE = 'STOP_LOADING_ACTION_TYPE';
export type LoadingActions = StartLoadingAction | StopLoadingAction;
export class StartLoadingAction implements Action {
readonly type = STAR... |
7eab2355aa7b4bb890032ab00f00063e8a831dbf | TypeScript | pruthvirajpatel/pruthvirajpatel.github.io | /src/app/form/form.component.ts | 2.53125 | 3 | import { Component } from '@angular/core';
import { Form } from './form';
import { List } from './list';
interface IShape {
area(): number;
}
interface EnumServiceItem {
id: number; label: string; key: any
}
interface EnumServiceItems extends Array<EnumServiceItem> { }
// Option A
var result: EnumServiceIt... |
fcac8dc05866e71a01ed11aeba3b7a755a34bf69 | TypeScript | Abbondanzo/SubDom | /src/redirectProxy.ts | 3.234375 | 3 | interface RedirectProxyOptions {
baseUrl: string;
useSSL: boolean;
writeToFile: boolean;
initialProxies: Proxies;
onError?: ErrorCallback;
}
type Url = string;
export type Proxies = {
[alias: string]: Url;
};
type ErrorCallback = (error: any) => void;
export class RedirectProxy {
private readonly baseUr... |
eeacb69ceb5055beeb5dc9d16a142778baf3af4f | TypeScript | ninthworld/Phaseroids | /src/utils/Vec2.ts | 3.6875 | 4 | export class Vec2 {
public x: number;
public y: number;
constructor();
constructor(x: number, y: number);
constructor(x: number = 0, y: number = 0) {
this.x = x;
this.y = y;
}
public clone(): Vec2 {
return new Vec2(this.x, this.y);
}
... |
17c22cff658a363f6b99aee3d64c1442728f7f9d | TypeScript | lifaon74/observables | /src/observables/distinct/distinct-value-observable/sync/functions.ts | 2.625 | 3 | import { IDistinctValueObservable } from './interfaces';
import {
DISTINCT_VALUE_OBSERVABLE_PRIVATE, IDistinctValueObservableInternal, IDistinctValueObservablePrivate
} from './privates';
import { ObservableEmitAll } from '../../../../core/observable/functions';
/** FUNCTIONS **/
export function DistinctValueObserv... |
f3f1c81b84da7017acbee26a5890670b9452b360 | TypeScript | simonzm7/adn-nodejs | /src/infraestructure/TRM/adapters/Handlers/Requests.ts | 2.515625 | 3 | import axios from 'axios';
import { BussinessExcp } from 'src/domain/Exceptions/BussinessExcp';
import { MethodType } from 'src/domain/Trm/port/Enums/MethodType';
export interface IRequest {
url: string;
method: MethodType;
headers: {};
data: string;
errorCode: string;
}
export class Requests {
... |
e46d2159f9153b89b9de58c637a34ff7e0bcc4e0 | TypeScript | emreturgutce/clothing-store | /src/utils/format-error.ts | 2.578125 | 3 | import { GraphQLError, GraphQLFormattedError } from 'graphql';
import { NODE_ENV } from '../config';
export const formatError = (
err: GraphQLError,
): GraphQLFormattedError<Record<string, any>> => {
if (err.message.match(/validation error/i)) {
const errors: string[] = [];
if (err.extensions)... |
b92f37639fc16ebf382b7ae7ed76a816882f84ce | TypeScript | webhintio/hint | /packages/formatter-stylish/src/formatter.ts | 2.65625 | 3 | /**
* @fileoverview The stylish formatter, it outputs the results in a table format with different colors.
*
* This formatter is based on [eslint stylish formatter](https://github.com/eslint/eslint/blob/master/lib/formatters/stylish.js)
*/
/*
* ---------------------------------------------------------------------... |
b3231a7c3957cd627887cfe49f6486f13f78861d | TypeScript | mjavadalj/NestGrpcMicroservices | /user/src/user.repository.ts | 2.671875 | 3 | import { EntityRepository, Repository } from 'typeorm';
import { AuthCredential } from './auth/dto/authCredential.dto';
import { CreateUserDto } from './dto/createUser.dto';
import { User } from './user.entity';
import * as bcrypt from 'bcrypt';
@EntityRepository(User)
export class UserRepository extends Repository<Us... |
bfdfef28ca67fb3fd7ed1538bc627906c27c90f3 | TypeScript | aca-js-angular/shop | /shop/src/app/validators/adress.validator.ts | 2.65625 | 3 | import { FormControl, ValidationErrors, ValidatorFn, AbstractControl } from '@angular/forms';
export function _adress(control: AbstractControl): ValidationErrors | null {
const source = control.value
const number = new RegExp(/\b\d\b/)
const char = new RegExp(/[A-Za-z]/)
if(char.test(source) && number.... |
d8dd81dd9f9e4e9832c87cbf3c51c430179e2697 | TypeScript | amidos2006/BAMLike | /src/SoundManager.ts | 3 | 3 | class SoundManager{
static MAX_MUSIC:number=0;
static MUSIC_VOLUME:number = 0.2;
static SOUND_VOLUME:number = 0.3;
sound:boolean;
music:boolean;
game:Phaser.Game;
currentMusicIndex:number;
currentMusic:Phaser.Sound;
currentSounds:Phaser.Sound[];
constructor(game:Phaser.Ga... |
cf3616be8b12ede4911da60352d5ae0e60fad121 | TypeScript | jcgurango/denim-lemonade | /packages/denim-forms/forms/utils/useScreenSize.native.ts | 2.6875 | 3 | import { useEffect, useState } from 'react';
import { Dimensions, ScaledSize } from 'react-native';
const useScreenSize = () => {
const [screenData, setScreenData] = useState<{ width: number, height: number }>(() => {
const { width, height } = Dimensions.get('window');
return { width, height };
});
use... |
7fa306f7031dd16dd9a08415f2602bea9f7f1ed7 | TypeScript | liangchunn/automata | /src/internal/RegExp/applySRule.ts | 3.265625 | 3 | import { difference } from 'lodash'
import {
AutomatonDescriptor,
ApplySType,
RegExpStep,
AutomatonSymbol,
} from '../../types'
/**
* Applies the S rule by removing loop states and merging them to the outgoing transitions of a particular state
* @param automaton
*/
export function applySRule(
automaton: R... |
ed8ec509aaf2f737c7735bfa2306e046ff05c9c6 | TypeScript | gevartrix/cai-chatbot-webpart | /src/webparts/cai-chatbot/chatbotWebpartProps.ts | 2.859375 | 3 | /**
* Web part's core options for the configuration's panel.
* It needs to be populated by the credentials found under the appropriate channel from the chatbot repository's "Connect" tab.
*
* @interface ChatbotWebPartOptions
* @property channel - Selected connection channel for a CAI chatbot ("Webchat" or "SAP CAI... |
f2b9c5d85b2f4d71289e7371eecb680fe19759c7 | TypeScript | dynamic-packages/core | /packages/core-types/src/common/index.ts | 2.734375 | 3 | import { EventEmitter } from 'events';
export interface IBase extends EventEmitter {
toString(): string;
}
export interface IKeyString {
[key: string]: string;
[key: number]: string;
}
export interface IKeyValue {
[key: string]: any;
[key: number]: any;
}
export interface IFlag extends IBase {
getBitMas... |
4f6b756958a80532024df67966c1a359daccd556 | TypeScript | barryblando/all-about-typescript | /functional-programming/Currying.ts | 4 | 4 | // https://medium.com/javascript-scene/curry-and-function-composition-2c208d774983
// Currying
function curry(func: (...args: number[]) => number) {
return function curried(...args: any[]) {
// sum(a, b, c). Three arguments, so func.length = 3, PS .length is a built-in property for function that return the ... |
898b05a57cfde2af7fb37cddd9b1c174d77a468b | TypeScript | hugsmidjan/qj | /src/dom/htmlLang.ts | 3.53125 | 4 | import closestParent from '../select/closestParent';
/**
* Finds and returns the language of an element
* – traversing up the DOM tree looking for langauge attributes.
*
* @param elm Target element - defaults to <html/>
* @param returnFull `true` returns the full language value – not just the two-character shorth... |
4d195e7a4ebb162f6bae8848fb4413ded54b0cf9 | TypeScript | Zhongy1/smack | /string-manipulators/string-manipulator-3.ts | 3.390625 | 3 | import { StringManipulator } from "./string-manipulator";
export class StringManipulator3 extends StringManipulator {
private tempParam1: string;
private tempParam2: number;
private nums:string = "0123456789";
constructor() {
super();
this.author = 'Jaden';
}
private DARE(st... |
a0fd0bae0a25dda14e1cd2b70ad34c934080dc0a | TypeScript | australis-technica/tiny-crud-controller | /packages/crud-controller/src/crud-controller.ts | 2.765625 | 3 | import { RequestHandler } from "express";
import fromBody from "./from-body";
import fromParams from "./from-params";
import { Store } from "./types";
import fromAny from "./from-any";
/** */
const noFilter: (id: any, data: any | any[]) => any = (...x) => x;
/**
* TODO: paged
*/
export default function CrudController... |
eacb19b57bc2155d14aa5fa73d7ac8a52d31fcd5 | TypeScript | anthowm/graphqlpetapi-frontend | /src/app/shared/modules/validators/mimetype-validator.ts | 2.765625 | 3 | import { FormControl, Validators } from '@angular/forms';
export class FileTypeValidator implements Validators {
static validateMimeType(c: FormControl): { [key: string]: any } {
const files = c.value._files;
if (c.value && files.length > 0) {
return FileTypeValidator.checkExtension(... |
a32723d736c7c71139c37f0b6a234b597e5cf3bf | TypeScript | Zdend/movie-feed | /src/shared/theme.ts | 2.5625 | 3 | import { generate } from '@ant-design/colors';
export const COLORS = {
PRIMARY: generate('#09f'),
SUCCESS: generate('#4CAF50'),
ERROR: generate('#F44336'),
WARNING: generate('#FF9800'),
INFO: generate('#2196F3'),
GREY: generate('#a5adb7'),
DARK: generate('#414141')
};
export const GRADIENTS = {
PRIMAR... |
428225a584ab7a060e5cc36e1c04c140553a3c18 | TypeScript | JoeshuTT/v-shop | /src/model/index.ts | 2.8125 | 3 | /**
* 生成昵称
*/
export function fakeNickName(options: Recordable) {
const { type } = options;
if (type === 'mobile') {
return `用户${options.mobile.slice(-4)}`;
}
return `用户${String(new Date().getMonth() + 1).padStart(2, '0')}-${String(new Date().getDate()).padStart(2, '0')}`;
}
|
076e1bb517d5582906176554778bd64f4e4627e3 | TypeScript | Vuinfang/ToDoListBackEnd | /src/users/user.entity.ts | 2.671875 | 3 | import {
Entity,
Column,
PrimaryGeneratedColumn,
CreateDateColumn,
UpdateDateColumn,
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsNotEmpty, IsNumber, IsString, Min } from 'class-validator';
@Entity()
export class User {
@ApiProperty({
required: false,
descrip... |
382936659bff7dc870f8207e5cf5873d8de95620 | TypeScript | thomasbroderick/AngularFilmCRUD | /src/app/film/film.component.ts | 2.53125 | 3 | import { Actor } from './../models/actor';
import { Film } from './../models/film';
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-film',
templateUrl: './film.component.html',
styleUrls: ['./film.component.css']
})
export class FilmComponent implements OnInit {
selectedFilm = nu... |
64af38dae7fcd92c04e899b3ed5b25d55cb8cda7 | TypeScript | alpirres/LectorQrv2 | /src/app/services/ui.service.ts | 2.71875 | 3 | import { Injectable } from '@angular/core';
import { AlertController, LoadingController, ModalController, ToastController } from '@ionic/angular';
@Injectable({
providedIn: 'root'
})
export class UiService {
miLoading: any;
miToast: any;
constructor(public loading: LoadingController,
public modal: ModalC... |
926e86b3d11a38d00e4f323b89c5bfe8bd8437b5 | TypeScript | li2215890610/umi-study | /src/pages/Dashboard/Article/List/model.ts | 2.640625 | 3 | import { Effect, ImmerReducer } from 'umi';
import { removeNS } from '@/utils/action';
import { RootState } from '@/models/RootState';
import * as Service from './services/Article';
import * as Entity from './entities/Article';
import * as Action from './action';
export const NS = 'article';
export const articleStatu... |
b623da89af4c9f443d0a907dc08c102c79ec0662 | TypeScript | jicjjang/next-with-redux-observable-app | /store/user/reducers.ts | 2.84375 | 3 | import { createReducer } from "typesafe-actions";
import produce from 'immer';
import { fetchUserAction, UserActions } from 'store/user/actions';
export interface UserState {
nextUserId: number,
character: {
name?: string,
id?: string,
username?: string,
email?: string,
phone?: string,
web... |
abe629635f19caa24216e441fb589e2dc64755e1 | TypeScript | MyAeroCode/PS-TypeScript-Programmers | /lessons/67259/solution.ts | 3.578125 | 4 | type Dir = "↑" | "↓" | "←" | "→";
type Delta = { dy: number; dx: number; dir: Dir; forbidden: Dir };
export function solution(board: number[][]): number {
const N = board.length;
const delta: Delta[] = [
{ dy: +1, dx: 0, dir: "↓", forbidden: "↑" },
{ dy: -1, dx: 0, dir: "↑", forbidden: "... |
d2d1ccd30bad51f8bde855b85a763f664cc47e42 | TypeScript | frenchbench/frenchbench-app | /src/hooks/usePermissions.ts | 2.8125 | 3 | // see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/permissions
import { useEffect, useState } from 'react';
export const STATUS_PROMPT = 'prompt';
export const STATUS_GRANTED = 'granted';
export const STATUS_DENIED = 'denied';
export const PERM_NAME_GEOLOCATION = 'geolocation';
export function useP... |
ca0046d4e4e88ec168557fc0454aea9ab626b531 | TypeScript | arabsorkhi/Onion | /Onion.Web/Assets/src/utils/auth/unauthorized.ts | 2.640625 | 3 | import {addResponseErrorHandler, setDefaultHeaders} from '../rest';
import {authHeader, refreshToken, dataStore} from './index';
export const handleHttpUnauthorized = () => {
addResponseErrorHandler((rest, error) => {
if (error.response.status !== 401) return;
// 401 is Unauthorized error which m... |
8c932e1933b93ee2dc789601ccf5e896506e9a96 | TypeScript | renatoclt/OFE_REPO_DESKTOP | /1002.OFE_DESKTOP/src/app/facturacion-electronica/general/models/configuracionDocumento/idioma.ts | 2.578125 | 3 | export class Idioma {
idIdioma: number;
descripcionCorta: string;
descripcionLarga: string;
constructor(idIdioma: number,
descripcionCorta: string,
descripcionLarga: string) {
this.idIdioma = idIdioma;
this.descripcionCorta = descripcionCorta;
this.descripcionLarga = desc... |
98bc0f5f486e1a0726862df9e68265088367ac7a | TypeScript | djr-taureau/pomodoist-2 | /src/app/tasks/actions/pomo.ts | 2.703125 | 3 | import { Action } from '@ngrx/store';
import { Pomo } from '../models/pomo';
export enum PomoActionTypes {
Load = '[Pomo] Load',
LoadSuccess = '[Pomo] Load Success',
LoadFail = '[Pomo] Load Fail',
Select = '[Pomo] Select',
}
export class Load implements Action {
readonly type = PomoActionTypes.Load;
const... |
d3f50e987fdb688c308e862e237ba8cf90244bf9 | TypeScript | LeonBaudouin/Abyss | /src/front/Scroll/OnePageScroll.ts | 2.59375 | 3 | import { SwipeHandler } from "./SwipeHandler";
import {GetWindowHeight } from "../Utils/UtilsFunctions";
import { addWheelListener } from "../Utils/AddWheelListener.js";
import Easing from "../../threejs/Math/Easing";
import { Point } from "../Influencets/CustomTypes/Point";
type ScrollCallback = (i: number) => void; ... |
78465561aa5f34798b7222b27c31b10db9f317b6 | TypeScript | huytd/subreddit-monitor | /src/utils.ts | 3.203125 | 3 | export type Nullable<T> = T | null;
export type Errorable<T> = [Nullable<T>, Nullable<Error>];
/**
* Sanitize the string for using as name, remove all
* special characters.
*/
export const sanitizeString = (input: string): string => {
const matched = input.match(/[a-zA-Z0-9_]/g);
if (matched) {
return match... |
b160491dff43db9ffc5c44748e2327bdc0b5f05f | TypeScript | einari/JavaScript.Fundamentals | /Source/concepts/for_ConceptAs/when_creating_concept/as_something.ts | 2.921875 | 3 | // Copyright (c) Dolittle. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
import { some_concept, some_base } from '../given/some_concept';
import { ConceptAs, conceptFrom } from '../../ConceptAs';
class another_something extends ConceptAs<som... |
29fc3366df24946cec072371792436aa7cefd96a | TypeScript | Senth/accounting | /packages/backend/src/adapters/repository/FiscalYearGetAllRepositoryAdapter.ts | 2.515625 | 3 | import { BaseAdapter } from './BaseAdapter'
import { Id } from '../../app/core/definitions/Id'
import { FiscalYear } from '../../app/core/entities/FiscalYear'
export class FiscalYearGetAllRepositoryAdapter extends BaseAdapter {
/**
* Get all the user's fiscal years
* @param userId the user id to get the fiscal ye... |
c58720465cbefb76ec5698fa6b18d4dd0f4d5a50 | TypeScript | opensumi/core | /packages/markers/src/browser/markers-filter.model.ts | 2.609375 | 3 | import {
IMarker,
MarkerSeverity,
IFilter,
matchesFuzzy,
matchesFuzzy2,
matchesPrefix,
strings,
URI,
getEmptyExpression,
IExpression,
splitGlobAware,
} from '@opensumi/ide-core-browser';
import {
IFilterOptions,
IRenderableMarker,
IRenderableMarkerModel,
MarkerItemBuilder,
MarkerModelBu... |
dbba0304ed59b7f7f63e4a3710ccb45b4dadb490 | TypeScript | njirem/rdf-converter | /src/lib/n3.d.ts | 2.96875 | 3 | // Very Quick and dirty!! Do not reuse!!
declare module N3 {
export interface Triple {
subject: string,
predicate: string,
object: string,
graph?: string,
}
export interface Options {
// Options: 'N-triples', 'application/trig'
format: string;
prefi... |
52566a390a5bbda4b9aefa49f3b4304016961d23 | TypeScript | ag-grid/ag-grid | /grid-packages/ag-grid-docs/documentation/doc-pages/charts-events/examples/interaction-ranges/main.ts | 2.5625 | 3 | import { AgCartesianChartOptions, AgChart } from "ag-charts-community"
let options: AgCartesianChartOptions = {
container: document.getElementById("myChart"),
autoSize: true,
data: [
{
quarter: "Q1",
petrol: 200,
diesel: 100,
},
{
quarter: "Q2",
petrol: 300,
diesel... |
19d5ad4761bbeba054707616069aad791acf5087 | TypeScript | future4code/Luccas-Candido | /semana18/Cookenu/src/endpoints/signUp.ts | 2.859375 | 3 | import {Request, Response} from "express"
import { insertUser } from "../data/insertUser"
import { generateToken } from "../services/authenticator"
import { generateId } from "../services/generateId"
import { hash } from "../services/hashManager"
import { User } from "../types/user"
export const signUp = async(req:... |
8901ea034f987b55e4fc1418b71760e06c3d9211 | TypeScript | DmitryBogomolov/webgl-playground | /playground/14_draw_image/index.ts | 2.84375 | 3 | import type { ImageRendererRawImageData, Vec2 } from 'lib';
import { Runtime, createRenderState, ImageRenderer, color, colors, color2uint } from 'lib';
/**
* Draw image util.
*
* Shows ImageRenderer helper. It renders image on the screen.
* Location defines image location in viewport. Region defines part of the im... |
763d7fa65e25056edb4e3adb6dbd302a5e089d8b | TypeScript | mmgoodnow/snooker-tracker | /src/app/services/user.service.client.ts | 2.578125 | 3 | import {
LOGIN_URL,
LOGOUT_URL,
PROFILE_URL,
USER_URL,
REGISTER_URL,
} from "../constants/urls";
import { User } from "../models/user.model.client";
export class UserServiceClient {
findAllUsers() {
return fetch(USER_URL).then(response => response.json());
}
findUserById(userId: string) {
return fetch(USER... |
53a7c18b4e67d7fd24fe88dd3049ecc957611b6f | TypeScript | schmaluk/indigo | /src/models/cube.ts | 2.515625 | 3 | import {Model} from "./model";
import {Type, plainToConstructor} from "constructor-utils";
import {JsonMember,JsonObject} from "typedjson/src/typed-json";
@JsonObject
export class Cube implements Serializable<Cube>{
deserialize(input:Object):Cube {
this.name = input.name;
this.model = new Model().deserializ... |
a88ad6b702ae18126c7c8be78939c6f1490a6116 | TypeScript | entipic/domain | /src/entities/unknown-name-helper.ts | 2.8125 | 3 | import { clearText, atonic, md5, unixTime } from "../helpers";
import ms = require("ms");
import { UnknownName } from "./unknown-name";
export type UnknownNameBuildParams = {
name: string;
lang: string;
country?: string;
refIP: string;
refHost?: string;
};
export class UnknownNameHelper {
static createUni... |
f0734263845f46a7c175a859ae7dd2d46effea0e | TypeScript | firecrackerz/swift-to-js | /builtins/floats.ts | 2.625 | 3 | import { wrapped } from "../functions";
import { withPossibleRepresentations, FunctionMap, PossibleRepresentation, ReifiedType } from "../reified";
import { addVariable, lookup, uniqueName, DeclarationFlags, Scope } from "../scope";
import { lookupForMap } from "../utils";
import { binary, call, callable, conditional, ... |
e1282064db4b8edde8ed32e1c720d2df7f0f6624 | TypeScript | pvtri96/pvtri96.github.io | /src/hooks/useDarkMode.ts | 2.703125 | 3 | import { useState, useEffect } from "react";
import useMedia from "hooks/useMedia";
export const useDarkMode = (): ReturnType<typeof useState<string>> => {
const [theme, setTheme] = useState("light");
const toggleTheme = () => {
if (theme === "light") {
window.localStorage.setItem("theme", "dark");
... |
fa7f03042bd2b5dc39f0d84910e4f1dd07e4807f | TypeScript | sajitron/climedo | /src/data/identity/identity.schema.ts | 2.71875 | 3 | import { SchemaTypes } from 'mongoose';
import bcrypt from 'bcrypt';
import { trimmedString, SchemaFactory } from '../base';
import { Identity } from './identity.model';
import env from '@app/common/config/env';
const IdentitySchema = SchemaFactory({
password: { ...trimmedString, required: true, select: false },
e... |
b6da21510288209055a8f61a616b17069e157857 | TypeScript | fukurosan/Jhaystack | /src/ThreadPlanner/ThreadPlannerMain.ts | 3.203125 | 3 | import { ObjectLiteral } from "../Utility/JsonUtility"
/**
* Interface for workers that adopts the browser standard
*/
export interface IThreaderWorker {
onmessage: (result: { data: any }) => void
onerror: (...args: any[]) => any
postMessage: (...args: any[]) => any
terminate: () => void
}
/**
* Interface for ... |
e78ed606012e707b5f596cca7d98806d4bc6940b | TypeScript | JohnCSimon/typescript-express-starter | /src/mongo.ts | 2.859375 | 3 | import { UpVote } from './dto/votes';
import * as mongodb from 'mongodb';
// import * as url from 'url';
var server = new mongodb.Server('localhost', 27017);
var db = new mongodb.Db('mydb', server, { w: 1 });
db.open(function () { });
// function createRecord(record: UpVoteDTO) {
// try {
// console.log(... |
3a7a84a5a6e9ad971dde52f5035ba82881589758 | TypeScript | yiqingfeng/node-ts-start | /src/utils/fs.ts | 3.203125 | 3 | /**
* @description 文件相关操作
*/
import * as utils from '../../types/utils'; // 引入声明
import fs from 'fs';
import path from 'path';
type resData<T> = utils.resData<T>;
/**
* @description 检查指定目录是否存在
* @param oPath 指定目录
*/
export function checkDir(oPath: string): boolean {
return fs.existsSync(oPath);
}
/**
* @des... |
e494715762df175e343a78fa1d83983db0a26a44 | TypeScript | themojilla/query-machine | /src/services/createRequests.ts | 2.625 | 3 | import { AxiosInstance, AxiosRequestConfig } from 'axios'
import { ICreateRequests, TSend } from '../types'
export const createRequests = <T>(
axios: AxiosInstance,
send: TSend<T>
): ICreateRequests => {
const onGet = (url: string, config?: AxiosRequestConfig) => {
const request = () => axios.get<T>(url, con... |
555de4b1b0e78709f888ca703e0b45ec8d9fa1ee | TypeScript | soroushchehresa/cli-corona | /src/utils/table.ts | 2.75 | 3 | import cli from 'cli-ux';
import chalk from 'chalk';
import TableCLI from 'cli-table';
type ColItem = string[];
export default class Table {
static async draw({ data }: {data: object}): Promise<void> {
const cols = this.renderColumns(data);
const table = new TableCLI({
head: [
chalk.blue.bold(... |
da338d50b6f4f2167327c63e4e3092d223a309be | TypeScript | GregoryPevnev/albums-front | /src/store/actions/albumActions.ts | 2.578125 | 3 | import Bundle from "../bundle";
import { Actions } from "./types";
import { SortBy, AlbumsQueryResult } from "../../application/loaders";
import { AlbumData, UpdateAlbum } from "../../application/operations";
import Album from "../../application/models/Album";
import Track from "../../application/models/Track";
import ... |
886d654a0d5e38ae5ebfb24f7f8f2c627b5ea753 | TypeScript | scottohara/loot | /src/transactions/controllers/flag.ts | 2.546875 | 3 | import type {
Transaction,
TransactionFlag,
TransactionFlagType
} from "~/transactions/types";
import type TransactionModel from "~/transactions/models/transaction";
export default class TransactionFlagController {
public errorMessage: string | null = null;
public flagType: TransactionFlagType;
public flag: Tr... |
d6a3e5f040a4944b58db003fd29cca94f3e043c2 | TypeScript | internetErik/dnd-campaign-manager-angular-old | /lib/collections/battles.ts | 2.734375 | 3 | import {simpleRoll} from '../dice';
export var Battles = new Mongo.Collection('battles');
Meteor.methods({
insertBattle: function(battle) {
if (battle) {
battle.createDate = Date.now();
battle.complete = false;
battle.combatPhase = -1;
return Battles.insert(battle);
}
},
updateBattle: function(_id,... |