Datasets:

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
900ae21c78ee9f5f9ac002627e80a357027dd195
TypeScript
DataSignInc/did-siop-lib
/src/core/Signers.ts
2.984375
3
import { createHash, createSign, constants as cryptoConstants } from 'crypto'; import { leftpad } from './Utils'; import { Key, RSAKey, ECKey, OKP } from './JWKUtils'; import { ALGORITHMS, KEY_FORMATS } from './globals'; import { eddsa as EdDSA, ec as EC} from 'elliptic'; export const ERRORS = Object.freeze({ NO_P...
c47ecc52629de4c6854ea594be7c0963ca7dba6e
TypeScript
whirly/teamview.nodejs
/server/cli/db/sync.ts
2.53125
3
import { CommandModule } from 'yargs'; import {IFixture, IFixtureSide, IPerformance, PlayerPosition} from '../../../shared/models'; import logger from '../../logger'; import * as models from '../../models'; import { connectDatabase, disconnectFromDatabase } from '../../mongoose'; import axios from 'axios'; import {cru...
8d0b4420d676ecfef2061b6d49b7016f2b85ebc8
TypeScript
MartinREMY42/multi-game-project
/src/app/games/pylos/PylosTutorial.ts
2.84375
3
import { PylosCoord } from 'src/app/games/pylos/PylosCoord'; import { PylosMove } from 'src/app/games/pylos/PylosMove'; import { PylosState } from 'src/app/games/pylos/PylosState'; import { Player } from 'src/app/jscaip/Player'; import { MGPValidation } from 'src/app/utils/MGPValidation'; import { TutorialStep } from '...
035cd3c32bda486d0ce29882aaefb9f148ec529a
TypeScript
nimi/ngx-elasticsearch
/packages/core/src/query/ImmutableQuery.ts
2.6875
3
import { BoolMust } from './query_dsl'; import { guid } from '../utils'; import { SelectedFilter } from './SelectedFilter'; import { omitBy, omit, values, pick, merge, isUndefined } from 'lodash'; import { update } from '../utils/immutability-helper'; export type SourceFilterType = string | Array<string> | boolean; ...
b3887b20da4cf2ccf1d88322237861d25f92193b
TypeScript
arist0tl3/typescript-express-starter
/src/index.ts
2.578125
3
import 'dotenv/config'; import cors from 'cors'; import express from 'express'; import compression from 'compression'; const app = express(); // Use process.env as default const PORT = process.env.PORT || 3333; // Whitelist all routes with cors app.use(cors()); // Use express json app.use(express.json()); app.use(...
51fe005311e97b4736227673478761c4f98207c2
TypeScript
xrl8tien/tool_management_ui
/src/app/model/Kpi.ts
2.53125
3
export class Kpi { id: number; code_employee: string; target: number; create_time: Date; constructor(id: number, code_employee: string, target: number, create_time: Date) { this.id = id; this.code_employee = code_employee; this.target = target; ...
b348ec9f846634badada2176736d64c0bc52cf4f
TypeScript
alxmcr/spacestagram-react
/src/reducers/likesReducer.ts
3.21875
3
import { Reducer } from "react"; // Reducers export interface LikesState { nasaIds: string[]; } export interface LikesAction { type: "LIKE" | "UNLIKE", payload: string } export const likesReducer: Reducer<LikesState, LikesAction> = (state: LikesState, action: LikesAction) => { let currentState = stat...
fa1a9665a0c6325482d6f65cbc9bb331572cb1a2
TypeScript
mitre/heimdall2
/apps/backend/src/authn/github.strategy.ts
2.53125
3
import {Injectable, UnauthorizedException} from '@nestjs/common'; import {PassportStrategy} from '@nestjs/passport'; import axios from 'axios'; import {Strategy} from 'passport-github'; import {ConfigService} from '../config/config.service'; import {User} from '../users/user.model'; import {AuthnService} from './authn....
a78385195f935db3dcf7ee01182736926d44e80e
TypeScript
harogen-net/viewer
/src/utils/LayerViewFactory.ts
2.53125
3
import { Layer, LayerType } from "../model/Layer"; import { LayerView } from "../view/LayerView"; import { ImageView } from "../view/layer/ImageView"; import { TextView } from "../view/layer/TextView"; import { ImageLayer } from "../model/layer/ImageLayer"; import { TextLayer } from "../model/layer/TextLayer"; import $...
8894bd283491ab375242ecaa6128b460bc45f16a
TypeScript
siyul-park/conev-sync
/package/conev-sync-core/src/source/sources.ts
2.84375
3
import merge, { Options } from 'deepmerge'; import Source from './source'; class Sources implements Source { private readonly sources: Source[]; private readonly options?: Options; constructor(sources: Source[], options?: Options) { this.sources = sources; this.options = options; } add(source: Sou...
c913413a2ce02d109dedb79b4ba9b012bc9f49a5
TypeScript
DeskproApps/github
/src/utils/getUniqUsersLogin.ts
2.640625
3
import uniq from "lodash/uniq"; import isArray from "lodash/isArray"; import { User } from "../services/github/types"; const getUniqUsersLogin = ( user?: User|null, assignee?: User|null, assignees?: User[], ): Array<User["login"]> => { let users = []; if (user?.login) { users.push(user.log...
28f010c270e6bd9c6a82a803529d26a2fef15d68
TypeScript
ananas-dev/slippi-quick-tournaments-1
/src/responders.ts
2.796875
3
interface Response { type: string; message?: string; } export function success(message?: string): Response { return { type: "success", message: message }; } export function error(message: string): Response { return { type: "error", message: message, }; }
bddbcf157ba873337c075875609cbc07080cfce2
TypeScript
quasarframework/quasar
/ui/types/utils/is.d.ts
4.125
4
interface is { /** * Recursively checks if one Object is equal to another. * Also supports Map, Set, ArrayBuffer, Regexp, Date, and many more. * * @example * const objA = { foo: 1, bar: { baz: 2 } } * const objB = { foo: 1, bar: { baz: 2 } } * objA === objB // false * is.deepEqual(objA, objB) ...
92ba84b74951d6372e8de3631183e9752fbf5172
TypeScript
anyweez/scraper
/structs/source.ts
2.9375
3
/** * Represents a single news source. */ export class Source { id: string; name: string; constructor(raw) { this.id = raw.id; this.name = raw.name; } }
fa42575f26fd9bb099f749cd55eef0691bacfce6
TypeScript
Bluefinger/rythe
/src/operators/dropWith.ts
3.109375
3
import { emitSKIP } from "../signal"; import { Stream, OperatorFn } from "../types/stream"; import { map } from "./map"; /** * Pushes non-repeating values using a predicate function. Skips any repeated values. */ export const dropWith = <T>( predicate: (prev: T | undefined, next: T) => boolean ): OperatorFn<T, T> ...
783292df6cda4e1f42deb85c6830310a94ed62bf
TypeScript
matheusqs/e-commerce-books
/src/app/pages/cart/cart.component.ts
2.625
3
import { Component, OnInit } from '@angular/core'; import { Book } from 'src/app/core/models/book'; import { CartService } from 'src/app/core/services/cart.service'; @Component({ selector: 'app-cart', templateUrl: './cart.component.html', styleUrls: ['./cart.component.scss'], }) export class CartComponent implem...
2d001561f2a72a11e716ac94321bc4e53568c745
TypeScript
cross-development/practice
/simple-code/ts-code/src/tasks-02/task-02-03.ts
3.6875
4
const findLongestWord = function (string: string): string { const words: string[] = string.split(' '); let LongestWord: string = words[0]; for (const word of words) { if (word.length > LongestWord.length) { LongestWord = word; } } return LongestWord; }; /* * Вызовы функции для проверки работоспособност...
528436c46a10e038f4d6ef5352c9e5c608cb9be4
TypeScript
wesherwo/dynamic-forms
/src/app/controls/checkbox.ts
2.6875
3
import { ControlBase } from './control-base'; export class Checkbox extends ControlBase<string> { controlType = 'checkbox'; type: string; constructor(options: {} = {}) { super(options); } update(newValue){ this.value = newValue.checked; } isValid(){ return super.isValid(); } }
25c613404543a23e472a1717f6d198854e3577b5
TypeScript
Flipize/GithubAngular
/src/models/Movie.ts
3.125
3
export class Movie { constructor(private Title?: string, private year?: number, private director?: string) { } get Name(): string { return this.Title; } set Name(value: string) { this.Title = value; } get Year(): number { return this.year; } set Year(value: number) { this.year = v...
c652beea349eb148caa69a8b0cd8d5571b516087
TypeScript
mjvandermeulen/outlets-react
/src/redux/outlets/types.ts
2.84375
3
interface SwitchDataValues { mode: boolean } export interface SwitchData { [group: string]: SwitchDataValues } export interface TimerDataValues { time: number isTimerRunning: boolean } export interface TimerData { [group: string]: TimerDataValues } export type SyncRequestData = string[] // array of groups...
678e3207d9aa3287aaab866d9356c35c4e1976c1
TypeScript
fearthecowboy/scratchpad
/compute/2019-12-01/models/GalleryApplicationProperties.ts
2.859375
3
import { OperatingSystemTypes } from '../enums/OperatingSystemTypes'; /** * @description Describes the properties of a gallery Application Definition. */ export interface GalleryApplicationProperties { /** * @description The description of this gallery Application Definition resource. This property is updata...
9ed85629e3d3afdd32fcb4343a1090a5481f07ab
TypeScript
ivan-skv/weatherapp
/src/utils/events.ts
3.1875
3
export default class EventEmitter { private listeners: { [x: string]: Array<(...args: any[]) => void>; } constructor() { this.listeners = {}; } addListener(event: string, callback: (...args: any) => void): void { const listeners = Array.isArray(this.listeners[event]) ? this.listeners[event] : []; t...
31c73c3f7ff3cc4e9d41408c884b8e3747ec2c9f
TypeScript
dlucazeau/ngx-lro-datepicker
/src/app/_datepicker/_models/visual-day.spec.ts
2.84375
3
import { VisualDay } from './visual-day'; describe('VisualDay', () => { it('ctor / calendar / should not be a weekend', async () => { // Arrange const d: Date = new Date(2020, 0, 18); // Act const vd = new VisualDay(d, new Date(1970, 0, 1), new Date(1970, 0, 1), new Date(1970, ...
659fab8ef34b7cd2a45e2e0db7bb1d823872ddcf
TypeScript
FrontEnd-ro/frontend.ro
/server/event/event.router.ts
2.734375
3
import express, { Request, Response } from 'express'; import EventModel from './event.model'; import { ServerError } from '../utils/ServerError'; import EmailService, { EMAIL_TEMPLATE } from '../Email.service'; const eventRouter = express.Router(); eventRouter.get('/:label/seats', async function getAvailableSeats( ...
9c092a98c8e10fc12f2dc55a6a7b4255e121524a
TypeScript
Andor123/exercise
/ts/24.ts
3.671875
4
var func = (x)=> { if (typeof x == "number") { console.log(x + " is numeric"); } else if (typeof x == "string") { console.log(x + " is a string"); } }; func(12); func("Tom");
f513500a18d51210d0ee66047a7c763c3484e2d1
TypeScript
Kasama/petshop-backend
/src/models/Event.ts
2.609375
3
import ApplicationModel from './ApplicationModel'; import Pet from './Pet'; import Service from './Service'; class Event extends ApplicationModel { public name: string; public date: string; public slot: number; public pet_id: string; public service_id: string; constructor(base?: any) { super(Event, base); ...
05e8a39494994489c10052716f5cd72c1d629122
TypeScript
szab100/sfdb
/admin/ui/src/app/error/error.component.ts
2.546875
3
import { Component, OnInit } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { HttpStatus } from '../services/constants'; @Component({ selector: 'app-error', templateUrl: './error.component.html', styleUrls: ['./error.component.scss'] }) export class ErrorComponent impleme...
de99aaa9cf4052e1ebff3a8e9efab143845b63f4
TypeScript
hmuralt/typestately
/src/core/ReducerHelpers.ts
2.96875
3
import { Reducer, Action } from "redux"; import RouteAction, { isRouteAction } from "./RouteAction"; import RoutingOption from "./RoutingOption"; import DefaultStateReducer from "./DefaultStateReducer"; export interface DefaultStateReducerWithOptionalRoutingOptions<TState, TActionType> extends DefaultStateReducer<TS...
325ccba1a0190a3c830bd9d48e75a5cd04ff1b9a
TypeScript
bitsevn/workspaces
/src/app/features/tree/tree.component.ts
2.640625
3
import { Component, Input, OnInit } from '@angular/core'; export class Item { id: number | string; name: string; } export enum NodeType { BRANCH = 'branch', LEAF = 'leaf' } export interface TreeNode<T> { id: number | string; name: string; nodeType: NodeType; visible?: boolean; expanded?: boolean; ...
295828db4abc50612dfd9a79f2d488283e199836
TypeScript
YePpHa/maia-yt
/src/app/settings-storage/SettingsStorageFactory.ts
2.515625
3
import { SettingsStorage } from "./SettingsStorage"; import { Storage } from "../libs/storage/Storage"; import { Container, injectable } from "inversify"; export const storageCache: {[key: string]: SettingsStorage} = {}; @injectable() export class SettingsStorageFactory { private _storage: Storage; private _conta...
62e70f5c9f4104be3000818379775bc82795de7a
TypeScript
jlambert97/msAuthorization
/src/graphql/resources/user/schema.ts
2.59375
3
const userTypes = ` type User { id: ID! name: String! email: String! createdAt: String! updatedAt: String! } input UserCreate { name: String! email: String! password: String! } input UserUpdatePassword { password: String! ...
167f25590b5cdd8bf4c3e086b7333a6248b5183b
TypeScript
mpicciollicmq/framework-investigations
/typescript-marionette/src/TodosView.ts
2.609375
3
namespace TodoMVC { "use strict"; interface CheckboxEventTarget extends EventTarget { checked: boolean; } interface CheckboxEvent extends Event { currentTarget: CheckboxEventTarget; } interface TodosViewOptions { collection: TodoCollection; } /** Controls the ...
117226f83c2b31c3f8db2d8f2941753d96791598
TypeScript
jalescardoso/ionic2-cordova-plugin-googlemaps-v2
/ionic-native/src/plugins/text-to-speech.ts
3.21875
3
import { Plugin, Cordova } from './plugin'; export interface TTSOptions { /** text to speak */ text: string; /** a string like 'en-US', 'zh-CN', etc */ locale?: string; /** speed rate, 0 ~ 1 */ rate?: number; } /** * @name TextToSpeech * @description * Text to Speech plugin * * @usage * ...
7319552789856ac8a9637326643553cdc5e1b8b9
TypeScript
first-line-outsourcing/media-shop
/src/app/shared/models/order.model.ts
2.6875
3
import { Address } from './address.model'; import { Product } from './product.model'; export class Order { public id: string; public products: Product[]; public total: number; public tax: number; public currency: string; public grandTotal: number; public payment: string; public promocode: string; pub...
b873366c465577d628058d02c39405efd6fbc887
TypeScript
DEV6hub/TypeScript-Course-Files
/Demos/Unit04/Demo05/arrow_functions.ts
3.703125
4
class Person { constructor(public name: string) { } sayHello(friends: string[]): void { // this will work friends.forEach((friend: string) => { console.log(`${this.name} says hello to ${friend}`); }); // this will not friends.forEach(function(friend: string) { console.log(`${this.n...
76dc125efce065deb4f4a0083cf012e2bb9ec787
TypeScript
ldqUndefined/ts-algorithms
/src/chapter1/questions/1-4/Ex_1_4_15.ts
4.125
4
//线性级别的,数组两端向中间走 const twoSumFaster = (arr: number[]): number => { //最小大于0或者最大小于0都可以直接得出结果为0 if (arr.length === 0 || arr[0] > 0 || arr[arr.length - 1] < 0) { return 0; } let count = 0, lo = 0, hi = arr.length - 1; //整数对,只有1个0应该不算吧,这里就不是<=了 while (lo < hi) { if (arr[lo] + arr[hi] < 0) { ...
cd6241b3bacbf7d0b3295a33dac1ce829881603b
TypeScript
rocketryjs/device-launchpad-mk2
/src/features/clock.ts
2.921875
3
import type {Device} from "@rocketry/core"; import bindDeep from "bind-deep"; const clear: Clock<DependentDevice>["clear"] = function () { // Stop the interval if (this.clock.interval) { clearInterval(this.clock.interval); delete this.clock.interval; } return this; }; const change: Clock<DependentDevice>["cha...
28aa3d4c214196391c058c6932c4a74c84249c21
TypeScript
movelikeabishop/twitter-app
/src/api/twitter/index.ts
2.671875
3
import Twitter from 'twitter'; import FilterTweets from './filter/tweetFilter'; import { ITweet } from './schema'; import { NotFoundError } from '../../core/ApiError'; import PaginationController from './paginationController'; export interface ITweetsResponse{ tweets: ITweet[], // an array of tweets in our s...
9c8fddbbfc7cc14c71395475b1c4a8c4f62b6e85
TypeScript
npmcdn-to-unpkg-bot/TS_config
/ts-namespace/src/myapp/controllers/MainCtrl.ts
2.625
3
namespace MyApp.Controllers { export class MainCtrl { static $inject = ["NameSvc"]; constructor(private svc: Services.NameSvc) { this.name = 'World...'; svc.getName().then( n => this.name = n ); } public name: string public show($event) { ...
73ae44923afe6040d0eca45ab6cdd1983f7a1d77
TypeScript
NoworksM/home-server-api
/src/entity/Role.ts
2.546875
3
import {Column, Entity, Index, ManyToMany, PrimaryGeneratedColumn} from "typeorm"; import {Length} from "class-validator"; import {User} from "./User"; @Entity() export class Role { @PrimaryGeneratedColumn("uuid") id: string; @Column() @Index({unique: true}) @Length(3, 64) name: string; @...
613b7be5fde249b21c6f376d8860637058af0dfa
TypeScript
rootulp/exercism
/typescript/resistor-color-duo/resistor-color-duo.ts
3.375
3
export class ResistorColor { private colors: string[]; constructor (colors: string[]) { if (colors.length < 2) { throw Error('At least two colors need to be present'); } // Ignore additional colors this.colors = colors.splice(0, 2); } public value(): number { let result = "" for...
1533b74249e2deeaf250a97ce85b5f369147f47e
TypeScript
rodolfoHOk/hiok.despensa
/src/services/produtos.ts
2.515625
3
import Produto from "../interface/produto"; import apiClient from "./apiClient"; const url = '/produtos' export function getAllProdutos(){ return apiClient.get(url); } export function getProdutos({nome, categoria}:{nome: string, categoria: string}){ return apiClient.get(url, { params: { nome: nome, ...
707f0af07e30e4803ff343793e9c222cb7fadae1
TypeScript
corbinu/eslint-typescript-smoketest
/projects/glimmer/packages/glimmer-benchmarks/lib/benchmarks/baseline.ts
2.703125
3
import { TemplateBenchmarkScenario, BenchmarkScenario } from '../bench'; class SingleTextNodeScenario extends TemplateBenchmarkScenario { public name = "single text node"; public description = "A simple static text template"; template() { return `hi`; } renderContext(): Object { return {}; } t...
09769cddf2aba4f576f00b09511ad90131b808da
TypeScript
O4epegb/Practice
/algorithms/in-typescript/src/utils/index.ts
2.984375
3
export function mutatedSwap( firstIndex: number, secondIndex: number, array: Array<number> ) { const temp = array[firstIndex]; array[firstIndex] = array[secondIndex]; array[secondIndex] = temp; }
a3b484dcf2b27a0d8e67df2472348f32fabc5a98
TypeScript
EllaB12/loop-machine
/src/app/components/loop-list/loop-list.component.ts
2.703125
3
import { Component, Input, OnInit } from '@angular/core'; import { Loop } from '../../models/loop.model'; @Component({ selector: 'loop-list', templateUrl: './loop-list.component.html', styleUrls: ['./loop-list.component.less'] }) export class LoopListComponent implements OnInit { @Input() loops!: Loop[]; pla...
0bb9452fd5a38617497a13e651ed94905146ee43
TypeScript
MarkSFrancis/course-review
/utils/hooks/firebase/firestore/query/state.ts
2.59375
3
import { db as fireDb } from "../../../../firebase/firestore"; import { Query } from "./queryTypeHelpers"; export type FirebaseQueryBuilder<TQuery extends Query> = ( db: typeof fireDb ) => TQuery; export interface QueryFailedState { state: "error"; error: unknown; } export interface QuerySuccessState<T> { st...
c9af5effddd3918c18daa03ad1c36538892945e3
TypeScript
thundermiracle/geocoder-free
/packages/geocoder-free-utils/__test__/lib/getLocaleString.test.ts
2.84375
3
import getLocaleString from 'lib/getLocaleString'; test('input is wrong', () => { const result1 = getLocaleString(null); const result2 = getLocaleString(''); expect(result1).toEqual(''); expect(result2).toEqual(''); }); test('input is not date string', () => { const result = getLocaleString('abc'); expe...
27c3ea49535a899b0a1665805bde24caf98740ba
TypeScript
ViGouRCanberra/Tamafit
/app/src/components/saveManager.ts
2.671875
3
import { readFileSync, writeFileSync, unlinkSync } from "fs"; //CONSTS var SAVE_PATH = "tama.sav"; export function SaveManager() { } SaveManager.prototype.getData = function() { //unlinkSync(SAVE_PATH); return getFileData(); } SaveManager.prototype.saveStepData = function(newData) { var data = getFileDa...
08e892f7dcd954c58d8f92b95559823cb2ed6bf3
TypeScript
genstackio/libs-js
/packages/themes2tailwindcss/src/index.ts
2.625
3
import fs from 'fs'; import ejs from 'ejs'; import { colord } from 'colord'; import path from 'path'; export type value_format = 'auto' | 'raw' | 'rgba' | 'rgb' | 'hexa' | 'rgblist'; export type extended_variable_value = [value_format, string]; export type variable_value = string | number | undefined | extended_variab...
b62a9893470cabb8188757b10f1166343d6f2fd1
TypeScript
future4code/Bruno-Silva
/logic-exercises/exercise3/src/maxValueTheft.ts
3.375
3
export const maxValueTheft = ( valuesOfHouseArray: number[], houseIndex: number = 0, finalValueOfTheft: number = 0, possibleValueOfTheft: number = 0 ): number => { if (valuesOfHouseArray.length < 1) { return finalValueOfTheft; }; if (houseIndex <= valuesOfHouseArray.length - 1) { ...
7b2a28f555cb08be587615be77598d89cf4212f5
TypeScript
Splidejs/splide
/src/js/components/Controller/Controller.ts
2.71875
3
import { EVENT_END_INDEX_CHANGED, EVENT_REFRESH, EVENT_RESIZED, EVENT_UPDATED } from '../../constants/events'; import { MOVING, SCROLLING } from '../../constants/states'; import { LOOP, SLIDE } from '../../constants/types'; import { EventInterface } from '../../constructors'; import { Splide } from '../../core/Splide/S...
cbc687fee498096269d590f6f7fdcd32a294bd59
TypeScript
linkiez/JCMserver
/public/ts/view/mensagemView.ts
2.828125
3
export class MensagemView { private divMensagem: HTMLDivElement; constructor() { this.divMensagem = document.querySelector("#divMensagem"); } mensagemLimpar(): void { if (this.divMensagem.classList.contains("alert-success")) { this.divMensagem.classList.remove("alert-success"); } if (thi...
a80e48406bbab078a8878df4bc5e4e3f8f28a881
TypeScript
goeaway/user-tagger
/src/common/services/site-user-service.ts
2.640625
3
import { ISiteUserService, IStorageService } from "../abstract-types"; import { SiteUser, Site, UserTag, RGBExtensions } from "../types"; import * as uuid from "uuid"; export default class SiteUserService implements ISiteUserService { private LOCAL_STORAGE_SITE_USER_KEY = "user-tagger.saved-site-user."; privat...
8fdc3044c52256d6b6805ece659fe75468877668
TypeScript
ziyofun/cb-sea
/src/course.ts
2.921875
3
import base from './base' import { genQuery } from './util' interface ICourse { id?: string name?: string type?: string state?: string semesterId?: number stageId?: number subjectId?: number subjectName?: string stageName?: string semesterName?: string } interface ISemester { ...
6467441bd6cf772d08d4b1ca6613c0a02dcef536
TypeScript
harut0111/redux-crud
/src/component/ReduxCRUD/reduxCRUDSlice.ts
2.84375
3
import { createSlice, PayloadAction } from "@reduxjs/toolkit"; import type { RootState } from "../../app/store"; export interface postsType { id: string; title: string; message: string; } export interface reduxCRUDType { posts: Array<postsType>; } const initialState: reduxCRUDType = { posts: [], }; export...
1ef6a27031646aae922fa161fb5e70bd078abed5
TypeScript
sarker24/eesmiley-fromtend
/frontend-client/src/pages/registration/GuestRegistrationHistory/utils/phraseLocalize.ts
2.546875
3
import { InjectedIntl } from 'react-intl'; function phraseLocalize(intl: InjectedIntl, key: string): string { const lastDot: number = key.lastIndexOf('.'); if (lastDot < 0) { return intl.messages[key]; } const lastKey: string = key.substring(lastDot + 1); const pluralKeys: string[] = ['zero', 'one', 'o...
2433ea0eb2b81b140075a8f0253b1532c5dd207c
TypeScript
Autapomorph/forecast
/src/utils/weather/time/__tests__/index.test.ts
2.859375
3
import { DateTime } from 'luxon'; import formatTime from '..'; describe('Format time', () => { it('should return instance of DateTime', () => { expect(formatTime(0, 'Europe/Moscow')).toBeInstanceOf(DateTime); }); it('should convert to UTC+3 zone', () => { const res = formatTime(0, 'UTC+3'); expect(r...
b31ef3e5333760eb033f0126d6a2a8242e36625c
TypeScript
bigshoesdev/WorkLine-App
/src/app/main/auth/register/register.ts
2.515625
3
import { Component } from '@angular/core'; import { UserService } from 'src/app/services/user.service'; import { UtilService } from 'src/app/services/util.service'; import { Router } from '@angular/router'; @Component({ selector: 'auth-register', templateUrl: 'register.html', styleUrls: ['register.scss'], ...
548f30050f421330a17e74b1b77f38186a501765
TypeScript
huangdoudou6174/cocosGame
/TypeScript/Script/Recommend/RecommendConfig.ts
2.65625
3
const { ccclass, property } = cc._decorator; /**使用Youzi互推时,管理后台提供的平台渠道 默认微信 */ const PLAT_TYPE_CHANNELID = { Test: 1001, //测试也用微信,此处为避免cc.Enum报错,使用1001,,get访问时会自动变为1002 WeChat: 1002, //微信 Oppo: 8001, //oppo小游戏 TouTiao: 11001 //头条小游戏 }; /**互推配置脚本,挂载在互推根节点上 */ @ccclass export default class RecommendCon...
e3092780938d6c00905ec6a88570bb26072c851b
TypeScript
couturecraigj/slds-react-components
/components/DateInput/__tests__/useCalendar.spec.ts
2.53125
3
import { renderHook } from "@testing-library/react-hooks"; import useCalendar from "../hooks/useCalendar"; import { getFormat } from "../parseDate"; describe("useCalendar", () => { let languageGetter; beforeEach(() => { languageGetter = jest.spyOn(window.navigator, "language", "get"); }); it("should work",...
054802325a57e68ccf4864a7fd81a7cf56a27bb2
TypeScript
irrigador/form_recursive
/server/src/controllers/ClassesController.ts
2.578125
3
import { Request, Response } from 'express'; import db from '../database/connection'; export default class ClassesController{ async index(request: Request, response: Response) { const filters = request.query; const subject = filters.subject as string; if (!filters.subject) { ...
3cf74c23280f9baaeab78de6107fd6595a7a2b6b
TypeScript
hetashpatel7/COMP397-Lesson01-Part2
/Lesson1/scripts/game.ts
2.546875
3
class person { constructor() { } public saysHello() { console.log("Hello world")} } function init() { var myPerson = new person(); myPerson.saysHello(); }
4fd4370ae742d93ea0cdcd2e76ca8c2d4673e441
TypeScript
nonameche/myblog
/src/hooks/useAntdTable.ts
2.625
3
import { useState, useCallback } from 'react' import axios from '@/utils/axios' import useMount from './useMount' /** * useAntdTable hooks 用于处理 loading 逻辑以及换页 检索等 * * @param {Object} obj * @param {Function} obj.fetchList 获取列表的函数 * @param {Object} obj.queryParams 默认要检索的参数 */ export default function useAntdTable({...
d5143938a0e02036d9cbc7c9432805156c303ebb
TypeScript
lixin2628/h5-egret-libs
/templates/UISlideView/UISlideBackGround.ts
2.609375
3
/** * Created by Lixin on 15/11/24. * * 横向滑动栏 背景 * */ class UISlideBackGround extends egret.Sprite { public config:any; public constructor(config:any) { super(); this.config = config; this.width = this.config.SlideViewWidch; this.height = this.config.SlideViewHeight; ...
93b37f9d0b20a3c38fd72edd5802ffbcce00303c
TypeScript
nguyenvanuoc/angular
/iOffice-theme/projects/main/src/app/shared-components/validator.ts
2.859375
3
import { AbstractControl, ValidationErrors } from '@angular/forms'; export class MyValidator { static DemoValidator(control: AbstractControl): ValidationErrors | null { return demoValid(control); } } export function demoValid(control: AbstractControl): ValidationErrors | null { if (control.value != null && ...
78753d3bb0234d83a3c23d20dee76d4ce14ff5a2
TypeScript
Hydro-Dog/react-todo
/src/redux/reducers/pagination-reducer.ts
2.734375
3
import { CHANGE_PAGE } from "../actions/pagination-actions" const initialState = { currentPage: '1' } export const paginationReducer = (state = initialState, action: any) => { switch (action.type) { case CHANGE_PAGE: { return { ...state, currentPage: action....
2acf40ff6a33233709add6a067012823b6aa4d62
TypeScript
torkpe/reebee-project
/src/services/showService.ts
2.578125
3
import { ShowDetails, ShowsResponse } from '../interface/interface'; import Axios from "../utils/axios"; export class ShowService extends Axios { private url = 'https://api.tvmaze.com/'; async searchShows (searchKey: string): Promise<ShowDetails[]>{ const response = await this.axios.get(`${this.url}search/sh...
6bc872a7725707999ec6d1618008a296cf2e6344
TypeScript
SergioEGGit/Project_Translator_From_Java_To_Javascript_And_Python_SEG
/Source Code/Backend/Traductores/Javascript/src/AnalizadorLexicoSintactico/Clase.ts
2.859375
3
// Imports // Clase Abstracta import { Instruccion } from "./Instruccion"; // Metodo Identacion import { AgregarIdentacion } from './Variables_Metodos'; // Clase Principal export class Clase extends Instruccion { // Constructor constructor(Linea: number, Columna: number, private Identificador: String, private...
cb5508cb07d919ec48f46dc69009e52ad7d5b62e
TypeScript
Marcosaurios/martian-robots
/src/server/routes/exploration.ts
2.84375
3
import express from 'express'; import Mars from '../../mars'; /** * Process a map and its robots in Mars * @param {express.Request} req Request object * @param {express.Response} res object, which will be returned with the exploration result */ /** */ function explore( req: express.Request, res: express.Respon...
36f0e72ff4fa4c4d6dc375ba0b06d3ab61adf02a
TypeScript
bastienhousiaux/pokerCoach
/ts/poker/Card.ts
3.515625
4
namespace poker{ export class Card{ static CARD_STRING_VALUES=["2","3","4","5","6","7","8","9","T","J","Q","K","A"]; static CARD_STRING_COLORS=["♥","♦","♣","♠"]; constructor(public value:number=0,public color:number=0){ } getStringRepresentation():string{ ...
906fd800e3d9f549f8c623ea23e266c38977f121
TypeScript
alex-davies/circuitnect
/test/engine/Hex.test.ts
2.6875
3
///<reference path="../../lib/qunit/qunit.d.ts"/> import Hex = require('../../engine/Hex'); export function run(){ QUnit.module('Hex'); //QUnit.test( "Neighbours", function( assert ) { // assert.deepEqual(Hex.Neighbours({pos_b:2, pos_a:3}),[ // {pos_b:2,pos_a:2}, // {pos_b:3,pos...
ac977e23dafaaaf47878cdb3281dcc35dbe20fa6
TypeScript
swc-project/swc
/crates/swc_bundler/tests/.cache/deno/cf12ac454c69f7afb74184149dc89ad59a2120c7.ts
2.515625
3
// Loaded from https://deno.land/x/deno_image@v0.0.3/lib/decoders/fast-png/types.ts import { IOBuffer } from './iobuffer/IOBuffer.ts'; declare enum StrategyValues { Z_FILTERED = 1, Z_HUFFMAN_ONLY = 2, Z_RLE = 3, Z_FIXED = 4, Z_DEFAULT_STRATEGY = 0, } export interface DeflateFunctionOptions { level?: -1...
62d896dcf7161b4564cc207a7725b8addfafa909
TypeScript
imba-js/stdio
/src/streams/mock-stream.ts
2.921875
3
import {Stream} from './stream'; export class MockStream implements Stream { private _content: Array<string> = []; private _columns: number; private _rows: number; constructor(columns: number = 80, rows: number = 20) { this._columns = columns; this._rows = rows; } public write(message: string): voi...
4b8d0d43f4bb754d1a7a14b4b75fe454acc17dbd
TypeScript
UCSD-PL/rs-benchmarks
/d3/src-ts/geom/voronoi.ts
2.59375
3
/// <reference path="../../d3.d.ts" /> /// <reference path="../core/functor.ts" /> /// <reference path="voronoi/.ts" /> /// <reference path="geom.ts" /> /// <reference path="point.ts" /> d3.geom.voronoi = function(points) { var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExten...
6acb833801b0b8dd71a66f2e2443847081e56f60
TypeScript
DrH97/dcs-engineering-test
/test/unit.test.ts
2.734375
3
import { createConnection, getConnection, getRepository } from "typeorm"; import Lot from "../src/entity/Lot"; import { calculateLotsQuantitySum, getFirstLot, sellLots, sortLotsByExpiry } from "../src/common/utils"; import supertest from "supertest"; import App from "../src/app"; const server = new App(3002); ...
124fb469085e1c8982b9ac1596be514bf55a0e92
TypeScript
aldukhn/Tayssir
/libs/api-interfaces/src/lib/Region.ts
2.515625
3
export interface Region { id: string; code: string; name: string; nameAr: string; } export interface Province { id: string; code: string; name: string; nameAr: string; region: Region; } export interface Circle { id: string; code: string; name: string; nameAr: string; province: Province; }...
141e0d69003a1b89270e9850910d1e3ee2e72469
TypeScript
DuoM2/damage-calc
/calc/src/data/interface.ts
2.65625
3
export interface As<T> {__brand: T} export type ID = string & As<'ID'>; export type GenerationNum = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; export type GenderName = 'M' | 'F' | 'N'; export type StatName = 'hp' | 'atk' | 'def' | 'spa' | 'spd' | 'spe'; export type Stat = StatName | 'spc'; export type StatsTable<T = number> = {[st...
699c9442a0f9acd04067a4f32d7ed8795d56bba3
TypeScript
kpokhare/cloud-governance-client
/typescript/src/models/CommonStatus.ts
2.609375
3
/* tslint:disable */ /* eslint-disable */ /* * Cloud Governance Api * * Contact: support@avepoint.com */ /** * * @export * @enum {string} */ export enum CommonStatus { Inactive = 0, Active = 1 } export function CommonStatusFromJSON(json: any): CommonStatus { return CommonStatusFromJSONTyped(json,...
da678db30a6e6542fc1e5836b367f2dfa1b87157
TypeScript
mako34/typescript_tuto
/4_interfaces.ts
4.15625
4
interface Iperson { firstName:string, lastName:string, sayHi: ()=>string } //implementation"? var customer:Iperson = { firstName:"mako", lastName:"tkt", sayHi:():string => {return "hola q hace"} } console.log("customer obj"); console.log(customer.firstName); console.log(customer.lastName); con...
0cf2816d6e34f1ddc52de0b82e0911fb3a444541
TypeScript
baleocho/angular-http-head
/src/app/pages/home/home.component.ts
2.5625
3
import { Component, OnInit } from '@angular/core'; import { HttpService } from '../../services/http.service' declare var $: any; @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.scss'] }) export class HomeComponent implements OnInit { urlIdEliminar: number;...
5026af251d310bd7ea79ae3d74db0d705cc365be
TypeScript
garmin954/-vue3-netease-music
/src/utils/rem.ts
3.015625
3
/** * 根据视窗计算rem */ import { throttle } from 'lodash'; export const remBase = 14; let htmlFontSize: number; const calc = (): void => { const maxFontSize = 18; const minFontSize = 14; const html = document.getElementsByTagName('html')[0]; const width = html.clientWidth; let size = remBase * (width / 1440)...
ee30e128db8ecc994c27493fc0a94d5d17b39d93
TypeScript
quatico-solutions/web-component-analyzer
/src/util/get-type-hint-from-type.ts
3.796875
4
import { SimpleType, toTypeString } from "ts-simple-type"; import { Type, TypeChecker } from "typescript"; /** * Returns a "type hint" from a type * The type hint is an easy to read representation of the type and is not made for being parsed. * @param type * @param checker */ export function getTypeHintFromType(t...
8aabd1efacaf912326f0e699505d358b371681a5
TypeScript
a313008430/webGLLearn
/app/core/Utils.ts
3.3125
3
export default class Utils { /** * 创建并编译一个着色器 * * @param {!WebGLRenderingContext} gl WebGL上下文。 * @param {string} shaderSource GLSL 格式的着色器代码 * @param {number} shaderType 着色器类型, VERTEX_SHADER 或 * FRAGMENT_SHADER。 * @return {!WebGLShader} 着色器。 */ static compileShader(gl:...
8267374785e8075009711c2cfc1753d0fba15042
TypeScript
Gaetano1979/introducion-node-ts
/lib/index.ts
2.75
3
export function hola() { console.log('Hola a todos desde nuevo module'); } export function holaDos(nome:string) { console.log('Hola a te che sei nuovo'+nome); } export const holaTs = () => { console.log('Hola desde paquete npm ts'); }
9959b7d5622187271fd58677faaefe65533554ff
TypeScript
junpotatoes/store-6
/client/src/lib/customStyledComponents/utils/cssStringify.ts
2.59375
3
import { compile, serialize, stringify } from 'stylis'; /** * stylis를 사용하여 css를 serialize 합니다. * compile을 사용하여 SCSS 문법을 해석하고, * 이를 직렬화하여 반환합니다. */ const cssSerializer = (tag: string, content: string) => serialize(compile(`.${tag}{${content}}`), stringify); export default cssSerializer;
47712701b574bdb788f3732d2229bccbb76f9024
TypeScript
dbecaj/boofio-api
/src/modules/services/dtos/service.dto.ts
2.546875
3
import { Types } from 'mongoose'; import { DLocation } from '../../../shared/dtos/common.dto'; import { IOpeningHours, IService, IBusinessHours } from '../entities/service.entity'; import { SERVICE_TYPE } from '../services.enum'; import { IImage } from '../../common/image/image.entity'; export class DOpeningHours { ...
a4ed42b9cfed0be46163b55ca42880b24c936320
TypeScript
gitter-badger/destiny
/src/index/generateTrees/shared/findSharedParent.ts
3.09375
3
import path from "path"; /** Find the common parent directory between all paths. */ export const findSharedParent = (paths: string[]) => { if (paths.length === 1) return path.dirname(paths[0]); const parentPaths: string[] = []; const parts: string[][] = paths.map(x => x.split("/")); const firstParts = parts[0...
9dc71bf977894b4286a4ffb478c6ac99d6735789
TypeScript
sethfowler/chromium-trace-analyzer
/src/writer.ts
3.265625
3
import stripAnsiStream from 'strip-ansi-stream'; import process from 'process'; import util from 'util'; export class IndentingWriter { private _stream: NodeJS.WriteStream; private _indent: number = 0; private _specialChar: string | undefined = undefined; private _specialCol: number = 0; constructor(private...
9f37197da7859458680de7b70cf0a08c53f843e0
TypeScript
color-coding/ibas-typescript
/openui5/extensions/components/Select.d.ts
2.640625
3
/** * @license * Copyright Color-Coding Studio. All Rights Reserved. * * Use of this source code is governed by an Apache License, Version 2.0 * that can be found in the LICENSE file at http://www.apache.org/licenses/LICENSE-2.0 */ declare namespace sap { namespace extension { namespace m { ...
3387073777dfe4e064ec70296162b4cbc1c18eaf
TypeScript
forkkit/fly.rs
/v8env/src/fly/data.ts
3.125
3
/** * Persistent, global key/value data store. Open collections, write data with `put`. Then retrieve data with `get`. * * Keys and values are stored in range chunks. Chunks migrate to the region they're most frequently accessed from. * @module fly/data */ import * as fbs from "../msg_generated"; import * as fla...
2d369a879a7be55c13ee170c934a5fd602da241a
TypeScript
deepkolos/hap-types
/system.bluetooth.d.ts
2.765625
3
/// <reference path="./types.d.ts"/> /** * 蓝牙 bluetooth * @后台运行限制 禁止使用。后台运行详细用法参见后台运行 脚本。 * @see https://doc.quickapp.cn/features/system/bluetooth.html */ declare module '@system.bluetooth' { interface Bluetooth { /** * 初始化蓝牙模块 * @example * ```js * bluetooth.openAdapter({ * success...
bd55da37c271f059b932bbc5a068166a4a92b365
TypeScript
2006NodeDev/Insta-Bytes
/project1-backend/src/routers/reimbursement-router.ts
2.515625
3
import express, { Request, Response, NextFunction } from "express" import { reimbursementStatusRouter } from "./reimbursement-status-router" import { reimbursementUsersRouter } from "./reimbursement-user-router" import { NewReimbursementInputError } from "../errors/NewReimbursementInputError" import { Reimbursement } f...
fcb6b7b3302b282051dcb7af07ae593adb30b6b2
TypeScript
vadkuze/weather-app
/src/app/common/components/weather/weather.component.ts
2.546875
3
import { Component, OnInit, Input, Output, EventEmitter, OnChanges } from '@angular/core'; @Component({ selector: 'app-weather', templateUrl: './weather.component.html', styleUrls: ['./weather.component.scss'] }) export class WeatherComponent implements OnInit, OnChanges { @Input() data; @Input() action = '...
82e80f7eb7ae349df44e8dd689329bf4c8a6158b
TypeScript
AgentOneCoLtd/gen_mysql_entities_cli
/src/create_ejs_data/index.ts
2.71875
3
import { isNil } from '@ag1/nil'; import { returnSwitch } from '@ag1/return_switch'; import * as camelcase from 'camelcase'; import { of, Observable } from 'rxjs'; import { IGetAllColumnsResult } from '../get_all_columns'; import { getTsType } from '../get_ts_type'; import { isOptional } from '../is_optional'; export ...
07191fc00f55efa6dcc8cb73c9262f25fd960d5c
TypeScript
yubaoquan/minigrep
/leetcode/ts/easy/search.ts
3.796875
4
/** * 在排序数组中查找数字 I * https://leetcode-cn.com/problems/zai-pai-xu-shu-zu-zhong-cha-zhao-shu-zi-lcof/ * https://leetcode-cn.com/problems/zai-pai-xu-shu-zu-zhong-cha-zhao-shu-zi-lcof/solution/mian-shi-ti-53-i-zai-pai-xu-shu-zu-zhong-cha-zha-5/ */ function search(nums: number[], target: number): number { let i = 0; ...
b8c652276dbccf554a2f3205979e6466a42fb1df
TypeScript
thirschbuechler/git-assistant
/src/handlers/git/branch_changed/BranchWarn.handler.ts
2.765625
3
'use strict' import Git from '../../../models/Git' import InformationMessage from '../../../UI/InformationMessage' import InputBox from '../../../UI/InputBox' import MessageOption from '../../../UI/MessageOption' import QuickPick from '../../../UI/QuickPick' import QuickPickOption from '../../../UI/QuickPickOption' im...
5098aed0bee4f1bb88a8a5e0f67af09f9845f241
TypeScript
CS506-MS3/ms3-web
/src/app/_actions/crud.reducer.ts
2.8125
3
import * as CrudActions from './crud.actions'; export const reducer = (state, action, prefix, initialState) => { switch (action.type) { case prefix + CrudActions.SET: return (<CrudActions.Set>action).payload; case prefix + CrudActions.CLEAR: return initialState; case prefix + CrudActions.U...
43dd96a694f7e736568af272b41e35f94d064954
TypeScript
cenxky/flexivue
/webpack-helpers/src/index.ts
2.71875
3
import { Definition } from "../../lib/src/definition" export interface ECMAScriptModule { __esModule: boolean default?: object } export function definitionsFromContext(context: __WebpackModuleApi.RequireContext): Definition[] { return context .keys() .map((key) => definitionForModuleWithContextAndKey(co...
2adfbe699baf567e398602d63655395f6f3ccc24
TypeScript
jahow/simuworld-proto1
/ts/meshbuilder.ts
3.21875
3
/// <reference path="../bower_components/babylonjs/dist/babylon.2.2.d.ts"/> // This is a utility class that produces a mesh by building it // step by step with simple operations: add quad, etc. class MeshBuilder { // singleton pattern private static _inst: MeshBuilder; private static _getInstance(): MeshBuilder {...
993b461160fc95f6b9d078df09f46ee020e488a5
TypeScript
Jac21/GistsCollection
/Angular/Angular/UsingReduxToManageStateInAngular/pluralsight-angular-redux/src/app/blocks/spinner/spinner.service.ts
2.546875
3
import { Injectable } from '@angular/core'; import { Observable, Subject } from 'rxjs/Rx'; export interface ISpinnerState { show: boolean } @Injectable() export class SpinnerService { private _spinnerSubject = new Subject(); spinnerState = <Observable<ISpinnerState>>this._spinnerSubject.asObservable(); show...