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 |
|---|---|---|---|---|---|---|
95e2c6eca6c35c783b982aa8476d64ec070ccc66 | TypeScript | pwFoo/riba-tinybind-fork | /packages/bs4/src/services/collapse.service.ts | 2.703125 | 3 | /**
*
* @see https://github.com/twbs/bootstrap/blob/v4-dev/js/src/collapse.js
*/
export class CollapseService {
public static DATA_KEY = 'bs.collapse';
public static EVENT_KEY = `.${CollapseService.DATA_KEY}`;
public static DATA_API_KEY = '.data-api';
public static EVENT = {
... |
2e64650d01bb0bba17423dcb0de498913a239997 | TypeScript | gruppe-adler/gruppe-adler.de | /api/src/utils/UploadService.ts | 2.875 | 3 | import { existsSync, mkdirSync, writeFileSync, unlinkSync } from 'fs';
export class UploadService {
private static instance: UploadService|null = null;
public static readonly UPLOADS_BASE_PATH = 'data/uploads';
private static readonly MINE_TYPES = new Map<string, string>([
['image/gif', 'gif'],
... |
f65169b1fdad161162669af1fa65e4527ba977ea | TypeScript | imjuni/jin-curlize | /src/generators/fastify/__tests__/fastify.query.test.ts | 2.515625 | 3 | import generateFastifyQuerystring from '#generators/fastify/generateFastifyQuerystring';
import encodeQuerystring from '#tools/encodeQuerystring';
describe('generate-querystring', () => {
it('empty-querystring', () => {
const url = new URL('https://localhost:1234');
const qs = generateFastifyQuerystring(url... |
bc2a70a4400ba8996e798fa65126004e8da58248 | TypeScript | ManuelMarinRodriguez/TiaCarmen | /front-TiaCarmen/src/app/tab3/model/tab3.model.producto.ts | 2.53125 | 3 | export class Producto {
id: number;
cantidad: number;
constructor(id: number, cantidad: number) {
this.id = id;
this.cantidad = cantidad;
}
} |
cf80635c469f3fd94a1744c88dc3b107f7532b34 | TypeScript | Zanguient/GankoBackend | /src/controllers/users/new-password.ts | 2.53125 | 3 | import { UserService } from "./../../services/user-service";
import { ResponseBody } from "./../response-body";
let md5 = require('md5');
export function newPassword(req, res, next) {
let oldPass = req.body.oldPass;
let newPass = req.body.newPass;
let id = req.params.id
UserService.instance.getById(id)... |
4bcf35f8b9433551b34411bc7bba498265b27640 | TypeScript | just-anohaker/ok-robot-server | /src/base/Platform.ts | 2.765625 | 3 | import * as path from "path";
import * as fs from "fs";
export interface IPlatform {
getUserDataDir(): string;
}
class NodePlatform implements IPlatform {
getUserDataDir(): string {
const ownDirName = ".etm_okex_datas";
const destDir = path.resolve(path.join(process.cwd(), ownDirName));
... |
b58086e2d16bc3f2471a837927d2e1d61f4b805f | TypeScript | xiaolilir/LayaMiniGameFrame | /src/dMyGame/$PrefabProcessor/z_T/RootProManager.ts | 2.546875 | 3 | import BasePrefabPro from './pro/BasePrefabPro';
import { EProcessor } from '../c_Enum/EProcessor';
import { EOtherLevelName } from '../../Enum/EOtherLevelName';
import { IPrefabsGather } from 'src/aTGame/3D/SceneUtils';
/**
* 加工者管理类基类
*/
export default class RootProManager {
//加工者列表
protected m_proList: { [i... |
8c5b42e330bb16b2c8f3751d3b27f71d3e466a40 | TypeScript | ZenkovichAlexsandr/living-it-assignment | /frontend/src/app/models/transactions.model.ts | 2.53125 | 3 | export interface Transaction {
money: number;
from: number;
to: number;
}
export interface TransactionList {
id: number;
creationDate: number[];
from: number;
to: number;
status: TransactionStatus;
}
export enum TransactionStatus {
NEW = 'NEW',
APPROVED = 'APPROVED',
DECLINED = 'DECLINED'
}
|
cf885a5ba9cd4aea172f609f4b2a7cf6f18349db | TypeScript | rochac2lee/speek.video | /libs/util/share/src/lib/types.ts | 2.578125 | 3 | export type Share = ShareData & {
title: string
text: string
hashtags?: string
}
export interface ShareOption {
shareTitle: string
cancel: string
copy: string
print: string
email: string
selectSms?: string
}
export interface ShareSocial {
sms: string
messenger: string
whatsapp: string
twitte... |
0df6d8f08cb5ab2ab6bf8b20a5966c76ef0efedd | TypeScript | jolylai/nodejs-serve | /app/service/user.ts | 2.625 | 3 | import { Service } from "egg";
export interface User {
id: number;
name: string;
email: string;
mobile: string;
address: string;
gender: string;
age: number;
created_at: Date;
updated_at: Date;
}
/**
* User Service
*/
export default class UserService extends Service {
public async getUserById(us... |
4c1edd0bf85baccf3c1d34aa8cf67466f6ef085d | TypeScript | ericop/meiosis | /helpers/routing/src/state/index.ts | 3.5 | 4 | /**
* `meiosis-routing/state`
*
* The `state` module contains functions for managing routes in the application state.
*
* @module state
*/
/**
* Route segment params.
*/
export type Params = Record<string, any>;
/**
* A route segment.
*/
export interface RouteSegment {
id: string;
params: Params;
}
/**... |
796b159e605bf9b6b7a2f46bfc57a0675f1daf7c | TypeScript | BinaryBlox/web-session | /test/__setup__/utils.ts | 2.6875 | 3 | declare let window: any;
interface Options {
hash?: string;
pathname: string;
search?: string;
}
export function navigate(options?: Options) {
const { pathname = location.pathname, search, hash } = options || {};
let url = `${location.protocol}//${location.host}${pathname}`;
if (search) {
url += `?${... |
c23c0ce21bb42775626be3178df25dedbc2761de | TypeScript | ViniciusDeLuca/CRUD_LGBT | /src/dao.ts | 2.859375 | 3 | import lowdb from "lowdb";
import FileSync from "lowdb/adapters/FileSync";
import { nanoid } from "nanoid";
import { Book } from "./model/Book";
class DAO {
db = lowdb(new FileSync("db.json"));
constructor() {
this.db.defaults({ books: [] }).write();
}
listProducts(): Book[] {
return sortByName(th... |
f8ad5342e73245a11be86f84523d92857515868a | TypeScript | gfrebello/qs-trip-planning-procedure | /src/main/webapp/app/shared/model/attraction.model.ts | 2.53125 | 3 | export interface IAttraction {
id?: number;
name?: string;
type?: string;
city?: string;
price?: number;
}
export const defaultValue: Readonly<IAttraction> = {};
|
bfbeffcf5fcee349906861a55bcb53ea6124a81c | TypeScript | anthoto/stencil | /test/karma/src/util.ts | 2.734375 | 3 | export type AddComponentFn = <T extends Element>(childHtml: string) => T;
/**
* Create setup methods for dom based tests.
*/
export function setupDomTests(document: Document, scratch: HTMLDivElement = null) {
const testDiv = document.createElement('div');
testDiv.className = 'test-app';
let app = document.body... |
957ca6fe52584a718cb78f6bfc9943014ac8adf1 | TypeScript | Tech-Code1/graphql-course-api | /src/graphql/resolvers/person.ts | 2.609375 | 3 | import { IResolvers } from 'graphql-tools'
import data from '../../data/data.json'
export const personResolver: IResolvers = {
Query: {
getPerson(__: void, args: any) {
const [found] = data.people.filter(p => p.id === args.id)
return found
}
},
Person: {
__resolveType(obj: any) {
re... |
cb1c21237d655ef6c5d30051bd17e50768acb9c5 | TypeScript | sourcegraph/sourcegraph | /client/shared/src/search/query/languageFilter.test.ts | 2.625 | 3 | import { languageCompletion, POPULAR_LANGUAGES, ALL_LANGUAGES } from './languageFilter'
import { type Literal, createLiteral } from './token'
const create = (value: string): Literal => createLiteral(value, { start: 0, end: 0 })
describe('languageCompletion', () => {
test('suggest popular languages', () => {
... |
ee8c1b698bbeb5c6271d5a1b557dd971d56d3e7a | TypeScript | LuccaSA/lucca-front | /packages/ng/core/group/group.interface.ts | 2.609375 | 3 | export interface ILuGroup<TItem, TKey> {
key: TKey;
items: TItem[];
}
|
2ec41165696edfb8a5d9e60f5123de62b86da9db | TypeScript | D4rkMindz/wavetrophyUI | /src/app/shared/models/event.model.ts | 2.609375 | 3 | import {Image} from '@app/shared/models/image.model';
import {Moment} from 'moment';
export interface WaveEvent {
hash: string;
day: string;
start: Moment;
end: Moment;
title: string;
description: string;
images: Image[];
}
export class EventModel implements WaveEvent {
private readonly _hash: string... |
1a9621f3e54d3a8f1c50cab482af0a0300ffdb0b | TypeScript | hwaterke/inab | /packages/web/src/entities/Filter.ts | 3.03125 | 3 | export class Filter {
attribute: string
operator: string
value: string | number
constructor(attribute: string, operator: string, value: string | number) {
this.attribute = attribute
this.operator = operator
this.value = value
}
}
|
e5d0008efca7d447d1e7f94920917ae22010b103 | TypeScript | qfl1ck32/bluelibs | /packages/ejson/src/utils/toJSONValueHelper.ts | 2.734375 | 3 | import { builtinConverters } from "./builtinConverters";
// Either return the JSON-compatible version of the argument, or undefined (if
// the item isn't itself replaceable, but maybe some fields in it are)
export const toJSONValueHelper = (item) => {
for (let i = 0; i < builtinConverters.length; i++) {
const con... |
a3e96afb8ca049019b53a96cde668287afbafbdc | TypeScript | willianevl/backend-recados-bd | /src/features/user/middleware/UsernameJaExiste.ts | 2.6875 | 3 | import { NextFunction, Request, Response } from "express";
import { User } from "../../../core/data/database/entities/User";
export default async function UsernameJaExiste(
req: Request,
res: Response,
next: NextFunction
){
const { username } = req.body;
const existe = await User.findOne({us... |
0f3a8f5954283e535cb726e099b1f2530a1ffebc | TypeScript | fshaikh/IndegoChallenge | /Code/BackEnd/Shared/src/Models/DataObjectBase.ts | 2.546875 | 3 | import { IdService } from "../sharedExports";
/**
* Base class for all domain objects
*/
export default class DataObjectBase {
constructor(id: string = null){
this._id = id == null ? new IdService().getUniqueId() : id;
this.CreatedDate = new Date();
this.LastModifiedDate = new Date(... |
3bf9cb43007d3dc0fbcba2ea6b8efc540e3da736 | TypeScript | plugjs/plug | /workspaces/cov8/src/index.ts | 2.609375 | 3 | import { install } from '@plugjs/plug/pipe'
import { Coverage } from './coverage'
import type { SourceMapBias } from './analysis'
/** Options to analyse coverage reports */
export interface CoverageOptions {
/** The bias for source map analisys (defaults to `greatest_lower_bound`) */
sourceMapBias?: SourceMapBia... |
b0892a389ba0daad44c7a293bda45ed5d377fedb | TypeScript | cennznet/explorer | /etl/src/task/task-collection.ts | 2.828125 | 3 | import { uniqBy } from 'lodash';
import { BlockTask } from './block-task';
export class TaskCollection {
constructor(private tasks: BlockTask[] = []) {}
public get first(): BlockTask {
return this.tasks[0];
}
public get last(): BlockTask {
return this.tasks[this.tasks.length - 1];
... |
c87d8f6196ee9b64260a8a5479e73df1055904cb | TypeScript | BobrD/simples.memorize | /src/memorize.ts | 2.9375 | 3 | import {memCache} from "./memCache";
import {IMemorizeHint} from "./IMemorizeHint";
export const memorize = <T extends Function>(f: T, tags: string[], hint: IMemorizeHint = {}): T => {
const tagHash = tags.join('__:__');
// add to every tag information about tagHash
tags.forEach(tag => {
if (void ... |
4482d4ac71d379773bed7224d63b5ff118c8d43c | TypeScript | plachenko/adenga | /src/classes/Item.ts | 3 | 3 | export default class Item{
public title!: string;
public time!: number;
constructor(title = '', time: number){
this.title = title;
this.time = time;
}
}
|
4dadae14bcd9ef37c648f9ac831a1c411dd697d3 | TypeScript | aadriantech/car-rental | /src/interfaces/ApiResourceInterface.ts | 2.640625 | 3 | import ResourceParameterInterface from '@/interfaces/ResourceParameterInterface';
import AvailabilityApiResource from '@/api/AvailabilityApiResource';
import {Store} from 'vuex';
interface ApiResourceInterface {
params: object;
resource: object;
resourcePathName: string;
store: object;
/**
* Assigns para... |
fafc8c1f54244b79afa299e598a2287da939ba50 | TypeScript | mmichlin66/mimcss | /src/typedoc/styleProps/b/background.ts | 2.734375 | 3 | import * as css from "mimcss"
class MyStyles extends css.StyleDefinition
{
// Using single string value
cls1 = this.$class({ background: "green url('lizard.png') 0.5em 20px / contain repeat-x fixed border-box content-box" })
// Using single color value
cls2 = this.$class({ background: 0xAA0033 })
... |
592553fb70d9c36c6c5443d97c793a08406085e0 | TypeScript | sakshimunjal/instaDirectMessage | /app/src/instaDirectMessage.ts | 2.640625 | 3 | import { IgApiClient, AccountRepositoryLoginResponseLogged_in_user, IgCheckpointError } from "instagram-private-api";
type SendFunc = (msg: string) => Promise<void>
export default async function(sender: {username: string, password: string, twoFactor?: (username: string) => (string | number | Promise<string | number>... |
39bb31fd4d856da4172abd7ca27a9241d483f1a7 | TypeScript | mhasselbusch/TypeScriptGameStudioBuild | /compilations/library/Sound.ts | 3.453125 | 3 | /*
* Wrapper class for HTML5 Audio
*/
class Sound {
/// The sound
private mSound: HTMLAudioElement;
constructor(srcFile: string) {
this.mSound = document.createElement("audio");
this.mSound.src = srcFile;
this.mSound.preload = "auto";
this.mSound.controls = false;
this.mSound.style.display... |
214ceb1d2c3ff4cf94732a2b79f8f18d5761a901 | TypeScript | HypoLast/asdflkj | /src/actors/Enemy.ts | 2.734375 | 3 | import DamageParticle from "../particlesystem/DamageParticle";
import { ICombatObject } from "./ActorInterfaces";
import NonPlayerActor from "./NonPlayerActor";
abstract class Enemy extends NonPlayerActor implements ICombatObject {
public health: number = 0;
public abstract isDead(): boolean;
public abstra... |
aa6de82e35b6e3d4f9785764126f536a579c5429 | TypeScript | future4code/Ana-Flavia-Rodrigues | /semana15/aula40/first-script/src/exercicio5.ts | 3.875 | 4 |
const num1 : number = 2;
const num2 : number = 10;
function soma(num1: number , num2: number) : number {
return (num1 + num2)
}
console.log(num1 + num2)
function sub(num1: number , num2: number) : number {
return (num1 - num2)
}
console.log(num1 - num2)
function mul(num1: number , num2: number) : nu... |
41eb03734bb1226f67e535981f77daf4759550ce | TypeScript | faciovega2020/djwt | /validate.ts | 2.921875 | 3 | import { makeJwt } from "./create.ts";
import type { Jose, Payload, JsonValue, Algorithm } from "./create.ts";
import { convertBase64urlToUint8Array } from "./base64/base64url.ts";
import { convertUint8ArrayToHex } from "./deps.ts";
type JwtObject = { header: Jose; payload: Payload; signature: string };
type JwtObject... |
01999412814a4f023ed7f7f7c17ba2e9f4b73e84 | TypeScript | borsemayur2/deno-sparkpost | /lib/transmissions.ts | 2.890625 | 3 | import { Base } from "./client.ts";
import {
cloneDeep,
filter,
has,
isArray,
isString,
isPlainObject,
map,
set
} from "./deps.ts";
const api = "transmissions";
/*
* "Class" declaration, Transmissions exposes three functions, one for sending a transmission,
* another for getting a list of transmissi... |
6e17da6678d94dafeb3fc7322244d0d80cadc584 | TypeScript | npmcdn-to-unpkg-bot/protontype-api-example | /src/routes/DefaultRouter.ts | 2.546875 | 3 | import { BaseModel } from 'protontype-api/dist/models/BaseModel';
import {ExpressRouter} from "protontype-api/dist/routes/ExpressRouter";
import {ExpressApplication} from "protontype-api/dist/libs/ExpressApplication";
import {Method} from "protontype-api/dist/routes/Method";
import {Route} from "protontype-api/dist/lib... |
3c49de155b917ec847a2607b318cc47974acb89a | TypeScript | jeverson34/guineabot-ts | /src/commands/Fun Commands/jokeCommand.ts | 2.5625 | 3 | import { RunFunction } from "../../interfaces/Command";
import axios from "axios";
export const run: RunFunction = async (client, message, args, prefix) => {
var options: any = {
url: "https://v2.jokeapi.dev/joke/Any?safe-mode?type=twopart",
method: "GET",
};
axios.request(options).then(async (response) => {
... |
fce28215c9d29aadd1fe0682deb014aa9de98df7 | TypeScript | housinganywhere/safe-redux | /src/index.spec.ts | 3.421875 | 3 | import { createAction, handleActions, ActionsUnion, Handler } from './index';
describe('handleActions', () => {
const ACTION = 'SOME_ACTION';
const initialState = { foo: 'bar' };
const returnedState = { foo: 'foo' };
const actionHandler = jest.fn(() => returnedState);
const reducer = handleActions(
{
... |
5b719024e528204522dd034a442ac2b84b32966c | TypeScript | TheWallOfDucks/chaos-duck | /src/config/schedule.ts | 3.03125 | 3 | /**
* @description This function returns a valid schedule object to deploy with serverless
* @returns {{rate: string; enabled: boolean; input: { body: any }}}
*/
export const schedule = (): { rate: string; enabled: boolean; input: { body: any } } => {
let rate: string = '1 hour';
let enabled: boolean = false... |
44c35c0a695d3f9dd803d43f71bc0163a7e79df6 | TypeScript | rhmoller/wasm-by-hand | /src/fizzbuzz.test.ts | 2.890625 | 3 | import { compileAndInstantiate, decodeWasmString } from "./wasm-util";
interface FizzBuzzInstance extends WebAssembly.Instance {
exports: {
fizzbuzz: Function
}
}
it("Prints fizzbuzz", async done => {
const lines: Array<string> = [];
const memory = new WebAssembly.Memory({ initial: 1 });
const instance ... |
725825d0820b6740ba55040e4e9874b196c7e580 | TypeScript | LaurieGami/creditcard-comparor | /graphql/types/Cashback.ts | 2.546875 | 3 | import { objectType, extendType, nonNull, intArg, floatArg } from 'nexus';
export const Cashback = objectType({
name: 'Cashback',
definition(t) {
t.int('creditCardId');
t.int('merchantId');
t.float('cashback');
t.string('merchantName');
t.string('creditCardName');
t.string('benefitName');
... |
dd78cb67f3c3def5199fe7c6595c4dc2a3c59441 | TypeScript | davidlikedog/typescript | /findWhere/index.ts | 3.34375 | 3 | function findWhere<T>(arr: Array<T>, map: T): Array<T> {
let result: Array<T> = [];
let isFind: boolean = false;
for (let i = 0; i < arr.length; i++) {
isFind = true;
for(let key in map){
isFind = arr[i][key] === map[key];
if (!isFind) {
break;
... |
f0cc05e458b581682ed40dcaec20c89a5980aa00 | TypeScript | Lakitna/Rulebound | /test/integration/openApiSchema/string/enum.spec.ts | 2.953125 | 3 | import { expect } from 'chai';
import { Rulebook } from '../../../../src/rulebook';
import rule from './enum';
const ruleName = 'openapi-schema/string/enum';
describe(`Rule: ${ruleName}`, function () {
beforeEach(async function (this: any) {
this.book = new Rulebook({
rules: {
... |
6b4065b3c55030e5af53a3b72a9fc0bb1e134b37 | TypeScript | csprance/node-misrcon | /src/utils/utils.ts | 2.859375 | 3 | /**
* Name: utils
* Created by chris on 4/30/2017.
* Description:
*/
import { AxiosResponse } from 'axios';
import * as crypto from 'crypto';
import { parseString } from 'xml2js';
const md5 = (contents: string) =>
crypto
.createHash('md5')
.update(contents)
.digest('hex');
export function createChal... |
a2cb3199cd87df3b293db6eba1f990fd60499d9b | TypeScript | pedritobata/ts-maxi-practical | /Typescript-legacy/namespace1/app.ts | 3.1875 | 3 |
//este archivo va a consumir al namespace MyMath
//para esto en la vista tendria que linkear a este archivo y a los otros dos
//que contienen a los mini archivos que definen el namespace
//otra forma es compilar de una manera especial y unir todos los
//archivos necesarios en un bundle, en este caso ese bundle será ... |
6e8f23e42fa11aa9202c46fbb722b5cef703f23e | TypeScript | manojown/Angular-Demo | /src/app/dashboard/dashboard.component.ts | 2.609375 | 3 | import { Component, OnInit, ViewChild } from '@angular/core';
import { ApiService } from '../api.service';
import {NgbTypeahead} from '@ng-bootstrap/ng-bootstrap';
import { Subject, Observable, merge } from 'rxjs';
import {debounceTime, distinctUntilChanged, filter, map} from 'rxjs/operators';
type Userdetails = { log... |
993ed0a0d9ddd872d246fb647ef8d66ff71f2557 | TypeScript | JSMonk/sweet-monads | /interfaces/async-monad.d.ts | 2.546875 | 3 | import type { Monad } from "./monad";
import type { AsyncApplicative } from "./async-applicative";
export interface AsyncMonad<T> extends AsyncApplicative<T>, Monad<T> {
asyncChain<B>(f: (a: T) => Promise<AsyncMonad<B>>): Promise<AsyncMonad<B>>;
}
|
94294c35cd33a516de5766d67fced050d7eabbe1 | TypeScript | pedrocmota/Vacinetro-WEB | /src/utils/Filter.ts | 2.71875 | 3 | import {IDose} from '../types/Dados'
import {toLowerCase} from '../utils/Utils'
export const filtrarDoses = (doses: IDose[] | undefined, mostrarInativas: boolean, pesquisa: string) => {
if (doses != undefined) {
doses = processarDose(doses)
if (!mostrarInativas) doses = doses.filter(e => e.estado == 'ATIVO')... |
4bbeadb4c5e0f1c7081b359defb540fddf33f4b0 | TypeScript | six7/design-tokens | /src/utilities/semVerDifference.ts | 2.546875 | 3 | export default (prevSemVers = '1.0.0', currentSemVer) => {
const [pMajor, pMinor, pPatch] = prevSemVers.split('.')
const [cMajor, cMinor, cPatch] = currentSemVer.split('.')
if (pMajor < cMajor) {
return 'major'
}
if (pMinor < cMinor) {
return 'minor'
}
if (pPatch < cPatch) {
return 'patch'
... |
8683bb88157c94a2dbff1bb64c14cdfa6053e4a3 | TypeScript | tibiaquest/optimizer | /src/app.ts | 2.578125 | 3 | import { TibiaData } from './tibia-data';
import { populateWorldMap } from '../data/map';
import { populateQuest } from '../data/quest';
const data = new TibiaData();
populateWorldMap(data);
populateQuest(data);
console.log(data.map.getNode("thais-city"))
let completedQuestParts = []; //none
let availableQuests = d... |
0d8366fe8431d7805c46ac72d5d1c95f8f9d24ad | TypeScript | spark-solutions/spree2vuestorefront | /src/utils/product.ts | 2.5625 | 3 | import Client from '@spree/storefront-api-v2-sdk/types/Client'
import { IProducts } from '@spree/storefront-api-v2-sdk/types/interfaces/Product'
import { findIncluded, findIncludedOfType } from '.'
import { ESProductType, JsonApiDocument, JsonApiResponse, JsonApiSingleResponse } from '../interfaces'
// productCustomAt... |
311020e16a4be52acc4caf14c867f8b2bf4dcf3d | TypeScript | strangerintheq/strangerintheq.github.io | /site/src/parts/components/generative-header/newSettings.ts | 2.546875 | 3 | import {rnd, rndi} from "./framework";
export type NeuralInterfaceSettings = {
cellCountX;
cellCountY;
count;
noiseSize1;
noiseSize2;
side;
colors: String[][],
}
export function newSettings(pal, w, h):NeuralInterfaceSettings {
let cellCountX = 333;
return {
cellCountX: cellC... |
bc7932a9ef35a3aae74d757b190b13f9617e718b | TypeScript | prokarmaproject/redui | /src/app/apiwrapper.service.ts | 2.546875 | 3 | import { Injectable } from '@angular/core';
@Injectable()
export class APIWrapperService {
jsonObject = `[
{
"answer": "answer 1",
"questionText": "Write your question for text",
"questionType": "textField",
"sectionName": "Section 1"
},
{
"answer": "",
"questionText"... |
a7977bf45b8756d30b1570f202e67685082531a0 | TypeScript | mhirapra/glide | /packages/glide-soql/src/expr.ts | 3.125 | 3 | import * as ops from "./ops";
import { IS_EMPTY, Fragment } from "./util";
const SINGLE_QUOTE = /'/gm;
export type Expr = Bool | Cmp;
export type Field = string | Fn;
export type Scalar = bigint | boolean | null | number | string;
export class Bool implements Fragment {
private readonly value: Expr[];
private c... |
e369f34d32366a73eeedf9b1b7d4e19aab090fbb | TypeScript | jundymek/ip-tracker-vue | /src/components/location/helpers.ts | 2.734375 | 3 | export const getUTCTimeDifference = (
offset: number | undefined
): string | null => {
if (offset) {
const start = offset > 0 ? "+" : "";
return `${start}${(offset / 3600).toString().padStart(2, "0")}:00`;
}
return null;
};
|
f15417d8bef5a5a4dd8cb1400a21686d9dc4aa62 | TypeScript | Hiayao/ug-unit3.0 | /.history/src/hooks/usecount_20200927152433.ts | 2.71875 | 3 | import { ref, onMounted } from 'vue'
export const useCount = (currents = 0, min?: number, ) => {
let current = ref<number>(currents)
const addCount = (max?: number) => {
if (current.value < max!)
current.value = current.value + 1
}
const cutCount = () => {
if (current.value ... |
91699a9f4a24e42a2bf69a33926d1eb2067fd5e8 | TypeScript | zhangfeixiang/cocos-example | /PhysicsReflectDemo/assets/Player.ts | 2.640625 | 3 | // Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const {c... |
60118c2f50daaffd5a5ad5dbf247237190726d3f | TypeScript | ionic-team/angular-toolkit | /packages/cordova-builders/utils/config.ts | 2.515625 | 3 | import type { Tree } from '@angular-devkit/schematics';
import { SchematicsException } from '@angular-devkit/schematics';
const CONFIG_PATH = 'angular.json';
export function getDefaultAngularAppName(config: any): string {
const projects = config.projects;
const projectNames = Object.keys(projects);
for (const ... |
5418efabf3146fee238d5a536f3fbc62c004118c | TypeScript | Aleixperez6/Rikapp | /src/app/pipes/character-filter.pipe.ts | 2.765625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { IResultados } from '../interfaces/characters';
@Pipe({
name: 'characterFilter'
})
export class CharacterFilterPipe implements PipeTransform {
transform(character: IResultados[], filterByName: string): IResultados[] {
const filterName = filterByNam... |
54e8d3c51abd168c14f8cc378554d9890ce506c6 | TypeScript | mehmetnyarar/programming-foundations-design-patterns-ts | /src/04_ObserverPattern/challenge/observers/ForecastDisplay.ts | 3.203125 | 3 | import { DisplayElement, Observer, Subject } from "../interfaces";
export class ForecastDisplay implements Observer, DisplayElement {
private currentPressure = 29.92;
private lastPressure!: number;
private weatherData: Subject;
constructor(weatherData: Subject) {
this.weatherData = weatherData;
this.w... |
32bdfb33a908513957603314e2057ce975943918 | TypeScript | qgolsteyn/easyaspi | /client/src/store/reducers/user.ts | 2.859375 | 3 | import produce from 'immer';
import { ActionType, createAction, getType } from 'typesafe-actions';
import { IClassroom, IUser, UserType } from '@shared/index';
export enum AuthStage {
AUTH_CHECK_LOADING,
AUTH_START,
AUTH_REGISTER,
AUTH_LOGGED_IN,
}
// We specify the shape of the state in an interface... |
82001976aa50428c0184ffc4042144f991d99da3 | TypeScript | microsoft/FluidFramework | /packages/tools/devtools/devtools/src/index.ts | 2.65625 | 3 | /*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
/**
* Primary entry-point to the Fluid Devtools.
*
* To initialize the Devtools alongside your application's {@link @fluidframework/fluid-static#IFluidContainer}, call
* {@link initializeDevtool... |
773db5862d64f4202b8590f1566ca4c5b4487d57 | TypeScript | vparaskevas/fattura-elettronica | /dist/Common/DatiDocumento.d.ts | 2.625 | 3 | /**Informazioni relative ad un documento a cui si fa riferimento. */
export interface DatiDocumento {
RiferimentoNumeroLinea?: number[];
/**Numero del documento a cui si fa riferimento. */
IdDocumento: string;
/**Data del documento a cui si fa riferimento. */
Data?: Date | string | null;
/**
... |
40f161dd7750b62669faccfd9155424bf646d939 | TypeScript | teal-front/virtual-dom | /src/util.ts | 2.703125 | 3 | export function isString (s) {
return typeof s === 'string'
}
export function isArray (arr) {
return Array.isArray(arr)
}
export function isObject (obj) {
return Object.prototype.toString.call(obj) === '[object Object]'
}
|
ee5b8bb749585626957ec5298817d3587961444a | TypeScript | AgentMulder/Connect-4 | /Key.ts | 2.921875 | 3 | /* Key.ts */
module C4 {
export class Key {
i_started : boolean = false
start : () => void = this.o_start
get starter () : string { return this.i_started ? 'i' : 'u' }
get other () : string { return this.i_started ? 'u' : 'i' }
get i () : boolean ... |
a0fe11ea061ce82a90ed134177bd3c2832c562a5 | TypeScript | GapMAX/vuex-maphooks | /src/utils.ts | 2.8125 | 3 | import { useStore as sourceUseStore } from "vuex";
const keyWithNamespace = (key : string, ns : string) => {
const result = ns ? ns.endsWith('/') ? ns + key : ns + '/' + key : key;
return result.split('/').filter(v => v).join('/');
}
export type GanValueWithArrayKeysType = (value : {
[key : string] : any
}, key... |
44fd53834e458b50cee4ad4ca7b7e7c7e09e0fa3 | TypeScript | qiujie8092916/egg-route-decorator | /lib/pipe/parse-int.pipe.ts | 2.9375 | 3 | import { BadRequestException } from '../exception';
import { PipeTransform } from '../feature';
import { ArgumentMetadata } from '../feature';
/**
* 转为number
*/
export class ParseIntPipe implements PipeTransform<string> {
async transform(value: string, metadata: ArgumentMetadata): Promise<number> {
const... |
73b114662619ab1dae3b55e1ec351a29ec32b9b9 | TypeScript | natansc-dev/curso_typescript | /src/Aula18-classes/Aula18-classes.ts | 3.265625 | 3 | export class Empresa {
public readonly name: string;
private readonly colaboradores: Colaborador[] = [];
protected readonly cnpj: string;
constructor(name: string, cnpj: string) {
this.name = name;
this.cnpj = cnpj;
}
addColaborador(colaborador: Colaborador): void {
this.colaboradores.push(col... |
e0f99ff59539d996b49b512ad70fb3aab836427d | TypeScript | NamitS27/BSAnalysis | /controllers/player.info.controller.ts | 2.53125 | 3 | import { Player } from "../models/player.model";
import { Request, Response } from "express";
export async function getPlayerInfo(req: Request, res: Response) {
try {
const tag: string = `#${req.params.tag}`;
const player = await Player.findOne({ tag: tag });
if (player) {
res.status(200).json(player);
} e... |
e3dc7d82ed0e9598b0ad088c9f5a2d67f170554d | TypeScript | gabrielcancio/nlw-3-happy | /server/src/views/image_view.ts | 2.625 | 3 | import Image from '../models/Image';
import getIP from '../utils/getIP';
const ip = getIP();
export default {
render(image: Image) { // Método para renerizar uma imagem
return {
id: image.id,
url: `http://${ip}:3333/uploads/${image.path}` // Atribuindo uma url para servir que as imagens que será usa... |
b79581c4afc6394682863f1a80da23b39784582c | TypeScript | fernandosouza/angular-builders | /merge-schemes.ts | 2.6875 | 3 | import {writeFileSync} from 'fs';
import {merge} from 'lodash';
interface CustomSchema {
originalSchemaPath: string;
schemaExtensionPaths: string[],
newSchemaPath: string;
}
const wd = process.cwd();
const schemesToMerge: CustomSchema[] = require(`${wd}/src/schemes`);
for(const customSchema of schemesToMerge){
c... |
32f3f2a9be1357d0603165b103aea5d43acbab47 | TypeScript | TWpower/eui | /src/services/sort/comparators.test.ts | 2.828125 | 3 | /*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not u... |
317942e41e48c17eeb349dba3a154b3fa557da99 | TypeScript | moker-monkey/Fleet-Vue | /src/api/Model.ts | 2.578125 | 3 | import Axios, { AxiosStatic, AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError, Method } from 'axios';
import Mock from 'mockjs'
import { parse } from 'path-to-regexp';
// TODO:数据中转站(已完成)
// 数据的流转中心,使用场景:当组件已经封装好了,但是后端给的数据结构不对,但是基本元素都存在,需要前端转换数据,此时就需要再数据中心挂载一个处理函数,
// 优点
// 1. 使用异步运算,可以保证数据转换时不阻塞后续的请求
// 2.... |
c5931630babc25ef5d66d1fc20fc8370ec67b114 | TypeScript | calebboyd/kataw | /src/compiler/ast/expressions/method-definition.ts | 2.625 | 3 | import { Node, NodeKind, NodeFlags, TransformFlags, AccessModifiers } from '../node';
import { updateNode } from '../../../visitor/common';
import { ObjectLiteral } from './object-literal';
import { ObjectBindingPattern } from './object-binding-pattern';
import { ClassDeclaration } from './../declarations/class-declara... |
9a598897fab6ba3c5e91010f84727ccde5936206 | TypeScript | decentraland/decentraland-gatsby | /src/entities/Route/wkc/response/Response.ts | 2.796875 | 3 | import type { IHttpServerComponent } from '@well-known-components/interfaces/dist/components/http-server'
export type ResponseBody =
| IHttpServerComponent.JsonBody
| Uint8Array
| Buffer
| string
export default class Response {
status?: number
statusText?: string
body?: ResponseBody
headers?: Record<s... |
7a2985ead7dac835e6ca621a23ec06eacdfbdd8e | TypeScript | anzerr/color.util | /index.d.ts | 2.8125 | 3 |
declare class Hsl {
public constructor(n0: number, n1: number, n2: number);
public toRgb(): [number, number, number];
}
declare class Hsv {
public constructor(n0: number, n1: number, n2: number);
public toRgb(): [number, number, number];
}
declare class Hue {
public constructor(n0: number, n1: numbe... |
8c6282278cd6ac6c17400bacf5dcc74dc953cd50 | TypeScript | RipaEx/core | /packages/core-debugger-cli/src/commands/verify.ts | 2.578125 | 3 | import { models } from "@arkecosystem/crypto";
import { flags } from "@oclif/command";
import { handleOutput } from "../utils";
import { BaseCommand } from "./command";
export class VerifyCommand extends BaseCommand {
public static description: string = "Verify the given HEX";
public static flags = {
... |
c258a10447dee79a97a42800c34d8613828d30ff | TypeScript | chunmu/aike-ts | /packages/aike-ts-base/src/is.ts | 2.765625 | 3 | // eslint-disable-next-line
export const isDefine = (v: any): boolean => v !== null && v !== undefined;
// eslint-disable-next-line
export const isUndefine = (v: any): boolean => v === null || v === undefined;
// eslint-disable-next-line
export const isFunc = (f: any): boolean => typeof f === 'function';
// eslint-disa... |
ecf9ce768c5c0af3fee6fc5e07ac28a84541a980 | TypeScript | ferdikoomen/openapi-typescript-codegen | /src/openApi/v2/parser/getServer.ts | 2.703125 | 3 | import type { OpenApi } from '../interfaces/OpenApi';
/**
* Get the base server url.
* @param openApi
*/
export const getServer = (openApi: OpenApi): string => {
const scheme = openApi.schemes?.[0] || 'http';
const host = openApi.host;
const basePath = openApi.basePath || '';
const url = host ? `${s... |
71cefd3b720b98790805387b1aa7c5495580c8dd | TypeScript | vavsab/telegram-green-house | /src/green-house/windows/bus/data-bus.ts | 2.671875 | 3 | export abstract class DataBus {
private queryPromise: Promise<string> = Promise.resolve('');
public async sendCommand(command: string):Promise<string> {
this.queryPromise = this.queryPromise.then(() => this.processCommand(command));
return await this.queryPromise;
}
protected abstract... |
178119cf61d94f3dc581b8b69bae30b1a6fc67d7 | TypeScript | pick4er/tiles | /src/flux/types/index.ts | 2.5625 | 3 | import type { Action } from 'redux';
import type { ThunkDispatch } from 'redux-thunk';
import { rootReducer } from 'flux';
export type RootState = ReturnType<typeof rootReducer>;
export interface PayloadAction extends Action<string> {
payload?: any;
}
export interface GetState {
(): RootState;
}
export type Ti... |
5a1f729bf2d5ce738afda5a552066384df3c9b14 | TypeScript | LeonardoGabrielSanches/AdoteUmAlunoApp | /backend/src/controller/UserController.ts | 2.59375 | 3 | import { Request, Response } from 'express';
import UserModel from '../models/User';
import UserService from '../service/UserService';
import LoginModel from '../models/Login';
export const Create = async (request: Request, response: Response) => {
const {
firstName, lastName, age, email, course, biography, phon... |
8f8ad9881771ba6447ca26f74ff2334ed76ffc1f | TypeScript | krillkrill/AngularBootCamp | /ticktactoe/src/app/app.component.ts | 2.609375 | 3 | import { Component } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor(private toastr : ToastrService){}
title = 'ticktactoe';
winMessage ... |
b245a677ff313981f9ab1be5e16e7dddf125c5ca | TypeScript | dvaJi/genshin-impact-scraper | /crawler/connectors/es/characters.ts | 2.640625 | 3 | import { Request } from "node-fetch";
import { Connector } from "@engine/Connector";
import {
Ascension,
Character,
Constellation,
DeepPartial,
instanceOfSkill,
Passive,
Skill,
} from "@engine/Types";
import { tableJson } from "@helper/table-json";
export default class CharactersCrawler extends Connector... |
e4a9d570301aad5d789bd0654f9e6470229c7e9d | TypeScript | miha80/ngrx_test | /ngrx-test/src/app/my/reducers/index.ts | 2.8125 | 3 | import * as fromRoot from '../../root-reducers/';
import * as fromActions from '../actions/number.actions';
import { Action, combineReducers, createReducer, on } from '@ngrx/store';
export const myFeatureKey = 'myFeature';
export interface NumbersState {
first: number;
second: number;
}
const initialState: Numbe... |
7eb3d5838195e5e1a3e812b7e04e63be52cc6574 | TypeScript | viljami/route-builder | /src/store/types.ts | 2.828125 | 3 | export type LocationId = string;
export interface Action<T> {
type: string,
payload: T
}
export interface Location {
id: LocationId,
latlng: L.LatLng
}
export interface LocationMove {
fromId: LocationId,
toId: LocationId
}
export interface StoreState {
locations: Location[]
}
|
ffe535768928d4499bdcd5fd4f7b82fceebc587f | TypeScript | william251082/nodefeed | /feeds/src/models/__test__/feed.test.ts | 3.140625 | 3 | import {Feed} from "../feed";
it('implements optimistic currency control', async (done) => {
// Create an instance of a feed
const feed = Feed.build({
title: 'concert',
price: 5,
userId: '123',
});
// Save the feed to the database
await feed.save();
// fetch the feed t... |
43aa085ba3bcca42cdee2bf0261eb0ae2de6a03b | TypeScript | Piglygamer/cli | /linker-app/src/modules/authorization/actions.ts | 2.53125 | 3 | import { action } from 'typesafe-actions'
import { Authorization } from './types'
export const FETCH_AUTHORIZATIONS_REQUEST = '[Request] Fetch LAND Authorizations'
export const FETCH_AUTHORIZATIONS_SUCCESS = '[Success] Fetch LAND Authorizations'
export const FETCH_AUTHORIZATIONS_FAILURE = '[Failure] Fetch LAND Authori... |
a6786257145844458db1e155f943690bfc1728dc | TypeScript | Angular-RU/angular-ru-sdk | /libs/cdk/tests/array/utility-arrays.spec.ts | 3.09375 | 3 | import {
exclude,
hasAtMostOneItem,
hasItems,
hasManyItems,
hasNoItems,
hasOneItem,
partition,
takeFirstItem,
takeLastItem,
takeSecondItem,
takeThirdItem
} from '@angular-ru/cdk/array';
import { isNumber } from '@angular-ru/cdk/number';
import { PlainObject } from '@angular-r... |
4960ef3e54c4013cdae8ed916bacca5b43a2c245 | TypeScript | workofartyoga/downdog | /src/shared/postal-address.ts | 3.078125 | 3 |
export interface IPostalAddress {
id: number;
city?: string;
label: string;
pobox?: string;
postalCode?: string;
state?: string;
street1?: string;
street2?: string;
}
export function createNewAddress( { id, city, label, pobox, postalCode, state, street1, street2}: any )
: any {
return { city, label,... |
a42abcbcd09fb70774e1af9851c0a044bb3a80ad | TypeScript | davidjaleixo/vfos.vapp23 | /views/app23/src/app/_helpers/dependecy.validator.ts | 2.625 | 3 |
import { FormGroup } from '@angular/forms';
export function dateDependecyValidator(lowerDate: string, biggerDate: string) {
return (fg: FormGroup) => {
console.log("Validating dependecy dates... ");
const bigger = fg.controls[biggerDate];
if(fg.controls[lowerD... |
8a915c27fb8048eca7763aa59f06ade85d75629d | TypeScript | wix-incubator/wix-answers-public | /answers-toolkit/src/utils/ensure-exists/index.ts | 2.96875 | 3 | export const ensureExists = <T>(item: T | null | undefined, msg?: string): T => {
if (typeof item === 'undefined' || item === null) {
throw (msg || 'Variable is null or undefined');
}
return item;
};
|
3b94944b5460c9ddda06f1e745349876b861b6c3 | TypeScript | KatjaLeonteva/An2-4-Routing | /src/app/core/interceptors/my.interceptor.ts | 3 | 3 | // Interceptor = перехватчик. Позволяет видоизменить запрос или ответ
// Используется когда хотим применить некую бизнес-логику к нескольким запросам
// Например, авторизация - будет перехватывать запросы и добавлять токен авторизации
import { Injectable } from '@angular/core';
import {
HttpEvent,
HttpInterceptor,... |
559118875086c485050a71ffb8b70181f14e5ad6 | TypeScript | JoshuaAHill/prototypeSoundBlocks2 | /custom.ts | 3.453125 | 3 | /**
* Use this file to define custom functions and blocks.
* Read more at https://makecode.microbit.org/blocks/custom
*/
/**
* Sound blocks
*/
//% weight=100 color=#0fbc11 icon=""
namespace sound {
/**
* Squeak - slide between two frequencies over a variable period of time.
* @param note pitch of... |
06f5d10ab20482559d63ba1ccead024c67e3d1f9 | TypeScript | zeakd/rollup-typescript-lib-starter | /src/hello.ts | 2.828125 | 3 | interface Hello {
(name: string): void;
}
const hello: Hello = (name) => {
console.log('hello ' + name)
}
export default hello; |
48721b161951699f8880ad8d04f75a008926b2c3 | TypeScript | ProjectParticle/web_app_frame | /src/app/auth/store/reducer.ts | 2.609375 | 3 | /**
* App / Auth / store / reducer
*/
const initialState = {
currentApplication: '',
};
export type AuthState = Readonly<typeof initialState>;
export default (state: AuthState = initialState, action: any): AuthState => {
return state;
};
|
af9e3eba5224ea6b8f786e6865c5f97bbbcceac2 | TypeScript | regal/regal-bundler | /dist/src/bundle.d.ts | 2.515625 | 3 | import * as rollup from "rollup";
import { LoadedConfiguration } from "./interfaces-internal";
import { BundlerOptions, RecursivePartial } from "./interfaces-public";
/**
* Imports and exports used for bundles in ESM format.
* @param metadata Stringified game metadata.
*/
export declare const esFooter: (metadata: st... |
5fe668a4b6c05a94e0bdbef45e31d4141a87f0ec | TypeScript | hayderux/do | /src/parser/parser.ts | 2.921875 | 3 | import {
AnnotationAST,
ArrayLiteral,
AstBoolean,
ASTProgram,
BlockStatement,
CallExpression,
CaseExpression,
Comment,
DecrementExpression,
EnumElement,
EnumLiteral,
Expression,
ExpressionStatement,
FloatLiteral,
ForLiteral,
FunctionLiteral,
HashLiteral,
Identifier,... |
14c305c8f125a8633e2d1ccf73c2b5532dca3aac | TypeScript | mkrahelski/the-platform | /webapp/src/components/classes/article.ts | 2.78125 | 3 | export class Article {
articleId:number = 0;
seriesId:number = 1;
statusType:number = 4; //4 = not Submited article
title:string = "";
preview:string="";
contents:string="";
pictureLink:string = "";
}
const testArticle = new Article();
testArticle.articleId = 10;
testArticle... |
bed901d9368ed0a6c0a76e1bf4b46a58dbf1f070 | TypeScript | youngjid/plasmic | /packages/host/src/registerComponent.ts | 2.875 | 3 | import {
CodeComponentElement,
CSSProperties,
PlasmicElement,
} from "./element-types";
const root = globalThis as any;
type StringType =
| "string"
| {
type: "string";
defaultValue?: string;
};
type BooleanType =
| "boolean"
| {
type: "boolean";
defaultValue?: boolean;
... |