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 |
|---|---|---|---|---|---|---|
13b7f91bfb6640188cddb2c730423817ca715694 | TypeScript | lMINERl/ts-react | /src/redux/actions/DataActions.ts | 2.828125 | 3 | import { DataModel } from '../../models/DataModel';
export interface Action {
type?: DataAction;
// tslint:disable-next-line: no-any
payload?: any;
}
// actions const
export enum DataAction {
GET_ALL_DATA = 'GET_ALL_DATA',
GET_DATA_BY_NAME = 'GET_DATA_BY_NAME',
DELETE_DATA_BY_ID = 'DELETE_DATA_BY_ID',
AD... |
ab6585ef866c9bae238fe925e41c85f9e0660db1 | TypeScript | ucdavis/uccsc-mobile-functions | /functions/src/notifications/index.ts | 2.625 | 3 | import * as functions from "firebase-functions";
import * as Expo from "expo-server-sdk";
import FirebaseClient from "../services/firebase";
import ExpoClient from "../services/expo";
const db = FirebaseClient.firestore();
export const addNotificationToken = functions.https.onRequest(
async (req, res) => {
try ... |
a108178a2ed4aba6209fbe976e383b7926e4dec2 | TypeScript | gradebook/utils | /packages/fast-pluralize/src/fast-pluralize.ts | 3.46875 | 3 | // Ending pairs to use, in order of precedence
const endings = [
['sis', 'sis'],
['zzes', 'z'],
['ies', 'y'],
['s', ''],
];
const OVERRIDES: Record<string, string> = {
bonuses: 'bonus',
};
export function singularize(phrase: string): string {
phrase = phrase.trim();
const phraseLower = phrase.toLowerCase();
... |
fe7ea7060076189e0073bb51c69045d95dd8b049 | TypeScript | kemalbekcan/Pokemon | /src/reducers/pokeReducers.ts | 2.640625 | 3 | import {
GET_POKE_SUCCESS,
GET_POKE_STATS,
POKE_FAILED,
POKE_STATS_FAILED,
POKE_ABILITIES_SUCCESS,
POKE_ABILITIES_FAILED,
ADD_LIKE_SUCCESS,
ADD_UNLIKE_SUCCESS,
LIKE_FAILED,
CATCH_POKEMON_SUCCESS,
DELETE_CATCH_POKEMON,
ALL_DELETE_CATCH_POKEMON
} from '../actions/types';
i... |
f7560f53cd384e66b1de8a4897c586035178431e | TypeScript | vbmeo/AngularP3 | /tre/src/app/gestone-utenti/gestone-utenti.component.ts | 2.59375 | 3 | import { Component, OnInit } from '@angular/core';
import {Utenti} from '../Model/Utenti.model';
@Component({
selector: 'app-gestone-utenti',
templateUrl: './gestone-utenti.component.html',
styleUrls: ['./gestone-utenti.component.css']
})
export class GestoneUtentiComponent implements OnInit {
//listaUtenti :... |
acab9b255ee2221a6c03a752fadc64957a9b67b9 | TypeScript | CN-Shopkeeper/ol_workshop | /src/components/page-maps/utils/styled-by-area.ts | 2.734375 | 3 | import { getArea } from "ol/sphere";
import colormap from "colormap";
import { Style, Fill, Stroke } from "ol/style";
import RenderFeature from "ol/render/Feature.js";
import Feature from "ol/Feature.js";
import Geometry from "ol/geom/Geometry.js";
import { clamp } from "../utils/clamp-area";
const min = 1e8; // the ... |
af1e21ac4c417edac952bbb56f1064e45188d22e | TypeScript | erinduncan/Vet-Application | /Front End/vet-app/src/utilites/index.ts | 2.5625 | 3 | import { combineReducers } from "redux";
import { userReducer } from "../reducers/login-reducer";
import { clientReducer } from "../reducers/client-reducer";
import { employeeReducer } from "../reducers/employee-reducer";
import { petReducer } from "../reducers/pet-reducer";
export interface IUserState {
currentUser... |
b26ad1628552c1726f8705579d6a6d6f84e22d5b | TypeScript | riganti/dotvvm | /src/Framework/Framework/Resources/Scripts/utils/dom.ts | 2.75 | 3 | export const getElementByDotvvmId = (id: string) => {
return <HTMLElement> document.querySelector(`[data-dotvvm-id='${id}']`);
}
/**
* @deprecated Use addEventListener directly
*/
export function attachEvent(target: any, name: string, callback: (ev: PointerEvent) => any, useCapture: boolean = false) {
target... |
ca8d4064c0a5687cd979383efd435e56cdf36e41 | TypeScript | Loebas/Opdracht-Webapp-4 | /gameapp/src/app/game.ts | 2.78125 | 3 | export class Game {
constructor(
private _id: number,
private _naam: string,
private _minSpelers: number,
private _maxSpelers: number,
private _difficulty: number,
) { }
get id(): number {
return this._id;
}
get naam(): string {
return this._... |
7953dedf929dd8fe3f5911fadb1de23743159af0 | TypeScript | typexs/typexs-ng | /archive/packages/base/messages/IMessage.ts | 2.703125 | 3 | export enum MessageType {
SUCCESS = 'SUCCESS',
ERROR = 'ERROR',
INFO = 'INFO',
WARNING = 'WARNING'
}
export interface IMessage {
type: MessageType;
topic?: any;
content: any;
}
|
0c0ad8ca052ddf2ffda67362c4c77cd73608b954 | TypeScript | mpicciolli/mean-stack-typescript-project-template | /server/utility.ts | 3.34375 | 3 | export class Enum {
static getNames(e:any):Array<string> {
var a:Array<string> = [];
for (var val in e) {
if (isNaN(val)) {
a.push(val);
}
}
return a;
}
static getValues(e:any):Array<number> {
var a:Array<number> = [];
... |
10fd0e2e1ad14fef61a1dcb1e69c34dda270c994 | TypeScript | singzinc/dotNet | /TypeScript/typescript_example2/example1.ts | 3.03125 | 3 | function greeter (person: String){
return "Hello, " + person;
}
var user = "test user 1";
console.log("this is test : " + greeter(user));
|
1531663789591d73d3be6ba7cb4048e0ef58f52e | TypeScript | MaximStrnad/prgGame | /src/scripts/core/classes/Grid.ts | 2.90625 | 3 | import Cell from "./Cell"
export default class Grid {
cells: Cell[];
cellsVeritacally: number;
cellsHorizonataly: number;
totalCells: number;
p: p5;
size: number;
constructor(p: p5, width: number, height:number, size: number) {
this.p = p;
this.cellsHorizonataly = Math.flo... |
4b55216b91c1244a944fb411f285308197cbf052 | TypeScript | lawvs/Algorithm-Training | /leetcode/315.count-of-smaller-numbers-after-self.ts | 3.25 | 3 | function countSmaller(nums: number[]): number[] {
const sortedNums: number[] = []
for (let i = nums.length - 1; i >= 0; i--) {
const curNum = nums[i]
sortedNums.push(curNum)
let cnt = 0
// insertion sort
let j = sortedNums.length - 2
for (; j >= 0 && sortedNums[j] >= curNum; j--) {
so... |
26a9f676ce8ec3602ba6fdd1e98c724fd7176ca9 | TypeScript | iksaku/djambi | /src/api/piece/Militant.ts | 2.515625 | 3 | import { Piece } from './Piece'
export class Militant extends Piece {
public get type(): string {
return 'Militant'
}
public get maxMovementDistance(): number {
return 3
}
}
|
f5c1da9a0003558ee1e5160c5fdbeb65e386d051 | TypeScript | ptwu/candidate-decider-google-form | /src/firebase-auth.ts | 3.125 | 3 | import firebase from 'firebase/app';
import 'firebase/auth';
export type AppUser = {
readonly displayName: string;
readonly email: string;
readonly token: string;
};
/**
* Returns the promise of an app user from the given raw firebase user.
*
* @param firebaseUser a raw firebase user or null.
* @return the ... |
5d9dee32340452b8eb3057248596aae18d5244da | TypeScript | dlgmltjr0925/marrakech | /libs/market_namespace.ts | 2.578125 | 3 | import { MarketListObject } from '../api/market/market.dto';
import { Server } from 'socket.io';
import SocketNamespace from './socket_namespace';
export interface ConnectUser {
socketId: string;
userId: number;
roomId: number;
}
export interface DisconnectUser extends ConnectUser {}
export interface MarketMes... |
8a68c9084264d19743701b62372c2aa221931e63 | TypeScript | NanimonoDemonai/kani.tech | /src/components/hooks/store.ts | 2.515625 | 3 | import {
configureStore as configureReduxToolkitStore,
combineReducers,
Store,
} from "@reduxjs/toolkit";
import {
TypedUseSelectorHook,
useDispatch as defaultDispatch,
useSelector as defaultSelector,
useStore,
} from "react-redux";
import { pageMetaReducer } from "./slices/pageMetaSlice";
import { pageOp... |
90a50e89fb48e96a2bd6046a0a74cc3cbe61f4b9 | TypeScript | Mati365/ts-c-compiler | /packages/compiler-rpn/src/utils/MathExpression.ts | 2.921875 | 3 | import * as R from 'ramda';
import { parseNumberToken } from '@compiler/lexer/utils/parseNumberToken';
import { isQuote } from '@compiler/lexer/utils/matchCharacter';
import { reduceTextToBitset } from '@compiler/core/utils';
import { MathOperator } from './MathOperators';
import { MathError, MathErrorCode } from './... |
3ec82c66c35f9a0defff644844f1e85e66b53285 | TypeScript | kinjalik/screeps-algorithm | /src/utils/RoomUtils.ts | 2.640625 | 3 | function getNotEmptyContainers(room: Room) {
const containers = <StructureContainer[]>room.find(FIND_STRUCTURES, {
filter: (struct: Structure): Boolean =>
struct.structureType == STRUCTURE_CONTAINER
});
containers.sort((a, b) => a.store.getUsedCapacity() - b.store.getUsedCapacity());
return container... |
4ef51f043b0d40b1fd07e7be3161a66996a4cca2 | TypeScript | ErickTamayo/react-native-breeze | /src/plugins/lineHeight.ts | 2.546875 | 3 | import { PluginFunction, PluginPattern } from "./types";
export type PluginGroups = {
key: string;
};
export const pattern: PluginPattern = ({ keys }) => {
return new RegExp(`^leading-(?<key>${keys("lineHeight")})$`);
};
export const plugin: PluginFunction<PluginGroups> = ({ groups, theme }) => {
const { key }... |
c5b83bfe9272eaecc3f221b6214dfc3abb11fed5 | TypeScript | WMs784/host | /main.ts | 2.703125 | 3 | let index = 0;
let host_num = 1;
let list = [ArrowNames.North,ArrowNames.NorthEast,ArrowNames.East,ArrowNames.SouthEast,
ArrowNames.South,ArrowNames.SouthWest,ArrowNames.West,ArrowNames.NorthWest];
let map = [ArrowNames.North,ArrowNames.South,ArrowNames.East,ArrowNames.West,ArrowNames.NorthEast];
let map2 = [1,2,3,4,5]... |
afed491a1f198e66dcb9cdf5e270801a305a7c11 | TypeScript | luohuidong/electron-music | /src/renderer/api/playList/requestPlaylistDetail.ts | 2.84375 | 3 | import { get } from "../http";
interface Artist {
name: string;
id: number;
}
/** 专辑 */
interface Album {
id: number;
name: string;
}
/** 歌单歌曲数据 */
interface Songs {
name: string;
id: number;
ar: Artist[];
al: Album;
}
/** 歌单歌曲 id */
interface SongIds {
id: number;
}
/** 歌单详情数据 */
interface PlayL... |
6bc308a750f3b966f982aa0a520105cdce0979a1 | TypeScript | ar-nelson/jaspr | /src/PrettyPrint.ts | 3 | 3 | import {Jaspr, Deferred, isArray, isObject, isMagic} from './Jaspr'
import {reservedChar} from './Parser'
import chalk from 'chalk'
import {join, sum, identity} from 'lodash'
const defaultIndent = 2
const maxLength = 80
const maxEntries = 36
const maxDepth = 36
function spaces(n: number) {
let s = ''
for (let i =... |
3df317b9707460b4d9f7f05f47b82b0688d157c6 | TypeScript | thomas-crane/sgml | /src/syntax/syntax-token.ts | 3.015625 | 3 | import { SyntaxKind } from './syntax-kind';
import { SyntaxNode } from './syntax-node';
import { SyntaxTrivia } from './syntax-trivia';
import { TextSpan } from './text-span';
export class SyntaxToken extends SyntaxNode {
readonly children = [];
constructor(
readonly kind: SyntaxKind,
readonly span: TextS... |
5b7d1aa84968f1519b1ed529142b08fe70e872e5 | TypeScript | discordjs/discord.js | /packages/builders/src/interactions/slashCommands/options/boolean.ts | 2.8125 | 3 | import { ApplicationCommandOptionType, type APIApplicationCommandBooleanOption } from 'discord-api-types/v10';
import { ApplicationCommandOptionBase } from '../mixins/ApplicationCommandOptionBase.js';
/**
* A slash command boolean option.
*/
export class SlashCommandBooleanOption extends ApplicationCommandOptionBase... |
3a409adc9d7e8a98dce303d1ec9cc9e54c21e733 | TypeScript | jackfranklin/fetch-engine | /src/utils/composeEvery.test.ts | 2.71875 | 3 | /// <reference path="../.d.test.ts" />
"use strict";
import test = require("ava");
import composeEvery from "./composeEvery";
test("composeEvery is requireable", (t: TestAssertions) => {
t.ok(composeEvery);
});
test(
"it composes identity functions to produce passed value",
(t: TestAssertions) => {
const id... |
0adae82b8121a2ced87b3d0ecc3953a890ee036d | TypeScript | ariesjia/react-use-form | /src/reducer.ts | 2.78125 | 3 | import {omit} from "./utils/omit";
import {FiledType} from "./filed-type";
import { getResetValue } from "./index";
export const actions = {
UPDATE_FIELD: 'UPDATE_FIELD',
SET_ERRORS: 'SET_ERRORS',
RESET: 'REST',
}
const getErrors = function(keys, fields, errors) {
const fieldsError = fields || {}
return Arr... |
f483606996d3dbaefff5f86442e49d7cd7ceb8f7 | TypeScript | usb777/typescript | /OOP/classes/Animal.ts | 3.578125 | 4 | /**
4 Pillars of OOP:
1. Abstraction: abstract classes and Interfaces
2. Inheritence: extends and implements-- class className <name_of_Interface>
3. Encapsulation: restrict access keywords:=== public, private, protected, -default- === and Getter-Setter methods
4. Polymorphism: many-forms - in same class... |
95afe612278e26f908b8a3593051f918a63f911c | TypeScript | zWaR/typescript-patterns | /src/abstract-factory/try-abstract-factory.ts | 2.515625 | 3 | import { NYPizzaStore } from './creators';
import { PizzaBase } from './domain';
class TryAbstractFactory {
public static run() {
const nyStore: NYPizzaStore = new NYPizzaStore();
const nyPizza: PizzaBase = nyStore.orderPizza('cheese');
console.log(`NY pizza ${nyPizza.getName()} ordered`);
}
}
Try... |
0eab71d8fd00fb511f55640358211200cf1389fb | TypeScript | jamiesunderland/rest-my-case | /test/HttpStringHelper.spec.ts | 2.84375 | 3 | import HttpConfig from '../src/HttpConfig';
import HttpStringHelper from '../src/HttpStringHelper';
import { clientCase } from './mocks';
describe('HttpStringHelper', () => {
let httpStringHelper: HttpStringHelper;
let config;
beforeEach(() => {
config = new HttpConfig();
config.port = 8080;
httpSt... |
18e8183d1b47a0d0c866466d03321cdf508df3a9 | TypeScript | kirontoo/QRMyWifi | /src/lib/util.ts | 2.71875 | 3 | import QRCode from "qrcode";
export interface WifiCredentials {
network: string;
password: string;
encryption: string;
hidden: boolean;
}
export const sampleWifiCred: WifiCredentials = {
network: "sampleSSID",
password: "samplePassword",
encryption: "WPA",
hidden: false,
};
export const generateQRCod... |
102e3c7c761fc079cbdcd36f6859ff47cf866dda | TypeScript | chenjsh36/media-carrier | /src/utils/dataTransform.ts | 2.875 | 3 | import { get } from 'lodash';
import Request from './request';
export function arrayBuffer2Blob(arrayBuffer: any, type: string ) {
const blob = new Blob([arrayBuffer], { type });
return blob;
}
export function arrayBuffer2File(arrayBuffer: any, name: string, options?: { type?: string; lastModified?: number } ) {... |
34023c3232b7402d8dd79079554efb68aeddbcbe | TypeScript | jonathapriebe/NodeJS-Interview | /src/models/customer.ts | 2.828125 | 3 | import mongoose, { Document, Model } from 'mongoose';
export interface Customer {
_id?: string;
name: string;
gender: string;
dt_birthday: Date;
age: number;
city_id: string;
}
const schema = new mongoose.Schema(
{
name: { type: String, required: true },
gender: { type: String, required: true },... |
590822eca99ff891cecbc7a66aaca8104516cf89 | TypeScript | mcortesi/battle4tronia-server | /src/db/message-store.ts | 2.671875 | 3 | import db from '../connections/postgres';
import { MessageType, MessagePlayerOpened, MessageDealerAccepted, MessagePlayerClosed } from '../model/message';
import { Address } from '../tron/types';
export function fromPG(record: any): MessagePlayerOpened | MessageDealerAccepted | MessagePlayerClosed {
const obj = reco... |
9d3e81d2c3302648f1ee2f107eb35d35ef6f3b49 | TypeScript | BraTTik/redux-paint | /src/modules/strokes/actions.ts | 2.5625 | 3 | import { Stroke } from '../../types';
export const END_STROKE = 'END_STROKE';
export type StrokesAction = {
type: typeof END_STROKE;
payload: { stroke : Stroke, historyLimit : number}
}
export const endStroke = (stroke : Stroke, historyLimit: number) => {
return {type: END_STROKE, payload: {st... |
bb5a5d1bc71022bb159ad5f5d0eb0b39d7aeb599 | TypeScript | abondoa/gq-cli | /cliParser.ts | 2.65625 | 3 | import * as commandLineArgs from 'command-line-args';
import * as commandLineUsage from 'command-line-usage';
import { Context } from 'gq';
const contextJson = (input: string) => new Context(JSON.parse(input));
const optionDefinitions = [
{
name: 'application-environment',
alias: 'a',
type: String,
/... |
abd018ca65151a313f9bf75e52412b4fafcbfd98 | TypeScript | FinOCE/Konzu | /models/Client.ts | 2.53125 | 3 | import {Client as DJSClient, ClientOptions, Collection} from 'discord.js'
import glob from 'glob-promise'
import {parse} from 'path'
import Event from './Event'
import Command from './Command'
import Button from './Button'
import Menu from './Menu'
/**
* Create a client.
*/
export default class Client extends DJSCli... |
24c33714667157bccd9847047300a439d0f1c4fc | TypeScript | includeVitor/react-boilerplate | /src/store/modules/notify/index.ts | 3.1875 | 3 | import { Action } from "redux"
import { toast } from "react-toastify";
import { IToastState, Toast } from "./types"
//Actions
const INFO = 'toast/info'
const SUCCESS = 'toast/success'
const WARNING = 'toast/warning'
const ERROR = 'toast/error'
interface InfoAction extends Action<typeof INFO> {
payload: Toast
}... |
46b9c960d8609b568f20bf9510cc92bb84ca052b | TypeScript | caio2009/asahi-api | /src/modules/ceasa/infra/typeorm/repositories/StockRepository.ts | 2.5625 | 3 | import IStockItemDTO from "@modules/ceasa/dtos/IStockItemDTO";
import IStockRepository from "@modules/ceasa/repositories/IStockRepository";
import { getConnection } from "typeorm";
import stockQueries from '@modules/ceasa/queries/stockQueries';
import IStockItemDetailsDTO from "@modules/ceasa/dtos/IStockItemDetailsDTO"... |
adef18417bce9dcf8527f633ad0547fece4600b5 | TypeScript | zf-wuxia/client-dev | /assets/Framework/Core/iFunction.ts | 2.8125 | 3 | import { PoolManager } from "../Manager/PoolManager";
import { iStore } from "./iStore";
export class iFunction extends iStore {
public once: boolean = true;
public target: any;
public func: Function;
public params: any[];
public get size(): number {
return this.func ? this.func.length : 0... |
f4c52452081e504ba8e7dcce6df58aa91a4fcd81 | TypeScript | BeteTech/typesciptPratice | /59/validator/LettersOnlyValidator.ts | 2.84375 | 3 | import { StringValidator } from './validation'
const LetterReg = /^[A-Za-z]+$/
export class LetterOnlyValidator implements StringValidator {
isAcceptable(s: string): boolean {
return LetterReg.test(s)
}
} |
16162613c2bbbf004d9d2c0c2348c4928af54334 | TypeScript | dipiash/cloudpayments | /src/Client/ClientRequestAbstract.ts | 2.59375 | 3 | import fetch from "node-fetch";
import {ClientResponse} from "./ClientResponse";
import {BaseResponse} from "../Api";
import {join} from "path";
import {ClientAbstract} from "./ClientAbstract";
export class ClientRequestAbstract extends ClientAbstract {
/**
* HTTP Client
*
* @returns {(url: (string ... |
1b707df312e14cb5881a58b6113de892d37c1254 | TypeScript | Luncert/csdn | /dashboards/src/com/ItemList.ts | 2.546875 | 3 |
import { r, rc } from '../util/react-helper';
import { Component, Props } from './Component';
const styles = <any> require('./ItemList.css');
interface CusProps extends Props {
width: String;
height: String;
fixScroll: number;
onScrollOverTop: () => void;
onScrollOverBottom: () => void;
}
/**
*... |
ad97a98e7b58ca2592b7c9664dadc2628880baee | TypeScript | snyk/snyk-nuget-plugin | /test/helpers/temp-fixture.ts | 3 | 3 | import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
export interface File {
name: string;
contents: string;
}
// Running tests in parallel can cause race conditions for fixtures at-rest, if two tests are `dotnet publish`'ing
// to the same fixture folder. So we supply a generator for... |
76db39a6e19c5cd1b541494c7d1d778dbdc0c7d3 | TypeScript | abhishekkhandait/ui-study | /src/data/BaseNode.ts | 3.109375 | 3 | import deepcopy from '../util/deepcopy'
export default class BaseNode {
public name!: string | null
public _parent!: BaseNode | null
constructor(
name: string | null = null,
attrs: {[s: string]: any} | null = null
) {
this.name = name
Object.defineProperties(this, {
_parent: {
writable: true,
... |
55a29a25f11d404b16f4e2e1525eed3ef6470dcb | TypeScript | brenopgarcia/nestjs-smart-ranking | /src/jogadores/jogadores.service.ts | 2.609375 | 3 | import { Injectable, Logger, NotFoundException } from '@nestjs/common';
import { CreatePlayerDto } from './dtos/criar-jogador.dto';
import { Jogador } from './interfaces/jogador.interface';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
@Injectable()
export class JogadoresService {
... |
ec97a19f73de3b836620540614cb70a31b6d12ac | TypeScript | gionji/ese459_solarlamp | /main.ts | 2.609375 | 3 | function big_light_on () {
basic.showLeds(`
# # # # #
# # # # #
# # # # #
# # # # #
. . . . .
`)
}
function small_light_on () {
basic.showLeds(`
. . . . .
. . . . .
. . . . .
. . . . .
# # # # #
`)
}
function EVT_nig... |
3a23ca219d88da856bb3a7f63b82dd6c4a3af31e | TypeScript | mungojam/use-persisted-state | /src/createGlobalState.ts | 3.3125 | 3 | type Callback<T> = (arg0: T) => void;
const globalState: Record<string, {callbacks: Callback<any>[], value: any}> = {};
export interface GlobalStateRegistration<T> {
deregister: () => void,
emit: (value: T) => void
}
const createGlobalState = <T>(key: string, thisCallback: Callback<T>, initialValue?: T): Global... |
9403f8e6d4e6cf722fd4ec9de03434ed17b7d96c | TypeScript | sumight/ts-react-mobx-demo | /src/rules.ts | 3.03125 | 3 | export function required (value:any, label:string):Promise<{message:string, passed:boolean}> {
if (
value === ''
|| value === null
|| value === undefined
|| JSON.stringify(value) === '[]'
) {
return Promise.resolve({
message: '请填写'+label,
passed: false
})
}
return Promise.res... |
d0f66c3fb6e8fab0d748a7201ffe2aa0eb137f50 | TypeScript | vveronika/memory-app | /src/helpers/helperFunctions.ts | 3.25 | 3 | import { Score } from "types";
export const shuffleArray = (arr: any[]) => {
return arr.sort(() => Math.random() - 0.5);
};
export function compareScores(a: Score, b: Score) {
const scoreA = a.score;
const scoreB = b.score;
let comparison = 0;
if (scoreA > scoreB) {
comparison = 1;
} else if (scoreA ... |
7c86558506cfe65b0434dc172f0592fd4b73e7a2 | TypeScript | ravendb/ravendb-nodejs-client | /src/Documents/Queries/Suggestions/SuggestionBuilder.ts | 2.890625 | 3 | import { ISuggestionBuilder } from "./ISuggestionBuilder";
import { ISuggestionOperations } from "./ISuggestionOperations";
import { SuggestionWithTerm } from "./SuggestionWithTerm";
import { SuggestionWithTerms } from "./SuggestionWithTerms";
import { throwError } from "../../../Exceptions";
import { TypeUtil } from "... |
622c6f10262c9a1d94e1af7c0eb019c08842b9d9 | TypeScript | jacobdavis1/fileshare-website | /src/app/_models/File.ts | 2.640625 | 3 | export interface File {
fileSize: number;
name: string;
isDirectory: boolean;
} |
09666125a1baec2e986eb03f736a5668db8a8246 | TypeScript | green-fox-academy/gergocsima | /week-02/day-01/05-factorial.ts | 3.9375 | 4 | // - Create a function called `factorio`
// that returns it's input's factorial
export { }
let inputNr: number = 5;
function factorio(inputNr: number) {
let summ: number = 1;
for (let i: number = inputNr; i >0; i--) {
summ = summ * i;
/*console.log(summ);*/
}
return summ;
}
console... |
2658e5c4ce2adfa2527598f2311458f578e029a1 | TypeScript | Equiem/gql-compat | /src/reportBreakingChanges.ts | 2.71875 | 3 | import chalk from "chalk";
import { BreakingChange } from "graphql";
import shell from "shelljs";
import { formatBreakingChanges } from "./formatBreakingChanges";
/**
* Formats the given breaking changes in ignore format.
*/
export const reportBreakingChanges = (breaking: BreakingChange[], ignored: BreakingChange[])... |
de30bf0f07dc99f6b144e40b325aef8237d33ee1 | TypeScript | marciomarquessouza/repeat-please-pron-server | /src/auth/user.repository.ts | 2.765625 | 3 | import { EntityRepository, Repository } from 'typeorm';
import { User } from './user.entity';
import * as bcrypt from 'bcrypt';
import { SignUpCredentialsDto } from './dto/signup-credentials.dto';
import {
ConflictException,
InternalServerErrorException,
NotFoundException,
} from '@nestjs/common';
import { SignIn... |
6688a0abf72f4e0b3aa20556a4a2cbbdd10badc8 | TypeScript | lucasavila00/INF221PRE2A | /__OWN_tests__/black.ts | 3.0625 | 3 | import { processByFilename } from "../src/lib";
describe("Teste de caixa preta", () => {
test("Funciona dentro do tempo esperado (<1s)", async () => {
const MULT = 100;
const MULT_ARR = Array.from(Array(100).keys());
expect.assertions(MULT);
return Promise.all(
MULT_ARR.map(_ => {
const... |
124ed9b3ac8a57943da4619f64e0f46e40a95656 | TypeScript | jay-gothi/wallet-web-components | /src/infra/http/fetch-http-client.ts | 2.546875 | 3 | import { HttpAuthHeader } from "../../data/protocols/http/http-auth-header";
import { HttpGetClient } from "../../data/protocols/http/http-get-client";
import { HttpPostClient } from "../../data/protocols/http/http-post-client";
import { HttpPutClient } from "../../data/protocols/http/http-put-client";
import { decrypt... |
85b998f13c124bbc21cdc34a3e543e654e81768d | TypeScript | ocreeva/incremental | /src/types/model/IGameContext.ts | 2.8125 | 3 | import type { AsyncModelMessage, ModelMessage } from '@/constants/worker';
import type { EntityId } from '@/types';
import type { MessageService } from '@/types/worker';
import type IGameSynchronization from './IGameSynchronization';
import type IOperationModel from './IOperationModel';
import type IRoutineModel from ... |
87b912209cec78ad6f2a59f3f6b0ee868d17d68a | TypeScript | Mitsu325/Angular_Course_Loiane | /data-binding/src/app/data-binding/data-binding.component.ts | 2.609375 | 3 | import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-data-binding',
templateUrl: './data-binding.component.html',
styleUrls: ['./data-binding.component.css']
})
export class DataBindingComponent implements OnInit {
url: string = 'https://github.com/Mitsu325';
like: boolean = true;
... |
0142b3a81e7a91680bb59daec0cfda244a4d4864 | TypeScript | Jackzinho/desafio-driva | /src/errors/MissingParamError.ts | 2.53125 | 3 | import { CustomError } from './CustomError'
export class MissingParamError extends CustomError {
constructor(paramName: string) {
super(`Missing param: ${paramName}`, 400)
this.name = 'MissingParamError'
}
}
|
011d44a686af2967fbb3517a483321dd46421916 | TypeScript | yeonjuan/md-replacer | /lib/stack.ts | 3.453125 | 3 | class Stack<Type> {
private elements: Type[] = [];
public static create<Type>() {
return new Stack<Type>();
}
public isEmpty() {
return this.elements.length <= 0;
}
public push(elem: Type) {
this.elements.push(elem);
}
public pop() {
return this.elements.pop();
}
public top() {
... |
4cdcc7b91c81b27fd909db6a18907b38956e2d6c | TypeScript | Nikita9950/companyTS | /Client.ts | 3.203125 | 3 | class Client implements IClient {
protected readonly _name: string
protected _employee: IEmployee
public constructor(name: string, employee: IEmployee) {
this._name = name
this._employee = employee
}
public get name(): string {
return this._name
}
public get employee(): IEmployee {
retu... |
0610f41358a69fd0735487768376473399b7b462 | TypeScript | jfresco/exchange-client | /src/model/trade.ts | 2.875 | 3 | import { sortBy, slice, last, dropRight, reverse } from 'lodash'
export default function Trade (orderBooks: OrderBooksByExchanges) {
// Unified order book: contains all asks and bits of all the exchanges
const unified: Unified = {
asks: [],
bids: []
}
Object.keys(orderBooks).forEach(exchange => {
... |
672f7b615a662de0171ae86e9a8b4a2bc47e716c | TypeScript | JohannesLichtenberger/componentish | /src/generic/helpers/renderChildren.ts | 2.75 | 3 | import { GenericNode } from "../interfaces/ComponentNodes/GenericNode";
import { TransformerCollection } from "../interfaces/transformer/TransformerCollection";
/**
* render all child nodes of a given node
* @param {GenericNode} node
* @param {TransformerCollection} transformers
* @param {number} [level=0]
* @ret... |
cc12dd3a0474021a92d4280c2b122c27dbb21094 | TypeScript | sezna/sky | /tests/runtime/if-expr.test.ts | 3.03125 | 3 | import { runtime } from '../../src/runtime';
import { makeSyntaxTree } from '../../src/lexer/parser';
import { tokenize } from '../../src/lexer/tokenizer';
import { isLeft } from 'fp-ts/lib/Either';
describe('if expr tests', () => {
it('should correctly assign its result to a variable #1', () => {
let prog... |
cd1a4c396b3ccce5fcfcc4b0e32f2de532d500ce | TypeScript | dzfranco/games-api | /server/api/interfaces/persistence/ipublisher.persistence.ts | 2.578125 | 3 | import { Publisher } from '../../../common/models/publisher/publisher';
import { IGame } from '../../../common/models/game/igame';
export interface IPublisherPersistence {
/**
* @description Gets a game publisher
* @param {IGame} game
* @return
* @memberof PublisherPersistence
*/
getGamePublisher(game: IG... |
f264b6e142be2ed1625a25462c633a01824bf29c | TypeScript | vietnh-vmo/nest-demo | /src/guards/auth.guard.ts | 2.578125 | 3 | import {
HttpStatus,
Injectable,
CanActivate,
ExecutionContext,
} from '@nestjs/common';
import { decodeToken } from '../utils/jwt';
import { UserError } from '../helpers/error.helpers';
import { UserService } from '../modules/users/user.service';
import { StatusCodes } from '../modules/_base/base.interface';
... |
285644eaf1f270cd48227794bf841bf6536e4723 | TypeScript | jsblanco/EmployeeTXTdb-Server | /ts/helpers/digestDbEntries.ts | 2.96875 | 3 | module.exports = (employeeData: string): employeeArr => {
const userDb: employeeArr = [];
employeeData
.toString()
.split("\n")
.forEach((user: string, index: number) => {
if (user.length>0){
let userData = user.split(",");
userDb[index] = {
id: parseInt(userD... |
cab4404b33e78de4fdf4fcaa8f4cba98df1a692d | TypeScript | fengluandll/self-talk | /src/infrastructure/firebase/firebase-authentication-controller.ts | 2.75 | 3 | import "firebase/auth";
import firebase from "firebase/app";
import { IAuthenticationController } from "../../application/authentication-controller";
import { sleep } from "../../domain/utilities";
export class FirebaseAuthenticationController
implements IAuthenticationController {
private signedIn: boolean | null... |
754111d7b53a606522fe223f03ac53fd27192f7f | TypeScript | chouchouxsl/ts-study-notes | /01-ts基本类型/基础类型.ts | 4.28125 | 4 | // Boolean
namespace Bool {
let falg: boolean = true
falg = false
}
// Number
namespace Num {
let num: number = 1
num = 12
}
// String
namespace Str {
let str: string = '哈哈哈哈'
str = '嘻嘻嘻嘻'
}
// Array
namespace Arr {
let strArr: string[] = ['哈哈哈哈', '嘻嘻嘻嘻']
let numArr: Array<number> = [... |
73f2732558fc913ea53833fc721bc462fe655b2b | TypeScript | corbane/g3 | /worker/math/funcs.ts | 3.234375 | 3 |
declare function lerp <T extends LVec2|LVec3|LVec4> (vin: T, vout: T, v: number): T
declare function remap (vin: LVec2, vout: LVec2, v: number) : number
//declare function length (a: LVec2|LVec3|LVec4)
declare function len (a: LVec2|LVec3|LVec4) : number
declare functio... |
2f62e4fab3aeb3d634fbcf8e9781cb106515e65d | TypeScript | NiluK/api | /packages/api/src/promise/Combinator.ts | 2.921875 | 3 | // Copyright 2017-2018 @polkadot/api authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { isFunction } from '@polkadot/util';
export type CombinatorCallback = (value: Array<any>) => any;
export type CombinatorF... |
e5fa2fe3006456ef58598026425537b16149a039 | TypeScript | KilianSL/project-rhino | /src/utils/redux/reducers.ts | 2.84375 | 3 | import {combineReducers, createStore, Action } from 'redux';
// App metadata
const app = (state={name:""}, action: Action) => { // action has its type explicitely defined because it is not given a default to infer from
return {
name: 'Project Rhino'
}
};
const createPostDialog = (state={open: false}, ... |
6f32e84183255f2511c99ed454bd1d260ecf36a7 | TypeScript | PositivePerson/VakerVideoEditor | /src/redux/user/user.reducer.ts | 2.9375 | 3 | import { SIGNIN } from './user.types';
export interface IUserState {
tokenData: object;
jwtToken: string | null;
isLoggedIn: boolean;
}
const initialState: IUserState = {
tokenData: {},
isLoggedIn: false,
jwtToken: null,
};
const ACTION_HANDLERS: any = {
[SIGNIN]: (state: any, { tokenData... |
7331de4927511295e4714b0eb461b08466350e6e | TypeScript | Ihnatiev/BackEmpList2 | /api/test/unit tests/controller tests/employees.ts | 2.59375 | 3 | import { Http } from './http';
export class Employees {
private _http: Http;
constructor() {
this._http = new Http();
}
public async findAll() {
// we actually don't need this intermediate step,
// we could just
// return this._http.get('employees');
// but then this method would be too du... |
7645005093154c179919fb33da0f61644f639828 | TypeScript | mocheer/map | /src/providers/GaoDeProvider.ts | 2.828125 | 3 | /**
* author mocheer
*/
import {AbstractMapProvider} from './AbstractMapProvider';
import {Coordinate} from '../core/Coordinate';
import {IMapProvider} from './IMapProvider';
/**
* 高德瓦片地图数据源提供程序
*/
export class GaoDeProvider extends AbstractMapProvider implements IMapProvider {
type: string;
/**
* 各类数据源URL模板,根... |
a4e68d96227a9cdacd92c407cf1454a9759c43b1 | TypeScript | zhuxinyu-znb/ts-laboratory | /6-1.泛型与Type区别.ts | 4.625 | 5 | //总结:
// 1.能用 interface 实现,就用 interface , 如果不能就用 type
// 2.https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-aliases
// 类型别名 创建新类型就用interface 组合类型就用type
//相同点
/**
* 1.都可以描述一个对象或者函数
* 2.都允许拓展(extends)
*/
//不同点
/**
* 1.type 可以而 interface 不行
* 1-1 type 可以声明基本类型别名,联合类型,元组等类型
* 1-2 type 语句中还可以使用... |
a418bdf2a9584677e35bf31616e9f8f2f73366ef | TypeScript | jrwalt4/arga | /src/types/collections/sorted-array.d.ts | 2.96875 | 3 |
declare module "collections/sorted-array" {
import GenericCollection = require('collections/generic-collection');
import PropertyChanges = require('collections/listen/property-changes');
import RangeChanges = require('collections/listen/range-changes');
export = SortedArray;
let SortedArray: Sort... |
8df7e0b3d70caae84328e3c6e9e4b68d217fe5c1 | TypeScript | sanity-io/sanity | /packages/sanity/src/core/theme/types.ts | 2.546875 | 3 | import type {RootTheme, ThemeColorSchemeKey} from '@sanity/ui'
/** @public */
export interface StudioTheme extends RootTheme {
/** @internal */
__dark?: boolean
/** @internal */
__legacy?: boolean
}
/**
* Used to specify light or dark mode, or to respect system settings (prefers-color-scheme media query) use... |
7f7955a1167cf91eb303bea8b4fd2827f6a0adc8 | TypeScript | Snuggle/Ba | /src/commands/reactions.ts | 2.859375 | 3 | import { Command } from './command'
import { Emote } from '../models/emote'
import { CommandInteraction } from 'discord.js'
/**
* Prints a list of all emotes which are active for today.
*/
export const ReactionsCommand: Command = {
data: {
name: 'reactions',
description: 'Prints a list of all currently act... |
65d6ea07d633fdd2dc917e2db87f94db20702c2f | TypeScript | acrois/falling-sand | /src/index.ts | 2.609375 | 3 | import { Canvas } from "./canvas";
import { Sand } from "./sand";
import { Particle } from "./particle";
import * as Color from 'color';
let canvas = new Canvas(<HTMLCanvasElement>document.getElementById('sand'));
let sand = new Sand(canvas);
let w: any = window;
w.sand = sand;
let targetFPS = 60;
sand.start(targetF... |
cc5eed4ad901d2c6f76ea8bd67609ecff5404ebb | TypeScript | markwetzel/ts-playground | /src/design-patterns/factory/FactoryMethod/Custom/models/Item/Weapon/Melee/OneHandedMeleeWeapon.ts | 2.765625 | 3 | import { MeleeWeapon } from "./MeleeWeapon";
export abstract class OneHandedMeleeWeapon extends MeleeWeapon {
constructor(
name: string,
level: number,
attackPower: number,
weight: number
) {
super(name, level, attackPower, weight);
}
}
|
a3e077efca2b346f5d46c987b3bff27b59438898 | TypeScript | bodryi/polynoms-app | /src/app/store/result-vectors/reducer.ts | 3.046875 | 3 | import * as Action from './actions';
import * as MainAction from '../main/actions';
import { RESULTS_COUNT } from '../../constants/app.constants';
export interface State {
result: Array<Array<Array<string>>>;
activeResult: Array<number>;
matrixSize: number;
}
const initialState: State = {
result: [
getEm... |
cefe1b3eda3367564ad35f0ec96486527cf9626f | TypeScript | dapplets/dapplet-extension | /src/contentscript/modules/widgetsCreator.ts | 2.71875 | 3 | import { State } from './state'
import { IWidget, WidgetConfig } from './types'
export class WidgetsCreator {
private stateStorage = new Map<string, State<any>>()
public createWidgetFactory<T>(Widget: any) {
const me = this
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[... |
1633e3fcf5f2cf3ce11c93e73fd42ce4e60acfa7 | TypeScript | nouakun/react-horizontal-timeline | /lib/esm/types/Components/Events.d.ts | 2.671875 | 3 | import React from "react";
/**
* Component propTypes
*/
export declare type EventsProps = {
events: {
distance: number;
label: JSX.Element | string;
date: string;
}[];
selectedIndex: number;
handleDateClick: (index: number) => void;
labelWidth: number;
styles?: any;
... |
e5b31432cd8f740a363d9c975c5e34f361216a43 | TypeScript | oscaroceguera/js-references-web | /src/pages/Editor/reducer.ts | 2.734375 | 3 | import React from 'react';
import { IInitialState } from './types';
import { IEditorActions, SET_FIELDS, UPDATE_FIELDS } from './actions';
const reducer: React.Reducer<IInitialState, IEditorActions> = (
state,
action,
) => {
switch (action.type) {
case SET_FIELDS:
return {
...state,
[ac... |
3533aa8946088d6a1578c7884b8f067d62dac6e2 | TypeScript | elancer-dev/f-test | /src/utils/reducer.ts | 2.65625 | 3 | import { TState, TAction } from './types';
export const initialState: TState = {
points: [
// { coord: [55.753215, 37.622504], name: 'Москва', },
// { coord: [56.185102, 36.977631], name: 'Солнечногорск', },
// { coord: [55.991390, 36.484994], name: 'село Новопетровское', },
],
... |
1a0bc89cff7ce49e10a4b5c7daabb53dcbe78213 | TypeScript | a-hess5/mun-tools | /target/flow-frontend/Authentication.d.ts | 2.90625 | 3 | import { MiddlewareClass, MiddlewareContext, MiddlewareNext } from './Connect';
export interface LoginResult {
error: boolean;
token?: string;
errorTitle?: string;
errorMessage?: string;
redirectUrl?: string;
defaultUrl?: string;
}
export interface LoginOptions {
loginProcessingUrl?: string;... |
d07e343863f57f0d29af53b9cc0ff67b6d717b24 | TypeScript | AntonShilin/eshop | /src/Reducers/HeaderPanelReducer.ts | 2.9375 | 3 | import {
IHeaderPanelState,
HeaderPanelActions,
OpenHeaderSearchPanelTypes,
CloseHeaderSearchPanelTypes,
ToggleSmallScreenSubmenuTypes,
SelectIdGenreInSubmenuTypes,
OpenSelectedGenreTypes,
CloseSelectedGenreTypes,
} from "../Types/HeaderPanelTypes";
const headerPanelState: IHeaderPanelState = {
isOpe... |
89236e4741bc4e5dbf181113e9df16edef48561e | TypeScript | Designer023/training-plan-generator | /src/types/index.ts | 2.53125 | 3 | import { DayPlan } from "./index";
import { Moment } from "moment";
export interface UserSpec {
PLAN_LENGTH: number;
PLAN_TAIL_OFF_LENGTH: number;
PLAN_RECOVER_WEEK_EVERY: number;
PLAN_START_DISTANCE: number;
PLAN_END_DISTANCE: number;
PLAN_START_DATE: string;
USER_MAX_HR: number;
USER_PACES: {
// ... |
0faf1913cb4b497453e00c16087ac3af720a6491 | TypeScript | haiertech/homes | /src/utilities/serverContext/database/entities/Message.ts | 2.703125 | 3 | import {
Column,
CreateDateColumn,
Entity,
getRepository,
UpdateDateColumn,
} from 'typeorm'
import * as types from '@/types'
import { PapyrEntity } from './PapyrEntity'
import {
DbAwareColumn,
DbAwarePGC,
sanitizeConditions,
} from '../utilities'
@Entity()
export class Message extends PapyrEntity {
... |