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 |
|---|---|---|---|---|---|---|
79a88a8192de188c7781c3ddefe7a7923c237013 | TypeScript | atschaef/typescript-react-playground | /test/unit/components/date_input/date_input.utils.spec.ts | 2.828125 | 3 | import { createSandbox, SinonSpy } from 'sinon'
import { expect } from 'chai'
import {
preventNonNumeric,
focusPreviousInput,
tryFocusNextInput,
DateFieldType,
normalizeValue,
} from '../../../../src/components/date_input/date_input_utils'
import { keyboardEvent } from '../../data/events'
describe('-- Date ... |
5355127f290f37f5c77826e0e0256ab53df68a4c | TypeScript | clubito/server | /src/controllers/event/admin.ts | 2.53125 | 3 | /* eslint-disable @typescript-eslint/no-explicit-any */
// create/edit/delete events
import { Request, Response } from "express";
import Club from "@models/Club";
import User from "@models/User";
import logger from "@logger";
import joi from "joi";
import { CLUB_ROLE } from "@models/enums";
import { ObjectId } from "mo... |
5ceef28dfecafd4e365a35a6f9736b200fca0729 | TypeScript | DaviiErazo/transfers-back | /src/modules/transfers/useCases/getTransfers/GetTransfersUseCase.ts | 2.71875 | 3 | import { Either, Result, left, right } from "../../../../shared/core/Result";
import { AppError } from "../../../../shared/core/AppError";
import { UseCase } from "../../../../shared/core/UseCase";
import { ITransferRepo } from "../../repos/transferRepo";
import { Transfer } from "../../domain/transfer";
type Response... |
ba3e4243fc1080d322b037c2fd74ebe20d44ae70 | TypeScript | shatee/use-click-document | /src/index.ts | 2.6875 | 3 | import { RefObject, useCallback, useEffect } from 'react';
export const useClickDocument = (
onClick: (event: MouseEvent) => void,
ignoreRefs?: RefObject<HTMLElement>[]
) => {
const onClickHandler = useCallback((event: MouseEvent) => {
if (!event.target) return;
if (ignoreRefs?.length) {
for (let r... |
863b1f000fb32857ac31f7947bb2937a4684eecb | TypeScript | Kayque-Goncalves/fullstack-twitter-clone | /server/src/useCases/Authentication/AuthenticationController.ts | 2.59375 | 3 | import { Request, Response } from 'express'
import { AuthenticationCase } from './AuthenticationCase'
class AuthenticationController {
private authenticationCase: AuthenticationCase
constructor(authenticationCase: AuthenticationCase){
this.authenticationCase = authenticationCase
}
async handle(request: R... |
f553163753c177d9d9ca97cf1d01c2ff3fa3b222 | TypeScript | lanmower/onethreethreeseven-core | /packages/crypto/src/builder/transactions/vote.ts | 2.65625 | 3 | import { TransactionTypes } from "../../constants";
import { feeManager } from "../../managers";
import { ITransactionData } from "../../transactions";
import { TransactionBuilder } from "./transaction";
export class VoteBuilder extends TransactionBuilder<VoteBuilder> {
constructor() {
super();
th... |
2e0b3dfc5d7ec31c92c35887c5a788ffef5623b4 | TypeScript | IgorMinar/angular | /packages/core/test/util/array_utils_spec.ts | 2.703125 | 3 | /**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {flatten} from '../../src/util/array_utils';
describe('flatten', () => {
it('should flatten an empty arra... |
26222e414eb92efc1cdd27eb331b6a5940e41849 | TypeScript | kike1303/peliculiando-ando | /src/app/store/reducers/my-movies.reducer.ts | 2.640625 | 3 | import * as myMoviesActions from '../actions/my-movies.actions';
import { createReducer, on, Action } from '@ngrx/store';
import { initialMyMoviesState, MyMoviesState } from '../states/my-movies.state';
import { MovieDetails } from '../../models/movie-details.model';
import { MovieInfo } from 'src/app/models/movie-info... |
91033a8b79683a00be2593ae3bc70de3ce8ddd84 | TypeScript | studiokaiji/sidetree | /lib/core/interfaces/IBatchWriter.ts | 2.765625 | 3 | /**
* Interface that defines a class that can write batches of operations to content addressable storage and blockchain.
*/
export default interface IBatchWriter {
/**
* Writes one or more batches of batches of operations to content addressable storage and blockchain.
*/
write (): Promise<void>;
}
|
89eafb8d23c5187d15c381cf9673eaec3e437e27 | TypeScript | dylang/npm-check | /index.d.ts | 2.625 | 3 | declare module NpmCheck {
interface INpmCheckOptions {
global?: boolean;
update?: boolean;
skipUnused?: boolean;
devOnly?: boolean;
ignoreDev?: boolean;
cwd?: string;
saveExact?: boolean;
currentState?: Object;
}
type INpmCheckGetSetValues = "packages" | "debug" | "global" | "cwd... |
d3a54c50ad9cf5d6588a332b9e24baf2cf25b162 | TypeScript | Chrisaxell/radio-sheep-gcs | /app/api/messages/vfr-hud.ts | 2.609375 | 3 | import {MAVLinkMessage} from '@gardsteinsvik/node-mavlink';
import {readInt64LE, readUInt64LE} from '@gardsteinsvik/node-mavlink';
/*
Metrics typically displayed on a HUD for fixed wing aircraft.
*/
// airspeed Vehicle speed in form appropriate for vehicle type. For standard aircraft this is typically calibrated airspe... |
4cf675312c8c9ac1458df403d72d18b9bbdbab4f | TypeScript | Jesusml1/euler_problems | /euler_06/euler_06.ts | 3.75 | 4 |
const generator = (limit:number) => {
let numbers:number[] = [];
for(let i = 0; i < limit; i++){
numbers.push(i + 1);
}
return numbers;
}
const sample = generator(100);
const SquareSum = (numbers:number[]): number => numbers.map(number => Math.pow(number, 2)).reduce((a, b) => a + b);
const SumSquare = (n... |
44e04f28c8ef558db194492ef9ee89f29fc3ca7e | TypeScript | Olddude/angular-challange | /src/app/tree/services/value-type/value-type.service.spec.ts | 2.890625 | 3 | import { ValueTypeService } from './value-type.service';
describe('ValueTypeService', () => {
let service: ValueTypeService;
beforeEach(() => {
service = new ValueTypeService();
});
it('should create', () => {
expect(service).toBeTruthy();
});
[
{ value: undefined, expected: 'undefined' },
... |
a2e2a297e032f801e0835df3b3b69b4f3089a439 | TypeScript | RocketCommunicationsInc/astro | /packages/web-components/src/utils/utils.ts | 3.203125 | 3 | export const hasShadowDom = (el: HTMLElement) => {
return !!el.shadowRoot && !!(el as any).attachShadow
}
export function hasSlot(el: HTMLElement, name?: string | undefined): boolean {
// Look for a named slot
if (name) {
return el.querySelector(`[slot="${name}"]`) !== null
}
// Look for a... |
e8ebc41349e4a617a321e08be139f984a13e7b8e | TypeScript | imlihao/aktm-cs | /src/NetWork/NetMgr.ts | 2.6875 | 3 | /**
* 网络管理
*/
class NetMgr{
private socket=new MySocket();
private static _self:NetMgr;
public static get instance(){
if(!NetMgr._self){
NetMgr._self=new NetMgr();
}
return NetMgr._self;
}
public TcpSend(cmd:any){
let data=JSON.stringify(cmd);
console.l... |
e989a82135b3e1192f5ad84ec1adb8f8ac228484 | TypeScript | merwaaan/tecs | /extra/motion.ts | 2.984375 | 3 | /// <reference path='../core/entity.ts' />
/// <reference path='../core/component.ts' />
/// <reference path='../lib/tween.js.d.ts' />
module Motion {
interface EasingFunction {
(k: number): number
}
interface CMotionOptions {
duration: number,
repetitions?: number,
yoyo?: boolean,
easing?... |
482b33afb5fd5db022f78f839a191d5f67470a0a | TypeScript | msafarigit/DreamApp | /src/app/component/course/shared/store/freezeState.ts | 2.703125 | 3 |
// https://github.com/substack/deep-freeze
// https://github.com/immutable-js/immutable-js
// https://github.com/buunguyen/redux-freeze
function deepFreeze(obj) {
Object.freeze(obj); // root props of object freezed!
Object.getOwnPropertyNames(obj).forEach(prop => {
if (obj.hasOwnProperty(prop) && obj[prop] &&... |
6d665be968c373b28eba3918fa6d71f7fc6198c1 | TypeScript | thaisjsoares/OmniLabs-Platform-Back | /src/modules/groups/useCases/UpdateGroup/UpdateGroupUseCase.ts | 2.53125 | 3 | import Groups from '@modules/groups/infra/typeorm/entities/Groups';
import IGroupsRepository from '@modules/groups/repositories/models/IGroupsRepository';
import { injectable, inject } from 'tsyringe';
import AppError from '@shared/errors/AppError';
interface IRequest {
name: string;
description: string;
... |
d70350590d22c95d60fa7a35abe5e2632f96d125 | TypeScript | fengzhicool163/slot_party | /Client/UpGame/src/game/ui/general/LongPress.ts | 2.765625 | 3 | module ui {
export class LongPress extends egret.EventDispatcher {
public static BEGIN:string = 'onLongPressBegin';
public static END:string = 'onLongPressEnd';
public static ACTION:string = 'onLongPressAction';
public static TRIGGER:number = 1.5;
public static INTERVAL:nu... |
b987f4315520e45e63397e6562cb366b9ba961d6 | TypeScript | couchbaselabs/node-ottoman | /__test__/schema.types.spec.ts | 3 | 3 | import {
applyDefaultValue,
ArrayType,
BuildSchemaError,
DateType,
EmbedType,
getDefaultInstance,
IOttomanType,
model,
NumberType,
Schema,
SearchConsistency,
StringType,
validate,
ValidationError,
} from '../src';
import { isOttomanType } from '../src/schema/helpers';
import { startInTest } ... |
7e56cb248aa0fae49d2c5e6021dd9d781c71b63d | TypeScript | karo6774/key-parser | /src/key-solvers/and.key-solver.ts | 2.859375 | 3 | import {ParsedKey} from "../parsed-key";
import {KeySolver, solve} from "../key-solver";
export class ParsedAndKey implements ParsedKey
{
public static make(data: any[]): ParsedAndKey
{
let keys = [data[0]].concat(data[2].map((val: any[]) => val[2]));
return new ParsedAndKey(keys);
}
p... |
c74368068157b12de2e242b87348fdfb7ee2917a | TypeScript | feryadialoi/salesman-deploy | /src/localpersistent/impl/ProfileLocalPersistentImpl.ts | 2.6875 | 3 | import { Profile } from "../../models/Profile";
import { ProfileLocalPersistent } from "../ProfileLocalPersistent";
export class ProfileLocalPersistentImpl implements ProfileLocalPersistent {
setProfile(profile: Profile): void {
const profileString = JSON.stringify(profile);
console.log("profileStr... |
ee8ae8150df5771abe763b40f7416fd474fc1f6b | TypeScript | stfmarkov/clock | /src/js/reducers/locationReducer.ts | 2.640625 | 3 | const locationReducer = (
state = {
location:"",
},
action:{type:string, payload:any}) => {
switch (action.type) {
case "SET_LOCATION":
state = {
location:action.payload,
}
break;
}
return state;
}
export default locationReducer |
2f0bf4059816af814d421db105a14f1b7fed46e1 | TypeScript | smallbatchdevs/27_stripe_checkout | /functions/src/sitemap/index.ts | 2.609375 | 3 | import admin = require('firebase-admin');
import * as functions from 'firebase-functions';
const { SitemapStream, streamToPromise } = require('sitemap');
// static routes that you can't easily get or generate from your database. i.e. /home or /login
const staticRoutes: string[] = [];
async function getDynamicRoutes(... |
da870b29f284d1addfc7c23db85b88383b350319 | TypeScript | drew-moore/rcv-widget | /src/app/core/state.ts | 2.828125 | 3 | import {Action} from "@ngrx/store";
export const CoreActions = {
ACTIVATE_POLL: '[Widget] activatePoll',
SESSION_USER_CHANGED: '[User] sessionUserChange'
};
export class ActivatePollAction implements Action {
public readonly type = CoreActions.ACTIVATE_POLL;
constructor(public readonly payload: string) {}
}
... |
e0232710a44630283108c0d2cb5b90ca4883e83d | TypeScript | trustee-wallet/trusteeWallet | /app/services/Cards/Cards.ts | 2.734375 | 3 | /**
* @version 0.30
* @author ksu
*/
import Log from '../Log/Log'
import axios from 'axios'
export namespace Cards {
export const getCountryCode = async (cardNumber : string) => {
try {
cardNumber = cardNumber.split(' ').join('')
if (cardNumber.indexOf('220') === 0 || ... |
8aac038fad74f58c1c66d30c9ab7c18a24e3359a | TypeScript | liebhartdevelopment/typescript-chat | /server/src/app.ts | 2.578125 | 3 | import WebSocket from "websocket";
import Http from "http";
import { ClientConnection } from "./clientConnection";
import { UserManager, UserData } from "./users";
import { ResponseType } from "./responsePackets";
export class Server {
// Hold all connections.
private static _connections: {
[connectionID: numb... |
6820b3fa7ea974459e4424323943a0bb16015758 | TypeScript | dbknickerbocker/tcx-builder | /src/models/Activity/Activity.ts | 2.5625 | 3 | import { BaseObject } from '../_common';
import { ActivityAttributes } from './ActivityAttributes';
import { ActivityLap } from './ActivityLap';
import { Training } from '../Training';
import { isNil as _isNil } from 'lodash';
import { AbstractSource } from '../AbstractSource';
import { ActivityAttributeSport } from '.... |
2f753ecd2841ca462496d1dfeca4fed2ac449706 | TypeScript | SEKCJ/victory-gardens | /src/server/DB/Queries/herbs.ts | 2.640625 | 3 | import { Query } from "../index";
import { IVegetables } from "../../Models/index";
// returns all info for all herbs with image url
const allHerbs = async () => {
return Query<IVegetables[]>(
`SELECT herbs.name, herbs.sci_name, herbs.id, herbsimages.url
FROM herbs
JOIN herbsimages ON herbs.id = herbsima... |
609fa3a39f9546603b01804cd494da53cd808cc6 | TypeScript | Tankerxyz/tappytanks | /src/components/player/PlayersController.ts | 2.59375 | 3 | import BABYLON, { Vector3 } from 'babylonjs';
import Player from './Player';
export default class PlayersController {
private players: Array<Player> = [];
private _scene: BABYLON.Scene;
constructor(players: Array<Player>, scene: BABYLON.Scene) {
this.players = players;
this._scene = scene;
}
public... |
db7e907842806563840c9822a19a89fcfc1b8651 | TypeScript | JonathonRichardson/typescript-error | /src/error.ts | 3.4375 | 3 | export interface Unwrappable<T> {
unwrap(): T | never
}
export interface Result<T, U extends Error> extends Unwrappable<T> {
unwrap(): T | never,
hasError(): boolean,
getError(): U
}
class OkResult<T> implements Result<T, Error> {
constructor(private readonly value: T) {}
unwrap(): T {
... |
84275a0dd56b531d4c1e767b6319de80b462b7e4 | TypeScript | yujuiting/gaudi-editor | /src/editor/widget/type.ts | 2.546875 | 3 | import { JSONValue } from 'gaudi';
export enum WidgetType {
Icon,
Panel,
Props,
Styles,
Input,
}
interface Widget {
readonly type: WidgetType;
readonly title?: string;
}
export interface IconWidget extends Widget {
readonly type: WidgetType.Icon;
readonly id: string;
readonly group: string;
rea... |
9ec96c50f48859d37a6541e0f5eab1cf03959442 | TypeScript | topaxi/learning-cs | /utils/object/entries.test.ts | 2.828125 | 3 | import { entries } from './entries'
describe('utils/object/entries', () => {
test('should return an iterator over all own keys and properties', () => {
let parent = { foo: 'bar', baz: 'qux' }
let value = Object.create(parent)
value.foo = 'buz'
let expected = [['foo', 'buz']]
expect(Array.from(... |
a71b633a07fbb230c9e6d0fb8eeccaeaf71bc596 | TypeScript | gornadan/myProject | /src/bll/packsReduser.ts | 2.765625 | 3 | import { Dispatch } from "redux";
import { CardPacksType, packsAPI } from "../api/api";
import { toggleIsFetching } from "./loginReducer";
// const initialState: Array<CardPacksType> = [];
const initialState = {
packs: [] as Array<CardPacksType>,
page: 1,
pageCount: 10,
cardPackTotalCount: 100,
packName: ""... |
49a244a95b1016cb60ac3cd602c2ddc85403b3aa | TypeScript | emrahoner/html-processor | /src/dom/selector-comparer.spec.ts | 2.8125 | 3 | import { is } from './selector-comparer'
import { NamedNodeMap } from './named-node-map'
describe('Selector Comparer', () => {
describe('compares mixed selectors', () => {
it('finds equal when tag name and attribute matches', () => {
const attributes = new NamedNodeMap([
{
name: 'attr1',... |
a316198a408595c9767583ce0e761d4f14b0a5f9 | TypeScript | TNOCS/csnext | /packages/cs-core/src/datasources/time-datasource.ts | 2.6875 | 3 | import { IDatasource, MessageBusService, Topics } from '..';
export class TimeDataSource implements IDatasource {
public start?: number;
public end?: number;
public focusTime?: number;
public id = 'timedatasource';
public events = new MessageBusService();
public setTimeRange(start: number, end: number) {... |
838c5f928fcd51855d507c229cd590aff23887c1 | TypeScript | vanovarderesyan/shemm-school-public | /src/services/warehouseService.ts | 2.5625 | 3 | import WarehouseDetail from '../domain/entities/WarehouseDetail';
import Warehouse from '../models/Warehouse';
import transform from '../utils/transform';
import WarehousePayload from '../domain/requests/WarehousePayload';
import * as object from '../utils/object';
import NotFoundError from '../exceptions/NotFoundEr... |
ac66e31537cc3a15405613f46655a435dbdb03aa | TypeScript | reyronald/tabs-with-chasing-underline | /src/MediaDisplay.ts | 2.671875 | 3 | import styled from 'styled-components'
import { mediaQueries } from './mediaQueries'
const mediaDisplayMap = ['xs', 'sm', 'md', 'lg', 'xl'].reduce(
(acc, key, index, arr) => ({
...acc,
[key]: {
min: index > 0 && mediaQueries[arr[index - 1]].max`display: none`,
max:
index < arr.... |
4c2743eb9caa97f3087676e088e085085a56f0a1 | TypeScript | robertcorponoi/fibtastic | /lib/index.d.ts | 3.734375 | 4 | /**
* Fibtastic provides methods to easily work with the Fibonacci sequence.
*
* @author Robert Corponoi <robertcorponoi@gmail.com>
*
* @version 2.0.0
*/
/**
* Get an array of the Fibonacci sequence from a specified start location to a specified end location.
*
* If only one parameter is specified, it will be ... |
c5249df7f6ffbfc1b257b1cd384a836b5b943f55 | TypeScript | graycoreio/daffodil | /libs/content/src/models/block.interface.ts | 2.65625 | 3 | import { DaffIdentifiable } from '@daffodil/core';
/**
* A piece of static webpage content.
*/
export interface DaffContentBlock extends DaffIdentifiable {
/**
* The human-readable title for this content.
*/
title: string;
/**
* The HTML content.
*/
content: string;
}
|
921f1bfa7bc53295302630eff8312675e2d717ad | TypeScript | tanasats/SAM | /src/app/services/file-upload.service.ts | 2.53125 | 3 | import { Injectable } from '@angular/core';
import { Observable, throwError } from 'rxjs';
import { catchError, map, tap } from 'rxjs/operators';
import {
HttpClient,
HttpErrorResponse,
HttpHeaders,
} from '@angular/common/http';
//const endpoint = 'http://localhost:3000/api/v1/upload';
const endpoint = 'http://l... |
6a19802c6b7e33ebd90bfe0bfcb567ea4885e53c | TypeScript | tanaka-it/repofy | /src/protocols/filter/comparator.ts | 2.921875 | 3 | import { ComparatorOperatorEnum } from './comparator-operator-enum'
import { OptionsFilter } from './options-filter'
interface OptionsComparator extends OptionsFilter {
regex?: string
}
export class Comparator {
private constructor (
private readonly _operator: ComparatorOperatorEnum,
private readonly _ke... |
1b3e58040cfd11e4e8f694066e3ec5a263ab3c38 | TypeScript | tcgdex/cards-database | /data/XY/Primal Clash/115.ts | 2.796875 | 3 | import { Card } from '../../../interfaces'
import Set from '../Primal Clash'
const card: Card = {
name: {
en: "Spinda",
fr: "Spinda",
es: "Spinda",
it: "Spinda",
pt: "Spinda",
de: "Pandir"
},
illustrator: "Mitsuhiro Arita",
rarity: "Common",
category: "Pokemon",
set: Set,
dexId: [
327,
],
hp: 8... |
3567002e431c58c0c7fbf095b47896164b4eb6c7 | TypeScript | NativeStream/jarviscript | /src/interfaces/cli/commands/player/Goto.ts | 2.5625 | 3 | import { EventData } from "../../../../app";
import Command, { iEventDatas } from "../../classes/Command";
import playerEvents from "../../../../interfaces/player/events";
class Goto extends Command {
public help: string = "Vai para a música no indice indicado";
public validate(eventData: EventData, args: string):... |
d2127ce4b5b665a9674960cf9840c546de7c6221 | TypeScript | wolfzxcv/Pokemon-shop | /src/utils/currency.ts | 2.75 | 3 | export function currency(num: number) {
const n = Number(num);
return `$${n.toFixed(0).replace(/./g, (c, i, a) => {
const currency =
i && c !== '.' && (a.length - i) % 3 === 0
? `, ${c}`.replace(/\s/g, '')
: c;
return currency;
})}`;
}
|
967cf0e1939ab1167edf9a8a9a43cf4caac55ba5 | TypeScript | Webiks/MapMip | /src/app/map-mip/position-form/color-picker/color-picker.pipe.ts | 2.671875 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'colorPicker'
})
export class ColorPickerPipe implements PipeTransform {
transform(value: any[], iconsPerRow = 1): any {
// if(iconsPerRow === 1) {
// return value;
// }
let rowsArray = [];
let rowArray = [];
value.fo... |
b5315ad338557dd52886380aa2b9bb938edb80be | TypeScript | AndreLuizPedroBotelho/controlreg-backend | /src/modules/sales/tests/CompanyTest.ts | 2.625 | 3 | import faker from 'faker';
import { CompanyFactory } from '../factories/CompanyFactory';
import { createTypeormConn, deleteTypeormConn } from '../../../shared/typeorm';
import { Company } from '../entities/Company';
import CompanyController from '../controllers/CompanyController';
let companyController: CompanyControl... |
d6fe97e0740d761c6b109d2657959fa299a16e40 | TypeScript | Lisianthus-A/leetcode-js | /answers/0001-0500/0451. 根据字符出现频率排序.ts | 3.78125 | 4 | function frequencySort(s: string): string {
// 统计字符出现次数
const counts: Record<string, number> = {};
for (let i = 0, len = s.length; i < len; ++i) {
const char = s[i];
counts[char] = counts[char] + 1 || 1;
}
// 二分法排序
const array: Array<string> = [];
const find = (char: string)... |
727668b7696f2f134b1f59fd8a9eccd5791e941a | TypeScript | wuxj00/webpaint-typescript | /src/plugins/DataModel.ts | 2.578125 | 3 | import VectorTree from '../collections/VectorTree';
const store = new Map();
const treeStore = new VectorTree();
export function get(id: string) {
return store.get(id);
}
export function add(id: string, data: any) {
// treeStore.add(data);
return store.set(id, data);
}
export function forEach(callback: (param... |
e9cb9907a3c87f09c64b39c1eab22a63f64da7a4 | TypeScript | kurone-kito/dantalion | /packages/dantalion-i18n/src/build/specialized.ts | 2.796875 | 3 | import type {
LifeBase,
Motivation,
Personality,
} from '@kurone-kito/dantalion-core';
import type { DetailAccessor } from '../resources/createGenericAccessor';
import type { DetailsBaseType, VectorType } from '../resources/types';
import article from './article';
import { line, list } from './list';
/**
* Crea... |
1a61627fe26fbf2dd39112757c2d5c5da573db56 | TypeScript | ijdickinson/deno-experiments | /data-generation.ts | 2.984375 | 3 | import parse from 'https://deno.land/x/date_fns@v2.22.1/parse/index.js'
/**
* Goal: read a file of texttual data, and generate a JSON file that
* encodes the data in a more regular form.
*/
interface SightingsData {
species: string
quant?: string
location: string
date: string
time?: string
spotter: str... |
2626f93d8eec5ffb8e51b5f4086628ccde9810b6 | TypeScript | Rumbleship/acl | /src/permissions-matrix.ts | 3.140625 | 3 | import { Registry } from '@rumbleship/oid';
import { Resource, Actions, Roles } from './types';
import { OneToUniqueManyMap } from './utils/one-to-unique-many-map';
/**
* Lookup table that maps OidScopes to the Authorizable Resource; critical because
* both OidScopes:Buyer|Supplier are treated as the samee core Auth... |
437436e24418ce1d87836d3c5953d5dbae2b8635 | TypeScript | KevReece/Dungeon | /src/app/model/celloccupiers/enemy.model.ts | 3.015625 | 3 | import { Fighter } from './fighter.model';
import { Direction } from '../direction.model';
import { FactoryService } from 'src/app/services/factory.service';
import { Cell } from '../cell.model';
import { DirectionHelper } from '../direction-helper';
import { Character } from './character.model';
import { FightService ... |
dabedde204ddea49f10a7849ad0af4af32582a64 | TypeScript | pcholuj/ecs-deploy | /src/deployers/adapter/adapter.interface.ts | 2.515625 | 3 | import { Applications } from 'api/applications/applications.entity';
export interface DeployersVersions {
name: string;
tag: string;
config?: any;
}
export interface DeployersStatus {
name: string;
tag: string;
status: number;
}
export interface AdapterInterface {
name: string;
deplo... |
2c5d7e2620733a44edafa5fba4fe8725fe40be22 | TypeScript | tyblue/blog | /code/accumulate/design-pattern/strategy.ts | 3.359375 | 3 | abstract class Strategy {
public abstract method()
}
class Strategy_1 extends Strategy {
constructor() {
super();
}
method() {
console.log('strategy_1')
}
}
class Strategy_2 extends Strategy {
constructor() {
super();
}
method() {
console.log('strategy... |
a48be01aad16bdb32ff2e398b266fd1aa1bb51ff | TypeScript | nwtgck/egghead-todo-typescript-react | /src/reducers.ts | 2.53125 | 3 | import {combineReducers, Reducer} from "redux";
import {reducerWithInitialState} from "typescript-fsa-reducers";
import {List} from "immutable";
import {TodoItem} from "./datatypes";
import * as actionCreators from "./actionCreators";
import {Filter} from "./actionCreators";
import {typeSa... |
04ebd5fa0c8921a12217e9e0f2d2337b6644bacd | TypeScript | tumiMsaki/LeetCode-Recording | /leetcode/70.ts | 4.03125 | 4 | /** 爬楼梯 递归方式
* @param {number} n
* @return {number}
*/
var climbStairs = function(n: number): number{
if (n === 1) {
return 1
}
if (n === 2) {
return 2
}
return climbStairs(n - 1) + climbStairs(n - 2)
};
console.log(climbStairs(10))
/** 爬楼梯 非递归
* @param {number} n
* @return {numb... |
164717b88ea68fb0a2133378cad170c85b3894e3 | TypeScript | jmcknight-clgx/Initiate | /initiate.angular/src/app/models/stats.spec.ts | 3.03125 | 3 | import { Stats } from "./stats";
describe('stats', () => {
describe("CalculateMod", () => {
it("should return 0 when stat is 11", () => {
let target = new Stats();
target.Strength = 11;
expect(target.StrengthMod).toBe(0);
});
it("should return -1 when ... |
7cd7da8848fd005e05c4a7de376b59365a757d7d | TypeScript | nutanix/papiea | /papiea-backend-utils/src/axios_response_parser.ts | 2.890625 | 3 | export class AxiosResponseParser {
public static getAxiosErrorResponse(err: any): any | null {
if (err) {
if (err.response) {
return err.response
}
console.info("Received null/undefined value for error response")
} else {
console.info("... |
69ca73382325fffa56afadc9dda8a72262c3abc7 | TypeScript | 6thquake/react-material | /packages/material-ui/core/src/styles/createPalette.spec.ts | 2.578125 | 3 | import { Color } from '@material-ui/core';
import blue from '@material-ui/core/colors/blue';
import createPalette, {
PaletteColorOptions,
SimplePaletteColorOptions,
} from '@material-ui/core/styles/createPalette';
{
const palette = createPalette({});
const color: Color = blue;
const option: SimplePaletteColo... |
54c4d029213cd05c843e89b1ae5500048f24a37f | TypeScript | ChristianKohler/styled-webcomponents | /src/params.ts | 2.859375 | 3 | const bracesRegex = /(\(|\))/g;
export function extractDestructuredParams(fnAsString: string) {
const fnParams = extractFnParams(fnAsString);
if (fnParams.length === 1) {
const pattern = new RegExp(`${fnParams[0]}\\.(\\w+)`, "gm");
const paramMatches = fnAsString.match(pattern);
return paramMatches
... |
fb6f5c725817549fd93abc4cb964ffb92edddf38 | TypeScript | ringcentral/ringcentral-js-widgets | /crius/packages/crius-runner/src/runner.ts | 2.875 | 3 | /* eslint-disable @typescript-eslint/no-use-before-define */
import { CriusNode, Children, StepFunction, CriusElement } from 'crius';
import {
isCriusNode,
isCriusStep,
isCriusStepClass,
isCriusStepFunction,
} from 'crius-is';
import { runWithLifecycle } from './lifecycle';
import { handleContext } from './cont... |
cf551ed7af029e645da2963c270e1d907997760c | TypeScript | Nolanus/ngx-multi-window | /projects/ngx-multi-window/src/lib/types/window.type.ts | 3.046875 | 3 | import { Message } from './message.type';
export interface WindowData {
heartbeat: number;
id: string;
name: string;
}
export interface KnownAppWindow extends WindowData {
stalled: boolean;
self: boolean;
}
/**
* Represents a window with the current application how it is stored
* in the localstorage. It ... |
95344e9f270e045dfdedc0a22ef766463a968047 | TypeScript | morrys/wora | /packages/redux/src/createStore.ts | 2.546875 | 3 | import $$observable from 'symbol-observable';
import Cache, { ICache, CacheOptions, mutateKeysLayer, prefixLayer, DataCache } from '@wora/cache-persist';
import isPlainObject from './redux/utils/isPlainObject';
import ActionTypes from './redux/utils/actionTypes';
import { filterKeys } from '@wora/cache-persist/lib/laye... |
c929c00ceccc8ee63345621d5b5f1a33056400d3 | TypeScript | ronan583/RiddleGame-egret | /GuessGameClient/src/dliy/Utils/Http.ts | 2.5625 | 3 | module dliy.utils {
export class Http {
private loader: egret.URLLoader = new egret.URLLoader();
private variables: egret.URLVariables;
private httpReq:egret.HttpRequest = new egret.HttpRequest();;
static create(): Http {
return new Http();
}
success(han... |
45187a33b188ca43c1740d49450420180a03f4d4 | TypeScript | spankoj/nextjstravelplaner | /utils/valtio/sessionstore.ts | 2.703125 | 3 | import { proxy } from 'valtio';
/* eslint-disable-next-line */
export const SESSIONS = {
ANONYMOUS: 'anonymous', // Not logged in, not started the login/register process
DURINGLOGINORREGISTER: 'duringloginorregister', // Started the login/register process
LOGGEDIN: 'loggedin', // Logged in
};
type SessionStoreT... |
d88de282d83f8c3860fa88772cfe1b30f7b95fac | TypeScript | MariusAlch/json-to-ts | /test/array-merging.spec.ts | 3.359375 | 3 | import * as assert from "assert";
import { removeWhiteSpace } from "./util/index";
import JsonToTS from "../src/index";
describe("Array type merging", function() {
it("should work with arrays with same inner types", function() {
const json = {
cats: [{ name: "Kittin" }, { name: "Sparkles" }]
};
co... |
9b01e1d43b10b179c0ada3e8156b7153749e7966 | TypeScript | Tebogo-Seshibe-Retro/db-decor | /src/lib/util/DatabaseState.ts | 2.859375 | 3 | export type NameCasing = 'pascal' | 'camel' | 'snake' | 'kebab'
export interface TableProperties
{
textCasing?: NameCasing
}
export interface TableDetails
{
name?: string
primaryKey?: string
foreignKeys?: {
field: string,
table: string
}[],
textCasing?: NameCasing
}
export type... |
0282e0feb2f3e8596da7f81b2c1a02de7ab042de | TypeScript | chenyijie2016/Snake | /SnakeVSBlock_TS/src/view/GameStart.ts | 2.75 | 3 | /**Created by the LayaAirIDE*/
module view {
export class GameStart extends ui.GameStartUI {
constructor() {
super();
this.gameStartButton.on(Laya.Event.CLICK, this, this.onGameStart);
this.leaderBoardButton.on(Laya.Event.CLICK, this, this.onShowLeaderBoard)
this.colorModeButton.on(Laya.Event.CLICK, this... |
ce825db8b2dd5791342d87778ead9d6d9c2eb4e5 | TypeScript | emqx/MQTTX | /src/utils/topicMatch.ts | 3.265625 | 3 | /**
* Topic matching algorithm
* @return Return matched result, true or false
* @param filter - type: topic string, subscription list topics
* @param topic - type: topic string, real send-receive topics
*/
export const matchTopicMethod = (filter: string, topic: string): boolean => {
let _filter = filter
let _t... |
b8213343e5c2494e019a1af6a5cc9be6baffb41b | TypeScript | hfleischer/vector-tile-analysis | /synergis/protobuf/base/source/SubSourceMessage.ts | 3.03125 | 3 | import { CodedInputStream } from "./CodedInputStream";
import { ISubSource } from "./ISubSource";
/**
* implementation of ISubSource wrapping a single message as defined in the protocol-buffer standard<br>
*
* @author h.fleischer
* @since 26.07.2019
*/
export class SubSourceMessage implements ISubSource {
/... |
3e4b8901ff6ed6f08050a1c6d044df5564bcca37 | TypeScript | jankaspar/virtual-roads | /src/game/game.ts | 2.625 | 3 | import THREE = require('three');
import Input = require('./input');
import Level = require('./level');
import GameState = require('./gameState');
class Game {
element: HTMLElement;
state = GameState.Welcome;
onStateChange: () => void;
private levels = ['level1', 'level2'];
private currentLevel = 0;
private re... |
a60fe9e2a2d73467bf5123e08019074b5bad168a | TypeScript | Moseyza/BatisAutomationWeb | /src/store/models.d.ts | 2.53125 | 3 | export interface LetterDto {
id: string;
title: string;
from: string;
date: string;
summary: string;
number: string;
footNote?: string | null;
}
export interface LetterList{
letters:LetterDto[];
}
|
48c5756e47b5a9c73d52dc0fcf62bc7291f934ed | TypeScript | vova557/desktop | /app/test/unit/git/rebase/progress-test.ts | 2.59375 | 3 | import { IStatusResult } from '../../../../src/lib/git'
import {
rebase,
RebaseResult,
getRebaseSnapshot,
} from '../../../../src/lib/git'
import { createRepository as createShortRebaseTest } from '../../../helpers/repository-builder-rebase-test'
import { createRepository as createLongRebaseTest } from '../../../... |
8d6abc896d70fa53a85dc9b987d49ef40988356c | TypeScript | redemma71/cs701-finalProject | /src/app/pipes/telephone.pipe.ts | 2.703125 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'telephone',
pure: false
})
export class TelephonePipe implements PipeTransform {
transform(phoneNumber: number): string {
let phoneNumberNormal = (phoneNumber.toString()).replace(/\D/g, '');
return '(' + phoneNumberNormal.substr(0, 3)... |
45dbbe9743bc13bdd6b121716aa3431b010cf10a | TypeScript | dtassone/material-ui-x | /packages/grid/_modules_/grid/utils/keyboardUtils.ts | 2.65625 | 3 | import * as React from 'react';
export const isEscapeKey = (key: string): boolean => key === 'Escape';
export const isEnterKey = (key: string): boolean => key === 'Enter';
export const isTabKey = (key: string): boolean => key === 'Tab';
export const isSpaceKey = (key: string): boolean => key === ' ';
export const is... |
161b0866b5add605b1a7dba588194f86545e44bc | TypeScript | maximeleroylaval/ugram | /client/src/reducers/Notification/Notification.ts | 2.765625 | 3 | import {Action, ActionTypes} from "../../actions/Notifications/notifications";
import {Notification} from "../../models/Notification";
export interface IStateNotifications {
notifications: Notification[],
}
export const initialState: IStateNotifications = {
notifications: []
};
export function reducer(state:... |
ee83ffa58ff9bdc309861e846eb2d22aabeadcb5 | TypeScript | wix-incubator/raw-http-response | /index.spec.ts | 2.53125 | 3 | import buildHttpResponse from "./index";
test("builds an empty http response", () => {
const response = buildHttpResponse({
status: 200,
headers: { "X-My-Header": "Hello world!" },
body: Buffer.from("")
}).toString("utf8");
expect(response).toMatchSnapshot();
});
test("builds a simple string respon... |
81ac4be17953120578758853e25f9be9b5b4851d | TypeScript | Rigii/mystery-chat | /src/user/schemas/user.schema.ts | 2.796875 | 3 | import * as mongoose from 'mongoose';
import { USER_GENDER, USER_ROLE } from '../constants';
import { statusEnum } from '../enums/status.enum';
export const UserSchema = new mongoose.Schema({
email: { type: String, required: true }, // necessary field
status: {
type: String,
enum: Object.values(statusEnum)... |
f7763fefea3b5955fbf72bdc7bf536b8cc3f136f | TypeScript | cintiaribeiro/code-micro-videos | /frontend/src/util/helper /index.ts | 2.765625 | 3 | const members: string[] = ["Diretor", "Ator"];
export const member = (member:number) => {
return members[member];
} |
4d8435736006acc5cb8a3c2baed61e66766f5b9d | TypeScript | frjjkil2009/najs-eloquent | /lib/relations/HasOneOrMany.ts | 3.09375 | 3 | export type RelationInfo = {
model: string
table: string
key: string
}
export class HasOneOrMany {
/**
* Store local RelationInfo, it always has 1 record
*/
protected local: RelationInfo
/**
* Store foreign RelationInfo, it can has 1 or many depends on "isHasOne"
*/
protected foreign: Relatio... |
487dd0d0f01a62dac2b6b1471c1d7ee201c2da38 | TypeScript | AsimAlmshni/BankSystem | /Bank/ClientApp/src/app/customers-list/customers-list.component.ts | 2.515625 | 3 | import { Component, OnInit } from '@angular/core';
import { MatTableDataSource } from '@angular/material';
import { CustomerService } from '../core/services/customer.service';
import { CustomerModel } from '../models/customer.model';
@Component({
selector: 'app-customers-list',
templateUrl: './customers-list.compo... |
89aa40681fd1f101554bc111af5c0eb7003093d9 | TypeScript | PirateSeal/PongBabylonJs | /src/components/objects/ball.ts | 2.546875 | 3 | import {
Color3,
Mesh,
MeshBuilder,
Scene,
StandardMaterial,
Vector3,
} from "babylonjs";
import { BallDirection, PaddleDirection } from "../enums/enums";
import Game from "../../game";
export default class Ball {
_body: Mesh;
_speed: number;
_direction: BallDirection;
_ctx: Game;
constructor(sc... |
3aea67f14baa91d9ab093985016203bf3a1db98d | TypeScript | flux627/abstract-factory-factory | /index.ts | 2.96875 | 3 | import 'reflect-metadata'
type Ctor<T> = Function & { prototype: T }
type FactoryCtor<T> = { create(): T }
type RegisteredFactoryMap<T> = Map<Ctor<T>, FactoryCtor<T>>
export class AbstractFactoryFactory {
static createAbstractFactory<B extends Object>(baseClass: Ctor<B>) {
return class AbstractFactory {
p... |
719484d3cdca20840762e5eaffd26ebb01c4717d | TypeScript | dmforaname/cobain_ts | /inheritance.ts | 3.34375 | 3 | class Pekerja{
bonus : number;
constructor(private noPekerja:string , private nama: string, private gaji:number){
this.bonus = this.gaji * 0.1 ;
}
getDetail(){
return "Nomor pekerja " + this.noPekerja + " dengan nama " + this.nama;
}
}
class Manajer extends Pekerja {
construc... |
e20522421bf5789529d4158614db7d7770958686 | TypeScript | rcauler/node-edi-stream | /lib/EdiLinePositional.d.ts | 2.546875 | 3 | import { EdiColumnSchema } from "./EdiColumnSchema";
export declare class EdiLinePositional {
line: string;
constructor(line: string);
read(column: EdiColumnSchema): string | number | Date;
readDate(startPosition: number, endPosition: number, dateFormat: string): Date;
readDateTime(datePos: number, ... |
aaac3f1f276167fb659b670e1ab740cb1538c710 | TypeScript | iyegoroff/typed-graphqlify | /dist/types.d.ts | 2.671875 | 3 | declare type ValueOf<T> = T[keyof T];
export declare function optional<T>(obj: T): T | undefined;
export declare function on<T extends {}>(typeName: string, internal: T): Partial<T>;
export declare function onUnion<T>(types: Record<string, T>): T;
export declare class types {
static readonly number: number;
... |
6986f52ff80a90ae56b1275d35d8ac0cb28ceccd | TypeScript | MegafonWebLab/megafon-ui | /packages/ui-shared/src/components/AudioPlayer/hooks/useTrackDuration.ts | 2.796875 | 3 | import React from 'react';
const useTrackDuration = (audioRef: React.RefObject<HTMLAudioElement>): number => {
const [trackDuration, setTrackDuration] = React.useState(0);
React.useEffect(() => {
const audioNode = audioRef.current;
if (!audioNode) {
return;
}
cons... |
36a34d14b0aacf207692e006d40dfb6e88833141 | TypeScript | AvinaLakshmi/sp-dev-fx-controls-react | /lib/controls/fileTypeIcon/FileTypeIcon.d.ts | 2.609375 | 3 | /// <reference types="react" />
import * as React from 'react';
import { IFileTypeIconProps } from './IFileTypeIcon';
/**
* File type icon component
*/
export declare class FileTypeIcon extends React.Component<IFileTypeIconProps, {}> {
constructor(props: IFileTypeIconProps);
/**
* Function which returns the... |
ae036ef00d627cf3b44d0bd56065ef7bf5d769d5 | TypeScript | mobitel-ltd/jira-to-matrix | /src/modules/log.ts | 2.890625 | 3 | import * as path from 'path';
import * as winston from 'winston';
import { config } from '../config';
/**
* Customize logger timestamp format to locale datetime with milliseconds
*
* @returns {string} Formatted datetime string
*/
const timestamp = () => {
const datetime = new Date();
const ms = String(date... |
5b59ed3afed3714b549e443df2ecc99e164f7bf9 | TypeScript | jithyan/iag-challenge | /frontend/src/data/sagas.ts | 2.71875 | 3 | import { all, takeLatest, call, put } from "redux-saga/effects";
import axios, { AxiosResponse } from "axios";
import {
setHint,
setError,
START_NEW_GAME,
IVerifyAttemptAction,
setCorrect,
addAttempt,
VERIFY_ATTEMPT,
} from "./actions";
export interface INewPasswordResponse {
hint: string;... |
79032c957496b499d4d06cde64ddb39ef1a57e46 | TypeScript | nprisament/OpenCircuits | /tests/app/digital/ts/models/CircuitDesigner.test.ts | 2.828125 | 3 | import "jest";
import {DigitalCircuitDesigner} from "digital/models/DigitalCircuitDesigner";
import {Switch} from "digital/models/ioobjects/inputs/Switch";
import {LED} from "digital/models/ioobjects/outputs/LED";
import {Place, Connect, Remove} from "test/helpers/Helpers";
describe("CircuitDesi... |
c1c04dc99594cd3304a76a181212c4ab8566e723 | TypeScript | RileyMShea/mui-next-ts | /__tests__/services/register.spec.ts | 2.59375 | 3 | import { STATUS_CODES } from 'http';
import register from 'services/register';
/* global fetchMock */
describe('login', () => {
it('should allow to send credentials', async () => {
fetchMock.mockResponseOnce(`{
"id": "760add88-0a2b-4358-bc3f-7d82245c5dea",
"username": "kristen.williams@example.com",
"name... |
88413f674f2c92687e783ea592247e56d322aa32 | TypeScript | artyomsv/bootcamp-assessment | /src/services/Routing.service.ts | 2.546875 | 3 | import {AppView} from '../store/reducers/Navigation.reducer';
export interface PathParams {
id: number;
}
export interface AppRoutingData {
path: (id?: number | string) => string;
view: AppView;
}
export const AppRouting: { [id: string]: AppRoutingData } = {
root: {
path: () => '/',
view: 'home' as A... |
710eac14e213e2b1b257d6c5ce3780fcb7669542 | TypeScript | janderson-souza/CRUD-ANGULAR-FIREBASE | /src/app/shared/models/find.ts | 2.96875 | 3 | export class Filter<T> {
numberOfResult: number;
obj: T;
constructor(numberOfResult: number, obj: T) {
this.numberOfResult = numberOfResult;
this.obj = obj;
}
} |
9041d008f97641b0872458d469307e8ffa70d3ec | TypeScript | bcherny/json-schema-to-typescript | /src/normalizer.ts | 2.65625 | 3 | import {JSONSchemaTypeName, LinkedJSONSchema, NormalizedJSONSchema, Parent} from './types/JSONSchema'
import {appendToDescription, escapeBlockComment, isSchemaLike, justName, toSafeString, traverse} from './utils'
import {Options} from './'
import {DereferencedPaths} from './resolver'
import {isDeepStrictEqual} from 'u... |
ecb4b8ea0a9bda7b27479c73c28190df0df02ae9 | TypeScript | PremierLangage/Amphi | /amphi_angular/src/app/interface/exercice/chart-ngx/chart-ngx.service.ts | 2.734375 | 3 | import { Injectable } from '@angular/core';
import { ChartKind, Type, Exercice, Data } from '../../../models/amphi.models';
@Injectable({ providedIn: 'root' })
export class ChartService {
step : number = 5;
kind : ChartKind = ChartKind.GRADER;
exercice : Exercice = { name: "", type: Type.FREE_ANSWER, question: ... |
ae430d3520b9f54caab0155ee7b451b1c8214c4d | TypeScript | astuanax/fun-monads | /test/applicativelaws.test.ts | 3.34375 | 3 | import { Option } from '../src/Option'
import { Try } from '../src/Try'
import { Reader } from '../src/Reader'
const aValue: any = 1
const monads: any[] = [Option, Reader, Try]
describe('Applicative laws', () => {
test.each(monads)('Identity', m => {
const a = m.of(aValue)
const b = m.of((x: any) => x)
... |
1676bb9728795df28c7ff3c260b474d20295ddd9 | TypeScript | iamr0b0tx/scalabel | /app/src/js/common/track/track.ts | 2.765625 | 3 | import _ from 'lodash'
import Label2D from '../../drawable/2d/label2d'
import Label3D from '../../drawable/3d/label3d'
import { makeIndexedShape, makeTrack } from '../../functional/states'
import { IndexedShapeType, Label2DTemplateType, LabelType, State, TrackType } from '../../functional/types'
import { LabelTypeName,... |
f978f6d9f305f55dbc249aae6a723de6b4a453d0 | TypeScript | SivaCse/AngularUnitTestingShowcase | /src/app/services/auth.service.ts | 2.75 | 3 | import { Injectable } from '@angular/core';
import { AuthApiService } from './auth-api.service';
@Injectable()
export class AuthService {
private _isLoggedIn = false;
public get isLoggedIn() {
return this._isLoggedIn;
}
private _username = "";
public get username() {
return this._username;
}
c... |