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
c941a04e1655564640439e9c6694a85e50da5f84
TypeScript
knenkne/6cities
/src/store/reducer/cities/selectors.ts
2.65625
3
import {city} from '../../../common/types'; interface State { cities: { current: city; data: city[]; }; } export const getCity = (state: State) => { return state.cities.current; }; export const getCities = (state: State) => { return state.cities.data; };
e987f01c238827d140e3ca4708bc72ab41f01228
TypeScript
jpowersdev/lat_lng_radius
/pkg/lat_lng_radius.d.ts
2.78125
3
/* tslint:disable */ /* eslint-disable */ /** * @param {number} lat * @param {number} lng * @param {number} rad * @returns {Coords} */ export function within_radius(lat: number, lng: number, rad: number): Coords; /** */ export class Coords { free(): void; lat: Delta; lng: Delta; } /** */ export class Delta { ...
f8daf23cd6b93b425eaac261235ee8a76ca05074
TypeScript
DevelopByTarun/TODAY-HELP
/ANGULAR/Angular-2-4-5-6-JavaScriptFramework-master/PipesAndCustomPipes/app/employee.ts
2.59375
3
export class Employee { constructor(public id:number, public name:string, public age:number, public city:string) {} }
d7892adf6e57527acc3dc4aa3af5b4f7e2604079
TypeScript
expert-elm/util-extra
/base/boolean.test.ts
3.28125
3
import { to_boolean, is_boolean, is_true, is_false, is_falsy, is_truthy, } from './boolean' describe(to_boolean, () => { test('true', () => { expect(to_boolean(42)).toBe(true) expect(to_boolean({})).toBe(true) }) test('false', () => { expect(to_boolean(0)).toBe(false) expect(to_boole...
5a12ff9c66d55406ca5c830269c7135c9459e0a5
TypeScript
davolcu/tfg-app
/interfaces/instances.ts
2.640625
3
// Out of the box imports import { FunctionComponent } from 'react'; import { IconDefinition } from '@fortawesome/free-solid-svg-icons'; // Interface for the User entity export interface IUser { [key: string]: string; } // Interface for the Header dropdown options export interface IHeaderDropdownOption { id: ...
54e0ed6f443e19ea08fb5e1f6e802dde9a7c5d67
TypeScript
modegod/newPA
/packages/frontend/store/system/actions.ts
2.578125
3
import { SET_MOBILE_VIEW, SET_WINDOW_DIMENSIONS, ISystemState, ISetMobileViewAction, ISetWindowDimensionsAction, WindowDimensions, } from './types'; export const setMobileView = ( mobileView: ISystemState['mobileView'], ): ISetMobileViewAction => { return { type: SET_MOBILE_VIEW, mobileView, ...
e86dc06f18107c19085ca6eb6cbfaed20b95d34f
TypeScript
aws/aws-cdk
/packages/aws-cdk-lib/aws-lambda/lib/params-and-secrets-layers.ts
2.578125
3
import { Construct, IConstruct } from 'constructs'; import { IFunction } from './function-base'; import { Token, Stack, Duration } from '../../core'; import { RegionInfo, FactName } from '../../region-info'; /** * Config returned from `ParamsAndSecretsVersion._bind` */ interface ParamsAndSecretsBindConfig { /** ...
333aa68487a3bf8663329b5342efd510061a035f
TypeScript
ToggyO/ts-inversify
/services/tsi-service-data/src/modules/v1/sales-flat-order/sales-flat-order.validator.ts
2.65625
3
/** * Description: Validators for the sales flat order service */ import { BaseValidator } from 'modules/common'; import { Validator, ValidatorError } from 'utils/validation'; import { CreateOrderPayload, BookOrderItemsUpdateOrderPayload } from './types'; export class SalesFlatOrderValidator extends BaseValidator ...
65ef33ebfbc687f699485ae0dcbf0531d9a80a19
TypeScript
storm1er/jsmake-libraries
/06_maester/src/lib/exceptions/BaseException.ts
2.953125
3
export class BaseException { constructor(input, exception = null) { Object.keys(input).forEach((key) => { if (key in this) { return; } this[key] = input[key]; }); this.exception = exception; } static wrap(input, ex) { if ...
a8b80ed3c7127292332589e26059b849a02ca057
TypeScript
eprincev-egor/model-layer
/lib/type/Type.ts
2.90625
3
import EqualStack from "../EqualStack"; import { UnknownTypeError, ReservedWordForPrimaryKeyError, InvalidValidationError, InvalidKeyValidationError } from "../errors"; import {invalidValuesAsString} from "../utils"; const FORBIDDEN_PRIMARY_KEYS = [ "row", "primaryKey", "prim...
e36019f41a20e351926031c5e1c44e4d258c4457
TypeScript
maechabin/react-native-typescript-sample
/src/actions.ts
2.765625
3
export interface Action { type: ActionType, payload?: any, } export enum ActionType { CHANGE_HELLO_TO_ABE, CHANGE_HELLO_TO_KIM, CHANGE_HELLO_TO_MAEDA, } export function changeToAbe(): Action { return { type: ActionType.CHANGE_HELLO_TO_ABE, payload: 'abe', }; } export function changeToKim(): Act...
88be6ab8f44518fb0c03a4bce260ed46763888bd
TypeScript
yiwanzhutourou/KeepLightProject
/src/utils/reg.ts
2.546875
3
export const pattern = { 'wechat': /^[a-zA-Z\d_]{5,}$/, 'qq': /^[0-9]{4,15}$/, 'email': /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/, 'mobile': /^1[34578]\d{9}$/, 'smscode': /^\d{6}$/, } export const verifyReg = (text: string, patternName: string) => { let pat = pattern[patternName] ...
aa6b63bac481d882a75e7ea368ede98592d790d0
TypeScript
roma-lukashik/matrix-ts
/src/iteration/neach.test.ts
2.828125
3
import { neach } from './neach' import { reshape } from '../geometry/reshape' import { arange } from '../creation/arange' describe('neach', () => { it('iterates over Matrix0', () => { const args: [number][] = [] neach(1, (...arg) => args.push(arg)) expect(args).toEqual([[1]]) }) it('iterates over al...
dbdbfba5b23918faaf34b27e560ee9fd764c163e
TypeScript
typeorm/typeorm
/test/functional/columns/update-insert/entity/Post.ts
2.546875
3
import { Entity } from "../../../../../src/decorator/entity/Entity" import { Column } from "../../../../../src/decorator/columns/Column" import { PrimaryGeneratedColumn } from "../../../../../src/decorator/columns/PrimaryGeneratedColumn" @Entity() export class Post { @PrimaryGeneratedColumn() id: number @...
ccab564ab0dacd064c6996444f0d984aca36887d
TypeScript
Ishadijcks/test
/src/ig-template/features/statistics/requirements/NumberStatisticRequirement.ts
2.875
3
import {Requirement} from "@/ig-template/tools/requirements/Requirement"; import {NumberStatistic} from "@/ig-template/features/statistics/NumberStatistic"; export class NumberStatisticRequirement extends Requirement { statistic: NumberStatistic; targetValue: number; constructor(statistic: NumberStatisti...
b7f9d8d1b7df648937122f5be3167da8026ab69f
TypeScript
Lameaux/cloudpass
/pages/api/user_data.ts
2.6875
3
import { NextApiRequest, NextApiResponse } from 'next'; import PasswordRowData from '../../types/PasswordRowData'; import SecretNoteRowData from '../../types/SecretNoteRowData'; import FolderRowData from '../../types/FolderRowData'; function createFolder(id, name, description): FolderRowData { return { id, name, ...
244a622e90c92fb542c5ce772610dd6a3fdb3da9
TypeScript
cydran/cydran
/test/error/Errors.spec.ts
2.984375
3
import { BehaviorError, ComponentStateError, AmbiguousMarkupError, DigestLoopError, InvalidTypeError, LockedRegionError, MalformedOnEventError, ModuleAffinityError, NullValueError, RecursionError, RegistrationError, ScopeError, SelectorError, SetComponentError, TemplateError, UnknownComponentError, Unk...
c2907333e48c8bbeb8938cc2e4e53ef715c4b2f3
TypeScript
island-is/island.is
/libs/service-portal/petitions/src/lib/utils.ts
2.6875
3
import { Endorsement } from '@island.is/api/schema' import format from 'date-fns/format' export const formatDate = (date: string) => { try { return format(new Date(date), 'dd.MM.yyyy') } catch { return date } } export const PAGE_SIZE = 10 export function paginate( petitions: Endorsement[], pageSize...
df699777a4b0a9d4f2d79c8b5a23a274984bf4a0
TypeScript
iokononyuk/io-lazy-loader
/src/io.lazy-loader.ts
2.828125
3
class IOLazyLoader { public document: Document = document; public window: Window = window; private config: IOLoaderConfig; constructor(config: IOLoaderConfig) { this.config = config; this.initIOLoader(); } public initIOLoader(): void { if (this.config.afterInit) { ...
fc83f19470c80012c6d151627f49ce1d24d028d2
TypeScript
DefinitelyTyped/DefinitelyTyped
/types/array-binarysearch.closest/array-binarysearch.closest-tests.ts
3.65625
4
import binarySearch = require('array-binarysearch.closest'); // Test with object class Record { constructor( public time: Date, ) { } } binarySearch( [new Record(new Date(21)), new Record(new Date(42)), new Record(new Date(91)), new Record(new Date(91))], new Record(new Date(92)), (a: Record, b: Reco...
dc4b140327c6302b25b266e402b212a61c389037
TypeScript
vorfol/vms
/src/config_v2/sections/user-password.ts
2.828125
3
import { ConfigSection, ConfigData } from "../config_v2"; import { UserPasswordHostConfig } from "../../host-config"; import { isNumber, isString } from "util"; /** * ConfigSection implementations * * * */ export class UserPasswordSection implements ConfigSection, UserPasswordHostConfig { host: str...
a809f3fa9f196439e0b11a5c5c19e6cff64584cc
TypeScript
cooliean/vue3-antd-admin
/src/api/system/role/model.d.ts
2.5625
3
declare namespace API { /** 新增角色 */ type CreateRoleParams = { name: string; label: string; remark: string; menus: Key[]; depts: number[]; }; /** 更新角色 */ type UpdateRoleParams = CreateRoleParams & { roleId: number; }; /** 角色列表项 */ type RoleListResultItem = { createdAt: string...
c98f21c840221a926fdb471787ffaf78a8d5dc05
TypeScript
xiao-tiger/svg-drawing-vue
/src/util.ts
3.234375
3
/** * 生成随机码 * @param len 随机码长度 */ export function createRandomCode(len = 11): string { const charset = `_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`; const maxLen = charset.length; let ret = ""; for (let i = 0; i < len; i++) { const randomIndex = Math.floor(Math.random() * maxLen); ...
428feea4af5c4f83b3b9d5c1a4f64afcbee81d98
TypeScript
craigphicks/yamato_daiwa-es_extensions
/Source/Logging/Errors/FileWritingFailed/FileWritingFailedError.ts
2.765625
3
import FileWritingFailedErrorLocalization__English from "./FileWritingFailedErrorLocalization__English"; class FileWritingFailedError extends Error { public static readonly NAME: string = "FileWritingFailedError"; public static get DEFAULT_TITLE(): string { return FileWritingFailedError.localization.defaultT...
0a1f33151d67c6261ebb4519b41e44c6dd3d697a
TypeScript
AnimeNL/volunteer-portal
/src/api/IUser.ts
3
3
// Copyright 2021 Peter Beverloo & AnimeCon. All rights reserved. // Use of this source code is governed by a MIT license that can be // found in the LICENSE file. /** * The /api/user API call enables information about the authenticated user to be requested, which * immediately validates that the given authenticatio...
e2178ddcadd6e06e10e26a7db03ff92e29677187
TypeScript
Marinammm/SmarttbotTest
/src/store/strategy/strategy.reducer.ts
2.953125
3
import { GET_STRATEGIES, GET_STRATEGIES_FAILED, GET_STRATEGIES_SUCCESS, Strategy, StrategyActionTypes, } from './strategy.types'; const initialState: Strategy = { loading: false, error: undefined, data: undefined, }; const strategyReducer = ( state = initialState, action: StrategyActionTypes, ): S...
33630952c55e655eb200dce2a904c30b5fc6eaa5
TypeScript
nuclearide/reactor
/src/Selection.ts
3.203125
3
export class Selection { static in(target, a, b) { let min = Math.min(a.line, b.line); let max = Math.max(a.line, b.line); return target >= min && target <= max; } static between(target, a, b) { let min = Math.min(a.line, b.line); let max = Math.max(a.line, b.line); ...
fa1f7197037ed12a5242614c38c5bc74dc717736
TypeScript
devashreegosavi/angular_demo
/demo1.ts
3.0625
3
import { Top } from './oops'; let nm: string = 'android' let num = 456 function nmNum(): string { return `android`; } let mg: number | string | boolean = true mg = 'android' mg = 1235 let an: any = mg let fn: (nm: number) => void = function (nm: number) { } let fn1: (nm: number) => void = (nm: nu...
5cb427fff59adae9855034dc89fc9d89bf815314
TypeScript
SteffenKn/cloudflare-ddns-sync
/src/lib/ip-utils.ts
2.703125
3
import * as wimIp from 'what-is-my-ip-address'; import {publicIpv4, publicIpv6} from 'public-ip'; export default class IPUtils { private static readonly ipPollingDelay = 10 * 1000; private static ipChangeEventListeners: Map<string, NodeJS.Timeout> = new Map(); public static async getIpv4(): Promise<string> { ...
95f6e9ec9982ac2de33c7780f5b1a513009ef78f
TypeScript
JuvenalG/nodebucket
/src/app/shared/item.interface.ts
2.59375
3
/** * Title: item.interface.ts * Author: Professor Krasso * Date: 29 March 2021 * Modified By: Juvenal Gonzalez * Description: defines data fields to be used in an Item object */ export interface Item{ _id: string; title: string; description: string; }
530934d8fc66db05f03158f894d29e1a64ff6d7c
TypeScript
kelvinleaves/engine
/packages/core/src/shader/state/RenderTargetBlendState.ts
2.78125
3
import { BlendOperation } from "../enums/BlendOperation"; import { BlendFactor } from "../enums/BlendFactor"; import { ColorWriteMask } from "../enums/ColorWriteMask"; /** * The blend state of the render target. */ export class RenderTargetBlendState { /** Whether to enable blend. */ enabled: boolean = false; ...
d661982b7407444befe933aa6c47611853244e3c
TypeScript
samaronybarros/data-structures
/src/test/binary-search-tree.test.ts
3.203125
3
import * as chai from 'chai' import { BinarySearchTree } from '../core/binary-search-tree' const expect = chai.expect describe('Binary Search Tree', () => { describe('Insert', () => { it('Should insert a value to root', () => { const tree = new BinarySearchTree() tree.insert(27) const root =...
1dc74944f67157f5a44c9a1eb9bf238fd151b11b
TypeScript
srestrepoo/backend-homework
/src/users/users.controller.spec.ts
2.546875
3
import { UsersController } from './users.controller'; import { UsersService } from './users.service'; import { CreateUserDto } from './dto/create-user.dto'; import { User } from './interfaces/user.interface'; import { Model } from 'mongoose'; describe('UsersController', () => { let usersController: UsersController;...
b2444d1f116b5b65062cf62ca555a669e6cb6f9c
TypeScript
krybc/budget-app
/src/app/categories-data-access/store/categories.reducer.ts
2.546875
3
import {createEntityAdapter, EntityAdapter} from '@ngrx/entity'; import {Action, createReducer, on} from '@ngrx/store'; import * as CategoriesActions from './categories.actions'; import {Categories, Category} from './categories.models'; export const CATEGORIES_FEATURE_KEY = 'categories'; export interface State { ca...
cab37a8eccf949dc26f57a4df8c1fb5ff2a31f3a
TypeScript
ivanmjartan/gooddata-js
/src/util.ts
2.671875
3
// (C) 2007-2017 GoodData Corporation import { get } from 'lodash'; import { delay } from './utils/promise'; import { name as pkgName, version as pkgVersion } from '../package.json'; /** * Utility methods. Mostly private * * @module util * @class util * */ /** * Gooddata-js package signature * @private */ e...
436eff03f305729d95bddbb95f1e1510ac90e4a8
TypeScript
gil/noto
/src/store.ts
2.828125
3
import * as fs from 'fs-extra' import * as path from 'path' let configFile: string let state: { currentVault: string; vaults: {[vault: string]: string}; } = { currentVault: '', vaults: {}, } export default { async init(configDir: string) { configFile = path.join(configDir, 'config.json') if (await ...
aa3009d6637c437d16a22b8514d11940a4dfe050
TypeScript
datools/dadoc
/src/core/Yaml.ts
3.125
3
import * as fs from 'fs-extra'; import * as yaml from 'js-yaml'; /** * YAML parser and dumper */ export class Yaml { /** * Load a yaml file * @param filepath File to read */ public static async load(filepath: string) { const buffer: Buffer = await fs.readFile(filepath); return yaml.safeLoad(buf...
ec5c6822f966b492a2b8145a7969494e2be4ce50
TypeScript
EmNudge/get-smallest-chars
/src/getChars.ts
2.9375
3
const getChars = ({ checkers, range }) => { const chars = []; outer: for (let i = range[0]; i < range[1]; i++) { // no idea why TS doesn't like this. This is old at this point. // @ts-ignore const char = String.fromCodePoint(i); for (const charChecker of checkers) { ...
6c1956ac1b62a12cc64e3aef83c8300ebb5d5ebc
TypeScript
enkhdari/expressjs-mongoose-ts
/src/controllers/base.controller.ts
2.5625
3
export class BaseController { returnData(data) { return { success : true , data } } returnSuccess(success: boolean) { return { success } } returnError(error) { return { success: false, error } } }
9089d43e1fe38c1ff1fed58ede3d067387623d08
TypeScript
gabliam/gabliam
/packages/core/core/src/common/interfaces/type.ts
3.359375
3
/** * * Represents a type that a Service or other object is instances of. * * An example of a `Type` is `MyCustomService` class, which in JavaScript is be represented by * the `MyCustomService` constructor function. */ export const Type = Function; export function isType(v: any): v is Type<any> { return typeof...
40e0ef7680b8888431777fe0f4c655a580236449
TypeScript
robinsl/BennuJs
/src/interfaces/cache-engine.interface.ts
2.71875
3
export interface CacheEngineInterface { get(key: string): Promise<string>; set(key: string, value: string, ttl: number, grace: number): Promise<string>; clear(key: string): Promise<string>; }
cdbc1bffdf8a69b047ec854c3c6b35e581dab642
TypeScript
isaacev/TinyGit
/src/plumbing.ts
2.71875
3
import { format as fmt } from 'util' import * as path from 'path' import * as fs from 'fs' import * as io from './io' import * as resolve from './resolve' import { ID } from './models/object' import { Commit } from './models/commit' import { Tree, TreeChild } from './models/tree' import { Blob } from './models/blob' i...
49706b2dedbe4950242441638e769949baa3b5ae
TypeScript
hendrik-scholz/iot-device-information
/test/messages/messageGenerator.spec.ts
2.546875
3
import chai from 'chai'; import fs from 'fs'; import waitOn from 'wait-on'; const expect = chai.expect; import { generateUUIDMessage } from '../../src/messages/messageGenerator'; const waitOnOptions = { delay: 500, interval: 500, resources: ['test/messages/uuid.json'], timeout: 3000 }; function dele...
dc9ff8443098bf5ccfc7608982a5f6341e5a6fc0
TypeScript
fkopriva/blog-ukol
/blog-ukol/backend/src/resolvers/comment.ts
2.625
3
import { Comment } from "../entities/Comment"; import { isAuth } from "../middleware/isAuth"; import { Arg, Ctx, Field, FieldResolver, Int, Mutation, ObjectType, Query, Resolver, Root, UseMiddleware } from "type-graphql"; import { MyContext } from "../types"; impo...
5fd883fc83b38128e957d3e2f87fc854bc3d796d
TypeScript
BroFred/wp5-and-single-spa
/packages/dashboard/src/utils/dataSourceUtils.ts
2.796875
3
// This util convert data fetch function to observable which emits json /* input(funtion which returns json) */ import { from, empty, Observable, } from 'rxjs'; import LinkHeader from 'http-link-header'; const toAsync = (fn:Function) => async (...args:any[]) => fn(...args); export const toObservable = (fn...
5944d82d42140fe994439bf9db02032ce4df1361
TypeScript
leonamtv/base-converter
/base-conversor/src/app/app.component.ts
2.65625
3
import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent { base2: string = '0' base8: string = '0' base10: string = '0' base16: string = '0' base2Only ( event: any ) { let k ...
ee48d547093dce49cb7d751df84f81f5d52534eb
TypeScript
guagin/foodies_0321
/src/authentication/command/domain/user/service/user-login-service.ts
2.71875
3
import { UserRepository } from "../user-repository" import { User } from "../model/user" import { UserEventPublisher } from "../event/user-event-publisher" import { UserNotFound } from "../error/user-not-found" import { PasswordNotMatched } from "../error/password-not-matched" export class UserLoginService { ...
0f3c3a76fd93cf3f6b95e8ace3e6833488c19761
TypeScript
tylearymf/psd2ugui.ts
/src/Factories/NodeFactory.ts
2.515625
3
namespace psd2ugui { export class NodeFactory { public static GetInstanceByType(baseLayer: BaseLayer) { var nodeType = baseLayer.nodeType Global.GetInstance().mainDoc.activeLayer = baseLayer.layer let node: BaseNode switch (nodeType) { case C...
828e8fb706f64606d7112f991f0b9c9343ffeea3
TypeScript
ldh2016/test
/testDictionary/src/LayaSample.ts
3.71875
4
// 程序入口 class GameMain { private dic: Laya.Dictionary; constructor() { Laya.init(600, 400); this.dic = new Laya.Dictionary(); //生成3个玩家信息 for (let i: number = 0; i < 3; i++) { let roleInfo: RoleInfo = new RoleInfo(); roleInfo.account = "role_" + (i + 1...
b13bc9e073cba20cef7ca204753198af6fcdf250
TypeScript
studiometa/js-toolkit
/packages/js-toolkit/utils/math/clamp.ts
3.609375
4
/** * Clamp a value in a given range. * * @param {number} value * @param {number} min * @param {number} max * @returns {number} */ export default function clamp(value: number, min: number, max: number) { /* eslint-disable no-nested-ternary */ return min < max ? value < min ? min : value > max...
d6eb6c63c1f7fcc853e09631000a62c055cc5168
TypeScript
Veams/http-service
/src/index.ts
2.796875
3
/** * Represents a simple http service, which returns a promise. * * @module http * @author Sebastian Fitzner */ // Imports import Base from '@veams/base'; export interface RequestObject { method?: string; url?: string; type?: string; data?: string; } export interface ServiceOptions { url?: ...
05462d891a076b606afb57dd88d6e56afd3d1351
TypeScript
milkshakeWaves/menu-code-test-react
/src/rules/PierreWaiterRule.ts
2.875
3
import { Order } from "../models/Order"; import { Dish } from "../models/Dish"; import { Rule, RuleResult } from "./Rule"; const PRAWN_COCKTAIL_ID = 4; const SALMON_FILLET_ID = 7; export default class PierreWaiterRule implements Rule { check(orders: Order[]): RuleResult { for (let i = 0; i < orders.length...
d59b2ce78a6f1d90ab0deb3b351bffb4b9e2c237
TypeScript
NatalyStroynov/techsee
/src/app/app.service.ts
2.703125
3
import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable, of } from 'rxjs'; import { catchError, map,tap } from 'rxjs/operators'; const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json','Access-Control-Allow-Origin':'...
5cce75574032946c4c50e7f0811985054481ecf0
TypeScript
Algoritm211/painting-market
/src/store/paintingsStore.ts
2.640625
3
import {action, makeAutoObservable, observable, runInAction} from "mobx"; import {IPainting} from "../types/types"; import {paintingsTestAPI} from "../api/api"; import Venera from "../assets/paintings/venera_born.png"; import Dinner from "../assets/paintings/dinner.png"; import Adam from "../assets/paintings/adam.png";...
f19b833aebedc304253257d3cbe10f5555b390af
TypeScript
covertbert/cats-api-graphql
/src/mutations/createCat/mutation.ts
2.578125
3
import { UserInputError } from 'apollo-server' import logger from '../../logger' import { Cat } from '../../types/Cat' import { Resolver } from '../../types/GraphQl' const createCat: Resolver = async ( _, args: { cat: Omit<Cat, 'id'> }, context ) => { const { cat } = args const { CatService } = contex...
991b1c8a125a259d55aa5392756b4772da56de6e
TypeScript
stentorium/stentor
/packages/stentor-guards/src/isActionable.ts
2.859375
3
/*! Copyright (c) 2019, XAPPmedia */ import { Actionable } from "stentor-models"; /** * Guard to check if the object is actionable. * * @param {(T | Actionable<T>)} potential * @returns {potential is Actionable<T>} */ export function isActionable(potential: object | Actionable): potential is Actionable { retu...
ab58ad146674ad52e82b090b3c37897024506ad2
TypeScript
samousavih/fullstack-typescript-mono-repo
/common/index.ts
2.5625
3
import { isBuffer } from "node:util"; export interface IUser { id: string; name: string; } export type GetUser = (id: string) => Promise<IUser>; export interface ICanGetUser { getUser(id: string): Promise<IUser>; }
f4866897d3e8c30a0a74498ceb8377bc216500b1
TypeScript
AlexcastroDev/castroclock
/__tests__/CastroClock.spec.ts
2.734375
3
import { CastroClock } from '../src/index' import { initialCurrentTimeString, initialCurrentTime, } from './__mocks__/CastroClock.mocks' import { initialTimerProxy, } from './__mocks__/instance.mocks' jest.setTimeout(10000); describe('Chronometer Functions', () => { beforeEach(() => { Cast...
7d023e005c4d72aa5e833066fb86ea3a0cd6bbf6
TypeScript
k3ith-fowl3r/platform
/modules/component-store/src/tap-response.ts
3.140625
3
import { EMPTY, Observable } from 'rxjs'; import { catchError, finalize, tap } from 'rxjs/operators'; type TapResponseObserver<T, E> = { next: (value: T) => void; error: (error: E) => void; complete?: () => void; finalize?: () => void; }; export function tapResponse<T, E = unknown>( observer: TapResponseObs...
eb294feedc3f2a4b9d6c69a12ebcea0e6a812062
TypeScript
alex-haas/angular-gof2
/src/app/gof/gof.component.ts
2.59375
3
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-gof', templateUrl: './gof.component.html', styleUrls: ['./gof.component.css'] }) export class GofComponent implements OnInit { width: number = 16; height: number = 48; cellSize: number = 10; rows: number[] = Array(this.height...
d3fece62defecc35ad3545d998850f51a9623645
TypeScript
green-fox-academy/vis0rka
/week-04/day-2/post-it.ts
3.453125
3
class PostIt { backgroundColor: string; text: string; textColor: string; constructor(message:string,textColor:string,backgroundColor:string) { this.text = message; this.backgroundColor = backgroundColor; this.textColor = textColor; } textPostIt():string { return `post it text: ${this.tex...
dc49392aca6f7cc495c1977f5541f740151ec53a
TypeScript
ngxs/store
/packages/logger-plugin/src/log-writer.ts
2.75
3
import { NgxsLoggerPluginOptions } from './symbols'; export class LogWriter { private logger: any; constructor(private options: NgxsLoggerPluginOptions) { this.options = this.options || <any>{}; this.logger = options.logger || console; } startGroup(message: string) { const startGroupFn = this.opti...
7578fac34f14811851936fba825022f9ecceae95
TypeScript
ngAnzar/core
/src/animation.module/renderer.service.ts
2.546875
3
import { Injectable, ElementRef, Inject, Optional, Renderer2, RendererFactory2, RendererStyleFlags2 } from "@angular/core" import { memoize } from "../util" @Injectable() export class Renderer extends Renderer2 { @memoize() public get renderer(): Renderer2 { if (this._renderer) { const r ...
3a16c9151606f87ab03a9f8eb43517c3a81aec0e
TypeScript
DmitryAstafyev/ceres
/server/transports/ws/src/transport.connection.ts
2.6875
3
import * as HTTP from 'http'; import { Tools } from 'ceres.provider'; type THeaders = { [key: string]: string }; export class Connection extends Tools.EventEmitter { public static EVENTS = { onAborted: Symbol(), }; private _request: HTTP.IncomingMessage; private _response: HTTP.ServerRespon...
e65e424943d1895d8dd6291bf6bb2196d5ba3256
TypeScript
abhioshar/meanapp
/angular-src/src/app/helper/player.ts
3.015625
3
export class Player { score: number = 0; isComputer: boolean = true; updateScore(increment: number) { this.score += increment; } }
126b322edf390566ab672726467710178a73edcd
TypeScript
textlint/textlint
/packages/@textlint/kernel/test/messages/sort-messages-process-test.ts
2.59375
3
// LICENSE : MIT "use strict"; import * as assert from "assert"; import sortMessages from "../../src/messages/sort-messages-process"; import { TextlintMessage } from "@textlint/types"; const createTextlintMessage = ( message: Partial<TextlintMessage> & { line: number; column: number } ): TextlintMessage => { r...
6a5f8618add521fa8e4e35d71709061aaf388732
TypeScript
shankarganesh1234/BarterUiClient
/src/app/models/error-messages.ts
2.515625
3
export class Messages { user_not_logged_in: string; orig_user_interested_user_equal: string; constructor() { this.user_not_logged_in = "Please log in to facebook to express interests, swap items and more..."; this.orig_user_interested_user_equal = "You cannot express interest for your own ...
c0424296fa79aa962962d680b3e57a152a249c34
TypeScript
thiscouldbebetter/EconomicsGame
/Source/Model/DemoData.ts
2.703125
3
class DemoData { world(mapSizeInPixels: Coords): World2 { var mapSizeInCells = new Coords(16, 16, 1); var mapCellSizeInPixels = mapSizeInPixels.clone().divide ( mapSizeInCells ); var mapTerrains = [ new MapTerrain ( "Floor", ".", 1, // costToTraverse new VisualRectangle ( ...
968cc76dcd3738394acd65c644d605936b98ce04
TypeScript
SanjayTalyaOfficial/lab-typescript-string-number-manipulations
/started-code/main-service.ts
3.109375
3
//progression 1 export interface StringManipulationService { print(word:string): void; printWithSpace(sentence:string) : void; findVowel(str: string) : void; } //progression 3 export interface NumberManipulationService { findPrime(num:number):void; findMagic(num:number):void; }
6b6834bcd472673eee260d4b77da5eb7bfbb9e97
TypeScript
BrennerBatR/nestjs-kafka
/src/submission/submission.service.ts
2.515625
3
import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { ChallengeService } from '../challenge/challenge.service'; import { Between, FindConditions, Repository } from 'typeorm'; import { Submission, SubmissionStatus } from './entity/submission.entity'; import { CreateSub...
b0d9b9c441b0035cedb0d525d1654bade3d2485d
TypeScript
vialab/spatial-abilities-public
/frontend/src/js/taskBase/TaskController.ts
2.578125
3
import {Option} from "../ui/Option"; import {TaskDisplay, UserInterface} from "../io"; import {Timer, UnlimitedTimer} from "../metrics"; export abstract class TaskController { private promise : Promise<void>; protected resolve : () => any; protected reject : (reason : any) => any; constructor() { this.resolve...
d8f87d75525ae9393574a0b7316152cb1d9068ba
TypeScript
sonuishaq67/tsjs
/noobstuff/objInt.ts
3.859375
4
interface ObjectC { m3: string; } interface ObjectB { m2?: ObjectC; } interface ObjectA { m1?: ObjectB; } function print(o: ObjectA): void { if (o.m1) { if (o.m1.m2) { console.log(o.m1.m2.m3); } } } const obj1: ObjectA = { m1: undefined, }; const obj2: ObjectA = { ...
f097871c2c89f3b22582dd00926d64252f0afc16
TypeScript
Moshiach770/flow-js-sdk
/packages/protobuf/src/generated/flow/entities/event.ts
2.734375
3
import * as pb_1 from "google-protobuf"; export namespace entities { export class Event extends pb_1.Message { constructor(data?: any[] | { type?: string; transaction_id?: Uint8Array; transaction_index?: number; event_index?: number; payload?: Uint...
5252ca406b53fa8b1e49200d9dc8a34b05d94f58
TypeScript
PenghaiZhang/openEQUELLA
/oeq-ts-rest-api/src/Schema.ts
2.625
3
/* * Licensed to The Apereo Foundation under one or more contributor license * agreements. See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * The Apereo Foundation licenses this file to you under the Apache License, * Version 2.0, (the "License"); you ma...
c55f6090342d23333afb6db503065f6fcabee145
TypeScript
Trebossalol/simple-authentication
/src/util.ts
2.84375
3
import * as Express from 'express' import SimpleAuth from '.' export interface ApiOnErrorProps { req: Express.Request res: Express.Response } export interface ViaLoginProps { username: string } export interface ViaUserID { userID: string | number } export interface UserTemplate { ...
1fb7721b1ff4f79bd7e2e0fb054edeaf664a5b4e
TypeScript
fclebinho/gostack-gobarber-backend
/src/modules/users/providers/hash/fakes/hash.ts
2.578125
3
import { IHashProvider } from '@modules/users/providers'; class BCryptHash implements IHashProvider { public async generate(payload: string): Promise<string> { return payload; } public async compare(payload: string, hashed: string): Promise<boolean> { return payload === hashed; } } export default BCr...
eb0af9c8f27338d14e15cd087a16b0a49057fed7
TypeScript
bruennijs/sabbat.notes
/src/main/sabbat.notes.app/domain/user/UserFactory.ts
2.5625
3
/** * Created by bruenni on 24.09.15. */ import mongodb = require('mongodb'); import _ = require('underscore'); import {IFactory} from "../../common/ddd/factory"; import {Id} from "../../common/ddd/model"; import {ObjectID} from "mongodb"; import {User} from "./User"; export class UserFactory implements IFactory<Us...
e8a23f9055b623c632ad57e061a00e6d4ff7a43b
TypeScript
mhaligowski/vocally
/src/log.ts
3.09375
3
export interface Logger { debug(...args: any[]): void; info(...args: any[]): void; } // Dummy placeholder for a logging function export default function getLogger(): Logger { throw new Error("This is unimplemented."); } // Dummy hook implementation. // eslint-disable-next-line @typescript-eslint/no-unused-vars ...
a9bfff88fe152520ae7b77bafbea1795936375d6
TypeScript
banksean/patchcab
/core/src/state/libraries.ts
2.703125
3
import { get, writable } from 'svelte/store'; class Libraries { private libraries = writable<{ id: string; loaded: boolean; script: HTMLScriptElement }[]>([]); public async add(libList: string[]) { const $libs = get(this.libraries); return Promise.all( libList.map((lib) => { return new Prom...
f0e625e65f0d92770398684519f1e7a9deed87ba
TypeScript
LucasTonetto/penguin-adinfo
/src/ts/models/Auth.ts
3
3
import { RoutesPermission } from './RoutesPermission'; export class Auth { private _permission: string; private _agency: string; private _company: string; private _email: string; constructor(permission: string, company: string, agency = '', email: string) { this._permission = permission; this._agency = agenc...
7c90ce705f7b6a92ff996098d5fbe09190d32b3b
TypeScript
ferdingler/cdk-openapi-example
/lib/booksapi-stack.ts
2.546875
3
import * as cdk from "@aws-cdk/core"; import { SpecRestApi, ApiDefinition } from "@aws-cdk/aws-apigateway"; import { Function, Runtime, Code } from "@aws-cdk/aws-lambda"; import * as iam from "@aws-cdk/aws-iam"; import * as yaml from "yamljs"; import * as fs from "fs"; export class BooksApiStack extends cdk.Stack { ...
5807a8458b70892e118ff01b402d22903e220b37
TypeScript
Najdi1996/TS-Labki
/Drumkit/src/index.ts
2.671875
3
let boomSound :HTMLAudioElement; let clapSound : HTMLAudioElement; let hihatSound :HTMLAudioElement; let kickSound: HTMLAudioElement; let operhantSound: HTMLAudioElement; let rideSound: HTMLAudioElement; let snareSound: HTMLAudioElement; let tinkSound: HTMLAudioElement; let tomSound: HTMLAudioElement; let channel1:a...
b2485f8e5f8433d902ce68cacb9356d996f79f63
TypeScript
ahmad245/Functional-Programming-with-TypeScript
/curring.ts
3.875
4
// Currying is a functional programming technique that allows us to partially apply // a function without having to worry about the way in which we implement our // functions. Currying is the process of taking a function that takes multiple // arg(uments and transforming it into a chain of unary functions. The followin...
e3914320abf1056ff146224344e4e011f312d110
TypeScript
rapkeb/Principles-of-Programming-Languages
/Assignment1/result.ts
3.640625
4
/* Question 3 */ import { useWith } from "ramda"; interface Ok<T> { tag: "Ok"; value: T; } interface Failure { tag: "Failure"; message: string; } export type Result<T> = Ok<T> | Failure; export const makeOk = <T>(x: T): {tag: "Ok",value: T} => ({ tag: "Ok", value: x}); export const...
17cf999dbdb342045fb9bff24d621f5b0ecc2991
TypeScript
turbobo/Ant-demo
/src/models/detaildemo.ts
3.171875
3
// 导入接口文件,并采用解构的方式, // 将detaildemo.js的文件里面的getDetail赋值给这里的getDetail import { getDetail } from "@/services/detaildemo"; export default { namespace: "detaildemo", // State 是储存数据的地方,收到 Action 以后,会更新数据。 state: { data: {} }, effects: { /** * @param payload 参数 * @param call 执行异步函数调用接口 * @...
ddb74b07ae9b6ef3dcb641f77642e3bc327f248c
TypeScript
valex91/maze-gen
/src/main-canvas-generator/main-canvas-generator.ts
2.5625
3
import { PIXEL_FIX } from '../maze-renderer/pixel_fix.constant'; import { TILE_SIZE } from '../maze-renderer/tile-size'; export class MainCanvasGenerator { private static ref: HTMLCanvasElement; public static generate(size: number): HTMLCanvasElement { const canvasElement: HTMLCanvasElement = self.document.cr...
e745d7d9ba630a4cfc028bdc841e19463aa70124
TypeScript
dbarczewski/Cashier-Register-App
/cypress/integration/app.spec.ts
2.75
3
/// <reference types="cypress" /> import Content from "./../../content.json"; describe("The App", () => { beforeEach(() => { cy.visit("http://localhost:8080/"); }); it("should type the same amount", () => { cy.write("1234").write("{enter}").write("1234").write("{enter}"); cy.get("dialog").should("co...
13fd60b6713d4291471542c21002adef33f762a7
TypeScript
kaikai2823/GunnerComing
/src/view/gun.ts
2.625
3
/**Created by the LayaAirIDE*/ module view{ export class gun extends ui.gunUI{ public isShootEnemy:boolean = false; constructor(){ super(); this.addChild(this.gun); } //触发条件为,主角射击后 public enemyGunInit(shootRotation:number):void{ this.gun.rotation = 0; //从水平方向转动到特定位置 Laya.timer.frameLoop(1,thi...
50d1f310f263e19e1fbe2368313d51fa10783414
TypeScript
elear-solutions/kibana
/x-pack/legacy/plugins/upgrade_assistant/server/lib/query_default_field.ts
2.609375
3
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ import Boom from 'boom'; import { Request } from 'hapi'; import { get } from ...
6fa75c7be0910f39d332f2edd2972290721f1d4f
TypeScript
Linjovi/git-repos-manager
/pages/store/reducers.ts
2.75
3
import { Action } from 'rxjs/internal/scheduler/Action'; var initialReposState: any[] = []; export function _repos(state = initialReposState, action: any) { switch (action.type) { case 'GET_REPOS': return action.repos; case 'GET_STATUS': let index = state.findIndex( (item: any) => item.na...
76c3f9e407a5307971efa865aa91bb57846786c4
TypeScript
skyformat99/CoSky
/cosky-dashboard/src/app/model/RowExpand.ts
3.09375
3
export class RowExpand<Data> { data: Data; expand = false; constructor(data: Data, expand: boolean) { this.data = data; this.expand = expand; } static of<Data>(data: Data, expand: boolean = false): RowExpand<Data> { return new RowExpand(data, expand); } }
236d41c078c40136ca94431974e59409e82a3d6d
TypeScript
robertomassabr/rakkas-realworld
/api-test/form/delete-article.test.ts
2.703125
3
import { Article, SingleArticleResponse } from "lib/api-types"; import { apiCall, formSubmit, registerJaneFoo, registerJohnDoe, resetDb, } from "../api-test-helpers"; describe("Update Article API", () => { let article: Article; let johnsToken: string; beforeEach(async () => { await resetDb(); const john ...
e69f2348835f35de0d850c84809cc91364a5207e
TypeScript
alibaba/G3D
/src/mesh/base-mesh.ts
2.546875
3
import Node from "../core/node"; import Scene from "../scene/scene"; import { findIndex } from "../utils/lodash"; import BaseGeometry from "../geometry/base-geometry"; import ShaderMaterial from "../material/shader-material"; class BaseMesh extends Node { public scene: Scene; public visibility: boolean = true...
2c651bd1c075b8ee8add4107487107c07fa907aa
TypeScript
smart-u/shopware-pwa
/packages/shopware-6-client/src/interfaces/search/Pagination.ts
2.71875
3
export enum PaginationLimit { ONE = 1, FIVE = 5, TEN = 10, TWENTY_FIVE = 25, FIFTY = 50, SEVENTY_FIVE = 75, HUNDRED = 100, FIVE_HUNDRED = 500 } /** * @alpha */ export interface Pagination { limit?: PaginationLimit; page?: number; }
39d9b22b79ac5c0216067062213cd5b339ae4226
TypeScript
migraf/typescript-rest-api
/packages/trapi-metadata/src/resolver/utils/initializer.ts
2.796875
3
/* * Copyright (c) 2021. * Author Peter Placzek (tada5hi) * For the full copyright and license information, * view the LICENSE file that was distributed with this source code. */ import * as ts from 'typescript'; import {Resolver} from "../type"; import {hasOwnProperty} from "@trapi/metadata-utils"; export funct...
aa9556c9c0c3ff28743723ede30381bc53f97651
TypeScript
ChristopherChudzicki/mathbox
/test/primitives/types/types.spec.ts
3.171875
3
import * as MathBox from "../../../src"; import type { Axes, AxesWithZero } from "../../../src/types"; const { Types } = MathBox.Primitives.Types; describe("primitives.types.types", function () { it("validates axes", () => { const axis = Types.axis("y"); let value = axis.make(); expect(value).toBe(2); ...
0d27279ba1ec933a8b13aa892184e9020720a288
TypeScript
dirvine/miscreant
/js/src/internal/polyfill/aes_ctr.ts
2.984375
3
// Copyright (C) 2016 Dmitry Chestnykh // MIT License. See LICENSE file for details. import { ICtrLike } from "../interfaces"; import { wipe } from "../util"; import PolyfillAes from "./aes"; /** * Polyfill for the AES-CTR (counter) mode of operation. * * Uses a non-constant-time (lookup table-based) AES polyfill...
3c85b0e12c49f92e932ee3c358a6f4310cb5e375
TypeScript
osaulenkoUA/VocabularyFront
/src/redux/Vocabulary/vocabularyOperation.ts
2.609375
3
import axios from 'axios'; import {addWord, content} from '../../types/types' import vocabularyActions from './vocabularyActions'; import {AppDispatch} from '../store'; axios.defaults.baseURL = 'https://sleepy-escarpment-78189.herokuapp.com'; type addData = { data: content; } type getData = { data: content[];...
cd7b125a9b36dc41875efbf1aef1c9802dae1d68
TypeScript
SamOdin/agile
/src/app/store/root-reducer.ts
2.53125
3
import { Action, createReducer, on } from '@ngrx/store'; import * as FileActions from './root-actions'; import { FILE_STATUS } from '../enums'; export interface State { text: any | undefined; } export const initialState: State = { text: [] }; const fileReducer = createReducer( initialState, on(FileAc...
fe6ab3560e44f4cb7625a5e7a755a2bfa5e85d34
TypeScript
nastasya146/web-example
/StaffingWebApi/src/app/working-time.pipe.ts
2.625
3
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({name: 'workingTime'}) export class WorkingTimePipe implements PipeTransform { transform(minutes: number): string { return (('0' + (Math.floor(minutes / 60)).toString()).slice(-2) + ':' + (('0' + (minutes % 60)).toString().slice(-2))); } }