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 |
|---|---|---|---|---|---|---|
34b43a5e997033e2831159a02892cd44c4062c6e | TypeScript | WindSpiritSR/casdoor-js-sdk | /src/sdk.ts | 2.59375 | 3 | export interface sdkConfig {
serverUrl: string, // your Casdoor URL, like the official one: https://door.casbin.com
clientId: string, // your Casdoor OAuth Client ID
appName: string, // your Casdoor application name, like: "app-built-in"
organizationName: string // your Casdoor organization name, like: ... |
3d048ec5f8e8f0112d97eb312a814585ed7ff562 | TypeScript | mircearoata/SMRVersionVerifier | /src/virustotal.ts | 2.65625 | 3 | import got, { Response } from 'got';
import FormData from 'form-data';
import { VTAuthorization } from '../config.json';
import { sleep, setIntervalImmediate } from './util';
import { logger } from './logging';
export interface VTRequest {
endpoint: string;
method?: 'GET' | 'POST';
body?: string | Buffer | FormD... |
15b8e1116516e0d50fa6fadaf0183b19bcad44a9 | TypeScript | clokken/gaf-converter | /src/frameWriter.ts | 2.75 | 3 | import { PNG } from "pngjs";
import { Palette } from "./palette";
export const FrameWriter = {
makePNG(frame: Buffer, width: number, height: number, palette: Palette = null) {
let png = new PNG({
filterType: -1,
width: width,
height: height,
});
let read... |
7fc56540c5c118e24499dba1b94ef39d0c4838f1 | TypeScript | SocialGouv/code-du-travail-numerique | /packages/code-du-travail-modeles/src/modeles/conventions/2596_coiffure/salary.ts | 2.703125 | 3 | import { ReferenceSalaryLegal } from "../../base";
import type {
IReferenceSalary,
ReferenceSalaryProps,
SalaryPeriods,
SupportedCcIndemniteLicenciement,
} from "../../common";
import { nonNullable, rankByMonthArrayDescFrench, sum } from "../../common";
export enum CatPro2596 {
agentsMaitrise = "Agents de ma... |
251ef26e556835a15d0a86d23379512c2d5fd930 | TypeScript | kuma-research/typescript | /pro-typescript/chap01/listing0160_generic_interface.ts | 3.234375 | 3 | class CustomerId {
constructor (public customerIdValue: number) {}
get value() {
return this.customerIdValue;
}
}
class Customer {
constructor (public id: CustomerId, public name: string) {
}
}
interface Repository<T, TId> {
getById(id: TId): T;
persist(model: T): TId;
}
class CustomerReposito... |
34e68556e225ac954b43214b4c0b7b5da0744768 | TypeScript | unkindypie/graphqltodo | /server/src/entities/Task.ts | 2.6875 | 3 | import {
Entity,
ManyToOne,
Column,
PrimaryGeneratedColumn,
AfterUpdate,
} from 'typeorm';
import {ObjectType, Field, Int} from 'type-graphql';
import {TaskKind} from './TaskKind';
import {User} from './User';
import {IdType} from '../modules/core/types/CommonEntityTypes';
@ObjectType()
@Entity()
export cla... |
676058563d026cd6b81df4d7c52118fa10b37c2c | TypeScript | krotscheck/cv | /src/app/model/career-event.ts | 3.078125 | 3 | /**
* Basic event type.
*/
export interface CareerEvent {
date: string | {
begin: string,
end: string
};
type: string;
title: string;
institution?: string;
event?: string;
description: string;
duration: {
begin: string,
end: string | 'current'
};
location: {
city: strin... |
4fe408fd3a0e1e61b20167e04b06039658608f4b | TypeScript | jaimetellezb/typescript-basico | /src/server/server.ts | 3.078125 | 3 | /**
* para usar express con typeScript
* debemos tener instalado typeScript (sudo npm i -g typescript)
* también npm install @types/express --save-dev (express para typescript en desarrollo)
*/
import express = require("express");
// también se puede
//import express from "express";
import path = require("path");
... |
c8ff43af2e2c8c44ba4c2aae2891270b23ef2f50 | TypeScript | manuel-woelker/topd | /ui/src/app/reducers.ts | 2.703125 | 3 | import {LocationState} from "redux-first-router";
const HISTORY_SIZE = 30;
export type DataSeries = number[];
export interface DiskHistory {
_max: number,
disks: { [key: string]: any },
}
export interface CpuUsage {
system: number,
user: number,
other: number,
}
export interface DiskUsage {
[key: string]: nu... |
f7f5092beeb11ed7a4e6ea2c61483680bfeb7bd4 | TypeScript | cloudfoundry/stratos | /src/frontend/packages/cloud-foundry/src/shared/q-param.ts | 3.21875 | 3 | export enum QParamJoiners {
greaterThanOrEqual = '>=',
lessThanOrEqual = '<=',
lessThan = '<',
greaterThan = '>',
in = ' IN ',
colon = ':',
equal = '='
}
export class QParam {
static fromString(qString: string) {
const qParamComponents = Object.values(QParamJoiners).reduce((split, joiner) => {
... |
8c7ab1e1c52ef7ca66f94896efc2a51af1f59349 | TypeScript | gradebook/utils | /packages/release-utils/src/util/require-env-variables.ts | 2.53125 | 3 | import {env, exit} from 'process';
export function requireEnvVariables(requiredVariables: Readonly<string[]>) {
for (const key of requiredVariables) {
if (!(key in env)) {
console.error(`Missing environment variable: ${key}. Recipe failed`);
exit(1);
}
}
}
|
272db798aad16886cb9a1045665a69ab1df89327 | TypeScript | mrfsrf/node-rcs-core | /lib/allWarnings.ts | 3.03125 | 3 | export interface Source {
line: number;
file: string;
text: string;
}
export class Warnings {
ranOnMinifiedFiles = false;
warningArray: { [s: string]: Source[] } = {};
constructor() {
this.reset();
}
summary(text: string): string {
if (text.length > 120) {
this.ranOnMinifiedFiles = thi... |
7b047a5863f08ccaa287ca5f38c6140f09e2a5ee | TypeScript | jcpachecoh/waes-todo-app | /src/Containers/LoginContainer.ts | 2.609375 | 3 | import { connect, Dispatch } from 'react-redux';
import { StoreState } from '../Models/StoreState';
import { LoginProps, Login } from '../Components/Login';
import { userActions, handleUsername, handlePassword, setUserId } from '../actions/userActions';
export function mapStateToProps(state: StoreState) {
return {... |
14954f7a6feec795144ba4fca30484b94054e17f | TypeScript | bngesp/typescript | /tp/tp3/personne.ts | 2.703125 | 3 | import {Adresse} from "./adresse";
export class Personne {
private _nom: string;
private _sexe: string;
private _adresses: Adresse[];
constructor(nom: string, sexe: string, adresses: Adresse[]) {
this._nom = nom;
this._sexe = sexe;
this._adresses = adresses;
}
get no... |
c56bb12a72131e9c21c306a02f4261358144a370 | TypeScript | fatihky/vald | /test/extend.spec.ts | 2.78125 | 3 | import * as assert from 'assert'
import {Map} from 'immutable'
import {isValid, notValid} from '../src/test-utils'
import vald, {SchemaBase, IValidator, ValidatorInsertType, ValidationStepResultOp} from '../src'
describe('extend', () => {
it('basic', () => {
const NUMBER_LIST_REGEX = /^(\d+)(,\d+)*$/
const e... |
6f2622b9748f3d356480fc2c17e1576992dd4c17 | TypeScript | Assylkhan/ecommerce-app | /src/app/services/user.service.ts | 2.53125 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { User } from '@app/models';
import { tap } from 'rxjs/operators';
import { ViewOptions } from '@app/helpers/view-options';
@Injectable({
providedIn: 'root'
})
export class UserSer... |
c3d27a6ac3927ac1e68d2bbfc8d2b18ad3f90bf6 | TypeScript | green-fox-academy/kkovax25 | /week-01/day-4/16-i-wont-cheat-on-the-exams.ts | 3.296875 | 3 | 'use strict';
// Create a program that writes this line 100 times:
// "I won't cheat on the exam!"
let a: number = 0;
let cheatLine: string = "I won't cheat on the exam!"
while (a <= 100) {
console.log(cheatLine);
a++;
} |
61aa2011c557eb3a01b243f4aa09d6e7cc1894db | TypeScript | sindresorhus/type-fest | /test-d/delimiter-cased-properties-deep.ts | 2.9375 | 3 | import {expectType} from 'tsd';
import type {DelimiterCasedPropertiesDeep} from '../index';
declare const foo: DelimiterCasedPropertiesDeep<{helloWorld: {fooBar: string}}, '/'>;
expectType<{'hello/world': {'foo/bar': string}}>(foo);
declare const fooBar: DelimiterCasedPropertiesDeep<() => {a: string}, '/'>;
expectTyp... |
2c97e222093d1e49ce83314b1a224d51406fb743 | TypeScript | figuevigo/angular-escalable-vitae-febrero | /libs/data/src/lib/services/xtore.service.ts | 2.875 | 3 | import { queueScheduler } from 'rxjs';
import { distinctUntilChanged, map } from 'rxjs/operators';
import { StoreService } from './store.service';
// ToDo: define Action with payload
type Action<StateType> = (state: StateType) => StateType;
export class XtoreService<StateType> extends StoreService<StateType> {
cons... |
3a809e212d0721b4a32c865e1038c082477ec4c4 | TypeScript | dvens/atomify | /packages/kit/src/utilities/store/store.ts | 2.84375 | 3 | import { isServer } from '@atomify/shared';
import { defaultObject, Observers, Store, StoreSettings } from './store.types';
let proxyContainer: any = null;
export function createStore<State>(settings: StoreSettings<State>): Store<State> {
const actionsHolder = settings.actions || {};
const observers: Observe... |
30852d22a92064f2888becf094af8e7520155326 | TypeScript | totofish/XSS | /src/extension/utility/importFormatHelper.ts | 2.53125 | 3 | import { IScriptItem } from '../../types';
export default function importFormatHelper(data: Array<IScriptItem>): Array<IScriptItem> {
if (!Array.isArray(data)) return [];
let savelist: Array<IScriptItem> = [...data];
savelist = savelist.filter((item) => (
Object.prototype.hasOwnProperty.call(item, 'title')
... |
f74f4f7ed886e327af9062446fabf3a8f7b272f7 | TypeScript | amruta8712/Assignments | /UI Framework/TYPESCRIPT/A1Que3.ts | 2.875 | 3 | const order={
id:10,
title:"Pizza",
price:200,
printOrder(){
console.log(this.title);
},
getPrice(){
console.log(this.price);
}
};
const NewOrder=Object.assign(order);
console.log(order);
console.log(NewOrder);
NewOrder.getPrice();
NewOrder.printOrder(); |
54188d088b177542abdd532984d95ea27f525370 | TypeScript | dwook/mini-link-ts | /front/feature/Home/saga.ts | 2.5625 | 3 | import axios from 'axios';
import { call, put, takeLatest } from 'redux-saga/effects';
import { homeAction } from './slice';
import { HomeInfo } from './types';
async function getHomeAPI(username: string) {
const response = await axios.get<HomeInfo>(`/home/${username}`);
return response.data;
}
function* getHome(... |
aac9c1b4f3ed3a5b5c37b8a35078bc253be54f13 | TypeScript | UniBitProject/wallet | /app/lib/commands/CreateRawTransaction.ts | 2.765625 | 3 | import { RpcRequest } from '../RpcRequest'
import { RpcResponse } from '../RpcResponse'
/**
* JSON-RPC request for the *createrawtransaction* command.
*/
export interface CreateRawTransactionRequest extends RpcRequest {
readonly method: 'createrawtransaction'
readonly params?: any[]
}
/**
* JSON-RPC response f... |
84cbe409574879be827eb7fc93f64d358708b4bc | TypeScript | nullnull/apollo-server-sample | /src/prototype.ts | 2.921875 | 3 | export function defineProperty(target: any, name: string, f: any) {
if (target[name]) return
Object.defineProperty(target, name, {
enumerable: false,
configurable: false,
writable: false,
value: f,
})
}
const unique = function (this: Array<any>) {
return Array.from(new Set(this))
}
definePrope... |
8fda1aaec99ed1e4d44aa006a73790547668a1d4 | TypeScript | rossng/transcriptor | /packages/util/src/lib/convert-words-to-text/index.ts | 2.859375 | 3 | import { TranscriptWord } from 'types/slate';
/**
* Helper function
* @param {array} words - dpe word object, with at list text attribute to be able to convert to string of text
*/
export function convertWordsToText(words: TranscriptWord[]): string {
return words
.map((word) => {
return word.text ? word... |
137852bb741388cec25c0df61043d5ef35e7a1fa | TypeScript | artem-linenko/game-of-life | /src/hooks/useFieldDataGeneration.ts | 2.84375 | 3 | import { isEqual } from 'lodash';
import { useEffect, useRef, useState } from 'react';
import { FieldData } from '../types';
import { calculateNextTickFieldData, initialFieldData } from '../utils';
export const useFieldDataGeneration = ({
rowsNum,
columnsNum,
}: {
rowsNum?: number;
columnsNum?: number;
}) => ... |
12ae3f9e5d406bd4c0fdaeb68a425dfde3a9fd7d | TypeScript | lukasgeiter/gettext-extractor | /src/js/utils.ts | 3.0625 | 3 | import * as ts from 'typescript';
export abstract class JsUtils {
public static segmentsMatchPropertyExpression(segments: string[], propertyAccessExpression: ts.PropertyAccessExpression): boolean {
segments = segments.slice();
if (!(segments.pop() === propertyAccessExpression.name.text)) {
... |
380ed53e9d4f5bf709f639ac032d7569ee148e9b | TypeScript | luangregori/express-typescript | /src/controllers/order.controller.ts | 2.546875 | 3 | import { Get, Route, Tags, Post, Body, Path } from "tsoa";
import * as Yup from 'yup';
import { Product, Order } from '../models'
import { getOnlyProductbyId, getOnlyPriceByMarket } from '../repositories/product.repository';
import { getOnlyMarketbyId } from '../repositories/market.repository';
import { getOnlyAddress... |
47203de9225943e77d53c2ea54eb93e5c3d7f067 | TypeScript | zhuoqi-chen/algorithm_course | /Heap/utils.ts | 2.8125 | 3 | export function getRadomNumberArray(size: number = 10) {
return [
...new Set(
Array.from({ length: size }, (item) => Math.floor(Math.random() * size))
),
];
}
|
9399933af0b10d731a24116c3e13371ba1c3c13b | TypeScript | JimmySorza/sentry-importer | /src/helpers/SentryClient.ts | 2.625 | 3 | import { AxiosInstance } from "axios";
import axios from "./axios";
import { MAX_RETRY_COUNT } from "./config";
/**
* @class Sentry API Manager
*/
class SentryClient {
static _instance: SentryClient;
/**
* Create SentryClient Instance
*
* @param token
* @returns
*/
static create = (): SentryCli... |
2f3e517dabb6a0f215dbe680c9398dea97dd6c1c | TypeScript | EventRegistry/event-registry-node-js | /src/returnInfo.ts | 2.890625 | 3 | import * as _ from "lodash";
import { EventRegistryStatic } from "./types";
import * as fs from "fs";
export abstract class ReturnInfoFlagsBase<T extends {}> {
protected type: string;
private data = {};
public setFlag(key: string, value: boolean, defaultValue?: boolean) {
this.setProperty("Include... |
d80115cb624c13722072074e8fd36f68b2914930 | TypeScript | amalpsy101/psykhe | /types/analytics/events.ts | 2.546875 | 3 | export enum AnalyticsEvent {
PAGEVIEW = 'pageview',
HOME_EVENT = 'home_event',
TRANSACTION = 'transaction',
BROWSE_EVENT = 'browse_event',
PROFILE_EVENT = 'profile_event'
}
export type AnalyticsMessage =
| PageViewMessage
| TransactionMessage
| HomeEventMessage
| BrowseEventMessage
| ProfileEventMe... |
8c619d09ecaad891fd37280d85e03ccaef38257f | TypeScript | DaniFernandezCal/codetest2_seedtag | /tests/builders/ScanBuilder.ts | 3.125 | 3 | import { Coordinates } from '../../src/radar/models/Coordinates';
import { Enemy } from '../../src/radar/models/Enemy';
import { Scan } from '../../src/radar/models/Scan';
const getRandomInteger = () => {
return Math.floor(Math.random() * 100);
};
const getRandomEnemyType = (): 'mech' | 'soldier' => {
return Math.... |
b21112b176c9387d05849eb18d7e3cc2269c4ea2 | TypeScript | globalbrain/sefirot | /lib/validation/validators/maxFileSize.ts | 2.78125 | 3 | export function maxFileSize(file: File, size: string): boolean {
const factor = /gb/i.test(size)
? 1e9
: /mb/i.test(size)
? 1e6
: /kb/i.test(size)
? 1e3
: 1
return file.size <= factor * +size.replace(/[^\d\.]/g, '')
}
|
c56a0e42f6b2415ce22b551e51f2d5e6c2a91ba3 | TypeScript | RennanD/api-app-memoria | /src/modules/user/services/DeleteImportantDateService.ts | 2.53125 | 3 | import { getRepository } from 'typeorm';
import ImportantDate from '../models/ImportantDate';
import AppError from '../../../errors/AppError';
interface Request {
date_id: string;
user_id: string;
}
class DeleteImportantDateService {
public async execute({ date_id, user_id }: Request): Promise<void> {
con... |
e9c6dc08179e9025b3aaffda19b92810a2620ee1 | TypeScript | shlomiassaf/tdm | /libs/data/src/lib/metadata/meta-types/action.ts | 2.890625 | 3 | import {
isFunction,
isString,
DecoratorInfo,
BaseMetadata
} from '@tdm/core/tdm';
import {
ExecuteResponse,
ActionOptions,
ValidationSchedule,
AdapterStatic
} from '../../fw';
import { ExecuteContext } from '../../core';
export enum ActionMethodType {
/**
* Used to mark a method as local to the ... |
55e4b58521328d57aab2d8a72f25ad5e79af3f32 | TypeScript | ethisscam/keep-subgraph | /src/utils.ts | 2.5625 | 3 | import { ethereum } from "@graphprotocol/graph-ts";
/**
* If nothing better is available, this generates a unique id from the trransaction hash + log index.
*/
export function getIDFromEvent(event: ethereum.Event): string {
return event.transaction.hash.toHex() + "-" + event.logIndex.toString()
} |
a06b76785cf0aaacb9727ba2df73ff3ac7311cf6 | TypeScript | sky7th/lotto | /src/domain/LottoPrize.ts | 3.359375 | 3 | export class LottoPrize {
static readonly READY = new LottoPrize('결과 발표 전', 0, 0);
static readonly LOSE = new LottoPrize('꽝', 0, 0);
static readonly FIFTH = new LottoPrize('5등', 3, 5000);
static readonly FOURTH = new LottoPrize('4등', 4, 50000);
static readonly THIRD = new LottoPrize('3등', 5, 2000000);
st... |
876cc6a0671711fc0e65f55c4fc133173dabbbf9 | TypeScript | sirian/js | /scripts/prebuild.ts | 2.609375 | 3 | import * as fs from "node:fs";
import {PackageJson} from "type-fest";
import {debug, getPackageDir, packagesDir, readPackageJSON, rootDir, validate, writeJSON} from "./util";
const VALIDATE = process.argv.includes("--validate");
const getReferences = (pkg: PackageJson) =>
Object.keys({...pkg.dependencies, ...pkg.... |
9ddd10d2a62125908159b824e15c2dd5def99f14 | TypeScript | huixiong123/todolist | /src/model/ProjectDetail.ts | 2.5625 | 3 | export class ProjectDetail {
id: number;
name: string;
createDate: string;
constructor(id: number, name: string, createDate: string) {
this.id = id;
this.name = name;
this.createDate = createDate;
}
}
|
4c467d3d1736c2911cea8401d9d7f9b9269d0dca | TypeScript | sorokinvld/database-viewer | /types/src/generated.ts | 2.71875 | 3 | import { useMutation, UseMutationOptions, useQuery, UseQueryOptions } from 'react-query';
export type Maybe<T> = T | null;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
export type M... |
f63510e2fdc723cc6194f247378c6c818fb02bae | TypeScript | hd-code/hd-neural-net | /src/helper/random.ts | 3.296875 | 3 | /*! random v0.1.0 | MIT | © Hannes Dröse https://github.com/hd-code/js-snippets */
/**
* @file
* The JavaScript Math.random() function is not seedable. This package provides
* an implementation of the Lehmer random number generator. The generator is
* seedable, but will use a random seed when none was set.
*
* M... |
862af62ee8dca81ef4d2e89dfe0c4937a27d0f88 | TypeScript | JetBrains/intellij-plugins | /AngularJS/testData/inspections/expressionType/genericDirectiveReference.ts | 2.65625 | 3 | /* tslint:disable */
import { Component } from '@angular/core';
import {FormControl, ReactiveFormsModule} from '@angular/forms';
import {MatDatepicker, MatDatepickerModule} from '@angular/material/datepicker';
import {MatInputModule} from "@angular/material/input";
export interface Moment extends Object {
month(): ... |
b60cbf2f41169d52aef6aab6df6f0a98fe05f229 | TypeScript | dotrey/cursed-kanji | /src/app/ui/views/game/RomajiBoardView.ts | 2.609375 | 3 | import m from "../../Mithril.js";
const RomajiBoardView : any = {
orientation : "",
layout : "aiueo",
layouts : {
"aiueo" : {
// vocal and consonants in order how they appear in hiragana alphabet
// exception: two y since it is often used in conjunction with the other chars
... |
99294d49bf62abb9d6e4658cb4814a5badebcd94 | TypeScript | pras75299/typescript-master | /src/baisc.ts | 3.453125 | 3 | function addBasic(n1: number, n2: number, showResult: boolean, pharse: string) {
const result = n1 + n2;
if (showResult) {
console.log(pharse + result);
} else {
return result;
}
}
const number1 = 5;
const number2 = 3.8;
const printResul = true;
const resultPharse = "Result is: ";
addBasic(number1, nu... |
0ac12b72c036a80ed4c89b7f5fcaf1b322609a28 | TypeScript | anthcny/pdns-admin | /server/src/auth/dto/sign-up.dto.ts | 2.5625 | 3 | import {IsBoolean, IsOptional, IsInt, IsString, IsEmail, IsMobilePhone} from 'class-validator';
class SignUpHeaders {
@IsOptional() @IsString()
token?: string;
@IsOptional() @IsInt()
username?: number;
@IsOptional() @IsBoolean()
update?: boolean;
}
export class SignUpDto {
// mobile
@IsOptional() @IsBoolean... |
e88cd9724fe6acb7f64a259c82b41e9aa3f54b32 | TypeScript | VitaminCtea/ts-canvas | /src/colorPicker/index.ts | 2.640625 | 3 | window.onload = () => {
const $ = (selector: string) => document.getElementById(selector) as HTMLElement
const colorPickerPanelCanvas: HTMLCanvasElement = $('color-picker__panel') as HTMLCanvasElement
const colorPickerBarCanvas: HTMLCanvasElement = $('color-picker__bar') as HTMLCanvasElement
const colo... |
c7114f4d2e8842ce9c2a305d89a3ae0411ad1eb2 | TypeScript | daniilshustov10/Netcracker | /other/typescript/src/types.ts | 4.09375 | 4 | // boolean
let isLoading: boolean = true;
const isWaiting: boolean = false;
// number
const num: number = 10;
const float: number = 3.5;
// string
const str: string = 'I am str';
const word: string = "TypeScript";
// Array
const arr: number[] = [1, 2, 3];
const arrayOfWords: Array<string> = ['TS', 'JS'];
// Tu... |
72e0a4c94c78bcd8f83e13df5177edc597ae49bc | TypeScript | kagan1/GraphicalPeercoinAddress | /lib/Peercoin.ts | 3.15625 | 3 | import BigInteger=require("../lib/BigInteger");
import Base58=require("../lib/Base58");
//module Peercoin {
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
////////////////////... |
f298187769797fd9fb10b050eb2e933f35b18427 | TypeScript | future4code/Tania-Oliveira | /projeto_labook/src/model/User.ts | 2.875 | 3 | export default interface authenticationData {
id: string
}
enum POST_TYPES {
NORMAL = "normal",
EVENT = "event"
}
export class User {
constructor(
private id: string,
private name: string,
private email: string,
private password: string
) { }
getId() {
return this.id
}
getName(... |
f849f7227602af7d2c044abdd2218b071065fbb9 | TypeScript | mahwish-chohdry/webportaldocker | /SuperAdmin.WebUI/ClientApp/src/reducers/admin_settings.ts | 2.546875 | 3 | import { SettingsActions, ActionTypes } from '../action/admin_settings';
import { Reducer } from 'redux';
import { getPersonaPermissionsData, getRolePermissionsData, getFormNameFromID, getPersonaNameFromID, getRoleNameFromID } from 'utils';
export interface settingsState {
roles: any[];
persona_roles: any[];
... |
eef6d31a5fd971b1c36d62ed0cd72623863ec0f7 | TypeScript | GeovaneF55/hibridas | /src/providers/itens/itens.ts | 2.546875 | 3 | import { Http } from '@angular/http';
import { Injectable } from '@angular/core';
import 'rxjs/add/operator/toPromise'
import { Item } from '../../interfaces/Item';
import firebase from 'firebase';
@Injectable()
export class ItensProvider {
constructor(public http: Http) {
console.log('Hello ItensProvider Provi... |
0e70aa80a674c5fb254b1d869429fd94cac25131 | TypeScript | mddr/taiga-ui | /projects/cdk/utils/math/clamp.ts | 3.015625 | 3 | import {tuiAssert} from '@taiga-ui/cdk/classes';
/**
* Clamps a value between two inclusive limits
*
* @param value
* @param min lower limit
* @param max upper limit
*/
export function clamp(value: number, min: number, max: number): number {
tuiAssert.assert(!isNaN(value));
tuiAssert.assert(!isNaN(min));... |
a7fdbd7077d509b3a009198134e0409f695c0dae | TypeScript | miguelbogota/presentup-me | /src/app/shared/pipes/md-to-html/md-to-html.pipe.ts | 2.90625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { parse } from 'marked';
@Pipe({
name: 'mdToHtml'
})
export class MdToHtmlPipe implements PipeTransform {
transform(value: string): string {
/**
* Firestore sanitize the input send and converts to a string.
* In order to have a new line in ... |
5713c09248f5a80d41925bed091bed0130db292e | TypeScript | superxp1412/ng2-series-workshop | /src/app/home/notes/note-creator/index.ts | 2.671875 | 3 | import {Component, Input, Output, EventEmitter} from "@angular/core"
import {ColorPicker} from './color-picker'
import { isEmpty } from 'lodash'
@Component({
selector: 'note-creator',
template: require('./note-creator.html'),
styles: [require('./note-creator.css')],
directives: [ColorPicker]
})
export... |
b0aa7e02720f9ae70a2a3e4fe0d2213c2c135545 | TypeScript | yutiansut/tzsq | /src/F/lastNumber.ts | 3.171875 | 3 | export const lastNumber = (arr: ArrayLike<number>) => {
for (let i = arr.length - 1; i >= 0; i--) {
if (isNaN(arr[i]) === false) {
return arr[i]
}
}
return NaN
} |
facff2ad1a09d0f15a3dcdf995765713feaf0630 | TypeScript | observerzy/blog-app | /src/common/httpFetch.ts | 2.921875 | 3 | //返参可以有多种情况,此处是json
// enum ContentType {
// json = "application/json;charset=UTF-8",
// formData = "multipart/form-data;charset=UTF-8"
// }
interface Header {
'Content-Type'?: string;
[propName: string]: any; //索引签名
}
interface Request {
method: 'POST' | 'GET';
headers: Header;
body: any;
... |
be31c7ac91cd4eed69419d42099fb1b933529f2b | TypeScript | whpac/testina | /frontend/ts/components/survey_lists/no_surveys.ts | 2.53125 | 3 | import UserLoader from '../../entities/loaders/userloader';
import Component from '../basic/component';
export default class NoSurveys extends Component<'create-first-survey'> {
public constructor(hidden: boolean = false) {
super();
this.Element.classList.add('empty-placeholder');
if(hidd... |
778c350b2b841553b28b52fb5b4017ae9873c5f5 | TypeScript | hsjoberg/blixt-wallet | /src/storage/database/db-utils.web.ts | 2.546875 | 3 | import { SqlJs } from "sql.js/module";
export const query = async (db: SqlJs.Database, sql: string, params: any[]) => {
try {
return await db.exec(sql, params);
} catch (e) {
if (typeof e === "string") {
throw new Error(e);
}
throw e;
}
};
/**
* @returns number Insert ID
*/
export const ... |
18516825e63bfa4402dabc60970d45efcdea6b36 | TypeScript | josedaesbar/School-Management-System | /packages/web_application/src/styles/image.ts | 2.578125 | 3 | export enum ImageShape {
NORMAL = '5px',
CIRCULAR = '50%'
}
export type ImageShapeTypes = 'normal' |'circular';
|
28dc25a48cb422e56adb4c2bf4533665f61baf17 | TypeScript | furkleindustries/sound-manager | /src/Sound/Sound.ts | 2.5625 | 3 | import {
BaseNode,
} from '../Node/BaseNode';
import {
getFadeVolume,
} from '../Fade/getFadeVolume';
import {
getFrozenObject,
} from '../functions/getFrozenObject';
import {
IFade,
} from '../Fade/IFade';
import {
IPlaySoundOptions,
} from './IPlaySoundOptions';
import {
ISound,
} from './ISound';
import ... |
cd4b02f382783bb0637f31fb2a3b12b9361a3de3 | TypeScript | SamTomashi/marines-core-angular | /src/app/login/login.component.ts | 2.59375 | 3 | import { Component, OnInit, OnDestroy } from '@angular/core';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit, OnDestroy {
user: string = "";
username!: any;
enabled = true;
inputType = "pa... |
6598eeed0523406bef4ca0f2d2236d6457eb262a | TypeScript | QoVoQ/nestjs-blog | /src/modules/auth/jwt-optional.guard.ts | 2.515625 | 3 | import {
Injectable,
CanActivate,
ExecutionContext,
HttpException,
HttpStatus,
} from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { jwtFromRequest } from './constants';
import { JwtPayload } from './auth.interface';
import { UserService } from '../user/user.service';
import { UserEntity... |
44d5fab484e9a7f5ab182433c6e35a2492198ef3 | TypeScript | ji03mmy18/BackendTemplate | /src/service/eventRecord.ts | 2.59375 | 3 | // src/service/announcement.ts
import {
DeleteResult, getRepository, InsertResult, Repository, UpdateResult,
} from 'typeorm';
import { eventRecord } from '@/entry';
import { filterObjectUndefined } from '@/utils';
export class eventRecordService {
private static INSTANCE: eventRecordService;
private eventRecor... |
c927f9e170c28dc9b9719b563f22a7fa5edba67c | TypeScript | kimrejstrom/dice-typescript | /spec/lexer/string-character-stream.spec.ts | 3.21875 | 3 | import * as Lexer from '../../src/lexer';
describe('StringCharacterStream', () => {
const input = 'floor(4d6!!+5d10kl2/2+4)';
describe('constructor', () => {
it('does not throw.', function () {
expect(() => {
const stream = new Lexer.StringCharacterStream(input);
}).not.toThrow();
});
... |
e7d5f856d79daeb8c938a15988515ffb3443b3ee | TypeScript | meghoshpritam/courses-server | /src/middleware/checkRole.ts | 2.578125 | 3 | import { Request, Response, NextFunction } from 'express';
export const checkRole = (roles: string[] = []) => {
return async (req: Request, res: Response, next: NextFunction) => {
let authenticate = false;
roles.forEach((role) => {
if (role === res.locals.role) {
authenticate = true;
}
... |
2f5a8f57edad395b97482af549a5c3530898b838 | TypeScript | IVjs/IVjs | /src/lib/command-engine/create-engine.ts | 2.53125 | 3 | import { IvCommandEngine } from './command-engine';
import { CommandRunner } from './command-runner';
import { switchFactory } from './switch';
import { Omit } from '../../types';
export function createEngine(engineConstructorInput: CommandEngine.ctor, ...functionFactories) {
const { settings, nodes, variables, comm... |
1a08d5b40aec7dd9bd2b87b5832747afa76d88bb | TypeScript | sshyam-gupta/dynamic-components-rn | /src/lib/common.ts | 2.828125 | 3 | import _ from 'lodash';
import {Platform, Dimensions} from 'react-native';
export const isWeb = Platform.OS === 'web';
export const isAndroid = Platform.OS === 'android';
export const isIOS = Platform.OS === 'ios';
export const isIphoneX = () => {
const {height, width} = Dimensions.get('window');
if (Platform.OS =... |
80193bba96ca7e3b7e14bacc9e9c92886e9d9c36 | TypeScript | Rocking-horse/TrelloWIPLimits-exclusions | /src/ts/trello-list.ts | 2.734375 | 3 | /** Represents an individual list in Trello. Observes the list for changes. */
class TrelloList {
public readonly listNode: Element;
private listContentNode: Element;
private listObserver: MutationObserver;
private listHeaderNode: Element;
private listHeaderObserver: MutationObserver;
private mi... |
271ae207ed1c25581e6bbca6b3ba744dc61918c9 | TypeScript | edgarsit/cse416 | /src/model/user.ts | 2.609375 | 3 | import type { Types } from 'mongoose';
import { hash, pre } from './RT-PROP';
import type { Description, Fields } from './util';
import { fields, ruprop } from './util';
@fields
// TODO updates do not use this handler
@pre<User>('save', async function userPreSave() {
if (this.isModified('password')) {
this.pass... |
45882450286bc35a0da719b9157ecbc02d64e7ea | TypeScript | ToonoW/autoDocstring | /src/extension.ts | 2.65625 | 3 | 'use strict';
import * as vs from 'vscode';
import { AutoDocstring } from "./autodocstring";
export function activate(context: vs.ExtensionContext): void {
console.log('autoDocstring has been activated');
context.subscriptions.push(vs.commands.registerCommand('extension.generateDocstring', () => {
gen... |
32d4107fa476e9566fd86d307f69e774296720e1 | TypeScript | powerpuffpenguin/jsgenerate_grpc | /jsgenerate/src/helper.ts | 2.8125 | 3 | import { join, sep } from "path"
export class Exclude {
private set_: Set<string>
constructor(
public readonly prefix?: Array<string>,
public readonly suffix?: Array<string>,
exclude?: Array<string>,
) {
if (exclude) {
const set = new Set<string>()
fo... |
5bc0ef3432ce84f88747df1840397326a4364a5d | TypeScript | INSIDE-information-systems/api-sensorthing | /src/server/utils/getId.ts | 2.96875 | 3 | /**
* getId.
*
* @copyright 2020-present Inrae
* @author mario.adam@inrae.fr
*
*/
/**
*
* @param input string or number search
* @returns the bigint extract number
*/
export const getId = (input: string | number): bigint | undefined => {
try {
return typeof input == "string" ? BigInt(input.match(... |
3e48cc01e30afab9d1ad2d61f690999bc14840f7 | TypeScript | DanteDeRuwe/DamienExperience-Web | /src/app/models/registration.model.ts | 2.828125 | 3 | import { ShirtSize } from "../enums.model";
export interface RegistrationJson {
registrationId: string,
timeStamp: Date,
routeId: string,
orderedShirt: boolean,
shirtSize: string,
paid: boolean
}
export class Registration {
constructor(
private _registrationId: string,
priv... |
bc77198db85ca8c65059d719193edcdb5116fc32 | TypeScript | crimx/ext-saladict | /src/components/dictionaries/weblio/engine.ts | 2.578125 | 3 | import { fetchDirtyDOM } from '@/_helpers/fetch-dom'
import {
HTMLString,
getInnerHTML,
handleNoResult,
handleNetWorkError,
getOuterHTML,
SearchFunction,
GetSrcPageFunction,
DictSearchResult,
getText,
removeChild
} from '../helpers'
export const getSrcPage: GetSrcPageFunction = text => {
return `... |
10193fb5a3eac3c932b2b5f90ffcd619e0776e0d | TypeScript | ahuounan/weather-app | /src/store/models/weather/transformers.ts | 2.71875 | 3 | import {
OpenWeatherCurrent,
OpenWeatherDaily,
OpenWeatherHourly,
OpenWeatherCommon,
OpenWeatherOneCallResponse
} from 'models/api/openWeatherApi';
import {
WeatherCommon,
Weather,
WeatherDaily,
WeatherHourly,
WeatherCurrent
} from 'models/weather';
const openWeatherToWeatherCommon = (data: OpenWea... |
6fb524172b573bf7cb10f67ef573571dfc4434d2 | TypeScript | HOVOH/beacon-feed-service | /src/feed/GetFeedRequest.ts | 2.515625 | 3 | import { Transform } from 'class-transformer';
import { IsIn, IsOptional } from 'class-validator';
import { FeedEventType, FeedEventTypes } from './feed.service';
export class GetFeedRequest {
@IsOptional()
@Transform(
({ value }) => {
return value
?.split(',')
.map((string) => string.toU... |
d7da65ebcead5e4507bf10558e9e367a00592275 | TypeScript | prysmex/ember-scopes | /addon/utils/scope.ts | 2.671875 | 3 | import { assert } from '@ember/debug';
export type LocalScope = (
record: unknown,
index: number,
collection: Array<unknown>
) => boolean;
export type RemoteScope = () => Record<string, unknown>;
export interface IRemoteAndLocalScope {
remote: RemoteScope;
local: LocalScope;
}
export type Scope = (
owne... |
8816b48f2c46d10353423e7b43f0466adb087de4 | TypeScript | Andrea-MariaDB/aws-s3-tools | /lib/api/move.ts | 3.078125 | 3 | import AWS, { S3 } from "aws-sdk";
import { deleteObject } from "./delete";
/**
* Move S3 object from source bucket and key to destination
* @param {string} sourceBucket - S3 bucket where the object is stored
* @param {string} sourceKey - S3 key where the object is referenced
* @param {string} destinationBucket - ... |
b4f53d9e3ae62d011ab51ae9e664cb1426ba5f19 | TypeScript | afuhge/TODOApp2 | /backend/src/data.ts | 2.84375 | 3 | import {User} from './model/user';
import {Todo} from './model/todo';
let idGen = 10;
export const id = () => ++idGen;
const user1: User = {
id: 1,
firstName: 'Annika',
lastName: 'Fuh',
userName: 'annie',
password: '12345',
color: '#dddddd',
eMail: 'a.fuh@blah.de',
isAdmin: true,
todos: [5, 6, 7, 8,... |
5471e5a48a860234ada466d69ca4d60c7f425e7c | TypeScript | asesh/electron_update | /main.ts | 2.515625 | 3 | // Modules to control application life and create native browser window
//import BrowserWindow = require('electron')
import {app, BrowserWindow, autoUpdater, dialog} from "electron"
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is g... |
9fda4a60de88bf7769e4d2c64f22b888dabe054b | TypeScript | angleshe/leetcode | /src/longestPalindromeSubseq.ts | 3.421875 | 3 | function getPalindromeMaxLength(
s: string,
left: number,
right: number,
cache: Map<string, number>
): number {
let res: number = 0;
const key = `${left}-${right}`;
if (left >= 0 && right < s.length) {
if (cache.has(key)) {
return cache.get(key)!;
}
if (s[left] === s[right]) {
res ... |
6a6ba0c8e07c6a9ef9818384fa72993360bfd758 | TypeScript | wangeditor-team/wangEditor | /packages/core/src/render/index.ts | 2.671875 | 3 | /**
* @description formats entry
* @author wangfupeng
*/
import { Element as SlateElement, Descendant } from 'slate'
import { VNode } from 'snabbdom'
import { IDomEditor } from '../editor/interface'
// ------------------------------------ render style ------------------------------------
export type RenderStyleFn... |
9cc865b09ba74d5e25fee0fc1db8e5e27d59f5ec | TypeScript | mtcairneyleeming/robot-web-interface | /src/routes/errors.ts | 2.6875 | 3 | export var init = function(app) {
// catch 404 and forward to error handler
app.use(function(req, res, next) {
res.status(404);
// respond with html page
if (req.accepts('html')) {
res.render('404', { url: req.url });
return;
}
// respond with js... |
6c0ddf7b0f6b46d659c7bd3e9dcc822d8571e742 | TypeScript | ceoseo/velog-server | /src/cache.ts | 2.546875 | 3 | import Redis from 'ioredis';
class Cache {
client: Redis.Redis | null = null;
connect() {
this.client = new Redis({
maxRetriesPerRequest: 3,
host: process.env.REDIS_HOST || 'localhost',
});
}
remove(...keys: string[]) {
if (!this.client) {
this.connect();
}
return this.c... |
359eff5f538ac0c86e9564477af18e20ade90ad3 | TypeScript | DavidBerryUK/CompanyResourceManager | /Client/src/components/interfaces/ComponentMetaDataInterfaces.ts | 2.78125 | 3 | export interface IComponentMetaData {
componentName: string;
componentDescription: string;
}
export default class ComponentMetaDataInterfaceGuards {
public static doesSupportIComponentMetaData(classInstance: any): classInstance is IComponentMetaData {
const doesUseInterface = classInstance.compone... |
165b3022cc9299eeb891fa6cfe1d90463f343c6b | TypeScript | kitsune7/revenge-of-the-pancakes | /src/flipPancakes/flipPancakes.ts | 3.109375 | 3 | function flipPancakes(s: string): number {
const happyPancake = '+'
const endsOnHappyPancake = s.charAt(s.length - 1) === happyPancake
let flipCount = endsOnHappyPancake ? -1 : 0
let currentGroupType = null
for (let i = 0; i < s.length; i++) {
if (currentGroupType !== s.charAt(i)) {
flipCount++
... |
3759acf6422e8926b337adea72f497ce16d1a078 | TypeScript | dannielsousa/udm_dev_web | /typescript/app2.ts | 3.046875 | 3 | import { Concessionaria } from './Concessionaria';
import { Carro } from './Carro';
import { Pessoa } from './Pessoa';
/*--- Criar Carros ---*/
let carroA = new Carro('dodge', 4);
let carroB = new Carro('ferari', 4);
let carroC = new Carro('veloster', 3);
/*--- montar a lista de carros da concessionaria --*/
let l... |
605fb59a807ad8182bb9fd3c9f27774dbe78d8ce | TypeScript | xh/hoist-react | /utils/js/Decorators.ts | 2.984375 | 3 | /*
* This file belongs to Hoist, an application development toolkit
* developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
*
* Copyright © 2023 Extremely Heavy Industries Inc.
*/
import {XH} from '@xh/hoist/core';
import {debounce, isFunction} from 'lodash';
import {throwIf, getOrCreate, warnIf} from '... |
6cd0917c90664cbff24e6c1335930ef61b38f39d | TypeScript | linuxcarl/learn-typescript | /types-typescript/src/type-union.ts | 3.875 | 4 | export = {};
// string or number
let idUser: number | string;
idUser = 4;
idUser = "3";
//Buscar username dado un ID
function getUsernameById(id: number | string): Array<object> {
const users: Array<Object> = [
{ id: 1, user: "Carlos" },
{ id: 2, user: "Enrique" },
{ id: 3, user: "Tonny" },
{ id: 4... |
b08c752ebd2e3ab98a6a20d94a6b605c41825b59 | TypeScript | scottohara/tvmanager | /spec/public/mocks/program-model-mock.ts | 2.625 | 3 | import type { SerializedModel } from "~/models";
import type { SinonStub } from "sinon";
import sinon from "sinon";
const saveStub: SinonStub<unknown[], Promise<string | undefined>> = sinon.stub(),
removeStub: SinonStub = sinon.stub(),
listStub: SinonStub = sinon.stub(),
findStub: SinonStub<string[], Promise<... |
59cf30af17d1bfcc01ba15689238f1098dbb255c | TypeScript | openslice/io.openslice.tmf.web | /src/app/openApis/ServiceOrderingManagement/models/service-order-update.ts | 2.671875 | 3 | /* tslint:disable */
import { Note } from './note';
import { ServiceOrderItem } from './service-order-item';
import { ServiceOrderRelationship } from './service-order-relationship';
import { RelatedParty } from './related-party';
/**
* Skipped properties: id,href,externalId,priority,state,orderDate,completionDate,ord... |
c1eaa1a0933e4c0007be658f1339c3f4bfddf097 | TypeScript | ankur-sardar/project-feedback-app | /client/src/reducers/employee.ts | 3.484375 | 3 | import Employee from '../models/employee';
import {ActionTypes} from '../actions/action';
import {Action} from '../actions/action';
// Define our State interface for the current reducer
export interface State {
employeeList: Employee[]
}
// Define our initialState
export const initialState: State = {
employeeLis... |
f3b2265bd38b90806c5f1c424a25474a82857763 | TypeScript | MinionsDave/Data-Structures-Algorithms-with-Javascript-exercise-answer | /src/chapter6-linked-list/doubly-linked-list.ts | 3.3125 | 3 | import { TwoWayNode } from "./two-way-node";
export class DoublyLinkedList<T> {
head = new TwoWayNode<any>('head')
currentNode = this.head
find(item: T): TwoWayNode<T> {
let currentNode = this.head
while (currentNode.element !== item && currentNode.next) currentNode = currentNode.next
return curren... |
74195b512972f75b2683cea30aa51323c1f9c080 | TypeScript | marcosvega91/node-request-interceptor | /src/XMLHttpRequest/override.ts | 2.5625 | 3 | import { ModuleOverride } from '../glossary'
import { createXMLHttpRequestOverride } from './XMLHttpRequest/createXMLHttpRequestOverride'
const debug = require('debug')('XHR')
const original = {
XMLHttpRequest:
// Although executed in node, certain processes emulate the DOM-like environment
// (i.e. `js-dom... |
ec029c219178dcec1c59d6d05477099ac998da5a | TypeScript | cr7yash/realworld-remix.run | /src/http/remix/app/lib/users/users.ts | 2.953125 | 3 | import type { Session } from "@remix-run/core";
import { fetchWithToken } from "../api-client";
import { AUTH_TOKEN_SESSION_KEY, removeAuthToken } from "../session-utils";
/**
* User object returned from the Conduit api
*/
export type User = {
/** Displayable name of the user */
username: string;
/** User ema... |
71e228079201454a3c53b8cd21ef14321a7c94a5 | TypeScript | eslawski/quick-colors | /src/app/toolbar/toolbar.component.ts | 3.140625 | 3 | import { CurrentColorService } from './../current-color.service';
import { Color } from './../shared/color.model';
import { ColorCollectionService } from 'app/color-collection.service';
import { Component, EventEmitter, Output, OnInit } from '@angular/core';
/**
* Toolbar that contains controls for manipulating the c... |
fbfbdafbb5170e155b969495a7c2b355a831b96f | TypeScript | ShaatsSucher/antonius-phaser | /src/gameObjects/button.ts | 2.8125 | 3 | import GameObject from './gameObject'
import { Spritesheets } from '../assets'
export enum ButtonState {
DEFAULT,
HOVERED,
DOWN,
DISABLED
}
type Frames = null | number[] | string[]
export class Button extends GameObject {
/**
* The internal state of the button. ButtonState.DISABLED will never be
* as... |
9eeb6a8a3218cfb9ab33b2fc8cd9493b96411dac | TypeScript | lekhachuy08/shogi-board | /src/fn/movings-ka.ts | 2.859375 | 3 | import { MovProps } from './movings';
import PieceObj from '../game-handler/piece';
import EmpObj from '../game-handler/emp';
import PromotionConfirmObj from '../game-handler/promotion-confirm';
import empLocations from './movings-emp-loc';
import { isPiece, isEmp } from '../fn/type-checker';
type Fn = (n: number) => ... |