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
b367ddb70bc5542f298d1eb5d060c1a7377d0aa1
TypeScript
l3eto/angular-star-wars
/src/app/models/flash.ts
2.59375
3
export class Flash { constructor(message: string, type: string, keepAfterLocationChange: boolean) { this.message = message; this.type = type; this.keepAfterLocationChange = keepAfterLocationChange; } message: string; type: string; keepAfterLocationChange: boolean; }
ed288c984d3665cb120752305a593b60ff00dd29
TypeScript
alesluca00/PW2021
/ITS.Allan.ProjectWork/ITS.Allan.ProjectWork.WebApp/ClientApp/src/app/shared/services/classroom.service.ts
2.5625
3
import { Inject } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import Classroom from '../models/Classroom'; export default class ClassroomService { public classroomUrl = ''; constructor(private http: HttpClient, @Inject('BASE_URL') private...
bab786bf4fde6163b49911a704e5f6e08933d10f
TypeScript
areller/denogent
/src/lib/runtime/runtime.ts
2.8125
3
import { runCommand as runCommandInternal } from "../../internal/helpers/cmd.ts"; import type { CommandArgs } from "./args.ts"; import type { Extension } from "../core/extension.ts"; import { Args, dotenv, parseArgs } from "../../../deps.ts"; import { isWindows } from "../../internal/helpers/env.ts"; class Runtime { ...
fafb64768da76fced96c29c4042cbb0e220a1be2
TypeScript
GSto/advent-of-code-2020
/day02/index.ts
3.53125
4
import fs from 'fs' import { xor } from '../lib' interface PasswordPolicy { start: number, end: number, substring: string, password: string } interface Range { start: number, end: number, } const contents = fs.readFileSync(__dirname+'/passwords.txt', 'utf8') const passwords: string[] = contents.split('...
94685b43b2e82138e592be5999917bb1f09d8900
TypeScript
strangerintheq/hare-and-carrots
/src/reborn/objects/CellObject.ts
2.546875
3
import {Object3D} from "three"; import {CellObjectType} from "../data/CellObjectType"; import {Carrot} from "./Carrot"; import {Bush1} from "./Bush1"; import {Tree2} from "./Tree2"; import {Tree1} from "./Tree1"; import {Obj} from "../renderer/Obj"; import {Poo} from "./Poo"; import {Bush2} from "./Bush2"; import {Poo1...
1d249ef6f9cc7828260df3d8b6bbed505ca6a162
TypeScript
Patrick-Wang/LoanMgr
/collection/collection/src/main/webapp/jsp/sdk/protocol.ts
2.734375
3
import ServerContext = collection.protocol.ServerContext; module collection.protocol { export let carLoanTitle:string[] = []; export let creditLoanTitle:string[] = []; export let creditCardTitle:string[] = []; export function getTitles(type):string[]{ let titles = undefined; if (type...
5cc9a3ec62753496bf96e57394f92388c1636dfd
TypeScript
Eveble/core
/test/unit/utils/helpers.test.ts
3
3
import { expect } from 'chai'; import { PropTypes } from 'typend'; import { isSerializable, resolveSerializableFromPropType, } from '../../../src/utils/helpers'; import { define } from '../../../src/decorators/define'; /* eslint-disable @typescript-eslint/no-empty-function */ describe('helpers', () => { @define(...
da55f1e89cad528cb3d973aa3f25e9f6dfa82eac
TypeScript
moepyxxx/practice-ts-pokemon
/src/model/statusAilment/SaFreeze.ts
2.515625
3
import { StatusAilment } from './StatusAilment'; export class SaFreeze extends StatusAilment { /** * 名前 */ protected _name: string = 'こおり'; /** * 状態異常になった時のメッセージ */ protected _sickedMessage: string = 'こおりづけになった'; /** * すでに状態異常だったときのメッセージ */ protected _alreadySickedMessage: string = 'すで...
a0e6053f09e82e2a70f4a13505d973f6c009cb74
TypeScript
daniel1433/app-reactjs
/src/services/api_servise.ts
2.59375
3
import { param } from "jquery"; interface paramsGet { key: string; value: string | number; } export default class API { private requestOptions = { method: 'POST', headers: { 'Content-Type': 'application/json', 'authorization': sessionStorage.getItem("session") ? '1' : '0' }, body: ...
75a30eeec32f19b5a7507ec803bbbde7752b149c
TypeScript
envoy/loglevel-file-logger
/src/defaultFormatter.ts
3.3125
3
/// Default formatter for formatting log message export default ( loggerName: string, methodName: string, objects: Array<any>, now?: () => Date ) => { const withDate = [ now ? now().toISOString() : new Date().toISOString(), loggerName, `[${methodName.toUpperCase()}]`, ...objects ] return w...
5a0e1b4632b2f6f9709e644cb2658f9fad8fb836
TypeScript
erezbm/javascript-dynalist-api-wrapper
/src/api-types/document-level/changes.ts
2.78125
3
import { BackgroundColor, HeadingLevel } from '.'; import { Id } from '..'; import { ChangeAction } from '../changes'; export type DocumentLevelInsertParams = { /** The ID of the parent node to insert under. */ parent_id: Id; /** The zero-indexed position the node should be in the parent node's children, supply ...
ac10f86cd603ac580c5cea70ae24db91d48e6be6
TypeScript
teuncortooms/Quizinator_TypeScript
/server/services/SpreadsheetHandler.ts
2.953125
3
class SpreadsheetHandler { private spreadsheetId: any; private sheet: any; public constructor() { this.spreadsheetId = SpreadsheetApp.getActive(); this.sheet = this.spreadsheetId.getActiveSheet(); } get Data(): string[][] { return this.sheet.getDataRange().getValues(); }; get ...
14197e24197008837222414afd40b02a35a13d33
TypeScript
dangphu2412/Example-nestjs-boilerplate
/src/packages/restBuilder/modules/Validator/entity/LengthValidator.ts
3.21875
3
import {BadRequestException} from '@common/exceptions'; import {OptionalValidator} from '@packages/restBuilder/modules/Validator/OptionalValidator'; export class LengthValidator implements OptionalValidator<string[]> { private readonly message: string; private readonly lengthValidate: number; constructor...
8fdf85dbcb5127794b67791c654b46597b6ea114
TypeScript
wu-yu-xuan/parseJson
/interface.d.ts
2.984375
3
export interface ValidJsonString { type: | 'false' | 'true' | 'null' | 'number' | 'string' | 'object' | 'array' | 'error'; value: string; } export type Json = boolean | null | number | string | JsonObject | JsonArray; export interface JsonArray extends Array<Json> {} export interfac...
5260978bde4bb7b2a6cc5468b2a66cd028893635
TypeScript
djek88/noteappangular2
/src/app/notes/shared/note.ts
2.859375
3
export class Note { constructor( public id: number = null, public title: string = '', public content: string = '', public updatedAt: Date = new Date(), public createdAt: Date = new Date() ) {} static clone(note: Note) { return new Note( note.id, note.title, note.content,...
3d9a0e7e1a6c890911019f6a14c1a1443982b1eb
TypeScript
kwoncharles/fp-modules
/src/core/Monad.ts
2.78125
3
import Functor from './Functor'; export default interface Monad<T> extends Functor<T> { flatMap<R>(mapperFn: (wrapped: T) => Monad<R>): Monad<R>; }
1b561880d47e96803cb98a26413d5f53c885e0b5
TypeScript
d-kostov-dev/JavaScript-OOP
/TypeScriptHomework/Battlefield/baseclasses/Soldier.ts
3.515625
4
module BaseClasses { export class Soldier implements Interfaces.ISoldier { name: string; health: number; damage: number; constructor(name: string, health: number, damage: number) { this.name = name; this.health = health; this.damage = damage; ...
9e7e20fcc847cde201af12d33cf4eae6adb9c3ff
TypeScript
JesusCarm/wsa
/classes/Core/engine/Vector/Vector2.ts
3.390625
3
module WSA { export class Vector2 { private c: Array<number> = [0,0]; public constructor(x: number = 0, y: number = 0){ this.x = x; this.y = y; } /* GETTERS / SETTERS */ public get x(): number { return this.c[0]; ...
292c57178d0d75df9c61a6b7e8567c4aef1d411d
TypeScript
kamsac/js13k-2018
/src/world/World.ts
2.53125
3
import Size from '../helpers/Size'; import {canvasSize} from '../render/GameRenderer'; import MainCharacter from '../main-character/MainCharacter'; import AABB from '../helpers/AABB'; import Flyswat from '../flyswat/Flyswat'; import Insect from '../insect/Insect'; import Cable from '../cable/Cable'; import Point from '...
5ff6f320a9d23faf9e1f4d1fe6cb4f4cf76c1120
TypeScript
SINTEF-9012/mobileMaster
/test/spec/filters/distance.ts
2.546875
3
/// <reference path="./../../../app/bower_components/DefinitelyTyped/angularjs/angular-mocks.d.ts" /> /// <reference path="./../../../app/bower_components/DefinitelyTyped/jasmine/jasmine.d.ts" /> 'use strict'; describe('Filter: distance', function () { // load the filter's module beforeEach(module('mobileMasterA...
ec2a23acb17ca6919452a4f8e795b4478bf78ad1
TypeScript
fazilathfathima5656/cloud-tool
/toolbox_2.0/packages/nodes-base/credentials/ZendeskOAuth2Api.credentials.ts
2.578125
3
import { ICredentialType, NodePropertyTypes, } from '@toolbox/toolbox-workflow'; const scopes = [ 'read', 'write', ]; export class ZendeskOAuth2Api implements ICredentialType { name = 'zendeskOAuth2Api'; extends = [ 'oAuth2Api', ]; displayName = 'Zendesk OAuth2 API'; documentationUrl = 'zendesk'; properti...
792f47221ba581d5d2965f7ed1f25eeca1889aa5
TypeScript
TrelloVol2-Bravo1/TrelloVol2-FrontEnd
/src/models/card.model.ts
2.734375
3
export class CardModel { constructor(private card_id: number, private list_id: number, private card_name: string, private card_description: string) { } getCardID(): number { return this.card_id; } getCardName(): string { return this.card_name; } getCardListID(): number { ...
61d79d9712ae3713ea4d2c39d1f710201f828a7b
TypeScript
akhilsarasan/hydrogen
/packages/cli/src/commands/create/app/templates/Index-server-jsx.ts
2.546875
3
import {Feature} from '../../../../utilities/feature'; import {TemplateOptions} from '../../../../types'; export default function ({features, name}: TemplateOptions) { const featuresMarkup = features.length ? ` <h2>Features:</h2> <ul> ${features .map( (feature) => ...
d231c2b281da8c757e8c96197e23653b0b1e4f2d
TypeScript
msgpack/msgpack-javascript
/src/utils/int.ts
3.109375
3
// Integer Utility export const UINT32_MAX = 0xffff_ffff; // DataView extension to handle int64 / uint64, // where the actual range is 53-bits integer (a.k.a. safe integer) export function setUint64(view: DataView, offset: number, value: number): void { const high = value / 0x1_0000_0000; const low = value; // h...
a97cc0b8570b3bd5470f38c999cf2a4a5de068b2
TypeScript
aws/aws-cdk
/packages/aws-cdk-lib/core/lib/validation/validation.ts
2.796875
3
import { PolicyValidationPluginReportBeta1 } from './report'; /** * Represents a validation plugin that will be executed during synthesis * * @example * /// fixture=validation-plugin * class MyPlugin implements IPolicyValidationPluginBeta1 { * public readonly name = 'MyPlugin'; * * public validate(context:...
fe22b981db97975fa58fc3d1e8c8e08713ba34b8
TypeScript
molstar/molstar
/src/mol-util/monadic-parser.ts
2.859375
3
/** * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal <david.sehnal@gmail.com> * @author Koya Sakuma <koya.sakuma.work@gmail.com> ** * Adapted from Parsimmon (https://github.com/jneen/parsimmon) * Copyright (c) 2011-present J. Adkisson (http://jn...
43cdeb1f40f338e573c715eaf5a95478f0738724
TypeScript
Fxdpt/discord-bot
/src/handlers/ProfilePictureHandler.ts
2.765625
3
import { Client, Message, User } from 'discord.js' import Handler from './Handler' import parsingHelper from '../helpers/parsingHelper' class ProfilePictureHandler extends Handler { validate (client: Client, msg: Message): boolean { return super.validate(client, msg) && msg.content.startsWith('!pp') } async...
b8d556eb1b2a32643567c1db044a86ba12b1a49f
TypeScript
atellmer/dark
/packages/core/src/ref/types.ts
3.078125
3
export type MutableRef<T = unknown> = { current: T; }; export type FunctionRef<T = unknown> = (ref: T) => void; export type Ref<T = unknown> = MutableRef<T> | FunctionRef<T>;
b13952836c54ff3b150e8edc38d1b9e2f33b455a
TypeScript
SkynetRTN/afterglow-access
/src/app/utils/deep-copy.ts
3.234375
3
export class DeepCopy { static copy(data: any, objMap?: WeakMap<any, any>) { if (!objMap) { // Map for handle recursive objects objMap = new WeakMap(); } // recursion wrapper const deeper = value => { if (value && typeof value === 'object') { ...
fe378bfc7c31f2c82812e88e4ce49ee9c6810220
TypeScript
Guezin/Cute-Burguer
/server/src/modules/users/useCases/CreateUserUseCases.ts
2.578125
3
import { inject, injectable } from 'tsyringe' import AppError from '@shared/errors/AppError' import User from '@modules/users/infra/typeorm/entities/User' import IUserRepository from '@modules/users/repositories/IUserRepository' import IBcrypt from '@shared/infra/container/providers/Bcrypt/models/IBcryptProvider' i...
9d17d9ff4dc60c518fe4c48ed8e221b703a30c65
TypeScript
diss1dent/finder
/src/app/reducers/login.reducer.ts
2.515625
3
import { ActionReducer, Action } from '@ngrx/store'; import ACTIONTYPES from "../actions/types"; export const LoginReducer: ActionReducer<any> = (state: {}, action: Action) => { switch (action.type) { case ACTIONTYPES.login: return Object.assign({}, state, { isLoggedIn:...
ee7c539b238470371e0a4f70dd27681be9afe201
TypeScript
obniz/obniz
/src/obniz/libs/wscommand/WSCommandWiFi.ts
2.515625
3
/** * @packageDocumentation * @ignore */ import { JsonBinaryConverter } from './jsonBinaryConverter'; import { WSCommandAbstract } from './WSCommandAbstract'; export class WSCommandWiFi extends WSCommandAbstract { module = 14; _CommandScan = 0; public scan(params: any, index: any) { this.sendCommand(thi...
cde93325ddb827a2c90c701d8b40f8570ca8a035
TypeScript
zhoubudian/lottery
/web-src/src/lib/utils.ts
2.890625
3
interface IAssert { name: string source: string } async function loadImage(url: string): Promise<HTMLImageElement> { return new Promise((resolve, reject) => { const img = new Image(); img.src = url; if (url.indexOf("/") === -1) { img.src = "http://localhost:14422/avatar...
c0c4fad14487ff138b934c75963374b65280af0f
TypeScript
sabman/toolkit
/packages/viz/src/lib/style/deck-styles.ts
2.875
3
/* eslint-disable @typescript-eslint/no-explicit-any */ import { hexToRgb } from './helpers/utils'; import { GeometryType } from '../sources/Source'; import { defaultStyles } from './default-styles'; import { colorValidation } from './validators'; import { CartoStylingError, stylingErrorTypes } from '../errors/styling-...
f64a23fc88c536332314ab188e90be3e6b5ca895
TypeScript
samenc99/cruz-lama-back
/src/model/Tickets.ts
2.6875
3
export type TicketDTO = { name: any, value : any, showId : any, ticketsQuantity : any } export type TicketData = { name : string, value : number, show_id : string, tickets_quantity : number, id : string } export const toTicketsData = (input : TicketDTO, id : string):TicketData=>{ return { name...
1cc52cfe2af9875734a807e6a8b9b25d635a9130
TypeScript
Kernell/Hayate-Server-RAGEMP
/Globals/Array.ts
3.03125
3
/********************************************************* * * Copyright © 2017, Raybit Games. * * All Rights Reserved. * * Redistribution and use in source and binary forms, * with or without modification, * is permitted only for authors. * *********************************************************/ ...
47d25c3e63855ccb5681401d5ddf913ebe341b0d
TypeScript
soltrinox/k8s-roman-numerals
/server/__mocks__/graphql-redis-subscriptions.ts
2.640625
3
export class RedisPubSub { public static ConstructorSpy = jest.fn(); public static SubscribeSpy = jest.fn(); public static PublishSpy = jest.fn(); public static AsyncIteratorSpy = jest.fn(); public static MockValue = { arabic: 10, roman: '10' }; public constructor(param: any) { RedisPubSub.ConstructorSpy(...
a3254200aeeb83ed808e7729cf3322ffc4b37742
TypeScript
tkmagesh/Fidelity-Angular-Feb-2018
/first-app/src/app/calculator/CalculatorModel.ts
3.375
3
export class CalculatorModel{ n1 : number = 0; n2 : number = 0; result : number = 0; add(){ this.result = this.n1 + this.n2; } subtract(){ this.result = this.n1 - this.n2; } multiply(){ this.result = this.n1 * this.n2; } divide(){ this.result = this.n1 / this.n2; } } export function f1(){ console....
84e88626cb11c8788d53b1245a6b498356663bc4
TypeScript
Sort-It/ServerUtils
/functions/src/sendOtptoClient.ts
2.640625
3
const express = require("express"); const router = express.Router(); const otpService = require('../otpService/otpServices.ts'); router.post('/sendOtp/', async (req: any , res: any ) => { try{ var phoneNo = req.body.phoneNo as string; if(!(phoneNo.length === 12 && isNumeric(phoneNo))){ ...
25c82e4be05c9c21901315bca4b9bbe10847f55a
TypeScript
nipe0324/learning-js
/react-recoil-realworld/src/types.ts
2.53125
3
export interface AuthProps { email: string; password: string; username?: string; } export interface UserProps { email: string; password: string; username: string; bio: string; image: string; } export interface ProfileProps { username: string; bio: string; image: string; following: boolean; } ...
05f3e054c61de68d0c4e40262915d86a81c15072
TypeScript
marsprince/leetcode-typescript
/base/algorithm/sort.ts
4.09375
4
export function lessThan(a, b) { return a < b; } export function equal(a, b) { return a === b; } export function checkArray(originalArray) { return originalArray.length <= 1 ? originalArray : [...originalArray]; } // Bubble sort, sometimes referred to as sinking sort, // is a simple sorting algorithm that repe...
d7395f4d2af46f33e284ff7eecfe512781d03fec
TypeScript
Motakjuq/hntest
/backend/src/services/news/tasks.ts
2.6875
3
import request from "request"; import { Story } from "./models"; interface IStory { story_id: number; objectID: string; title: string; story_title: string; author: string; story_url: string; url: string; created_at_i: number; created_at: Date; } const fetchData = (onComplete?: any, onError?: any) =>...
5e43fa71da9b08ffff77f1e2f9f8551133683f66
TypeScript
Amirus/RxJS-1
/src/operators/observeOn.ts
3.078125
3
import Operator from '../Operator'; import Observer from '../Observer'; import Scheduler from '../Scheduler'; import Observable from '../Observable'; import Subscriber from '../Subscriber'; export default function observeOn<T>(scheduler: Scheduler, delay: number = 0): Observable<T> { return this.lift(new ObserveOnOp...
de61d1a76b0d71ab665fa7787b0192f7f3215c0a
TypeScript
datagrok-ai/public
/packages/Chem/src/utils/chem-common.ts
2.71875
3
import BitArray from '@datagrok-libraries/utils/src/bit-array'; export const defaultMorganFpRadius = 2; export const defaultMorganFpLength = 2048; const lockPromiseForKey: any = {}; const unlockFunctionForKey: any = {}; export enum Fingerprint { Morgan = 'Morgan', RDKit = 'RDKit', Pattern = 'Pattern' } // By ...
8e568e68c3add30fa238cfe79d4c03b1ad436037
TypeScript
TheColorRed/query-builder
/src/DB.ts
2.5625
3
import * as mysql from 'mysql' import { packetCallback, Query, Connection as MysqlConnection } from "mysql"; import { Builder } from './Builder'; import { QueryBuilder } from './QueryBuilder'; export interface DatabaseConnection { default?: boolean safeAlter?: boolean dumpQueries?: boolean saveNonDirtyRows?: b...
6a1a77e6cee7d9d7020aa6989a9bbd86e95d2150
TypeScript
ForbesLindesay/graphql-schema
/packages/document/src/types/Location.ts
2.765625
3
import type LocationSource from './LocationSource'; interface LocationRange { readonly kind: 'LocationRange'; readonly source: LocationSource; /** * The character offset at which this Node begins. */ readonly start: number; /** * The character offset at which this Node ends. */ readonly end?: ...
ffa6a1b72f7a7f9afc1942b88cf10180b0424e28
TypeScript
Sapioweb/authentication
/lib/common/validatePassword.d.ts
3.03125
3
/** * The password string will start this way. * (?=.*[a-z]) The string must contain at least 1 lowercase alphabetical character. * (?=.*[A-Z]) The string must contain at least 1 uppercase alphabetical character. * (?=.*[0-9]) The string must contain at least 1 numeric character. * (?=.*[!@#\$%\^&\*]) The string m...
01fba5fa6e30c0d612fa44557cb5061688a28cac
TypeScript
jmtalarn/rpi_index
/src/utils/file-utils.ts
2.625
3
export const isVideoFile = (filename: string | undefined) => { if (!filename) { return false; } const extensions = ['MP4', 'AVI', 'MOV', 'FLV', 'WMV']; var lastIndex = filename.lastIndexOf('.'); const extension = filename.substr(lastIndex + 1).toUpperCase(); return extensions.indexOf(e...
d88f002ac56529428bcd9a8ed20d9a97886b6680
TypeScript
adafruit/pyright
/server/src/parser/characters.ts
2.53125
3
/* * characters.ts * Copyright (c) Microsoft Corporation. * Licensed under the MIT license. * Author: Eric Traut * * Based on code from vscode-python repository: * https://github.com/Microsoft/vscode-python * * Utility routines used by tokenizer. */ import * as unicode from './unicode'; export const enum Char { // ...
9d1996a0e1b5cd7bfb610a05b16aeca774adcb00
TypeScript
Harshul-Vijay/calculatorV2
/src/global/test/tokenizer.ts
3.453125
3
interface TokenInterface { type: string; value: string; } class Token implements TokenInterface { type: string; value: string; constructor(type: string, value: string) { this.type = type; this.value = value; } } export class Tokenizer { private letterBuffer: Array<any> = []; private numberBuff...
f6d77cb0efbfa0193ecb9aeb51e9693011c33f41
TypeScript
waltonseymour/vermeer
/src/interaction.ts
3.03125
3
import { Datum, Chart } from "./chart"; interface InteractionOptions { plot: Chart; handler: (point: Datum) => void; } export class ClickInteraction { plot: Chart; handler: (d: Datum) => void; constructor(options: InteractionOptions) { this.handler = options.handler; this.plot = options.plot; t...
24d9dae0b9e11a0fbebb33a3ae155a04522df9e3
TypeScript
MadManLabs/arrivals-osx
/src/lib/dispatcher.ts
2.609375
3
import { AbstractBatch } from 'abstract-leveldown'; import glob from 'glob'; import LevelJobs from 'level-jobs'; import { LevelUp } from 'levelup'; import path from 'path'; import { promisify } from 'util'; import logger from 'winston'; import { FileJobStatus, FileJobType } from './enums'; import { Tag } from './tag';...
ed45e3573aafb0845edfb3215b7e52cf0f5b413d
TypeScript
jdunkerley/AlteryxScript
/src/services/Operators/Assignment.ts
2.828125
3
import { BaseNode, AssignmentNode } from "../Nodes" import { Evaluator } from "../evaluator" export default (node:BaseNode, evaluator: Evaluator) => { const assignmentNode: AssignmentNode | null = node as AssignmentNode if (!assignmentNode) { throw new SyntaxError("Assignment not understood") } if (assign...
970c7e1e2f0eb3fdea00c6e51fbb596e1d38d766
TypeScript
avadev/AvaTax-REST-V2-JS-SDK
/lib/models/TaxRateModel.ts
2.625
3
/* * AvaTax Software Development Kit for JavaScript * * (c) 2004-2022 Avalara, Inc. * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @author Jonathan Wenger <jonathan.wenger@avalara.com> * @author Sachin Baijal <sachin.ba...
209596f755549dedea30359281de007631a8f23a
TypeScript
mvezer/tuya-home-control
/src/models/device/DevicesRepository.ts
2.75
3
import * as mongoose from 'mongoose'; import BaseDevice, {TDeviceData} from './BaseDevice'; import DeviceFactory from './DeviceFactory'; import Logger from '../../handlers/Logger'; const DEVICE_TYPES = ['rgb_bulb', 'plug']; const DeviceModel = mongoose.model('Device', new mongoose.Schema({ deviceId: { type: Strin...
491ec4c0e66a79313d8f256202bf9232dd21bdc1
TypeScript
robert-harbison/super-validator
/lib/validators/Required.test.ts
2.765625
3
import { setConfig } from '..' import required from './Required' beforeEach(() => { setConfig(null) }) describe('Required:required()', () => { test('Should return error if value is null or undefined.', () => { expect(required()('theField', null)).toEqual('`theField` is required.') expect(required()('theField', ...
16bdceb5923cbe009d17c4029c2fca79b5ad6a44
TypeScript
tec8297729/z-swagger-to-apidoc
/src/processing.ts
2.796875
3
import * as fs from 'fs'; import { TransformOptions, Parameters } from './interface'; const emptyApiText = '无'; // 描述空占位符 const initData = { treeLevelIndex: 1, }; class Processing { constructor(opts: TransformOptions, definitions) { this.opts = opts; this.definitions = definitions; } private opts: Tr...
57de12cd34bf86af441cf9828a48259a21d8fefe
TypeScript
bryan-jones/game
/node/server/classes/map/map.ts
3.40625
3
/** * Create a base character class. */ class Map { protected name: string; /** * Constructor.a * * @param name string */ constructor(name: string = '') { this.name = name; } /** * Save a map. */ save(name: string) { // Saving operations. } load(name...
09a5730b4bb3092a9d8f07351d45842a9ec3f163
TypeScript
BabylonJS/Babylon.js
/packages/tools/viewer/src/optimizer/custom/extended.ts
2.546875
3
import type { DefaultRenderingPipeline } from "core/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline"; import { Scalar } from "core/Maths/math.scalar"; import type { SceneManager } from "../../managers/sceneManager"; /** * A custom upgrade-oriented function configuration for the scene optimizer. ...
5e9640401945df589e0625593f5a320c29b7e159
TypeScript
gabrielcolson/acacia
/db/index.ts
2.53125
3
import { PrismaClient, User, Space, Expense } from "@prisma/client" export * from "@prisma/client" let prisma: PrismaClient if (process.env.NODE_ENV === "production") { prisma = new PrismaClient() } else { // Ensure the prisma instance is re-used during hot-reloading // Otherwise, a new client will be created o...
2aac8701398e099a3a5103aa49d653196a408b3a
TypeScript
Laotouy/ms
/packages/bukkit/src/typings/org.bukkit.inventory.meta.CrossbowMeta.ts
2.78125
3
declare namespace org { namespace bukkit { namespace inventory { namespace meta { // @ts-ignore interface CrossbowMeta extends org.bukkit.inventory.meta.ItemMeta { /** * Returns whether the item has any charged projectiles....
937a109bfb6c97c4517d13ef0babf799d3bf2c52
TypeScript
yidafu/algorithm
/88.merge-sorted-array.ts
3.328125
3
/* * @lc app=leetcode id=88 lang=typescript * * [88] Merge Sorted Array */ // @lc code=start /** Do not return anything, modify nums1 in-place instead. */ function merge(nums1: number[], m: number, nums2: number[], n: number): void { let i = m-1, j = n-1, idx = m + n - 1; while(i >= 0 || j >= 0) { if (j ...
4fad2eae61e8620bf73c6577d99a1284711c6aa5
TypeScript
cybersemics/em
/src/@types/Patch.ts
2.546875
3
import { GetOperation } from 'fast-json-patch' // Extend fast-json-patch Operation type to include actions list // See fast-json-patch types: https://github.com/Starcounter-Jack/JSON-Patch/blob/89a09e94e0e6500115789e33586a75c8dd1aea13/module/core.d.ts // TODO: This should allow any Operation, not just GetOperation. Bu...
91385742b7bc3f2add31a57994cad122b784f9bf
TypeScript
TylorS167/167
/src/object/dissoc/index.ts
3.140625
3
import { clone } from '../clone' import { curry2 } from '../../function/curry/curry2' export const dissoc: Dissoc = curry2(function dissoc<A extends object>(prop: keyof A, obj: A) { const newObj = {} as A for (const key in obj) if (key !== prop) newObj[key] = clone(obj[key]) return newObj }) export interface ...
f621b429731844cb09c77732b067c80c2077bd7d
TypeScript
a158abc/vue-window
/src/dom.ts
2.875
3
export function naturalSize(el: HTMLElement) { const { width, height } = el.style el.style.width = 'auto' el.style.height = 'auto' const rect = contentSize(el) el.style.width = width el.style.height = height return rect } export function contentSize(el: HTMLElement) { const style = win...
08f5dde8467725060b0aca5233a80e229882f8b8
TypeScript
alexdeassis7/Angular-UTN
/Clase 3 Typescript/claseTS/vendingmachine/test.ts
3.671875
4
// class HelloWorld{ // constructor(public message: string){ // } // } // var hello = new HelloWorld("hola type Script"); // console.log(hello.message); //creamos una funcion con todos los libros de nuestra "biblioteca" function GetAllBooks() { //creamos un array de libros ,cada libro con 3 pr...
f3dbf0551bb4f7c9c320102d6840f9c212a4b530
TypeScript
josemak25/streams_test
/src/utils/isTablet.ts
2.6875
3
import {TABLET_DIMENSION} from '@app/constants'; import {Dimensions} from 'react-native'; /** * * @description scale a method for scaling app fonts based off the pixel density of the users phone * @function isTablet * @returns boolean */ export const isTablet = () => { const {width, height} = Dimensions.get('wi...
4b8824f77878a3900943eb20de8365866b2b5daf
TypeScript
riceboyler/cv-web-core-bundle
/src/mixins/media.ts
2.59375
3
import styled, { css } from "styled-components" const breakpoints = { giant: 1199, xl: 1199, desktop: 992, lg: 992, tablet: 768, md: 768, phone: 576, sm: 576, smaller: 575, xs: 575, } const media = Object.keys(breakpoints).reduce((acc, label) => { acc[label] = (...args: Arr...
1f60a15a64db55d2865eefe8bf9f0f41bb39520b
TypeScript
ajafff/ng-dynamic-component
/projects/ng-dynamic-component/src/lib/io/types.ts
2.875
3
export interface InputsType { [k: string]: any; } export interface OutputsType { [k: string]: OutputExpression | undefined; } export interface OutputWithArgs { handler: AnyFunction; args?: any[]; } export type OutputExpression = EventHandler | OutputWithArgs; export type EventHandler<T = any> = (event: T) =>...
cc1fcb8d7c29f4a303fd49bba06808beb4d0eb75
TypeScript
Krakabek/DevTernityWorkshop
/src/stack.ts
3.5
4
export class Stack { private storage: Array<any>; constructor() { this.storage = []; } push(object: any) { this.storage.push(object); } pop(): any { if(!this.storage.length){ throw Error("Can not pop from empty stack"); } return this.storage...
f47773f39c31da317d118b9ea9892e462b6d0d4a
TypeScript
Horat1us/react-hooks
/src/use-window-size.ts
3.015625
3
import * as React from "react"; export type WindowSize = [number, number] | [undefined, undefined]; export type WindowSizeReducer = React.ReducerWithoutAction<WindowSize>; export const WindowSizeReducer = (prevState: WindowSize = [undefined, undefined]): WindowSize => { if ("object" !== typeof window) { re...
e335fa6b2f527355adbba8b427d495a53a6822d3
TypeScript
tom-berend/seen_ts
/src/model.ts
2.984375
3
// //// Groups // ------------------ import { Transformable } from './transformable'; import { Light } from './light' import { Surface } from './surface' import {Mesh} from './shape' import {V4} from './vectorMath' // The object group class. It stores `Shapes`, `Lights`, and sub-Groups // Notably, models are hierar...
dc912183faf7176fd3fcf1eafb5e9ae416120848
TypeScript
react-native-styled-paper/react-native-styled-paper
/components/Container/utils/helpers.ts
2.5625
3
export const isHidden = (screenSize, props) => { switch (screenSize) { case "small": return props.smHidden ? true : false; case "medium": return props.mdHidden ? true : false; case "large": return props.lgHidden ? true : false; default: return false; } }; const t...
62f4eaab572dee3734f9255980a8913c737523fe
TypeScript
sujanchhetri/ts-snip
/Advanced types/indexproperty.ts
2.75
3
// * property is defined as index interface ErrorChecker{ [prop:string]:string; } const errorCheck:ErrorChecker = { email : 'Not a valid email', username : 'Must be capital at start' };
5ffcda6bf4a99c15c26fbc99e3697c240faec980
TypeScript
minhtranin/codebase
/src/web/common/log.ts
3.28125
3
/* tslint:disable:no-console */ export enum Level { All = 0, Debug, Warn, Error, None } let _level: Level = Level.All function _init (level: Level) { _level = level } export function init (levelName: string) { const levelsMap: { [name: string]: Level } = { ALL: Level.All, DEBUG: Level.Debug, ...
51ae89342c229e75d9b2a44d1f44016224843a17
TypeScript
ChainSafe/incubator-milagro-crypto-js
/src/fp.d.ts
2.59375
3
import {BIG, DBIG} from "./big"; import {FpCommon} from "./fp-common"; export class FP extends FpCommon<FP> { public constructor(x: FP | BIG); public static logb2(v: number): number; public static mod(d: DBIG): BIG; public rcopy(y: FP): void; public bcopy(y: FP): void; public cswap(b: FP, d:...
c5ca21d07e960e1d45a7e304950a9d4652b3422a
TypeScript
navya7gowda/quintype-diamond-sweeper-solution-
/src/app/board/board.component.ts
2.578125
3
import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-board', templateUrl: './board.component.html', styleUrls: ['./board.component.css'] }) export class BoardComponent implements OnInit { data = [ ['diamond', 'unknown', 'unknown', 'unknown', 'unknown', 'unknown', 'unknown', 'unkno...
30eb3707d5e3a69e317a2ca0ee54163988a0907a
TypeScript
Raja-cloud/NgxValidations
/projects/ngx-validations/src/lib/ngx-validations.service.ts
2.828125
3
import { Injectable, Inject } from "@angular/core"; import { FormGroup } from "@angular/forms"; import { VALIDATION_CONFIG } from "./ngx-validations.config"; @Injectable() export class NgxValidationsService { constructor() {} getValidatorErrorMessage(validatorName: string, validatorValue?: any) { const config:...
92143db80c5cc5b7cdb4db8000cce8c7b0a5fc88
TypeScript
maciejtutak/tslox
/src/Expr.ts
2.859375
3
import { Literal as TLiteral, Token } from "./Token"; import { ExprVisitor } from "./AstPrinter"; export interface Expr { // accept(visitor: ExprVisitor<R>): R; // this is much cleaner with: accept<R>(visitor: ExprVisitor<R>): R; } export class Binary implements Expr { left: Expr; operator: Token...
1ad7d9c964d7ff46fb78b56cf3bc37e14bac4413
TypeScript
MaxPeak/vue-next-admin
/src/utils/random.ts
3.953125
4
/** * 随机数 * Math.random是一个0-1的左闭右开区间(取得到0取不到1),即 =>>> [0-1)这个样子,为了方便实用,可以利用计算来实现一个取随意区间的方法 */ export const random = (min: number, max: number) => Math.floor(Math.random() * (max + 1 - min) + min); /** * 创建一个随机数数组 */ export const randomArray = ( min: number, max: number, leng: number, isRepeat: boolean ...
3c25809d51176e1af01616ff77bfb8f9f9a28f96
TypeScript
cheshirescat/metastream
/packages/metastream-app/src/lobby/reducers/mediaPlayer.ts
2.5625
3
import { Reducer } from 'redux' import { isType } from 'utils/redux' import { setMedia, endMedia, playPauseMedia, seekMedia, queueMedia, repeatMedia, updateMedia, deleteMedia, updateServerClockSkew, moveToTop, lockQueue, setPendingMedia } from 'lobby/actions/mediaPlayer' import { MediaType } fro...
7ee1f719da3b4c3ec7042462c2623612bd73a5c8
TypeScript
yiitz/yh-h5-weapp-game-frontend
/assets/resources/prefab/script/keyboard.ts
2.71875
3
// Learn TypeScript: // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html // - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html // Learn Attribute: // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html // - [E...
1e157bc1000121e406f113cafa87bb56930d400d
TypeScript
loadoff/react-redux-sample
/src/states/States.ts
2.75
3
import { reducerWithInitialState } from 'typescript-fsa-reducers'; import { actions } from '../actions/Actions'; export interface State { name: string; email: string; } const initialState: State = { name: '', email: '' }; export const reducer = reducerWithInitialState(initialState) .case(actions....
81ec621226170d7b57e30da06d33b73bd8ccb041
TypeScript
GhostRealm/rotmg-sandbox
/src/common/asset/normal/loaders/TextureAssetLoader.ts
2.953125
3
import { AssetContainer } from "../AssetContainer"; import AssetLoader from "../AssetLoader"; import MapAssetContainer from "../MapAssetContainer"; export default class TextureAssetLoader implements AssetLoader<TextureConfig, AssetContainer<WebGLTexture>> { gl: WebGLRenderingContext; constructor(gl: WebGLRenderingCo...
a48dc77595e52f80776ea7f4879f3d957f22a87b
TypeScript
karakulov-web-dev/stalker_test
/external/seasonvar/ts/Polyfill/Promise_simple.ts
2.90625
3
export type Promise = { then(cb); }; export function Promise_simple(f) { var returnCb = this.returnCb.bind(this); f(returnCb); } Promise_simple.prototype.then = function(cb) { this.cb = cb; }; Promise_simple.prototype.cb = function() {}; Promise_simple.prototype.returnCb = function(q) { var self = this; se...
8eaa0023ca709e9ed9bce66e8dc545b6856eed8c
TypeScript
juliothomazelli/beautytech-server
/src/utils/DateUtils.ts
3.078125
3
import { ObjectUtils } from "./ObjectUtils"; export class DateUtils { public static formatDateTime(date : Date, initialDate = true){ if (ObjectUtils.isNullOrUndefined(date)){ return ''; } let result = ''; result = date.getFullYear() + '-' + DateUtils.getMonth(date.getMonth()) + '-' + Date...
aca671c978f6228304b9493a27ace035342405fc
TypeScript
alexanderpono/tothink
/my-courses/site/ui-src/Backend/Backend.validators.ts
2.796875
3
import Validator from 'schema-validator'; import { LoginAnswer } from './Backend'; interface User { name: string; id: number; } export interface GetUsersAnswer { success: boolean; users: User[]; } export interface ValidateResult { errors: { field: string; message: string; received?: string; expec...
4762263a284b6fb14473335f02a537b0ddf30a00
TypeScript
ppeelman/afriguideme
/src/accommodation/Accommodation.domain.ts
2.671875
3
import { Photo } from "../domain/Photo.domain"; import Rating from "../rating/Rating.domain"; import { Currency } from "../domain/Currency.domain"; import { IAccommodationBooking } from "../booking/Booking.domain"; import { SelectedOption } from "../domain/Choice.domain"; import Location from "../location/Location.doma...
652c332142732efcfae573de081fc8d40bfbfb5d
TypeScript
wongkuin/EffectProject
/eazax-cases/assets/eazax-ccc/components/RotateAround.ts
3
3
/** 轴 */ export enum Axis { /** 正 X 轴 */ PositiveX, /** 正 Y 轴 */ PositiveY, /** 负 X 轴 */ NegativeX, /** 负 Y 轴 */ NegativeY } const { ccclass, property } = cc._decorator; /** * 围绕旋转组件 * @see RotateAround.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/components/RotateAround.ts *...
467cf80eadcde36d4f0ef5f85bba2ff25e1985d6
TypeScript
borisKarastanev/stratos
/src/frontend/packages/store/src/actions/log.actions.ts
2.953125
3
import { Action } from '@ngrx/store'; export enum LogLevel { DEBUG, INFO, WARN, ERROR } export const LoggerActionTypes = { DEBUG: '[LOG] Debug', INFO: '[LOG] Info', WARN: '[LOG] Warn', ERROR: '[LOG] Error', }; export class LoggerAction implements Action { constructor( public logLevel: LogLevel ...
0f9a9449ce4716ee4b141aa3b438c92c62b39b70
TypeScript
vah7id/kal
/src/screens/multiplayer/reducer.ts
2.609375
3
import { GameState } from '../../store/ducks/schema'; import { MULTI_PLAYER_SET_STATUS } from './types'; import { Player } from './interfaces'; const defaultState = { username: '', loggedInUserId: '', status: MULTI_PLAYER_SET_STATUS.lobby, id: null, players: [], created_at: null, }; // types e...
1782270bfabd75efabcc93d942b0a77314c9e222
TypeScript
dream2023/wangeditor-for-react
/src/utils/helper.ts
3.40625
3
/* * @Author: dongmin * @LastEditors: donggg * @Date: 2021-04-02 18:36:57 * @LastEditTime: 2021-07-05 16:05:05 */ /** * 简单判断两个值是否相当 * @param {string} 值1 * @param {string} 值2 * @return {boolean} 判断结果 */ export const isEqualString = (value1: string, value2: string): boolean => value1 === value2; /** * 判断是否为...
cc79cef395a00235291e6ebc6ea9c8d05a175c64
TypeScript
SD787/dnimtob
/server/src/endpoint/ArticleEndpoint.ts
2.6875
3
import { Server } from 'express'; import Sanitizer from 'sanitizer'; import EndpointUtils from './EndpointUtils'; import User from '../data/entity/User'; import Article from '../data/entity/Article'; export default class ArticleEndpoint { static registerArticleEndpoint(app: Server): void { app.post('/api...
cc6ba5de31ca2b20db07da7e203766e16242d550
TypeScript
risingstar8030/Smart-Odisha-Hackathon
/src/app/components/map/map.component.ts
2.625
3
import { Component, OnInit } from '@angular/core'; import { FcrService} from '../../services/fcr.service'; import { Count} from '../../model/count'; @Component({ selector: 'app-map', templateUrl: './map.component.html', styleUrls: ['./map.component.css'] }) export class MapComponent implements OnInit { constr...
cc04edb3a71ab5ebbf46bd99b57f78c7a7ab7efa
TypeScript
rthreei/swc-node
/packages/integrate/__tests__/super/class-super.spec.ts
2.859375
3
import test from 'ava' class BadRequestError extends Error { constructor(public readonly message: string) { super(message) } } test('should handler class super', (t) => { const message = 'Bad request' const e = new BadRequestError(message) t.is(e.message, message) })
f3452a7f2e46186a605643ba95ad6fd43d8965ee
TypeScript
molgga/jood-appearer
/projects/packages/src/actor/base-actor.spec.ts
2.625
3
import { sleep, createEntry } from '../__testing__'; import { AppearStage } from '../stage/appear-stage'; //"projects/packages/src/stage/appear-stage"; import { AppearEvent } from '../common/types'; import { BaseActor } from './base-actor'; describe('BaseActor', () => { let stage: AppearStage; let dom: HTMLElement...
a7be839abe452605e22d7a3fb4b2f4fdffc7a44a
TypeScript
planttheidea/fast-equals
/__tests__/comparator.ts
2.828125
3
import { createEqualityComparator, createInternalEqualityComparator, } from '../src/comparator'; import { areArraysEqual, areDatesEqual, areMapsEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, } from '../src/equals'; import { createIsCircular } f...
1b6f48c698865deabc98b95683729352a474e5b0
TypeScript
a-type/graphql-arangodb
/src/errors.ts
2.953125
3
export class FieldMissingError extends Error { constructor(typeName: string, fieldName: string) { super( `Invalid state: field "${fieldName}" does not exist on type "${typeName}"` ); } }
9964cccc60323667c58defca3638b97edf1730ec
TypeScript
CodeStompNJ/Hermes-UI
/src/app/home/chat.service.ts
2.65625
3
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable, of } from 'rxjs'; import { map, catchError } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class ChatService { constructor(private httpClient: HttpClient) {} // defaulting to g...
3f584f760366fbfbeeb700e34e425e4268428162
TypeScript
cortezaproject/corteza-server-corredor
/src/services/dependencies.ts
2.671875
3
import { BaseLogger } from 'pino' import watch from 'node-watch' import glob from 'glob' import path from 'path' import { spawnSync } from 'child_process' interface CtorArgs { logger: BaseLogger; searchPaths: string[]; } interface WatchCallback { (path: string): void; } /** * Utility function for flatting w/ ...