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 |
|---|---|---|---|---|---|---|
b9a8057c2d94f27708bc713c68ff31623f648958 | TypeScript | zachowj/node-red-contrib-home-assistant-websocket | /src/common/errors/HomeAssistantError.ts | 2.625 | 3 | import { RED } from '../../globals';
interface HaError {
code: string;
message: string;
}
export function isHomeAssistantApiError(error: any): error is HaError {
return error.code !== undefined && error.message !== undefined;
}
export default class HomeAssistantError extends Error {
readonly #statusM... |
06882ca2ef89dc4e5f5af8a0ca5b74ce1785ed92 | TypeScript | kkumari27/Assngmnt6 | /assignment6-master/src/app/book.ts | 2.65625 | 3 | export class Book {
id:number;
name:string;
price:number;
author:string;
image:string;
details:string;
constructor(id,name,price,author,image,details){
this.id=id;
this.name=name;
this.price=price;
this.author=author;
this.image=image;
this.details=details;
}
} |
06d1fcc05085c8e2ef1b2faa51ea5f08ccd9aa75 | TypeScript | rahulagarwal10895/angular | /src/app/shared/model/Student.ts | 2.515625 | 3 | export class Student{
public id:number;
public studentName:string;
public category:string;
public dob:Date;
public fname:string;
public mname:string;
public score:number;
public email:string;
public contact:string;
public documents:Document;
constructor(){
this... |
ccdd25d82f2842cdf5dd6783fb1f9a0f8f844ac5 | TypeScript | desktop/desktop | /app/test/unit/octicon-test.ts | 2.53125 | 3 | import { iconForRepository } from '../../src/ui/octicons'
import * as OcticonSymbol from '../../src/ui/octicons/octicons.generated'
import { CloningRepository } from '../../src/models/cloning-repository'
import { Repository } from '../../src/models/repository'
import { gitHubRepoFixture } from '../helpers/github-repo-b... |
b778b39fc6896d4acc2eea7b60259c085bf6ffb5 | TypeScript | kryptonian41/mytry-next-app | /pages/api/users/authenticate.ts | 2.640625 | 3 | import type { NextApiRequest, NextApiResponse } from "next";
import axios from "axios";
export const authenticateUser = async (body = {}) => {
const { email, password } = body as any;
let response;
try {
response = await axios.post(process.env.WCOMM_DOMAIN, null, {
params: {
rest_route: `${proc... |
c83d3bf6e79b784b94867e77a3a5e862c6a57c1d | TypeScript | JRoman-brug/newFirebasePage | /src/app/services/firestore/firestore.service.ts | 2.515625 | 3 | import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/compat/firestore';
// Observables library
import { map } from 'rxjs/operators';
import { Observable, pipe } from 'rxjs';
// Intefaces
import { IProduct, IProductId } from '../../interfaces/product/p... |
951049a5a152b1da0ea8d9140ba458559f8948cb | TypeScript | m-mik/ipa-trainer | /common/hooks/useKey.ts | 2.640625 | 3 | import { useCallback, useEffect } from 'react'
function useKey(targetKey: string, handler: (e: KeyboardEvent) => void) {
const keyDownHandler = useCallback(
(e: KeyboardEvent) => {
if (e.key === targetKey) {
handler(e)
}
},
[handler, targetKey]
)
useEffect(() => {
window.addE... |
61e15ad73e94c07c75c040c4bc5e43feb0802cf7 | TypeScript | MrZhouZh/awesome-validator | /test/rules/full-width.ts | 3.078125 | 3 | import { assert } from 'chai';
import { AbstractRule } from '../../src/rules/abstract-rule';
import { FullWidth } from '../../src/rules/full-width';
describe('FullWidth', () => {
let fullWidth: FullWidth;
beforeEach(() => {
fullWidth = new FullWidth();
});
it('is rule', () => {
asse... |
34b6dfb1d46682bf765888cf7190ef987e987644 | TypeScript | oscarmelara/datalink | /src/utils/alerts.ts | 2.53125 | 3 | import Swal from 'sweetalert2'
const colors: { [x: string]: string } = {
confirmButtonColor: '#212754',
blackButton: '#333333',
}
interface SweetAlertProps {
title?: string
html?: string
icon?: 'success' | 'error' | 'warning' | 'info' | 'question' | undefined
}
export const confirmAlert = ({
title = '',
... |
ab0ee6e8244cd3d665eadf7342edbaeb6912bf0c | TypeScript | marcmrf/ts-auto-mock | /src/transformer/descriptor/enum/enumDeclaration.ts | 2.5625 | 3 | import * as ts from 'typescript';
import { TypeChecker } from '../../typeChecker/typeChecker';
import { RandomPropertyAccessor } from '../random/random';
import { IsTsAutoMockRandomEnabled } from '../../../options/random';
export function GetEnumDeclarationDescriptor(node: ts.EnumDeclaration): ts.Expression {
const ... |
8fe1018048fadbbacd444660a5d1957dc0140e90 | TypeScript | andretimm/flash | /src/modules/Message/MessageController.ts | 2.578125 | 3 | import { Request, Response } from "express";
import { validationResult } from "express-validator";
import { Errors } from "../../entities/Error";
import { Message } from "../../entities/Message";
import { MessageService } from "./MessageService";
class MessageController {
constructor(private messageService: MessageS... |
2b0e2a0c56c3b87799191ae7199e7b9b6521267e | TypeScript | netoudi/won-games-client | /src/utils/filter/index.ts | 2.625 | 3 | import { ParsedUrlQueryInput } from 'querystring'
import { ItemProps } from 'components/ExploreSidebar'
export type ParseArgs = {
queryString: ParsedUrlQueryInput
filterItems: Pick<ItemProps, 'type' | 'name'>[]
}
export const parseQueryStringToWhere = ({
queryString,
filterItems,
}: ParseArgs) => {
// eslin... |
ef57f92e34c76369c3385aa721925c3689702dd3 | TypeScript | modelmap/a1-notation | /dist/noObject/converters/A1-Col-2.d.ts | 2.8125 | 3 | /**
* @fileOverview Converts column letter to number
* @author Flambino
* @see https://codereview.stackexchange.com/questions/90112/a1notation-conversion-to-row-column-index
* @param {string} col
*
* @return {number}
*/
export default function (col: string): number;
|
2b3a6fe2a23389bf27d00866af990e246d35cccc | TypeScript | elkarouani/my-angular-demo | /src/app/courses.service.ts | 2.578125 | 3 | import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class CoursesService {
_courses: string[];
constructor() {
this._courses = ['item1', 'item2', 'item3'];
}
get courses() { return this._courses; }
addCourse() { this._courses.push('item') }
removeCourse(course: ... |
2c735189519b70498bd187470bf7cdaea24b28e3 | TypeScript | nexttiereducation/mobile-upgrade | /src/app/pipes/gerundize.pipe.ts | 3.09375 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { endsWith, join, trimEnd, words } from 'lodash';
@Pipe({
name: `gerundize`
})
export class GerundizePipe implements PipeTransform {
/**
* Takes a string of words and transforms one of them into a gerund.
*/
public transform(val: string, wordIndex... |
7fcdc2987561aeea913755883eb95a9e9f72cde6 | TypeScript | isabelADev/ray-tracing-css | /src/app/ray-trace-graph/utils/ray-trace-utils.ts | 2.796875 | 3 | import {Coord} from '../models/coord';
export class RayTraceUtils {
public static calculateTransformForBulletToCoord(coord: Coord) {
return `translate(${coord.xPos}px, ${coord.yPos}px)`;
}
public static calculateVectorWidth(dX: number, dY: number, offsetWidth: number): number {
return Math.sqrt(Math.po... |
63e6ec12ca6defb656ead672825373dcb1bca2ad | TypeScript | cichya/Angular.Learning.SPA | /src/app/features/ngrx/store/ngrx.actions.ts | 2.515625 | 3 | import { Data } from './../models/data';
import { Action } from '@ngrx/store';
export const FETCH_DATA = '[Ngrx] Fetch Data';
export const SET_DATA = '[Ngrx] Set Data';
export const ADD_DATA = '[Ngrx] Add Data';
export const DELETE_DATA = '[Ngrx] Delete Data';
export class FetchData implements Action {
readonly typ... |
4a5c4f98d64328ee142d3bc7e69e2e577385370c | TypeScript | emmaofori20/myPhpBlog | /src/app/models/Categories.model.ts | 2.625 | 3 | export class Categories
{
public id: number;
public CategoriesName:string;
constructor(Name:string, date:string, id:number){
this.CategoriesName=Name;
this.id=id;
}
}
|
ccae0956230fa633f87bb55f48ce502f563ba5e8 | TypeScript | njirem95/cah-clone | /src/networking/GameServerHandler.ts | 2.546875 | 3 | import { Connection } from "./Connection";
import * as socketio from "socket.io";
import { Event } from "../events/Event";
export class GameServerHandler implements Connection {
constructor(
private _server: socketio.Server,
private _events: Map<string, Event>
) { }
public handle(): void {... |
c49acb064fe65b2986ae1d9e358ad1d491603d9d | TypeScript | MisterMard/picklefinance-core | /src/database/DatabaseUtil.ts | 2.515625 | 3 | import { ethers } from "ethers";
import { JarDefinition } from "../model/PickleModelJson";
/**
* This file is not used currently. Might be deleted.
*/
export const CURRENT = 0;
export const ONE_DAY = 48;
export const THREE_DAYS = ONE_DAY * 3;
export const SEVEN_DAYS = ONE_DAY * 7;
export const THIRTY_DAYS = ONE_DAY... |
fb5e4f85824fe1616e4728064cb90794c8e8ccbf | TypeScript | gsapkar/user-likes-nodejs-api | /src/validators/schemas.ts | 2.6875 | 3 | import * as Joi from "joi";
// the password must have be more than 5 chars and at least one number and at least one uppercase char
const passwordRegex = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{5,}$/;
export const schemas = {
signup: Joi.object().keys({
username: Joi.string().required(),
password: Joi.string().reg... |
85b76861810a77c39ba397cc56f5253d4e0b15b0 | TypeScript | tcgdex/cards-database | /data/Sun & Moon/Ultra Prism/157.ts | 2.703125 | 3 | import { Card } from '../../../interfaces'
import Set from '../Ultra Prism'
const card: Card = {
name: {
en: "Leafeon GX",
fr: "Phyllali GX",
es: "Leafeon GX",
it: "Leafeon GX",
pt: "Leafeon GX",
de: "Folipurba GX"
},
illustrator: "5ban Graphics",
rarity: "Secret Rare",
category: "Pokemon",
set: Set... |
c948be3a7e718de2bf328be7eab219f490aa9d8a | TypeScript | TrungDucMai/MD5-Bai3-Angular-Simple-Calculator | /src/app/calculator/calculator.component.ts | 2.640625 | 3 | import {Component, OnInit} from '@angular/core';
@Component({
selector: 'app-calculator',
templateUrl: './calculator.component.html',
styleUrls: ['./calculator.component.scss']
})
export class CalculatorComponent implements OnInit {
public firstNumber: any;
public secondNumber: any;
public operators = ['Co... |
dcc572439209378dec106b00ed1bce81d048333e | TypeScript | do7be/lgtm-hub | /src/actions/index.ts | 2.546875 | 3 | import { Dispatch } from 'redux'
import { RootState } from '../reducers'
import * as types from '../constants/ActionTypes'
export const loadRandom = () => {
return async function (dispatch: Dispatch<RootState>, _getState: any) {
const data: { imageUrl: string }[] = await (await fetch('/random')).json()
const... |
3fb042e2537c6b6f79d6ee475f51e40178ffc7f0 | TypeScript | GodGee/ts-gg | /webpack/src/index.ts | 3.625 | 4 | // 需要在webpack.config.js中配置resolve属性
// 告诉webpack以.ts结尾的文件可以被认为是一个模块
import { hi } from './m1'
console.log(hi)
function sum(a: number, b: number): number {
return a + b
}
console.log(sum(123, 456))
// 如果配置babel时,不指定版本运行环境,生成的不变
// 而如果指定了IE 11,则const会被代替为var(IE 11不支持ES6!)
const obj = { name: '孙悟空', age: 33 }
consol... |
1deafd1f48ad0f9e5c0382bfc704e9178d9b26ce | TypeScript | martinjirak/phone-contacts | /src/helpers/factory.ts | 3.015625 | 3 | import { Contact } from "../types";
import * as R from "ramda";
export const normalizePhoneNumber = (value: string) => {
let phoneNumber;
if (!value.trim()) return undefined;
let digits = value.replace(/\D/g, "");
if (digits.length !== 9 && digits.length !== 12) return undefined;
let digitsArray = digits.m... |
894b1093995b3fac32309a35f3ddef1eeab14587 | TypeScript | timvandam/coding-challenges | /src/LeetCode/2. Add Two Numbers/index.test.ts | 3.1875 | 3 | import { addTwoNumbers, ListNode, ListNodeOrNull } from './index'
function createLinkedList(...args: number[]): ListNodeOrNull {
if (!args.length) return null
return new ListNode(args[0], createLinkedList(...args.slice(1)))
}
it('one', () => {
expect(addTwoNumbers(createLinkedList(2, 4, 3), createLinkedList(5, ... |
f39f4d62ee8bbb24b7dbdf8dc9fb419d7779da1c | TypeScript | JGrenet/EIP-Pinty-Web | /src/app/core/Api/Model/PlaceInfo.ts | 2.515625 | 3 | export class FriendsPassage {
id: string;
name: string;
pp: string;
}
export class PlaceInfo {
constructor(_id: string, _placeId: string, _name: string, _formattedAddress: string, _location: number[], _phone: string,
_priceLevel: number, _rating: number, _googleRating: number, _url: string... |
02e9f6a05cc8db18653062c3236f1a6c083b6b4c | TypeScript | ErYaminiPal/RecruitmentApp | /src/main/webapp/app/entities/applicant/applicant.model.ts | 2.90625 | 3 | import { IApplication } from 'app/entities/application/application.model';
export interface IApplicant {
id?: number;
firstName?: string | null;
lastName?: string | null;
email?: string | null;
phone?: string | null;
summary?: string | null;
cTC?: number | null;
eCTC?: number | null;
highestEducation... |
2ed682382c24023f0af046f1938aa261930baba6 | TypeScript | ytmfdw/Test | /code/code/src/utils/CommonUtils.ts | 2.78125 | 3 |
/**
* 生成指定位数的随机码
* @param num
*/
function createOneyCode(num?: number): string {
return 'FN_' + uuid(isNaN(num) ? 8 : num, 16);
}
function uuid(len, radix) {
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
var uuid = [], i;
radix = radix || chars.length;
... |
81816646b4e83f672a40238e4bb97605bd646624 | TypeScript | ghoul007/events | /src/app/pages/event/events.service.ts | 2.53125 | 3 | import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, throwError as observableThrowError } from 'rxjs';
import { catchError, map, tap } from 'rxjs/operators';
import { Event } from './event';
@Injectable({
providedIn: 'root'
})
export c... |
b1fbe72117014c0dffa4999a8f2d211fcd9fb195 | TypeScript | bfv/xrefcli | /src/commands/switch.ts | 2.8125 | 3 | import { Config } from './../config';
import { Executable } from './../executable';
import { Help } from '../help';
export class SwitchCommand implements Executable {
private config: Config;
private reponame = '';
constructor(config: Config) {
this.config = config;
}
execute(params: any)... |
bdedda8c5ebea0e6c05d452fe6efc999a1f97f6f | TypeScript | IoTSharp/IoTSharp | /ClientApp/src/stores/keepAliveNames.ts | 2.640625 | 3 | import { defineStore } from 'pinia';
import { KeepAliveNamesState } from './interface';
/**
* 路由缓存列表
* @methods setCacheKeepAlive 设置要缓存的路由 names(开启 Tagsview)
* @methods addCachedView 添加要缓存的路由 names(关闭 Tagsview)
* @methods delCachedView 删除要缓存的路由 names(关闭 Tagsview)
* @methods delOthersCachedViews 右键菜单`关闭其它`,删除要缓存的路... |
e49d8bf0ea9b0aa0366caef0d771b6ede9f1fe75 | TypeScript | protolambda/ssz | /src/types/index.ts | 3.328125 | 3 | /**
* SSZ is a type system that defines:
* - efficient serialization / deserialization
* - stable merkleization
* - default constructor
*
* Along with these standardized operations, we provide:
* - equality
* - valid value assertion
* - copy / clone
* - serialized byte length (for serialization)
* - chunk co... |
7cd077a3a7a4366c2425bac539272dede58c1aee | TypeScript | esbjornlarsen/SP2015 | /JavascriptPromise/JavascriptPromise/Scripts/CallBack.ts | 3 | 3 | namespace main {
export class TestCallBack {
static init() {
TestCallBack.doHelloWorld(TestCallBack.myCallBackFunction);
TestCallBack.doHelloWorld(TestCallBack.myCallBackFunctionLog);
}
static doHelloWorld(callback: (str : string, str2 : string) => any) {
... |
0bc7dfc3fbd7b3d7ebabe738a3729cfa34409ff2 | TypeScript | cheminfo/database-aggregator | /src/source/__tests__/driver-errors.test.ts | 2.546875 | 3 | import { getDriverPath } from '../../../test/util';
import { copy } from '../copy';
describe('source copy errors', () => {
it('shoud fail when driver config is missing', () => {
// @ts-ignore
return expect(copy({ driver: undefined })).rejects.toThrow(
/^driver must be a string or object$/
);
});
... |
8f6dba09cd1e1c0cd839f9b45e7118d102f36667 | TypeScript | junior5/ecommerce | /frontend/src/app/ecommerce/models/produto.model.ts | 2.5625 | 3 | export class Produto {
id: number;
nome: string;
descricao: string;
custoCompra: number;
urlImagem: string;
constructor(id: number, nome: string, descricao:string, custoCompra: number, urlImagem: string) {
this.id = id;
this.nome = nome;
this.descricao = descricao;
... |
656cf68a3465403335441fc0bad498aa4f4e668a | TypeScript | tenbot/tenbot | /packages/cipher/__tests__/pkcs7.spec.ts | 2.640625 | 3 | import { decrypt, encrypt } from '@tenbot/cipher';
describe('@tenbot/cipher > pkcs7', () => {
describe('decrypt', () => {
it('should get correct pkcs7 decrypted buffer', () => {
const size = 32;
const input = Buffer.concat([
Buffer.from([1, 2, 3, 4]),
Buffer.alloc(28, 28),
]);
... |
8ee671eabd97dd3d94659cf7f465800b71e25f44 | TypeScript | a707843858/courierCach | /src/packages/tasks.ts | 2.90625 | 3 | export class Task {
private queue: Map<Request, any> = new Map();
get(original: Request) {
return this.queue.get(original);
}
set(original: Request, controller: any) {
this.queue.set(original, controller);
return true;
}
delete(original: Request) {
return this.queue.delete(original);
}
... |
1ed6c9a60b81e5721bf5dbc361544533499e6ef9 | TypeScript | Yama-Tomo/json2typescript | /test/model/json/i-employee.ts | 2.546875 | 3 | export interface ISkill {
id: number;
skill_name: string;
description: string|null;
}
export interface IEmployee {
id: number;
first_name: string;
last_name: string;
branch_name: string;
age: number;
hobby?: string;
description: { length_of_service: number, position: string, sub_position: string };... |
d45ab883c5128b3c5f9337dd3264100e163c20ff | TypeScript | honnix/flyteconsole | /src/common/formatters.ts | 2.96875 | 3 | import cronstrue from 'cronstrue';
import { Admin, Protobuf } from 'flyteidl';
import * as moment from 'moment-timezone';
import {
subSecondString,
unknownValueString,
zeroSecondsString
} from './constants';
import { timezone } from './timezone';
import { durationToMilliseconds, isValidDate } from './utils'... |
0d851549bb4b2530f917a4d5663e7eb6d735af3e | TypeScript | idettman/idettman.github.io | /examples/js/story-graph-master/src/components/actor.ts | 3 | 3 | import { SOURCE, TARGET } from './constants'
import Type from './type'
export default class Actor {
id: number
type: Type
name: string
location: string | null
locations: string[]
entryTime: number
lifeTime: number
// callback: () => void
members: Actor[]
parentId?: number;
constructor(data, worl... |
35267ea258bf493703e5aa21ecaf5cc109d1b350 | TypeScript | chenchunfeng/ts-axios | /examples/cancel/app.ts | 2.734375 | 3 | import axios from '../../src/index'
let cancel;
const CancelToken = axios.CancelToken;
axios({
url: '/config/test',
method: 'post',
headers: {
test: '321'
},
CancelToken: new CancelToken(c => {
cancel = c;
})
}).then((res) => {
console.log(res.data)
}).catch(e => {
console.log(e, axios.isCancel... |
1e6a38072bd636ac7131b99d53c55431acd73e56 | TypeScript | huyhoangtb/nodejs-reactjs-core-project | /server/src/core/responseable/ResponseData.ts | 2.625 | 3 | export default class ResponseData {
protected _success: boolean;
protected _result: object;
protected _message: string;
protected _detail: object;
protected _trace: any;
protected _error: {
code: string,
desc: string
};
constructor(data?: any) {
if(!data) {
... |
7a1fde57f8dfa6e5b0baeec871edc9ee2aacb253 | TypeScript | mattmazzola/draft-js-sample | /src/ToolbarExample/classes.ts | 2.8125 | 3 | export interface IWordType {
id: string
name: string
multivalue: boolean
}
const wordTypes: IWordType[] = [
{
id: "0",
name: 'noun',
multivalue: true
},
{
id: "1",
name: 'verb',
multivalue: false
},
{
id: "2",
name: 'adjective',
multivalue: false
},
{
id: "3"... |
70d33074e9fe9127c808c44454e7f483c89862ce | TypeScript | begin29/rad_task | /orders/controllers/lib/paymentService.ts | 2.578125 | 3 | const axios = require('axios');
const models = require('../../../models');
const { PaymentProcessError, OrderUpdateError } = require('../../helpers/errors');
export class PaymentService {
readonly orderId: number;
readonly orderSum: number;
readonly paymentUrl = 'http://payments_api:3000/pay';
constructor(id:... |
241f84c85a0808f44a75f0e2073f7362002d1afa | TypeScript | AntonShilin/eshop | /src/Reducers/MainStateReducer.ts | 2.90625 | 3 | import {
IMainState,
MainStateActions,
GetFableResultsTypes,
GetBiographyResultsTypes,
GetStoryResultsTypes,
GetBestsellersResultsTypes,
GetFictionResultsTypes,
GetArtResultsTypes,
GetLifestyleResultsTypes,
} from "../Types/MainStateTypes";
const mainState: IMainState = {
allGenresData: [],
isLoa... |
9cf11075bbfc82c2a86908e96923445a4f10275c | TypeScript | Ernyoke/algorithms-ts | /src/sort/quickSort.ts | 3.859375 | 4 | /**
* In place Quick-sort algorithm
* @param {T[]} values: array to be sorted
* @param {(a:T, b:T) => boolean } comparator: function which takes to elements of T and returns true if a < b
*/
import partition from "../array/partition";
export default function quickSort<T>(values: T[], comparator: (a: T, b: T) => bo... |
b67a073316add5e5ecd1ac5bb4036172aa57622d | TypeScript | pasta04/oengs-submission-viewer | /src/types/oengus.d.ts | 2.65625 | 3 | export type MarathonGameAPI = Game[];
export type MarathonSubmissionAPI = {
id: number;
user: User;
games: Omit<Game, 'user'>[];
availabilities: {
from: string;
to: string;
}[];
answers: {
id: number;
question: Questions;
/**
* 回答
* @description チェックボックスの場合は、文字列で"true"になる。
... |
9e7dfe5ea69d8d3b157e6263641b27518bb44e9e | TypeScript | JamesHDuffield/fate | /functions/src/services/db.ts | 2.71875 | 3 | import { User } from '../models/user';
import { Moment, Option } from '../models/moment';
import { Location } from '../models/location';
// tslint:disable-next-line: no-implicit-dependencies
import { DocumentReference } from '@google-cloud/firestore';
import { Zone } from '../models/zone';
import { Flag } from '../mode... |
c8533ffbe5095215ffcf927bd2d54227a1b088e3 | TypeScript | tus-alpine-team/scrapbox-notification-bot | /src/index.ts | 2.578125 | 3 | import { ScrapboxProjectResponse } from './scrapboxProjectResponse';
import { sendToLine } from './sendToLine';
const project_name = 'tus-alpine';
// 更新情報をLINEに投げる
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function postMessage(): void {
const yesterday = new Date();
yesterday.setDate(yeste... |
a8714d28263e2dcd3266e896e6003da4f08019b5 | TypeScript | PixoDev/pammy-api | /src/services/recipe.service.ts | 2.65625 | 3 | import { NewRecipePayload } from "@interfaces/recipe";
import { RecipeModel } from "@models/recipe.model";
export const getRecipe = async (recipeId: string) => {
return RecipeModel.findById(recipeId).lean().exec();
};
interface RecipesParams {
params: any;
}
export const getRecipes = async ({ params }: RecipesPar... |
4f4bf1916e4bb0d6a0d5d88dbfc890f2c4bdc62b | TypeScript | villevauhkonen/node-ts | /src/index.ts | 2.75 | 3 | import Express from 'express'
import returnName from './returnName'
const app = Express()
const port = 8081;
// define a route handler for the default home page
app.get( "/", ( req: Express.Request, res: Express.Response ) => {
const name = returnName('Ville')
res.send(name);
} );
// start the Express serv... |
758b38e97519e9cb9253c78b23511770ee37998e | TypeScript | LBHackney-IT/NCC | /ng-ncc-app/src/app/common/components/current-caller/current-caller.component.ts | 2.53125 | 3 | import { Component, Input } from '@angular/core';
import { CallService } from '../../services/call.service';
@Component({
selector: 'app-current-caller',
templateUrl: './current-caller.component.html',
styleUrls: ['./current-caller.component.scss']
})
export class CurrentCallerComponent {
@Input() wit... |
25bf91f0cca63eebd331d9073e933f27e6e1a748 | TypeScript | Supinic/charlestonbieber | /src/commands/RandomLyrics.ts | 2.859375 | 3 | import { Lyrics } from './types';
import { Command, Platform, randomItem } from '../modules';
import { Supi, supi, someRandomAPI } from '../modules/GotInstances';
export class RandomLyrics extends Command {
name = 'randomlyrics';
aliases = null;
permission = Command.Permissions.EVERYONE;
cooldown = 7500;
syn... |
ee413bc6569621938071cf76189bde65d599ae13 | TypeScript | kerlos1256/socialMedia-server | /src/utils/check_Auth.ts | 2.546875 | 3 | require('dotenv')
const jwt = require('jsonwebtoken');
const key = process.env.SECRET_KEY
export default (headers) => {
if (headers) {
if (headers.authorization) {
const token = headers.authorization.split('Bearer ')[1];
if (token) {
try{
const ... |
c71eaf04af7fb9b2746d96baa808989e0c2a5a87 | TypeScript | nikoladimitroff/Zmey | /Prototypes/Overmind/src/utils.ts | 2.9375 | 3 |
export function checkAndSet(target: any, donor: any, prop: string): void {
if(donor[prop] !== undefined) {
target[prop] = donor[prop];
}
else {
console.assert(false);
}
}
export async function fetchJSON(url: string): Promise<any> {
let promise = new Promise(resolve => {
le... |
70cbeedd2229181e867a22b4209c967fa3524554 | TypeScript | pl4st3/SingleInstanceBrowser | /app/src/renderer/RendererApplication.ts | 2.6875 | 3 | import { ipcRenderer, remote } from "electron";
import * as $Settings from "../shared/Settings";
import * as $URLItem from "../shared/URLItem";
import * as $ShortCuts from "mousetrap";
/**
* The class for the renderer application part. Each window will have only one instamce.
*/
export class CRendererApplication {
... |
ca885fc085e142ebf6fc1726320942e8b143a852 | TypeScript | gristlabs/ts-interface-builder | /test/fixtures/ignore-generics.ts | 2.65625 | 3 | export interface ITest {
myGeneric: IMyType<string>;
}
export interface IMyType<T> {
value: T;
}
|
91c67b9dc1b9057458e3aef3a13dc101b2c71859 | TypeScript | Blubtastic/angularShoppwingWebsite | /client/app/google-maps/google-maps.component.ts | 2.578125 | 3 | /* Component for the google map on the products page that displays user
locations, show a selected product's location, and can be used to
filter the list of products based on the selected user */
import { Component, OnInit } from '@angular/core';
import { UserService } from '../services/user.service';
import { Messag... |
cc4b5c1af310c6f24518543c53d7b34c7ed94292 | TypeScript | skcotnam062/TypeScript30 | /src/10 - Hold Shift and Check Checkboxes/main.ts | 2.890625 | 3 | (function() {
const checkboxes = document.querySelectorAll(
'.inbox input[type="checkbox"]'
) as NodeListOf<HTMLInputElement>;
let lastChecked: HTMLInputElement;
function handleCheck(this: HTMLInputElement, e: MouseEvent): void {
// Check if they had the shift key down
// AND check that they are c... |
863bf40abd2025227a0e0cc823a532df8bd55d19 | TypeScript | eyaleizenberg/doom_minesweeper | /src/redux/reducers/game.ts | 2.578125 | 3 | import { handleActions } from 'redux-actions';
import { IGameState } from '../../interfaces/gameInterface';
import * as ACTIONS from '../../constants/actionTypes';
export const defaultState = {
isGameOver: false,
gameInProgress: false,
newGameDialogShown: false,
customGameDialogShown: false,
isGameWon: false... |
803607ff202a6ef5fe9dd1012a376429a2bff531 | TypeScript | netgum/archanova | /packages/cli/src/services/TemplateService.ts | 2.546875 | 3 | import { resolve, join } from 'path';
import { readdir, readFile, writeFile, stat, ensureDir, pathExists } from 'fs-extra';
import { SdkService } from './SdkService';
export class TemplateService {
private static SRC_DIR = resolve(__dirname, '../../template');
constructor(private workingPath: string) {
//
}... |
7fb7da0283b5b7f99c6f86ab2d7040f486d5ec44 | TypeScript | Tamareg/BlankExpressAsyncTesting | /BlankExpressAsyncTesting/mylib_express.ts | 2.640625 | 3 | const os = require('os');
const fs = require('fs');
const express = require('express');
const hbs = require('hbs');
var bUseMainten = false;
var app = express();
hbs.registerPartials(__dirname + '/views/partials')
app.set('view engine', 'hbs');
/* bUseMainten */
if (bUseMainten) {
//---------------------------... |
86e13a4142bbdf807f67bc73dc755c65e12d1854 | TypeScript | AnupriyaGola/Typescript | /youtube.ts | 2.875 | 3 | //defining a class
class Youtube{
//fields or properties
private videoTitle : string;
private publisher : string;
private publishDate : any;
private views : number;
private subscribe : number;
private no_of_likes : number;
private no_of_dislikes : number;
private category : string;
... |
04e1533dab8e05ba2409225c3aa6d8a3af089043 | TypeScript | zuramai/denovel | /config/database.ts | 2.734375 | 3 | import { config } from "https://deno.land/x/dotenv/mod.ts";
/*
|--------------------------------------------------------------------------
| Database Connection Interfaces
|--------------------------------------------------------------------------
|
| It will let you know available databases
| for this framework.
|
*/... |
572cec362cda2f915dd8f457d1ae2682e7847def | TypeScript | webdev0415/Estack-backend | /src/merchant/dto/create-otp.dto.ts | 2.546875 | 3 | import { IsEmail, IsNotEmpty, IsString } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
/** input for create Otp endpoint */
export class CreateOtpDto {
/** email */
@ApiProperty({
description: 'Email',
required: true,
format: 'string',
})
@IsString()
@IsNotEmpty()
@IsEm... |
f9acf98d9458ebb0d59a5d04da441b72ddc9d88d | TypeScript | wilfredlopez/color-converter | /test/methods/tints.test.ts | 3.328125 | 3 | import { ColorConverter } from "../../src";
function equal(value: any, expected: any) {
expect(value).toEqual(expected);
}
const defaultWeight = (w?: any) => {
it(`${w} should default to 10% weight tints`, () => {
const { length } = new ColorConverter("hsl(0 100% 50%)").tints(w);
equal(length, 10);
});
}... |
57fb8e69607ded35b7b66ea700924a24fc0d3b92 | TypeScript | ravunana/manda-negocio | /src/main/webapp/app/shared/model/retencao-fonte.model.ts | 2.625 | 3 | export interface IRetencaoFonte {
id?: number;
motivoRetencao?: string;
valor?: string;
porcentagem?: boolean;
detalheId?: number;
impostoCodigoImposto?: string;
impostoId?: number;
}
export class RetencaoFonte implements IRetencaoFonte {
constructor(
public id?: number,
public motivoRetencao?:... |
72960b0b2627fc194738f876e04e958e2a0188a7 | TypeScript | NativeScript/NativeScript | /apps/automated/src/ui/core/weak-event-listener/weak-event-listener-tests.ts | 2.8125 | 3 | import * as TKUnit from '../../../tk-unit';
import { Observable, EventData } from '@nativescript/core';
import { addWeakEventListener, removeWeakEventListener } from '@nativescript/core/ui/core/weak-event-listener';
import { forceGC } from '../../../ui-helper';
class Target {
public counter: number = 0;
public onEve... |
4f1d5d9fe081929a972d0714608818bb75936298 | TypeScript | abdelrahmanabdo/AdvancedCareClinics-app | /src/services/DepartmentsService.ts | 2.53125 | 3 | import { DepartmentModel } from "../models";
import axios from "axios";
export default class DepartmentsService {
/**
* Get all departments
* @public
*/
public static getDepartments(): Promise<DepartmentModel[]> {
return new Promise((resolve, reject) => {
axios
.get('http://www.advancedcar... |
2d047aae9078d22e0a52e6679bd489d223bf3b79 | TypeScript | Qlee-practice/good-practice-for-redux | /src/models/__test__/todo.spec.ts | 2.5625 | 3 | import { TasksModel } from "../todo";
import { storeService } from "../../services/store-service";
import { combineReducers, createStore, Store } from "redux";
describe('Model - TasksModel', () => {
describe('#Create', () => {
let store: Store;
beforeEach(() => {
store = createStore(combineReducers(... |
cdef4cee2600932d4f6902d7112f4cf3206c0eb4 | TypeScript | souldreamer/string-template-parser | /src/parser.ts | 3.0625 | 3 | export interface Pipe {
name: string;
parameters: string[];
}
export interface Variable {
name: string;
pipes: Pipe[];
}
export interface ParsedString {
literals: string[];
variables: Variable[];
}
const enum ParseState {
Literal,
Variable,
Pipe,
PipeParameter
}
export const DEFAULT_QUOTED_STRING_REGEX = ... |
8966f839350a996ccc9e13756d51c5be3e46071e | TypeScript | geoffdutton/amplitude | /test/errors.test.ts | 2.65625 | 3 | import { expect } from 'chai'
import { AmplitudeErrorResponse, axiosErrorCatcher } from '../src/errors'
interface MockAxiosError extends Error {
response?: {
status: number
data: unknown
}
}
describe('errors', () => {
it('catches axios response errors', async () => {
const err: MockAxiosError = new ... |
e02e3a49e11ea33bc78caf18fb6c5c93a09f35dd | TypeScript | green-fox-academy/jnsmtnr | /week-03/day-2/print-each-line.ts | 3.078125 | 3 | 'use strict';
export { }
declare function require(path: string): any;
const fs = require('fs');
try {
let fileContent = fs.readFileSync('my-file.txt', 'utf-8');
console.log(fileContent);
}
catch(err) {
console.log('Unable to read file: my-file.txt');
}
// Write a program that opens a file called 'my-file.txt',... |
5660a715c49237d82fd2572c4f77ee2746b3835e | TypeScript | Mayssa1000/mobius-viewer-dev-0-7 | /src/assets/core/inline/_set.ts | 3.3125 | 3 | /**
* Set functions for working with sets, using lists as a data structure. Does not modify input list.
*/
import * as Mathjs from 'mathjs';
/**
* Generates a list of unique items.
* @param list
*/
export function setMake(debug: boolean, list: any[]): any[] {
return Array.from(new Set(list));
}
/**
* Genera... |
2f149580ef05ec186cbf0271de8f4e93b346649b | TypeScript | echovijaypatel/epam-angular-task | /my-app/src/app/state/auth.reducer.ts | 2.828125 | 3 | import { User } from '../models/user';
import * as AuthActions from './auth.actions';
export const initialUserState: User = {
id: null,
name: null,
login: null,
password: null,
fakeToken: null,
token: null,
};
export interface AuthState {
isAuthenticated: boolean;
user: User | null;
errorMessage: st... |
847c0f68fd6685df9762e5c192c7d02bfac0f8f6 | TypeScript | roberta-fiume/angular-directives | /src/app/unless.directive.ts | 2.53125 | 3 | import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core';
@Directive({
selector: '[appUnless]'
})
export class UnlessDirective {
// the setter is a method of the property and it gets executed whenever the property changes and it changes outside of this directive so
// whenever the conditio... |
cb6eec20cb583c88c5a4fda2efa49c812e13d431 | TypeScript | fluffynuts/zarro | /tests/gulp-tasks/modules/create-temp-file.spec.ts | 2.578125 | 3 | import "expect-even-more-jest";
import { folderExists, mkdir, readTextFile } from "yafs";
import { faker } from "@faker-js/faker";
import { Sandbox } from "filesystem-sandbox";
describe(`create-temp-file`, () => {
const
createTempFile = requireModule<CreateTempFile>("create-temp-file"),
os = require("os"),
... |
f3fe1698bad1f2ea860e2b6fcda52c65e068adab | TypeScript | future4code/dumont-LAMA10 | /lama-template/src/controller/ShowController.ts | 2.78125 | 3 | import { Request, Response } from "express";
import { ShowInputDTO } from "../business/entities/Show";
import { Authenticator } from "../business/services/Authenticator";
import { IdGenerator } from "../business/services/IdGenerator";
import { ShowBusiness } from "../business/ShowBusiness";
import { ShowDatabase } from... |
5595543043d2c5ee5c3f2a7d005a2129fc0a4ee5 | TypeScript | leon740727/eth-agent | /example/client.ts | 2.703125 | 3 | import { w3cwebsocket as W3CWebSocket } from 'websocket';
import { ActionRequest, EventsRequest, Result, Event, Json } from '../index';
import { EventListener } from '../m/utils';
import EventStream from '../m/event-stream';
function connect (url: string, subprotocol: string): Promise<W3CWebSocket> {
var conn = ne... |
687872abd50dc4100db105da826caf77c5e4af95 | TypeScript | tntcomputers/cnds | /Plugins/Lpp.Dns.General.Metadata/Content/ViewModels/Terms/DateRange.ts | 2.578125 | 3 | /// <reference path="../../../../../Lpp.Mvc.Composition/Lpp.Mvc.Boilerplate/jsBootstrap.d.ts" />
/// <reference path="../../Models/Terms.ts" />
/// <reference path="../../ViewModels/Terms.ts" />
module RequestCriteriaViewModels {
export class DateRangeTerm extends RequestCriteriaViewModels.Term {
public Ti... |
34452953592491d77a22a82028a08c4a9e7b3472 | TypeScript | mastong/shapes-game | /app/app.component.ts | 2.625 | 3 | import { Component } from '@angular/core';
import { CircleModel } from './circle.model';
import { SquareModel } from './square.model';
import { ShapeModel } from './shape.model';
import { ShapeService } from './shape.service';
import { Utils } from './utils';
import { ToastsManager } from 'ng2-toastr/ng2-toastr';
@Com... |
6e1e91d5f39b769ee3a3ab46f996cdcfc65ac94f | TypeScript | vadistic/training-exercises | /ds/utils/random.ts | 2.609375 | 3 | export const randomInt = (min = -100, max = 100): number => {
return Math.floor(Math.random() * (max - min)) + min
}
|
c64ec53b2708f06230febfb6187866593b8fcfc1 | TypeScript | gallofeliz/node-camera-recorder | /src/onvif-camera.ts | 2.5625 | 3 | import { Camera } from '.'
import { EventEmitter } from 'events'
import * as url from 'url'
import { Cam as OnvifModuleCamera, CamOpts as OnvifModuleCameraOptions } from 'onvif'
type OnvifCameraUriOptions = { uri: string, name?: string }
type OnvifCameraOptsForOnvifModule = { name?: string } & OnvifModuleCameraOptions... |
ed21910522a2f35d3b2162d686199849ec6aac99 | TypeScript | dcmox/moxyscript-conditions | /tests/moxy-conditions.test.ts | 2.734375 | 3 | import assert from 'assert'
import sinon from 'sinon'
import * as testSuite from '../moxy-conditions'
import { demographics } from './test-data'
describe('Moxy Conditions test suite', () => {
it('Should not console.log (Sanitize Input)', () => {
const conditions = [
{
// Injection Example
key: 'country',... |
60111af9d2545e189ce07951958336740602ed39 | TypeScript | markmehere/weather-app | /src/redux/actions/weather.ts | 2.859375 | 3 | import { GenericAction } from "../../types/GenericAction";
import { CityType } from "../../types/CityType";
import { WeatherDetails } from "../reducers/weather";
import { MetaWeatherResponse } from "../../types/MetaWeatherResponse";
import { GenericThunk } from "../../types/GenericThunk";
import { WeatherKind } fr... |
57a7945a431c77ee32a40c50b68a231a06a610b8 | TypeScript | omarandstuff/desplega-api | /src/Printer.ts | 3.453125 | 3 | import { RowElement } from './Printer.types'
/**
* Advanced terminal printer
*
*/
export default class Printer {
/**
* Will draw a single terminal row adjusting text if necesary
*
* @param {Object} elements array of line seccions to draw
* options are:
* text: actual text to draw
* style: chalk ... |
c1d3488b9e2aace119be0513de1cb5a474263256 | TypeScript | zshannon/vite-plugin-bugsnag | /src/types.ts | 2.640625 | 3 | /**
* Describes the build you are reporting to Bugsnag.
*/
export interface Build {
/**
* Your Bugsnag API key [required]
*/
apiKey: string
/**
* The version of the application you are building [required]
*/
appVersion: string
/**
* 'production', 'staging' etc. Leave blank if this build ca... |
d284304d3140c258dc9f33f3c6117df9f204c46f | TypeScript | draity/exiftool-vendored.js | /src/WriteTask.ts | 2.609375 | 3 | import * as _path from "path"
import { Tags, WriteTags } from "./ExifTool"
import { ExifToolTask } from "./ExifToolTask"
import { htmlEncode } from "./String"
const successRE = /1 image files? updated/
// See https://sno.phy.queensu.ca/%7Ephil/exiftool/faq.html#Q10
// (`-charset utf8` is set by default)
const utfCha... |
5c3f49dde05727fcc4bdd154263233e22c499715 | TypeScript | piesome/valta | /src/Common/Types/BuildingTypes.ts | 2.71875 | 3 | import {BuildingType, TypeManager} from ".";
export class BuildingTypes extends TypeManager<BuildingType> {
constructor() {
super();
this.typeName = "building";
}
public transformRaw(data: any): BuildingType {
return new BuildingType(
data.name,
data.cost,
... |
7df7129a401f2a9eaef5d1cdf38ea066f7641b7f | TypeScript | Choheeseok/citrus-market | /src/libs/user/signup.check.ts | 2.515625 | 3 | import UserWriteForm from "../../models/user/user.signup";
import UserModel from "../../models/user/user";
const checkOmission = (data: UserWriteForm): string => {
let str: string = ``;
if (!data.email) str += `'이메일'`;
if (!data.password) str += `'비밀번호'`;
if (!data.confirmPassword) str += `'비밀번호 확인'`;
if (!... |
4adebb426c70957d6101b2bae293fc7ad76efac6 | TypeScript | vincentlaucsb/experiencer | /src/components/Helpers.test.ts | 2.875 | 3 | import { assignIds, process, arraysEqual } from "./Helpers";
import { BasicResumeNode } from "./utility/Types";
test('assignIDs Test', async () => {
const node = {
type: 'FlexibleRow',
childNodes: [
{ type: 'FlexibleColumn' },
{ type: 'FlexibleColumn' }
]
} as B... |
7c9ad6395623549c415d94a7899f3d1ad653344a | TypeScript | briebug/ngrx-auto-entity | /projects/ngrx-auto-entity/src/lib/selectors/selections.selectors.spec.ts | 2.78125 | 3 | import { mapToCurrentEntities, mapToCurrentEntitiesKeys, mapToCurrentEntity, mapToCurrentEntityKey } from './selections.selectors';
describe('mapToCurrentEntity', () => {
it('should return undefined if no selections root', () => {
const current = mapToCurrentEntity(undefined, undefined);
expect(current).toBe... |
fef01602a4fa684caba8e5ff9113caee0f5bf506 | TypeScript | SammyShehter/URL-shortener | /server/src/app.ts | 2.546875 | 3 | import * as dotenv from 'dotenv'
import * as expressWinston from 'express-winston'
import * as http from 'http'
import * as winston from 'winston'
import express from 'express'
import cors from 'cors'
import debug from 'debug'
import { CommonRoutesConfig } from './routes/common/common.routes.config'
import { UserRoutes... |
aae477b231ab69caa7e364ac5b414c792e5aebe5 | TypeScript | jirkapok/GasPlanner | /projects/planner/src/app/shared/formatters.spec.ts | 2.5625 | 3 | import { DateFormats } from './formaters';
describe('Date formatters', () => {
describe('Chart', () => {
it('Shows only minutes for 3000 seconds', () => {
const result = DateFormats.selectChartTimeFormat(300);
expect(result).toEqual('%M:%S');
});
it('Shows ... |
bb1dfb038eddb48c4f04331569300e57914faf50 | TypeScript | uStudioCompany/ts4ocds | /packages/ts4ocds/extensions/conversions/conversion.d.ts | 3.046875 | 3 | /**
* @packageDocumentation
* @module Conversions
*/
import type { Coefficient } from './coefficient';
/**
* Conversion is used to describe conversions and its coefficients applicable
* for specific value received for requirement or observation
*/
export interface Conversion {
/**
* An identifier for this ... |
7ddfb2ab1a1e614857958938941ad997c108ce7b | TypeScript | rodrigojmartin/greek-heroes | /cypress/integration/greek-heroes.cy-spec.ts | 2.6875 | 3 | import { inputData } from '../../src/Utils';
describe('Greek heroes calculation', () => {
beforeEach(() => {
cy.visit('/');
});
it('rounds numbers with more than 2 decimals to 2 decimals', () => {
inputData('2310000.159897');
cy.contains('Result is 2 310 000.16');
});
it('... |
bc3133a3d1cbb9130f7389e9b2b1760bc230175d | TypeScript | fossabot/discord-bot-1 | /src/tests/sample-test.test.ts | 2.96875 | 3 | import { expect } from "chai";
function sample(bool: boolean) {
if (bool) return true;
return false;
}
describe("Sample test", () => {
it("should return true", () => {
const result = sample(true);
expect(result).to.equal(true);
});
it("should return false", () => {
const result = sample(false);
... |
d3ba391127db5e0595f827b39e70aaa497b13753 | TypeScript | ottoBitPd/colletta | /code/test/model/Firebase/FirebaseUserManagerTest.ts | 2.703125 | 3 |
import {expect} from 'chai';
import 'mocha';
import {Student} from "../../../src/ts/model/Data/Student";
import {FirebaseUserManager} from "../../../src/ts/model/Firebase/FirebaseUserManager";
import {User} from "../../../src/ts/model/Data/User";
import {Teacher} from "../../../src/ts/model/Data/Teacher";
describe(... |