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 |
|---|---|---|---|---|---|---|
ed23f551fb865198fea3b7e69952297a2f256a4d | TypeScript | beingOptimusP/stv | /src/examples/stv.counting.example.ts | 2.875 | 3 | /* istanbul ignore file */
import { Vote } from "../model";
import { repeat } from "../utils";
export const andreaSymbol = "Andrea";
export const bradSymbol = "Brad";
export const carterSymbol = "Carter";
export const delilahSymbol = "Delilah";
//As taken from https://en.wikipedia.org/wiki/Counting_single_transferable... |
e2e84b13a944ce0484d809b1149cb844cffc95e6 | TypeScript | jpaul34/Test-Phaser3-Typescript-Ionic5 | /ionic-frontend/src/game/componets/scoreTable/score-table.ts | 2.546875 | 3 | import {GameTitles} from '../../consts/gameTitles/game-titles'
import { bindCallback } from 'rxjs';
interface scoreInterface {
id: number,
name: string,
dependenci: string,
acronym: string,
score: string
}
export class ScoreTable {
//scoreTable: Phaser.GameObjects.Grid;
scoreTable: Phaser.... |
05e6f864727db1c9fa4e4bfa4631259fda7fb5ef | TypeScript | audipasuatmadi/startup-backend | /src/services/user/validator.ts | 2.734375 | 3 | import { RegisterRequestBody } from './usertypes';
import Joi, { ValidationError } from 'joi';
const baseValidationMessage = {
'string.lowercase': '{{#label}} tidak boleh mengandung huruf besar',
'string.trim': '{{#label}} tidak boleh mengandung spasi',
'string.empty': '{{#label}} harus diisi',
};
const userReg... |
9cbfb3a265a34b1138135e034beb042044a107f3 | TypeScript | parklover/skryba | /web/essentialjs/JavaScript - EJ2/17.3.0.26/Web (Essential JS 2)/JavaScript/ej2-diagrams/src/diagram/interaction/spatial-search/quad.d.ts | 2.53125 | 3 | import { IGroupable, SpatialSearch } from './spatial-search';
import { Rect } from '../../primitives/rect';
/**
* Quad helps to maintain a set of objects that are contained within the particular region
*/
/** @private */
export declare class Quad {
/** @private */
objects: IGroupable[];
/** @private */
... |
14f3e551aa11bf71b81e64234ae81229bc60a913 | TypeScript | tajpouria/cors | /examples/attain/configuring-cors-asynchronously.ts | 2.8125 | 3 | import { App, Request } from "https://deno.land/x/attain/mod.ts";
import { attainCors, CorsOptionsDelegate } from "../../mod.ts";
const sleep = (ms: number) =>
new Promise((resolve) => {
setTimeout(resolve, ms);
});
const books = new Map<string, any>();
books.set("1", {
id: "1",
title: "Frankenstein",
a... |
820c63312d08200252edb1274c82fc39a4c5ac5a | TypeScript | TanyaMykhnevych/GreedyOptimization | /src/app/components/table/table.component.ts | 2.5625 | 3 | import { Component, Input } from '@angular/core';
import { MatTableDataSource } from '@angular/material/table';
@Component({
selector: 'app-table',
templateUrl: './table.component.html',
styleUrls: ['./table.component.scss']
})
export class TableComponent {
public displayedColumns: string[] = [' '];
... |
36adf968b87d62d7743209677a5ebcdaa448a54d | TypeScript | hanokhaloni/zoombiesZoo | /src/app/game/board/tile/tile-buy-popup/buy-item/buy-item.ts | 2.734375 | 3 | export interface ICost {
lumber?: number;
block?: number;
coin?: number;
wheat?: number;
}
export interface IBuyItem {
cost: ICost;
icon: string;
type: number;
}
export class BuyItem {
woodCost: number;
coinCost: number;
stoneCost: number;
constructor() {
}
}
|
0a060bb3db6bf595af3d687f87edc1f25a4c9bc0 | TypeScript | kurehajime/colamone_js | /src/static/canvas/BackgroundDraw.ts | 3.125 | 3 | import Params from "../Params"
export class BackgroundDraw {
/**
* 盤面を描画してDataURLを返す。
*/
static drawBoard(): string {
const canvas: HTMLCanvasElement = document.createElement("canvas")
const canvSize = Params.CANV_SIZE * 3
const cellSize = canvSize / 6
canvas.width = ... |
0ee84820e6877debbf782bec1ceb67c3d99be615 | TypeScript | WooodHead/codeglide | /packages/domain/src/searchRepository/mutations.ts | 2.59375 | 3 | import { State, SearchRepositoryResult } from "./state";
export const makeBusy = (state: State): State => {
return {
...state,
fetching: true
};
};
export const setResult = (
state: State,
result: SearchRepositoryResult
): State => {
return {
...state,
fetching: false,
totalCount: result... |
54084e890aa2391b55d98e8cb824302a4176e340 | TypeScript | Red2Blaze/azure-serverless-discord-bot | /HttpTrigger1/commands/button.ts | 2.625 | 3 | import {
SlashCommand,
ComponentType,
ButtonStyle,
SlashCreator,
CommandContext,
ComponentContext,
} from "slash-create";
import { env } from "process";
export class ButtonCommand extends SlashCommand {
constructor(creator: SlashCreator) {
let cDesc = {
name: "button",
descr... |
0b5051754a09de942399536a7f189f26ed7895bb | TypeScript | Starholme/GeneratorGame | /BoS/src/engine/Network.ts | 3.15625 | 3 | import { Box, Levels, Resource } from './interfaces'
interface Lvl {
current: number;
max: number;
diff: number;
mult: number;
}
export class Network {
public id: number;
private name: string;
private resource: Resource;
private boxes: Array<Box>;
constructor(id: number, name: str... |
dc4071ad9265d97e116992ee835663ce5a805171 | TypeScript | BlackspaceInc/typescript-microservices-template | /libs/kernel/test/domain/aggregate-root.spec.ts | 3.109375 | 3 | import { UniqueEntityId } from '../../src/domain/unique-entity-id';
import { Address, Contact } from './models';
describe('AggregateRoot', () => {
let address: Address;
let contact: Contact;
beforeEach(() => {
address = Address.create({
address: 'Av. Lima 123',
city: 'Lima',
latitude: '1.1... |
403467c4c5e7f6b9cdac5ae5eae698ffca4e53ce | TypeScript | AMfalme/mars-rover-photos | /src/data/mars-photos.ts | 2.75 | 3 | import axios from 'axios'
import { fireStore } from '../firebaseConfig';
export type Photo = {
id: number
sol: number
camera : {
id: number
name: string
rover_id: number
full_name: string
}
img_src: string
earth_date: string
rover: {
id: number
... |
fa5a7caa7858c705186eb14e9598350d89b401d2 | TypeScript | davidohlin/vite-aliases | /src/generator.ts | 2.65625 | 3 | import type { Alias, Options, Path } from './types';
import { slash, split, terminal, toArray, toCamelCase, toRelative } from './utils';
import chokidar from 'chokidar';
import { config } from './constants';
import { getDirectories } from './fs/glob';
import { resolve } from 'path';
import { writeConfig } from './fs/c... |
0a5ce5ab6691d3d4b9568892fbd3d599a13d63b7 | TypeScript | camronkhan/mancalaNg | /src/app/gameboard/gameboard.component.ts | 2.609375 | 3 | import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';
import { GameStartService } from '../services/game-start.service';
import { GameRestartService } from '../services/game-restart.service';
import { GameOverService } from '../services/game-over.service... |
cd18dd8cd696ddf66b90e173436e45b1b982cb4e | TypeScript | mion-madiori/deckBuilder | /js/patternSpecification/NotSpecification.ts | 3.046875 | 3 | class NotSpecification<T> extends AbstractCompositeSpecification<T>{
private other:Specification<T>;
constructor(other:Specification<T>){
super();
this.other = other;
}
isSatisfiedBy(candidate:T):boolean{
return !this.other.isSatisfiedBy(candidate);
}
toString():string{
return `(not ${thi... |
6f0f8f5b868544d1f81fc42768eb4e6e0298180d | TypeScript | inker/metro | /src/utils/math/index.ts | 3.046875 | 3 | import { Point, point } from 'leaflet'
import { head, last } from 'lodash'
import {
bisect,
dot,
det,
intersection,
orthogonal,
normalize,
} from './vector'
export const isNatural = (n: number) =>
n > 0 && Number.isInteger(n)
export const isArbitrarilySmall = (n: number) =>
Math.abs(n) <= Number.EPSI... |
ac5086b340cd8bcc61dce6a94c4f77644ed4c5dd | TypeScript | green-fox-academy/tundecsapo | /week-02/day-01/bubble.ts | 4.125 | 4 | // Create a function that takes a list of numbers as parameter
// Returns a list where the elements are sorted in ascending numerical order
// Make a second boolean parameter, if it's `True` sort that list descending
//NOTE: the given example for the advanced function are incorrect
function bubble(list: number[])... |
48f832c44e501073e7238188c32384b6d99663f6 | TypeScript | guimpo/internet_banking | /frontend/src/app/new-mensagens.component.ts | 2.59375 | 3 | import { Component , Output, EventEmitter } from '@angular/core'
//tem que importa o que foi criado tal sera webservice
import { WebService } from './web.service';
@Component({
selector: 'new-mensagem',
template: `
<mat-card style="margin:18px;">
<mat-card-content>
<mat-... |
1a1baf40e39ab3944b85174100ec5cf0cc04a901 | TypeScript | enixdark/ClusterWS-Client-JS | /src/modules/parser.ts | 2.671875 | 3 | import ClusterWS from '../index'
import { CustomObject, Message } from '../utils/types'
export function decode(socket: ClusterWS, message: Message): void {
const userMessage: Message = socket.options.encodeDecodeEngine ?
socket.options.encodeDecodeEngine.decode(message['#'][2]) : message['#'][2]
const actions... |
db86805a502d8f1323fb312720a79564ed4c22fe | TypeScript | nkint/umbrella | /packages/color/src/hsva.ts | 2.75 | 3 | import { declareIndices, IVector } from "@thi.ng/vectors";
import { Color, ColorMode } from "./api";
import { AColor } from "./internal/acolor";
import { ensureArgs } from "./internal/ensure-args";
export function hsva(col: Color, offset?: number, stride?: number): HSVA;
export function hsva(h?: number, s?: number, v?... |
2368e0b0df58940894c119c0edc53eca81708ff6 | TypeScript | Camille1007/tsharp | /test/extentions/test_String.ts | 3.34375 | 3 | import "../../src/extentions/String";
import "../../src/extentions/Number";
import "../../src/extentions/Date";
import "mocha"
import * as assert from "assert";
describe("String", () => {
describe("String.isNullOrEmpty", () => {
it("null is nullOrEmpty", () => {
assert.equal(String.isNullOrEmpt... |
6bfa29f57270199242807e2d70463cbfa8ca7f12 | TypeScript | brikr/advent-of-code-2020 | /src/day13/day13.ts | 3.046875 | 3 | import {fileLines} from '../utils';
function part1(): number {
const [earliestLine, idsLine] = fileLines('src/day13/input.txt');
const earliest = Number(earliestLine);
const ids = idsLine
.split(',')
.map(Number)
.filter(id => !isNaN(id));
let closestMod = ids[0] - (earliest % ids[0]);
let close... |
2c15588e22d7ce8d74b499919d50dbbcc7d994ff | TypeScript | mc-aweaver/ng-conf-managing-async-with-rxjs | /exercises-final-with-notes/node/15-subject-subscriptions.ts | 2.953125 | 3 | import { Subject } from 'rxjs';
import { createLoggingObserver } from './helpers/createLoggingObserver';
const observerA = createLoggingObserver('A');
const observerB = createLoggingObserver('B');
const subject = new Subject();
const subA = subject.subscribe(observerA);
const subB = subject.subscribe(observerB);
su... |
84b7a765b92b5a61ee57be84aa4489c75ddd5efe | TypeScript | cothema/nlp-tools | /packages/core/src/interfaces/IStringableTokenizer.ts | 2.625 | 3 | import { Token } from "@cothema/nlp-model";
import { TokenizableStringableEntity } from "@cothema/nlp-model";
import { IStringable } from "@cothema/nlp-model";
export interface IStringableTokenizer<
Entity extends TokenizableStringableEntity
> {
tokenize(input: IStringable): Token<Entity>[];
tokenizeToEntities(... |
d85ecd07357f6be407fade6fb3f1e044ca23a34b | TypeScript | webhintio/hint | /packages/hint/src/lib/utils/resource-loader.ts | 2.53125 | 3 | /**
* @fileoverview Locates and requires resources (connectors, parsers, hints, formatters)
* for hint across different places in the tree.
* By convention, these resources need to be under
* {/, /node_modules/}lib/{connectors, formatters, parsers, hints}/*.js
*/
/*
* --------------------------------------------... |
0065edba55a24a8643d7e9df408106c2eb04be8e | TypeScript | sundogrd/theworld | /packages/theworld-core/src/game/types/common.ts | 2.671875 | 3 | export enum EDirection {
WEST = 'west',
EAST = 'east',
NORTH = 'north',
SOUTH = 'south',
}
export enum ECreatureGender {
FEMALE = 'female',
MALE = 'male',
}
export type QueryType = {
is: {
[key: string]: any;
};
not: {
[key: string]: any;
};
};
|
a31d993ba566e4f86c6b61cc2fe375143e993891 | TypeScript | airgap-it/airgap-coin-lib | /packages/substrate/src/v1/data/scale/type/SCALEHash.ts | 2.71875 | 3 | import { InvalidValueError } from '@airgap/coinlib-core/errors'
import { Domain } from '@airgap/coinlib-core/errors/coinlib-error'
import { isHex, stripHexPrefix } from '@airgap/coinlib-core/utils/hex'
import { SCALEDecodeResult } from '../SCALEDecoder'
import { SCALEEncodeConfig, SCALEType } from './SCALEType'
expor... |
0336334ae440a7ce7c2299b55ecde392e04c02f8 | TypeScript | shekhar-shubhendu/squid-js | /src/utils/WebServiceConnectorProvider.ts | 2.515625 | 3 | import WebServiceConnector from "./WebServiceConnector"
export default class WebServiceConnectorProvider {
public static setConnector(connector: WebServiceConnector) {
WebServiceConnectorProvider.instance = connector
}
public static getConnector(): WebServiceConnector {
if (!WebServiceC... |
e3260207499de828428133e4f4edd1af82011fec | TypeScript | rubensworks/rdf-test-suite.js | /test/testcase/TestCaseUnsupported-test.ts | 2.578125 | 3 | import {TestCaseUnsupported, TestCaseUnsupportedHandler} from "../../lib/testcase/TestCaseUnsupported";
describe('TestCaseUnsupportedHandler', () => {
const handler = new TestCaseUnsupportedHandler('someHandler');
describe('#resourceToTestCase', () => {
it('should produce TestCaseUnsupported', async () => {
... |
fadf36b208427198b06ca60a831357eac7313e98 | TypeScript | LaunchMenu/LaunchMenu | /packages/core/src/utils/searchExecuter/_types/ISearchPatternFilterConfig.ts | 3.21875 | 3 | import {IPatternMatch} from "./IPatternMatch";
/** The config for the search pattern filter */
export type ISearchPatternFilterConfig<I> = {
/**
* The callback for when an item is added
* @param item The item that was found
*/
onAdd: (item: I) => void;
/**
* The callback for when an ite... |
72883272018248944a9027c513437fb5e9241f86 | TypeScript | Longwelwind/majority | /src/server/Player.ts | 2.6875 | 3 | import Game from "./Game";
import {ServerPacket} from "../commons/server-packets";
import * as WebSocket from "ws";
export default class Player {
static lastId: number = 0;
id: number;
name: string;
token: string;
game: Game | null = null;
clients: WebSocket[] = [];
constructor(id: number, nickname: string, t... |
413f593b9edc94fdfd7d851b5f80b32adbc4b0a7 | TypeScript | haniot/mhealth | /test/unit/models/sleep.duration.summary.model.spec.ts | 2.734375 | 3 | import { DefaultEntityMock } from '../../mocks/models/default.entity.mock'
import { assert } from 'chai'
import { SleepDurationSummary } from '../../../src/application/domain/model/sleep.duration.summary'
describe('MODELS: SleepDurationSummary', () => {
const sleepDurationSummaryJSON: any = DefaultEntityMock.SLEEP... |
f6950a00f414b5fea3d5f2ded1e5d18072c5bfee | TypeScript | abdelrahman543873/productive-family | /src/discount/discount.factory.ts | 2.609375 | 3 | import { ObjectID } from 'mongodb';
import * as faker from 'faker';
import { Discount } from './models/discount.schema';
import { providerFactory } from '../provider/provider.factory';
import { DiscountRepo } from '../../test/discount/discount-test-repo';
interface DiscountType {
provider?: ObjectID;
code?: string... |
21619b1a519b025ad1bd5189413b19c16006227c | TypeScript | rideshare-vinay/rideshare-frontend | /src/app/services/log.service.ts | 3 | 3 | import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class LogService {
/**
* A function that logs a debug message
* @param message
*/
debug(message: string) {
let logEntry = this.createLogStatement('debug', message);
console.info(logEntry);
return logEnt... |
fd1530d374e30ede072d59d19955d2aa61d4f529 | TypeScript | AsterAInpm/katrine | /src/meta-annotations.ts | 2.875 | 3 | import {
AccessByAuthData,
AccessByRoleData,
AccessRulesType,
AuthStatus,
HTTPRequestType,
KatrineActionInterface
} from './@types';
import KatrineAction from "./metadata/KatrineAction";
import projectMetadata from "./metadata/ProjectMetadata";
/**
* Marks handler(function) in controller as action
*
* ... |
5c4a1a8843bdf9fdaf16ca366c1499cd81dfd94f | TypeScript | azmanabdlh/validasaur | /tests/rules/date_after.test.ts | 2.953125 | 3 | import type { Validity } from "../../src/types.ts";
import { dateAfter } from "../../src/rules/date_after.ts";
import { invalid } from "../../src/utils.ts";
import { assertInvalid, assertValid, fakeUtils } from "../utils.ts";
Deno.test("rules.dateAfter() type check", () => {
const date = new Date();
assertInvalid(... |
ed6c875edf79480c39763d886ecf564585bc3a8c | TypeScript | tierratelematics/prettygoat-workflow | /scripts/ticks/TickScheduler.ts | 2.640625 | 3 | import {injectable, inject} from "inversify";
import {Subject, Observable} from "rxjs";
import Tick from "./Tick";
import {IDateRetriever, Event, IStreamFactory} from "prettygoat";
import * as moment from "moment";
export interface ITickScheduler extends IStreamFactory {
schedule(dueTime: number | Date, state?: st... |
bcad77ed3987a8af292df0705aa734c486b8f0b3 | TypeScript | nubiofs/flatgeobuf | /src/ts/geojson/geometry.ts | 3.078125 | 3 | import { flatbuffers } from 'flatbuffers'
import { GeometryType } from '../header_generated'
import { Feature } from '../feature_generated'
import { IParsedGeometry, flat, pairFlatCoordinates } from '../generic/geometry'
export interface IGeoJsonGeometry {
type: string
coordinates: number[] | number[][] | nu... |
47b5bd8afaa24947286c1ee46c8173ac1250ec0c | TypeScript | Rom1-J/grafibot | /test/Bot.test.ts | 2.703125 | 3 | import { Message } from 'discord.js'
import Bot from '../src/Bot'
import { expect, chai, fakeMessage } from './helpers'
import { ICommand, IFilter } from '../src/interfaces'
const generateCommand = function (name: string): ICommand {
let command = {
name: name,
description: name,
run (msg: Message, args:... |
feef2de1b60463c31edfafb090c7c4045fc09fb0 | TypeScript | GSA/sam-ui-elements | /src/ui-kit/experimental/aria/abstract-grid/abstract-grid.ts | 2.765625 | 3 | import { AbstractRow } from './abstract-row';
import { AbstractCell } from './abstract-cell';
import { EventDispatcher } from '../utils/events';
export type AbstractGridEvent = 'keydown' | 'click';
export interface AbstractGridConfig {
skipRows?: number;
useDefaultKeydownEvents?: boolean;
useDefaultClickEvents?... |
9de2f440e440fba5b2b510c1e8cf23fad0ea088a | TypeScript | 2008-310272/led-2 | /main.ts | 2.640625 | 3 | input.onButtonPressed(Button.A, function () {
basic.clearScreen()
led.setBrightness(0)
})
input.onButtonPressed(Button.AB, function () {
for (let Y = 0; Y <= 4; Y++) {
for (let X = 0; X <= 4; X++) {
led.plot(X, Y)
basic.pause(100)
}
}
for (let Y = 0; Y <= 4; Y... |
d7df546fcbb0138cc3d2a5eba0b59e87bb2fafab | TypeScript | pioner92/todoList | /src/api/rest/login.ts | 2.5625 | 3 | import {createEffect} from 'effector'
import {makeRequest, statusType} from '../make-request'
import {urls} from '../urls'
import {LocalStorage} from '../../lib/local-storage'
type dataType = {
login:string
password:string
}
type responseType = {
status: statusType,
message:{
token?:string
... |
e85d002b82bebec6634d12a9b23c090f0ef3120a | TypeScript | diltai/marker | /projects/dilta/web-transport/src/lib/transport.service.ts | 2.78125 | 3 | // tslint:disable-next-line: max-line-length
import { ApiFormat, ApiResponse, API_STATUS_CODE, API_STATUS_RESPONSE, BaseResponse, EntityNames, Log, modelActionFormat, ModelOperations } from '@dilta/platform-shared';
import { from, Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { v4 } from 'uuid'... |
a25f55a1cd15ebb9a6f17c503fba1d6d014ede29 | TypeScript | baight/baight-ng | /response.ts | 2.625 | 3 | import { Attribute } from "@angular/core";
export class Response {
error: any;
code: number;
desc: string;
data: any | Object;
static successCode = 200;
isSuccess() : boolean {
if (this.error) {
return false;
}
else if (this.code == Response.successCode){
... |
44cb1731e7e5e4d46b24ea9783e8272154070519 | TypeScript | sherazahmedse/typescript | /features/annotations/objects.ts | 3.203125 | 3 | const profile = {
name: 'alex',
age: 20,
coords: {
lat: 100,
long: 122
},
setAge (age : number) : void {
this.age = age;
}
}
// const age = profile.age;
const { age } : {age : number} = profile;
// const coords : {
// latitude : number ;
// longitude : number
// } = {
// latitude: 100... |
b5b3f7c9e6109819c2c93d66b2ac0290a09bf850 | TypeScript | hinterlist/cryptomarket | /src/reducers/assets.ts | 2.953125 | 3 | const initialState = {
error: null,
loading: false,
assets: [],
};
export default (state = initialState, action) => {
switch (action.type) {
// Reset to initia state and turn on loading status
case 'FETCH_ASSETS': {
return { ...initialState, loading: true };
}
... |
65b30ba2272ce2ad80991395edf69fa0e32588af | TypeScript | sproutt/eussya-eussya-view | /client/src/test/util/style.size.test.ts | 2.703125 | 3 | import {
Size,
SizeSeparator,
FontSize,
ElementSizeByHeight,
ElementDistanceEachOthers
} from "utils/style/size";
describe("SizeSeparator test", () => {
it("입력이 LARGE 일때 FontSize는 LARGE", () => {
expect(SizeSeparator.asFont(Size.LARGE)).toEqual(FontSize.LARGE);
});
it("입력이 Null 일때 FontSize는 MEDIUM"... |
9d95157a11df835352959db7f10cd29403d65aa2 | TypeScript | kyiimn/actapublisher | /src/js/pageobject/color/colormgr.ts | 2.875 | 3 | import ActaColor from './color';
class ActaColorManager {
private static _instance: ActaColorManager;
static getInstance() {
if (!ActaColorManager._instance) ActaColorManager._instance = new ActaColorManager();
return ActaColorManager._instance;
}
static get in() {
return ActaC... |
66ec549158bc20838854b36c3ff55fd11d5540d5 | TypeScript | lderrickable/daffodil | /libs/checkout/src/shipping/reducers/shipping.reducer.spec.ts | 2.609375 | 3 | import { TestBed, async } from '@angular/core/testing';
import { DaffAddress } from '@daffodil/core';
import { DaffAddressFactory } from '@daffodil/core/testing';
import { UpdateShippingAddress, SelectShippingOption } from '../actions/shipping.actions';
import { initialState, reducer, getShippingAddress, getSelectedS... |
64829fa174a38e1d1e7e6c76188acb367d427a6b | TypeScript | KyleMyers001/Todo | /src/app/classes/Cookie.ts | 2.9375 | 3 | class Cookie {
name: string;
data: string;
expirationDays: number;
constructor(name, data, expirationDays) {
this.name = name;
this.data = data;
this.expirationDays = expirationDays;
this.setCookie();
}
static getCookie(name): string {
name = `${name}=`;
const decodedCookie = decode... |
db31e194028eac8f1f374fec7c32106d8bf1c9d0 | TypeScript | wilsonshakespeare/next-js-template | /core/server/router/RouteModule.ts | 2.609375 | 3 | import { Express } from 'express';
import { RouteModel, RouteAsyncModel } from './index';
export class RouteModule {
public static addRoute(server: Express, route: RouteAsyncModel | RouteModel) {
switch (route.method) {
case 'PUT':
server.put(route.path, route.renderFunction);
break;
... |
399b1087a9b41fb816c2c4c39de654707861a7e4 | TypeScript | brizjose/JBCodingDojo | /MEAN/Angular/udemy/courseProject/src/app/shared/ingredient.model.ts | 3.609375 | 4 | export class Ingredient {
constructor(public name: string, public amount: number) {}
}
// the above code does exactly what we usually do with OOP, but it is so common that Typescript provides a short way of doing it, as shown.
// export class Ingredient {
// public name: string;
// public amount: number;... |
a843bedc2ecd8b4efe64331429a4fdc949ec018d | TypeScript | jazzmanweb/observables | /src/app/common/single-state.interface.ts | 2.5625 | 3 | export interface SingleStateInterface<T> {
index?: number | string;
value?: T;
}
|
6db73ad8d235cc7fa74fc8cdd26ce679aa4c1bf3 | TypeScript | clenemt/bontouch-assignment | /src/utils/generic.ts | 3.203125 | 3 | // Capitalize first letter of string passed
export const capitalize = (str: string) => {
if (typeof str !== 'string') return '';
return `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
};
|
625f05c0d9a920c44ad9e643734228bbd087bb59 | TypeScript | asurance/webgl-demos | /src/GLHanlderManager.ts | 2.6875 | 3 | import { ProceduralTexture } from './ProceduralTexture/ProceduralTexture'
import { ClearColor } from './ClearColor/ClearColor'
import { Mask } from './Mask/Mask'
import { Model } from './Model/Model'
import { RenderTexture } from './RenderTexture/RenderTexture'
import type { GLHandler } from './GLHandler'
export class... |
fb7da1408fd0e3e4cea04459589c972b7417376b | TypeScript | farhat97/TaskManagementApp | /src/app/shared/task.model.ts | 2.890625 | 3 | // TODO: for the moment, I am using this as opposed to the ITask interface in order to
// follow this approach: https://florimond.dev/blog/articles/2018/09/consuming-apis-in-angular-the-model-adapter-pattern/
import { Injectable } from '@angular/core';
import { Adapter } from './adapter';
export class Task {
tas... |
b204d84b77d25d4c67d5ce8edd4fcd52c0f939e6 | TypeScript | johannes-z/office-fabric | /packages/utilities/src/assertNever.ts | 3.015625 | 3 | /**
* AssertNever is a utility function that can be used for exhaustiveness checks in switch statements.
*
* @public
*/
export function assertNever (x: never): never {
throw new Error('Unexpected object: ' + x)
}
|
babdd6fde6be5b18a4559208d658718206ec25a1 | TypeScript | MayurNegi/Rocket.Chat.Fuselage | /packages/message-parser/src/utils.ts | 2.921875 | 3 | import {
BigEmoji,
Code,
Color,
Heading,
Markup,
Paragraph,
Types,
Task,
} from './definitions';
const generate =
<Type extends keyof Types>(type: Type) =>
(value: Types[Type]['value']): Types[Type] =>
({ type, value } as any);
export const paragraph = generate('PARAGRAPH');
export const bold... |
68affe9dd59c092ad698c7c678af9e013a59320a | TypeScript | goulartdev/rentalx | /src/modules/cars/usecases/create-specification/create-specification.ts | 2.515625 | 3 | import { inject, injectable } from "tsyringe";
import SpecificationsRepository, {
CreateSpecificationParams,
} from "@modules/cars/repositories/port/specifications.repository";
import AppError from "@shared/errors/app-error";
@injectable()
class CreateSpecification {
constructor(
@inject("SpecificationsReposi... |
7f0147aaa9088217dddf5b14d6e5e53c7433bdd8 | TypeScript | shaunluttin/design-patterns | /LaTeX/src/good-vs-bad/reason-to-change-02.ts | 3.328125 | 3 | interface GeometricRectangle {
calculateArea(): number;
}
interface Rectangle {
draw();
}
function computationalApp(rectangle: GeometricRectangle) {
rectangle.calculateArea();
}
function graphicalApp(rectangle: Rectangle) {
rectangle.draw();
}
|
c92670b20194e7ce6ab329d614857daab225d4db | TypeScript | ofoer/baike-zhanzhan-web | /constant/MOCK.ts | 2.578125 | 3 | interface MOCKTYPE {
id: string,
short_name: string,
full_name: string,
bn: string,
desc: string,
coordinates: {
lng: number,
lat: number
},
open: Array<{start: number, end: number}>
openText: Array<string>,
addressText: string
}
const MOCK:Array<MOCKTYPE> = [
{
... |
7f57a63d18b329fa0b59eefa5cef411a6bb9187f | TypeScript | ISyangk/transport-report | /src/utils/appFn.ts | 2.625 | 3 |
import { applicationList } from "@/models/global";
/**
* 验证当前操作是否符合用户权限
* return Boolen
*/
export function checkApplication(applicationList: applicationList, code: string) {
// 判断是否包含传入的项目权限
if (applicationList && applicationList.length) {
return applicationList.some((item) => {
return i... |
84e21797a272ca6d1c7e62a568972fbc88a8d3f2 | TypeScript | rossdowthwaite/weather-forecast-app | /src/app/store/forecast/forecast.action.ts | 2.59375 | 3 | import { Action } from '@ngrx/store';
import { Forecast } from '../../interfaces/forecast';
export const ADD_FORECAST = '[forecast] ADD_FORECAST';
export const ADD_FORECAST_SUCCESS = '[forecast] ADD_FORECAST_SUCCESS';
export const ADD_FORECAST_FAIL = '[forecast] ADD_FORECAST_FAIL';
export const UPDATE_FORECAST = '[fo... |
aeacaad2dff0893409ae478d831edddaa2c251bb | TypeScript | nakajimakotaro/dungeon | /src/gameMap.ts | 2.71875 | 3 | import "pixi.js";
import { Game } from "./game";
import { Character } from "./character";
import { Cell } from "./cell";
import { TurnManager } from "./turnManager";
export class GameMap {
turnManager: TurnManager;
charaList:Map<Character, Character> = new Map();
removeQueqeList:Character[] = [];
get g... |
a23f730e989331d66b6faa1a566cd68297ee858a | TypeScript | PenpenLi/gameModel | /assets/Script/common/BaseComponent.ts | 2.59375 | 3 | // Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import u... |
a535a3f80604e4e2f51fac6e66d2648a093e0c61 | TypeScript | srukshan98/SocialShare | /api/src/functions/hashing.ts | 3.359375 | 3 | import md5 from 'md5';
export function hash(rawPassword, options: any = {}) {
/**
* salt is optional, if not provided it will be set to current timestamp
*/
const salt = options.salt ? options.salt : new Date().getTime();
/**
* rounds is optional, if not provided it will be set to 10
*... |
66e4d1a88e0dd11aa579c97352f7aab7939e8615 | TypeScript | borisenki/SpaceShooterGame | /assets/Game/Enemy/Enemy.ts | 2.734375 | 3 | import { GameEvents } from "../GameEvents";
const { ccclass, property } = cc._decorator;
@ccclass
export default class Enemy extends cc.Component {
@property
speed: number = 300;
_direction: cc.Vec2 = null;
set direction(value: cc.Vec2) {
this._direction = value;
this.node.angle = M... |
0c4929863ceda689a53e56d4ad0f62f866215b85 | TypeScript | epiclabs-io/hyperjump | /backend/Protocol.ts | 2.828125 | 3 |
export interface IFunctionDefinition {
args: string[];
body: string;
}
export const ROOT_FUNCTION_GET_TYPE = 1;
export const ROOT_FUNCTION_GET_OBJECT = 2;
export enum RefType {
VALUE, // type is passed by value
REFVALUE, //type is passed by reference, alongside a snapshot of properties
REFONLY /... |
f28d85af9e1e52bac0530787b9923229613e6df2 | TypeScript | OntimizeWeb/ontimize-web-ngx-playground | /src/app/main/inputs/02.date/input-date.component.ts | 2.609375 | 3 | import { Component, ViewEncapsulation } from '@angular/core';
import moment, { Moment } from 'moment';
const DATE_HTML_DATA = `
<o-form editable-detail="no" show-header="no" layout-direction="column">
<o-date-input attr="date" label="Date" [data]="getValue()"></o-date-input>
<o-date-input attr="date2" labe... |
967e2b3afa40e6f7c4d8ee8a73d221035f54556f | TypeScript | tajpouria/GOF-design-pattenrs | /SOLID_Principles/liskov_subsections_principle/Rect.ts | 3.40625 | 3 | namespace react2 {
class Shape {
private shouldSyncHeightAndWidth = false;
constructor(private _width: number, private _height: number) {
if (_height === _width) this.shouldSyncHeightAndWidth = true;
}
get width(): number {
return this._width;
}
set width(value: number) {
th... |
b975b6ad600d9ed80aa4063c54b7f928f06169ff | TypeScript | 869288142/micro-code | /src/type-util/Push.ts | 3.046875 | 3 | type Push<T extends any[], V> = [...T, V]// 你的实现代码
// 测试用例
type Arr0 = Push<[], 1> // [1]
type Arr1 = Push<[1, 2, 3], 4> // [1, 2, 3, 4]
|
308184e06fcc9800cce4717e406cab3f7684a859 | TypeScript | hayes/beemo | /packages/driver-eslint/tests/ESLintDriver.test.ts | 2.625 | 3 | import fs from 'fs';
import DriverContext from '../../core/src/contexts/DriverContext';
import ESLintDriver from '../src/ESLintDriver';
import { createDriverContext, createTestTool } from '../../../tests/helpers';
describe('ESLintDriver', () => {
let driver: ESLintDriver;
let context: DriverContext;
let spy: jes... |
a809c1ca3568ec6b6447c94544421eeafa436204 | TypeScript | hakudev/nitro-emu | /src/app/messages/outgoing/user/inventory/badge/UserBadgesComposerUtilities.ts | 2.59375 | 3 | import { UserBadge } from '../../../../../../core';
export class UserBadgesComposerUtilities
{
public static composeCurrentBadges(badges: UserBadge[]): any[]
{
let totalBadges = 0;
const data: any[] = [];
if(badges)
{
for(let badge of badges)
{
... |
4c8125e389942b2b60dcf317ea7e13b1e4b2121a | TypeScript | leeanngrapes/task-app-angular | /src/app/services/ui.service.ts | 2.578125 | 3 | import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class UiService {
//define
private showAddTask: boolean = false;
//define subject
private Subject = new Subject<any>();
constructor() { }
//Service: call first one when t... |
fe5c9f2ebf8bd1e3359ba9953a6615bde4699520 | TypeScript | ydubinskyi/my-wallet | /apps/api/src/app/account/account.service.ts | 2.515625 | 3 | import {
Injectable,
Inject,
BadRequestException,
NotFoundException,
} from '@nestjs/common';
import * as Knex from 'knex';
import { TABLES } from '../db/constants';
import { Account } from './entities/account.entity';
import { CreateAccountDto } from './dto/create-account.dto';
import { UpdateAccountDto } fro... |
007f75c24e5ec831173ac214316311d0524be6d7 | TypeScript | Houfeng/noka | /packages/noka/src/IoCLoader/Inject.ts | 2.921875 | 3 | import { IInjectInfo } from "./IInjectInfo";
import { IInjectOptions } from "./IInjectOptions";
import { IOC_PROP_INJECT } from "./constants";
/**
* 注入一个类成员,通过名称在容器中查找类型并实例化后注入
* @param name 名称
*/
export function Inject(name?: string | symbol, options: IInjectOptions = {}) {
return (target: any, member: string | ... |
e4313b425071cd74e05b6e5cb66eb865f8a53391 | TypeScript | HannahWWD/drag_and_drop | /src/utility/validation.ts | 3.5625 | 4 | // interface for validation
export interface ValidateObj {
value: string | number;
required?: boolean;
minLength?: number;
maxLength?: number;
min?: number;
max?: number;
}
export function validate(validateInput: ValidateObj) {
let isValid = true;
if (validateInput.required) {
... |
086d2aad48184f20a0cf79223f0c5407c9cb9f86 | TypeScript | LaughingThroll/react-calendar | /src/utils/date/getCountDays/index.ts | 2.796875 | 3 | const getCountDays = (firstDate: string, secondDate: string): number => {
const SECONDS_IN_DAY: number = 1000 * 60 * 60 * 24
return Math.floor((Date.parse(secondDate) - Date.parse(firstDate)) / SECONDS_IN_DAY)
}
export default getCountDays
|
a2324b3b99b500b912bdcbcc0f2484fe767948e0 | TypeScript | cindyjh/study-typescript | /study-12-project/src/components/page/items/image.ts | 2.703125 | 3 | // import { PageComponent } from "./page.js";
import { BaseComponent } from "../../component.js";
export class ImageComponent extends BaseComponent<HTMLImageElement> {
constructor(readonly title: string, readonly url: string) {
super(`<section class="image">
<div class="image__holder"><img cla... |
ee739a102aa60387b2f6a76062e5a81298334cdc | TypeScript | shogonir/mandelbrot-map | /src/engine/object/geometry/TexturePlaneGeometry.ts | 2.890625 | 3 | import Geometry from './Geometry'
export default class TexturePlaneGeometry implements Geometry {
vertices: number[]
indices: number[]
constructor(width: number) {
const halfWidth = width / 2
this.vertices = [
-halfWidth, halfWidth, 0.0,
0.0, 0.0,
-halfWidth, -halfWidth, 0.0,
0.... |
99cef6d82014e5edc8f75338426bc0722ed29bb2 | TypeScript | gato/streamloots | /src/adapters/repository/mongodbCardRepository.ts | 2.75 | 3 | import Card from '../../core/entities/Card';
import Rarity from '../../core/entities/Rarity';
import { CardRepository } from '../../core/repositories/cardRepository';
import MongoClient from 'mongodb';
interface MongoCard {
id: string;
owner: string;
name: string;
image: string;
limit: number;
... |
37d228867478d501fca351e92cd7d3c6ddaf14de | TypeScript | MelkdeSousa/nlw-value | /src/controllers/User/Create.ts | 2.625 | 3 | import { Request as ExpressRequest, Response as ExpressResponse } from 'express'
import CreateUserService from '../../services/User/Create'
interface ICreateUserController {
handle(
request: ExpressRequest,
response: ExpressResponse
): Promise<ExpressResponse>
}
class CreateUserController implements ICre... |
468cb0258bac795c948d77a30f48d1d0d34d6f02 | TypeScript | muratkeremozcan/books | /Angular_with_Typescript/angular-unit-testing-with-Spectator-Jest/src/app/dashboard/dashboard-hero.component.spec.ts | 2.984375 | 3 | import { Hero } from '../model/hero';
import { Spectator, createComponentFactory, byText } from '@ngneat/spectator/jest';
import { DashboardHeroComponent } from './dashboard-hero.component';
// [1].2 unit testing components with @Input and @Output properties
// setup the component much less overhead with spectator (1... |
2b703f17982d1776cfdd8739d578b97137fd92df | TypeScript | foltz/gulp-babel-test | /src/api/auth/AppUser.ts | 2.703125 | 3 | //eval('var Slacktravel = (this.Slacktravel || (this.Slacktravel = {}))');
import Firebase = require('firebase');
interface IAppUser {
firstName?:string;
lastName?:string;
email?:string;
}
class AppUserDoc implements IAppUser {
firstName:string;
lastName:string;
email:string;
}
class AppUserForm {
id:string;... |
245e1053473b98398a658f4265bd8f8fc9af5077 | TypeScript | johanneslumpe/styled-props | /src/utils/backgrounds-and-borders/borderLeftStyle.ts | 2.703125 | 3 | import { BorderLeftStylePropertyCombined } from '@johanneslumpe/css-types';
import { style } from '../../style';
import { StyleOptions } from '../../types';
export interface BorderLeftStyleProps<T> {
/**
* The **`border-left-style`** CSS property sets the line style of an element's left `border`.
*
* @see... |
0c1efd2317fe53dcee7f005ce271eea4b6815dda | TypeScript | palantir/plottable | /src/memoize/memoizeProjectors.ts | 3.046875 | 3 | import type { MapCache } from "lodash";
import memoize from "lodash-es/memoize";
import { Dataset } from "../core/dataset";
import { AttributeToProjector, Projector } from "../core/interfaces";
interface IIndexMapRecord {
[key: number]: any;
}
/**
* An index that stores values by numeric key.
*
* Internally t... |
c895845435386562d28f109ed19a143c91f2358e | TypeScript | awslabs/amazon-eks-irsa-cfn | /lib/util.ts | 3.046875 | 3 | import { DefaultTokenResolver, IConstruct, Lazy, StringConcat, Tokenization } from '@aws-cdk/core';
import { IPolicy } from '@aws-cdk/aws-iam';
const MAX_POLICY_NAME_LEN = 128;
export function undefinedIfEmpty(f: () => string[]): string[] {
return Lazy.listValue({ produce: () => {
const array = f();
return ... |
d26ec449ed0cde80dcb86658e31b9580626b5261 | TypeScript | wi101/swagger2-angular2-materialize | /src/app/modules/main/left-menu/left-menu.ts | 2.546875 | 3 | import {Component} from '@angular/core';
import {ApiDocService} from '../../../services/apidoc.service';
import {ApiDefinition} from '../../../model/api-definition';
import {PathsObject} from '../../../model/apidoc';
import {Router} from "@angular/router";
@Component({
selector:'left-menu',
template:require('... |
f169dddef8ffde94af08f428e6fea9582306a06f | TypeScript | ai-labs-team/casium-devtools | /src/injected-script.ts | 2.78125 | 3 | /**
* This script is injected and executed in the context of the inspected page via
* the Content Script. It initializes an Instrumenter backend that uses
* `window.postMessage` to relay messages to the Content Script.
*/
import { Instrumenter } from './instrumenter';
import { fromMatches } from './util';
const i... |
6eb9bf7e65277f15c0c1da1efdd2ad3a2f2afad5 | TypeScript | Noronha1612/GatitoBook-Angular | /front/src/app/autenticacao/models/usuarioToken.ts | 2.578125 | 3 | interface Token {
exp: number;
iat: number;
email: string;
name: string;
id: number;
}
export type UsuarioToken = {
[Key in keyof Token]?: Token[Key];
}
|
47b52d934fc24f2a8dcf0e369a4fe068b5f78504 | TypeScript | WilliamRADFunk/chess | /front-end/src/app/utils/get-piece-point-value.ts | 3.25 | 3 | export function getPiecePointValue(piece: number): number {
switch (piece) {
case 1: { // Pawn
return 10;
}
case 2: { // Rook
return 50;
}
case 3: { // Knight
return 30;
}
case 4: { // Bishop
return 30;
}... |
cec2c1b2039e0c1a11b71adbafedbe8981728dfc | TypeScript | libin1991/landlord | /html/js/src/component/area/player-area/SidePlayerArea.ts | 2.75 | 3 | import Container from "../../../render/Container";
import Avatar from "../../player/avatar";
import Name from "../../player/name";
import SideHandPukes from "../../pukes/SideHandPukes";
import User from "../../../user/User";
import { i_DisplayObjectOptions } from "../../../render/DisplayObject";
import Desktop from "..... |
b029147a46113885932fa5e3a50722fb25858fb5 | TypeScript | theednaffattack/instagram-clone | /packages/client/src/lib/logoutAllTabs.ts | 2.75 | 3 | export const LOGOUT_KEY = "logout";
/**
* Update localStorage 'logout' key to sign out from all windows
* The 'logout' key expects a stringified Date object "Date.now().toString()"
*/
export function logoutAllTabs(): void {
window.localStorage.setItem(LOGOUT_KEY, Date.now().toString());
}
export function clearLo... |
5b548ef1cf6f55a9daa69d9725967c149232838a | TypeScript | gin-lsl/zzti-zhihu | /src/entities/Admin.ts | 2.53125 | 3 | import { SchemaDefinition } from "mongoose";
export interface IAdmin {
email: string;
username: string;
password: string;
}
export class Admin implements IAdmin {
id: string;
email: string;
username: string;
password: string;
static createSchemaDefinition(): SchemaDefinition {
return {
id: ... |
9c1c3a845afc95b36e21dfcb35221c75991d2da8 | TypeScript | zenatureza/franq-api | /src/shared/infra/providers/LogProvider/implementations/WinstonLogProvider.ts | 2.875 | 3 | import winston from 'winston';
import ILogProvider from '../interfaces/ILogProvider';
import loggerConfig from '@config/logger';
class WinstonLogProvider implements ILogProvider {
private logger: winston.Logger;
constructor() {
this.setup();
}
private setup() {
// Only shows warns and errors in prod... |
0b7ebbe66bd1be8e17aee63510c4c1d01a64df6c | TypeScript | david8zhang/battle-engine | /src/models/MultiSwitchTurn.ts | 2.890625 | 3 | import { IAbstractTurn } from "../interface/IAbstractTurn";
import { LooseObject } from "../interface/LooseObject";
import { ITeamManager } from "../interface/ITeamManager";
import { IArenaManager } from "../interface/IArenaManager";
import { TurnQueue } from "../managers/TurnManager";
import { Hero } from "./Hero";
e... |
dbc28087880151d1a0c6ca023c8338ec073d557c | TypeScript | Jhon-Idrovo/apiculture | /client/store/entities/expenses.ts | 2.515625 | 3 | import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import axiosInstance from '../../config/axiosInstance';
import { EXPENSES_ENDPOINT } from '../../config/config';
import { compareRows, errorToMessage, IField, Order, translate } from '../../utils/utils';
import { RootState } from '../configureStore';
impor... |
408fa70d0b024fe2bef804b25cc60985e5abcffa | TypeScript | Mahmudulazamshohan/project_management | /src/redux/reducers/postReducers.ts | 2.859375 | 3 | import { PostInterface } from "../interfaces/postInterface";
import {
GET_POSTS,
GetPostsStateType,
PostActionTypes,
REMOVE_POST,
} from "../types/postTypes";
const initialStateGetPosts: GetPostsStateType = {
posts: [],
};
type ActionTypes = {
type: string;
payload: any;
};
export const getPostsReducer ... |
a0e2d760833d0fbaf7a40c66841fe3262168711b | TypeScript | guardian/facia-tool | /fronts-client/src/util/__tests__/clipboardUtils.spec.ts | 2.578125 | 3 | import { liveArticle, articleWithSupporting } from 'fixtures/shared';
import { stateWithClipboard } from 'fixtures/clipboard';
import { normaliseClipboard, denormaliseClipboard } from '../clipboardUtils';
describe('Clipboard utilities', () => {
describe('normaliseClipboard', () => {
it('should normalise a clipbo... |