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 |
|---|---|---|---|---|---|---|
cc4fa5d918adc1b8aaaa0d5722be50ad24378fd6 | TypeScript | cdac-project-pold/POLD-Appointment-Booking-System | /Presentation/cdac_hospital_side/src/app/hospitalLogin/admin.ts | 2.828125 | 3 | import { Login } from '../login';
export class AdminLogin implements Login {
private username: string;
private password: string;
/**
*
*/
constructor() {
this.username = "a@b.com";
this.password = "abc";
}
login(_username: string, _password: string): boole... |
6999a14dd3a293e5119731710d3159b26dfdfa30 | TypeScript | rd-dev-ukraine/rd-redux-http | /dist/typings/redux/api.d.ts | 2.859375 | 3 | import { Middleware } from "redux";
import { HttpRequest, HttpRequestWithBody, MakeRequestActionFactory, MakeRequestWithBodyActionFactory } from "../http";
import { WithReducer, ReduxHttpRequestTypes, ReduxHttpRequestWithBodyTypes } from "./http-request-redux";
/**
* HTTP request augmented for redux integration.
*/
e... |
3855957a4aec622069132d517cd494fc1f24f72a | TypeScript | statiolake/zenvim | /src/state.ts | 2.71875 | 3 | import * as vscode from 'vscode'
import { Mode, RegisterMode } from './types'
import { hasCommand, run } from './mapping/index'
type State = {
mode: Mode
composedText: string
statusBarItem: vscode.StatusBarItem | null
anchorPosition: vscode.Position
registerMode: RegisterMode
isInComposition: boolean
}
ex... |
d981473647c423b51950dcc3701d6bb1317e5d14 | TypeScript | geunseok11/practice | /nested.ts | 3.65625 | 4 | const calc = (value: number, cb : (number) => void): void => {
let add = (a , b) => a + b
function multyply(a,b) {return a * b}
let result = multyply(add(1,2), value)
cb(result)
}
calc(30, (result:number) => console.log(`result is ${result}` )) |
6baab657d539dfeb7f92e0d2a2314dab98f74e89 | TypeScript | inkthought/trity | /src/commands/general/help.ts | 2.90625 | 3 | import { Command as CMD } from "../..";
import Discord from "discord.js";
let eye: number;
type o = {
name: string;
category: string | undefined;
}[];
type ok = {
general: string[];
inkthought: string[];
honkers: string[];
}[];
const Command: CMD = {
async run(client, message, args) {
// array to so... |
91c674b67395a314253d6a63e5d180c72571e364 | TypeScript | juliocamargog/olimpo | /src/app/historico/historico.component.ts | 2.59375 | 3 | import { Component, OnDestroy, OnInit } from '@angular/core';
import { interval, UnsubscriptionError } from 'rxjs';
import { ConexaoService } from 'src/app/service/conexao.service';
import { ControleEntradaSaida, controleEntregasConcluidas, Entrega } from '../service/conexao.model';
interface Tipo {
value: string;
... |
5ab4e20779562b29fff22bf8201e96e584191882 | TypeScript | mhbarros/basic-auth | /backend/src/helpers/crypt.ts | 2.5625 | 3 | import bcrypt from 'bcrypt';
const passCrypt = '$mh$';
export async function hashPassword(password: string){
return await bcrypt.hash(password + passCrypt, 10);
}
export async function checkPassword(password: string, hash: string){
return await bcrypt.compare(password + passCrypt, hash);
} |
855445edf42a451aaa5190dea83093aece01fe9a | TypeScript | aman26ci/upstreet-task | /src/KYC/index.ts | 2.8125 | 3 | import dotenv from 'dotenv'; //it will parse .env file and add it to process.env
import axios from 'axios'; // used to call third party api
import { constants } from '../utils/constants';
import { validationError } from '../validators';
dotenv.config();
interface kycType {
birthDate: string;
givenName: string;
... |
4e1785c28dcc86cb858dbb90fa8d3d6edea98c1b | TypeScript | levanthanh-ptit/techbase-code-challenge | /src/domains/models/department.model.ts | 2.640625 | 3 | import { ApiProperty } from '@nestjs/swagger';
import {
BelongsTo,
Column,
ForeignKey,
HasMany,
Model,
Table,
} from 'sequelize-typescript';
import { Team } from './team.model';
import { User } from './user.model';
export interface IDepartment {
id: number;
name: string;
managerId: number;
}
export ... |
e2ee817e78a2c12f83f1af345bb69460ca2064ed | TypeScript | wikiwi/typeless | /src/check-parse-results.ts | 2.578125 | 3 | import { TypingsData, existsTypesDataFileSync, readTypings } from "./lib/common";
import { Logger, logger, writeLog } from "./util/logging";
import { done } from "./util/util";
if (!module.parent) {
if (!existsTypesDataFileSync()) {
console.log("Run parse-definitions first!");
} else {
done(main());
}
... |
9619ddfc0d597f391860ad40669ccd60a4d93480 | TypeScript | AnandChowdhary/train-natural | /index.spec.ts | 2.875 | 3 | import { train } from "./index";
import { BayesClassifier, LogisticRegressionClassifier } from "natural";
import { join } from "path";
import { writeFile, mkdirp, readdir } from "fs-extra";
describe("train-natural", () => {
it("finds labels to train", async () => {
const classifier = new BayesClassifier();
c... |
ee684bd58c286b978258d6cc26567767438a971b | TypeScript | shijianjian/elememo | /src/app/store/memo.reducer.ts | 2.71875 | 3 | import { MemoModel } from 'app/model/memo.model';
import { List } from 'immutable';
import { ADD_MEMO_ACTION, EDIT_MEMO_ACTION, DeleteMemoAction, DELETE_MEMO_ACTION, AddMemoAction, EditMemoAction, CALLBACK_ACTION, CallbackAction, LOAD_DATA_ACTION, LoadDataAction } from './memo.action';
import { Action } from '@ngrx/sto... |
fffaf4fa3aeb460189337aea17efbc22691a788c | TypeScript | jjwall/ggj2020 | /src/engine/behavior.ts | 2.953125 | 3 | import { BaseState } from "../basestate";
import { Entity } from "./entity";
export enum BehaviorResult {
SUCCESS,
FAIL
}
export type Behavior = any;
export function sequence(...behaviors: (() => Behavior)[]) {
return function* (): Behavior {
for (const b of behaviors) {
const result ... |
deb6f72bb2a9f3c5bf400cdd88ad7cfee80d78a7 | TypeScript | PaaS-TA/PAAS-TA-PORTAL-WEBUSER | /src/app/model/domain.ts | 2.96875 | 3 | export class Domain {
/*
// DATA MODEL IS...
private metadata = {
created_at: null,
guid: null,
updated_at: null,
url: null
};
private entity = {
name: null,
owning_organization_guid: null,
router_group_guid: null,
router_group_type: null,
shared_organizations: null
}
... |
116d7c767bd15fa4595b2858465430419b9667de | TypeScript | workfel/kata-social-network-clean-archi | /libs/social-network-redux/src/core/use-cases/publish-message-to-timeline/publish-message-to-timeline.reducers.ts | 2.609375 | 3 | import * as actionCreators from './publish-message-to-timeline.actions';
import { CANNOT_PUBLISH_TIMELINE_MESSAGE, PUBLISH_TIMELINE_MESSAGE } from './publish-message-to-timeline.actions';
import { combineReducers } from 'redux';
const messages = (state: string[] = [],
action: actionCreators.Actions) ... |
5030c5d0185b96c005f3fbe49aa0338f366f442d | TypeScript | 0n3W4y/Tiny-Tale-Fight-OOP | /source/ts_scripts/Game.ts | 2.53125 | 3 | class Game {
public fps;
public commonTick:any;
public entityRoot:any;
public battle:any;
public userInterface:any;
private preStartDone:boolean;
private player:any;
private helper:any;
constructor( fps ){
this.fps = fps;
this.preStartDone = false;
}
public init( creaturesData, creatureClassData, hum... |
a49caa70f016c95b4dc01943112fbfbe768999e3 | TypeScript | gaabriel165/api-graphql | /server-graphql/src/resolver/resolvers.ts | 2.828125 | 3 | import {
getUsers,
newUser,
updateUserById,
deleteUserById,
} from "../repository/User";
export const resolvers = {
Query: {
getUser: async () => {
const users = await getUsers();
const usersParsed = users.map((e) => {
const createdAt = String(e.createdAt).split(" ");
const ... |
cbe328c3db82563abbbc0f8936f6f312cdd1e102 | TypeScript | SuyaSaju/InfantNutritionBackend | /src/products/entities/review.entity.ts | 2.546875 | 3 | import { Column, Entity, ObjectID, ObjectIdColumn } from 'typeorm';
@Entity({ name: 'reviews' })
export class Review {
@ObjectIdColumn()
id: ObjectID;
@Column()
brandId: string;
@Column()
productId: string;
@Column()
name: string;
@Column()
rating: number;
@Column()
title: string;
@Colu... |
c50f56f66dccb7f1985c357e331d1fc689888c53 | TypeScript | iffameah/component | /about.component.ts | 2.515625 | 3 | import { Component } from '@angular/core';
import {Config} from './config.service';
import {Video} from './video';
import {playlistComponent} from './playlist.component';
@Component({
selector: 'about',
templateUrl: './components/about.component.html'
})
export class AboutComponent {
/*using the class var i... |
fa8146a001e86af5e9452413752ad3603aad68d2 | TypeScript | keff6/100AlgorithmsChallenge | /boxBlur/boxBlur.ts | 3.09375 | 3 | function boxBlur(image: number[][]): number[][] {
const widthLen = image[0].length - 3;
const heightLen = image.length - 3;
const result = [];
for(let i=0; i <= widthLen; i++) {
const currentPixelLine = [];
for(let j = 0; j <= heightLen; j++) {
const currentMatrix = image.slice(i,... |
364176547ce55fa4d4b4ac883cac12530255a130 | TypeScript | motion-canvas/motion-canvas | /packages/core/src/utils/debug.ts | 3.3125 | 3 | import {useLogger} from './useScene';
import {LogPayload} from '../app';
function stringify(value: any): string {
switch (typeof value) {
case 'string':
// Prevent strings from getting quoted again
return value;
case 'undefined':
// Prevent `undefined` from being turned into `null`
re... |
459ec840a82555398ce99571de88b9396668d26f | TypeScript | joalisson/eng-zap-challenge-nodejs | /src/utils/DataSource.ts | 2.640625 | 3 | import fs from 'fs';
import logger from '../../logger';
import client from '../client';
import { IDataSource } from '../interfaces/datasource.interface';
import { IServiceFilter } from '../interfaces/service.interface';
const path = './datasource/data.json';
class DataSource {
private async get() {
try {
... |
aba19de5e085ebf1c81d47148027778d91e71c37 | TypeScript | rasha08/react-form-fp | /src/form/actions.ts | 2.703125 | 3 | import {
ADD_FIELD,
CLEAR_FIELD_ERROR,
FieldName,
FieldValue,
FormActionDispatcher,
FormContextState,
SET_FILED_ERROR,
SET_FILED_VALUE,
UseFormActions
} from './types'
export const useFormActions = <FormName extends string | number, T>(
state: FormContextState<FormName, T>,
dispatch: FormActionDi... |
7fc702afe1d1b56a6ab9b808cb4dbd66d155cc65 | TypeScript | jfouche/moria | /app/views/game-view.ts | 2.828125 | 3 | import { MoriaGame } from "../game"
import { MazeView } from "./maze-view";
import { HeroView } from "./hero-view";
import p5 = require('p5')
import { RoomView } from "./cell-view";
/**
* GameView
*/
export class GameView {
public readonly game: MoriaGame;
public readonly width: number;
public readonly... |
d2a60038c3fe0b1c923b3f7eb4c52eaa6d0fd34f | TypeScript | boyanstanchev/crwn-clothing | /src/redux/user/user.reducer.ts | 2.828125 | 3 | import UserActionTypes from './user.types'
import { User, UserState } from './user.models'
import BaseAction from '../base-action.model'
const INITIAL_STATE = {
currentUser: null,
}
const userReducer = (
state: UserState = INITIAL_STATE,
action: BaseAction<UserActionTypes, User>
) => {
switch (action.type) {
... |
e3f3f5dffac40e578db30e54ac14f59372157da5 | TypeScript | nathan-charles/react-native-blog-app | /src/redux/post/actions.ts | 2.765625 | 3 | import { Action } from 'redux';
import { ThunkAction } from 'redux-thunk';
import { AppState } from '../index';
import {
Post,
FETCH_USER_POSTS_PENDING,
FETCH_USER_POSTS_SUCCESS,
FETCH_USER_POSTS_ERROR,
FETCH_OTHER_POSTS_PENDING,
FETCH_OTHER_POSTS_SUCCESS,
FETCH_OTHER_POSTS_ERROR,
} from './types';
cons... |
5cf484701782a3af64d659b7ed3cd90b0efaf0f6 | TypeScript | adacahq/creator | /src/types/User.ts | 2.640625 | 3 | import { Omit } from 'types/util/Omit';
export interface User {
id: string;
email: string;
}
export type UserNew = Omit<User, 'id'>;
|
c098f0500095fa17b9e1112e71656d7cef78c0cf | TypeScript | Simone3/ReactMediaTracker | /react-media-tracker/app/data/models/api/common.ts | 3.296875 | 3 | import { IsDefined, IsOptional, IsString } from 'class-validator';
/**
* Type shared by all API requests
*/
export class CommonRequest {
}
/**
* Type shared by all API responses
*/
export class CommonResponse {
/**
* A generic message for easy response reading, should never be displayed to the user
*/
@Is... |
73dbdf3f09553c60b413a4bd8114064423ed58bf | TypeScript | Eazymov/urtk-express-mongodb | /src/api/instance.ts | 2.625 | 3 | import Axios, { AxiosInstance } from 'axios';
type Data = {
[key: string]: any;
}
const instance: AxiosInstance = Axios.create({
baseURL: '/api',
timeout: 3000,
transformResponse: [transformResponse],
});
function transformResponse (response: any): any {
const data: Data = JSON.parse(response);
const err... |
0ecf817e1774e871ac5051b869dfeebfe754462f | TypeScript | future4code/Pedro-Severo | /semana-14/RedeSocial/SOLID/src/animal.ts | 2.828125 | 3 | import { Bird } from "./bird";
export abstract class Animal {
// constructor(public name: string) {}
constructor(protected name: string) {}
public getName(): string {
return this.name;
}
}
|
40f777c01809121cd230ae269e75fa6d3fc9802f | TypeScript | lyon1986/i3yun.ViewerGallery | /ref/Sippreep.Extensions.PickPoint.d.ts | 2.53125 | 3 | /// <reference types="THREE" />
declare namespace Sippreep {
namespace Extensions {
namespace PickPoint {
/**
* 拾取三维点插件
*/
export interface PickPointExtension {
/**
* 启用拾取点
*/
enableMode(): vo... |
58a75a0f4e4f7b45670ec05a2c06beff14341dde | TypeScript | CodeExpertsLearning/workshop-angular-na-pratica-presencial | /ts/test.ts | 2.59375 | 3 | class Export {
sayHello(hello: string) {
console.log(hello);
}
}
function sayHello(hello: string) {
console.log(hello);
}
sayHello(12);
|
d8ba05c1851d119105778a34a4569f08323eda34 | TypeScript | NemoTravel/flights.search.widget | /src/store/form/passengers/reducer.ts | 2.90625 | 3 | import { ADD_PASSENGER, REMOVE_PASSENGER, SET_PASSENGER_COUNTER } from '../../actions';
import { PassengersState, passengersState, PassengerState } from '../../../state';
import { PassengersAction } from './actions';
export const setPassengersCounterReducer = (state: PassengerState, count: number): PassengerState => {... |
cc4ba15c2fd75d17bf2db43cec881d354c7dc6b1 | TypeScript | gdeb/crap-framework | /tests/domain.test.ts | 3.15625 | 3 | import { tokenize, evaluate } from "../src/domain";
describe("tokenizer", () => {
test("basic properties", () => {
expect(tokenize("")).toEqual([]);
expect(tokenize("1")).toEqual([{ type: "value", value: 1 }]);
expect(tokenize("1 2")).toEqual([
{ type: "value", value: 1 },
{ type: "value", va... |
41e59600f1ca82e4dcdb7a3e3c2e50290137de10 | TypeScript | jdrew1303/prettygoat | /scripts/projections/IProjection.ts | 2.53125 | 3 | import {ISnapshotStrategy} from "../snapshots/ISnapshotStrategy";
import IFilterStrategy from "../filters/IFilterStrategy";
import {Event} from "../streams/Event";
import {SpecialState} from "./SpecialState";
export interface IWhen<T extends Object> {
$init?:() => T;
$any?:(s:T, payload:Object, event?:Event) =... |
2dc4d343a44510d1aeaa2a0b6ee046965bd43dc5 | TypeScript | rluvaton/bulk-download-packages-from-platform | /src/progress-adapter.ts | 3 | 3 | import {Bar} from 'cli-progress';
import {PackagesGetterProgressInfo} from './common/progress/packages-getter-progress-info';
import {isNil} from './helpers/validate-helper';
import {humanFileSize} from './helpers/utils';
export class ProgressAdapter {
protected bar: Bar;
constructor() {
// create new progr... |
138ad03e0d19e6d2c45fa34a44823c9efe3ca6d2 | TypeScript | tinkeshwar/react-coreui-app-template | /src/features/user/helper/index.ts | 2.59375 | 3 | import { DropdownItemType, MetaType, PermissionListCustomType, PermissionResponseType, RoleListCustomType, RoleResponseType, UserListCustomType, UserResponseType } from '../type'
/* start total pages */
export const getTotalPages = (meta: MetaType|undefined) => {
return (meta !== undefined) ? Math.ceil(meta.total/... |
ee258222ecb3051a6deaf1314178e7c387075987 | TypeScript | MLamson/FriendlyDateRanges | /spec/friendlyDateRanges.spec.ts | 3.09375 | 3 | import {DateRanges} from "../src/friendlyDateRanges";
describe('Friendly Date Ranges', () => {
it('should input array of start and end dates with same year and month and return date with just start month and day and end day', () => {
expect(DateRanges.makeNamedDates(["2016-07-01", "2016-07-04"])).toEqual([... |
c5ace7e1a23a7ff52e032e325a58e38786ccd035 | TypeScript | future4code/bouman-Food4U-grupo1 | /src/data/RecipeDatabase.ts | 2.578125 | 3 | import MainDB from "./MainDatabase";
import Recipe from "../business/entities/Recipe";
export default class RecipeDB extends MainDB {
async createRecipe (recipe:Recipe) {
await this.connection.raw(
`INSERT INTO RECIPES VALUES (
"${recipe.getId()}",
"${recipe.get... |
59053a546469cf8cc64efcccc55e69cba940eca6 | TypeScript | joshburgess/typescript-tuple | /index.ts | 4.375 | 4 | /**
* Choose type base on whether or not a tuple is finite
* @example `IsFinite<[0, 1, 2]>` → `true`
* @example `IsFinite<[0, 1, 2, ...number[]]>` → `false`
* @example `IsFinite<[0], 'Finite', 'Infinite'>` → `'Finite'`
* @example `IsFinite<[0, ...number[]], 'Finite', 'Infinite'>` → `Infinite`
*/
export type IsFin... |
2b783e048f9cc0c8187b0e5f6881cd6587bfba80 | TypeScript | hrocha85/aula-angular-conversor | /conversor-alunos/src/app/cadastro/cadastro.component.ts | 2.546875 | 3 |
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, FormControlName, FormControl ,Validators } from '@angular/forms';
@Component({
selector: 'app-cadastro',
templateUrl: './cadastro.component.html',
styleUrls: ['./cadastro.component.css']
})
export class CadastroComponent impl... |
19f366eb08e70f0eee96e376fbdb773746057122 | TypeScript | andy-schulz/thekla | /packages/thekla-assertion/src/utils/assert.ts | 2.703125 | 3 | import {TheklaAssertionOptions} from "../interfaces/TheklaAssertionOptions";
class AssertionError extends Error {
public constructor(message: string) {
super(message);
this.name = this.constructor.name;
}
}
export const assert = (
expression: boolean,
failMessage: string,
negatedF... |
8d84d35d706e9fb89722f1cbcbf5976789c87295 | TypeScript | ppak10-archives/dog-ceo | /src/breeds/reducer.ts | 2.875 | 3 | /**
* reducer.ts
* Reducer for managing dog breeds.
*/
const INITIAL_STATE = {
all: {},
};
export default function reducer(state = INITIAL_STATE, {payload, type}) {
switch (type) {
case 'SET_BREEDS_ALL':
return {
...state,
all: payload.message,
};
default:
return state... |
acacd1abc9c6b97b74653c701945e6597020d526 | TypeScript | sno2/dmm | /src/commands/info.ts | 2.796875 | 3 | import { colours } from "../../deps.ts";
import DenoService from "../services/deno_service.ts";
/**
* Supplies information on the given module in the first
* index of `modules`
*
* @param modules - List of modules to get info on. Currently, we only support 1, so `modules[0]` will be used
*/
export async function ... |
451906996e6b66435118c943eae8ad0294479ea5 | TypeScript | kedoska/0xa | /test/04_bearer.spec.ts | 2.609375 | 3 | import * as express from 'express'
import * as request from 'supertest'
import router, { RouterProps } from '../src/api'
import { requiredRules, tokenize } from '../src/auth/middleware'
import { Client } from '../src/clients'
const tokenSecret = process.env['TOKEN_SECRET'] || ''
const app = express()
beforeAll(() => ... |
b3b642109c3bfefc5edec88b19dac34cf23b8637 | TypeScript | Sangrene/FoxLog | /tests/statsGeneration.test.ts | 2.640625 | 3 | import chai, {expect} from "chai";
import "mocha";
import statsGeneration, {isStatusError, getSectionPath} from "../src/analysis/statsGeneration";
import { fakeEntries } from "./fakeLog"
describe("statistics generation", () => {
it("Detects error in status code", () => {
expect(isStatusError("200")).to.be.false;... |
d3f9681ee92ca396ac96d4213874c484d3ae47d8 | TypeScript | LemberTeam/node-nest-ts-code-samples | /src/session.service.ts | 2.53125 | 3 | import { Injectable } from '@nestjs/common';
import { SessionRegistry } from './session.registry';
import { Session } from './session.model';
@Injectable()
export class SessionService {
constructor(private readonly sessionRegistry: SessionRegistry) {}
async getSessions(userId: number): Promise<Session[]> {
re... |
67e86fa75dd0278e19ceed2f01621576b3cb0261 | TypeScript | MarlonFrancisco/clean-architecture | /src/validation/validators/email-field/email-field-validation.spec.ts | 2.78125 | 3 | import faker from "faker";
import { EmailFieldValidation } from "./email-field-validation";
import { InvalidFieldError } from "@/validation/errors";
type SubTypes = {
sut: EmailFieldValidation;
};
const makeSut = (): SubTypes => {
const sut = new EmailFieldValidation("email");
return {
sut,
};
};
descr... |
78b6b903da0d86404206028bc785108e84e33a4a | TypeScript | dtmarangoni/solar-art-gallery | /backend/src/layers/ports/AWS/S3/fileStoreAccess.ts | 2.65625 | 3 | import 'source-map-support/register';
import * as AWS from 'aws-sdk';
import * as AWSXRay from 'aws-xray-sdk';
export class FileStoreAccess {
/**
* Constructs a FileStoreAccess instance.
* @param s3Client The S3 file store client.
* @param s3Bucket The S3 bucket name.
* @param signedUrlExp The ... |
a20c529588a4aaac145882884dfdc21d22fa3dfe | TypeScript | aizatto/interview-preparation | /src/question-roman-to-integer.ts | 3.71875 | 4 | /*
* Assume:
* - Everything is properly formatted
*
* https://projecteuler.net/about=roman_numerals
* https://www.interviewbit.com/problems/roman-to-integer/
* https://www.geeksforgeeks.org/converting-roman-numerals-decimal-lying-1-3999/
*/
const map = new Map([
['I', 1],
['V', 5],
['X', 10],
['L', 50],... |
28984231b469e940d73ee9db8c1537387fbf38c7 | TypeScript | akrasnyi/ReactTrainingExamples | /Presentations/B3 TS/TypeScriptExamples/interfacesAndClasses.ts | 4.1875 | 4 | // The easiest way to see how interfaces work is to start with a simple example
function sayHi(user: { name: string }): void {
console.log(`Hi ${user.name}`!);
}
// We can write the same example again, this time using an interface to describe the requirement of having the name
// property that is a string. We have... |
993b81fb3c54cebdad52633e0321fe6efb18c9fa | TypeScript | tcd/frame-data-scraping | /src/lib/write-json-file.ts | 2.796875 | 3 | import * as fs from "fs"
export const writeJsonFile = (filePath, data) => {
try {
let outData = JSON.stringify(data, null, 2)
fs.writeFileSync(filePath, outData)
console.log(`file written: ${filePath}`)
} catch (error) {
console.log(error)
process.exit(1)
}
}
|
a12db748e39fee8bbb674d5cdf711f50247f3034 | TypeScript | project-blurple/blurple-hammer | /src/commands/chatInput/channels/lock.ts | 2.765625 | 3 | import { inspect } from "util";
import type { ForumChannel, Snowflake, StageChannel, TextChannel, VoiceChannel } from "discord.js";
import { ApplicationCommandOptionType, ChannelType } from "discord.js";
import type { SecondLevelChatInputCommand } from "..";
import config from "../../../config";
import Emojis from "../... |
30bca73ba1624ec6c7e79dbbd5e19fae970b3287 | TypeScript | tomshanan/Packable | /src/app/shared/app-colors.ts | 2.515625 | 3 | import { Injectable } from '@angular/core';
// var ColorFac = require('color');
import * as ColorFac from 'color'
export var disabledColor = "#c6c6c6"
@Injectable({
providedIn: 'root'
})
export class AppColors {
public danger = new Color('#ff4400')//,'#e23b00')
public action = new Color('#007bff')//,'#0056... |
13be81c9a255ad20abac67d8fae2b0d4c309bb88 | TypeScript | rectcircle/new-file-by-type | /src/util/toSource.ts | 2.703125 | 3 |
/* toSource by Marcello Bastea-Forte - zlib license */
/* modify and fix bug from https://github.com/marcello3d/node-tosource */
export function toSource (object: any, filter: Function | undefined, indent: string | undefined, startingIndent: string | undefined) {
var seen: any[] = [];
return walk(object, filter, i... |
0872ca715d52347fcff094eadcd1f6bb9b10fe5b | TypeScript | shuangmianxiaoQ/ref-ui | /src/utils/numbers.ts | 2.921875 | 3 | import BN from 'bn.js';
import * as math from 'mathjs';
const BPS_CONVERSION = 10000;
const ROUNDING_OFFSETS: BN[] = [];
const BN10 = new BN(10);
for (let i = 0, offset = new BN(5); i < 24; i++, offset = offset.mul(BN10)) {
ROUNDING_OFFSETS[i] = offset;
}
export const sumBN = (...args: string[]): string => {
ret... |
2815d8ca9d49c3d40e075778e93709569be1b0de | TypeScript | laurencefass/react-redux-observables | /src/Epics/epics.ts | 2.796875 | 3 | import { Observable, Observer } from 'rxjs'
import {
debounceTime,
throttleTime,
mapTo,
delay,
tap
} from 'rxjs/operators';
import { ofType } from "redux-observable";
import {
INCREMENT,
INCREMENT_THROTTLE,
DECREMENT_DEBOUNCE,
PING,
INTERVAL,
INTERVAL_THROTTLE,
pongAction... |
f7ba2a5782dd1fa1d3fb26b9f67d33bd2ac098d9 | TypeScript | luangm/learn4ts | /src/expression/binary/Power.ts | 2.5625 | 3 | import {ShapeUtils, Tensor, TensorMath} from "tensor4js";
import Graph from "../../Graph";
import Expression from "../Expression";
import {ExpressionTypes} from "../ExpressionTypes";
import BinaryExpression from "./BinaryExpression";
import Multiply from "./Multiply";
export default class Power extends BinaryExpressio... |
9784fb837f4012ac02a023f3ed748ac5707a1b76 | TypeScript | alistairvu/organise-next-app | /pages/api/user/register.ts | 2.515625 | 3 | import connectDB from "../../../mongo"
import User from "../../../mongo/models/userModel"
import type { NextApiRequest, NextApiResponse } from "next"
import bcrypt from "bcryptjs"
import jwt from "jsonwebtoken"
const registerUser = async (req: NextApiRequest, res: NextApiResponse) => {
try {
if (req.method !== "... |
74fcbe7501c1cc6c4e0c207a89cb799e836bfd60 | TypeScript | cheng1994/axe-result-pretty-print | /test/index.test.ts | 2.515625 | 3 | import { prettyPrintAxeReport } from '../src';
const axeRawViolations = require('./__mock_data__/rawViolations.json');
const axeRawPasses = require('./__mock_data__/rawPasses.json');
describe('printAxeReport() test', () => {
it('Verify not throwing an error', async () => {
prettyPrintAxeReport({ violations... |
4f719b981bfd4cf414fedd5d256f612a1b71f08c | TypeScript | goodCat56/ng-sample | /src/app/services/fake.service.ts | 2.609375 | 3 | /**
* Created by Python on 11/7/2016.
*/
import { Injectable } from '@angular/core';
import {Service} from "./service";
import {HttpClient} from "./http-client.service";
import {Observable} from "rxjs/Rx";
const _API_BASE = 'https://jsonplaceholder.typicode.com/';
//Do not forget to register the service in the app ... |
480c0b7c5b142fe8a18ec8543c174c7b4bd9b576 | TypeScript | johnstonbl01/react-skeletor | /src/createSkeletonElement.ts | 2.515625 | 3 | /*
* Copyright (c) Trainline Limited, 2017. All rights reserved.
* See LICENSE.txt in the project root for license information.
*/
import * as React from 'react';
import { contextTypes, Context, Styling } from './utils';
const createStyle = (styles: (React.CSSProperties | undefined)[]) =>
styles
// tslint:disabl... |
a1b25109afa42e0b9c9267f4077fed284469d330 | TypeScript | swc-project/swc | /crates/swc_bundler/tests/.cache/deno/8dbd05883dea58125dac08eec329300c7b32871f.ts | 3.421875 | 3 | // Loaded from https://deno.land/x/ramda@v0.27.2/source/replace.js
import _curry3 from './internal/_curry3.js';
/**
* Replace a substring or regex match in a string with a replacement.
*
* The first two parameters correspond to the parameters of the
* `String.prototype.replace()` function, so the second paramet... |
4f60fc3f11663cfbb877c3cf09f17a3c245a32cd | TypeScript | vercel/vercel | /packages/build-utils/src/fs/download.ts | 2.578125 | 3 | import path from 'path';
import debug from '../debug';
import FileFsRef from '../file-fs-ref';
import { File, Files, Meta } from '../types';
import { remove, mkdirp, readlink, symlink, chmod } from 'fs-extra';
import streamToBuffer from './stream-to-buffer';
export interface DownloadedFiles {
[filePath: string]: Fil... |
b82e94c1ddfd2bb1fe429fed2c7e61e3945abaee | TypeScript | green-fox-academy/adamcsigas | /Foundation/week-1/day_4/Thursday-javava/Workshop-exercisesjava01/coding-hours.ts | 3.484375 | 3 | 'use strict';
// An average Green Fox attendee codes 6 hours daily
// The semester is 17 weeks long
//
/*
Coding hours a day = x
Working days of the semester = y (we are not counting with the vacation days!)
weekend = z
*/
let x : number = 6;
let y : number = 17*5;
// Print how many hours is spent with coding i... |
43caa1c8b4edfbd61ff872ef13ce66374df7f8f7 | TypeScript | stemyke/ngx-utils | /src/ngx-utils/pipes/filter.pipe.ts | 2.671875 | 3 | import {Pipe, PipeTransform} from "@angular/core";
import {ObjectUtils} from "../utils/object.utils";
export function defaultFilter() {
return true;
}
@Pipe({
name: "filter"
})
export class FilterPipe implements PipeTransform {
transform(values: any, filter: any = defaultFilter, params: any = {}): any {
... |
451819fcf5dc18e1bc52b8d0aea758b4390ca577 | TypeScript | oguz-yilmaz/Dependency-Checker | /src/IO/Input/__test__/Cli.test.ts | 2.625 | 3 | import { Cli } from '../Cli'
it('parses first argument as repo name', async () => {
const cli = new Cli()
process.argv = ['npm', 'start', 'testName']
const res = cli.parseInput()
expect(res.repos[0].repoUser).toEqual('testName')
})
it('parses second argument as repo user', async () => {
const cli = new Cli(... |
2a09cbba81724d31effda65bbc37ed4143372e5b | TypeScript | calebjmatthews/NewSummer | /client/models/traveler/dialogue.ts | 2.640625 | 3 | import Condition from './condition';
import ConditionalObject from './conditional_object';
import Field from '../../models/field';
import Homestead from '../../models/homestead';
import RecordBook from '../../models/record_book';
import Cast from '../../models/traveler/cast';
import Economy from '../../models/economy';... |
a92b2f637b26b7a9fe8fbfcd5732a40866762099 | TypeScript | MRamosObinte/pwa | /src/app/entidadesTO/inventario/LugarEntrgea.ts | 2.71875 | 3 | export class LugarEntrega {
public nombre: string = null;
constructor(data?) {
data ? this.hydrate(data) : null;
}
hydrate(data) {
this.nombre = data.nombre ? data.nombre : this.nombre;
}
} |
c95609cfb2206eb93f51175624c11c06ca123b5c | TypeScript | qingniao99/lit | /packages/labs/ssr/src/lib/element-renderer.ts | 2.703125 | 3 | /// <reference lib="dom" />
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
export type Constructor<T> = {new (): T};
import {createRequire} from 'module';
const require = createRequire(import.meta.url);
// eslint-disable-next-line @typescript-eslint/no-var-requires
const e... |
d20291624b086b16649503a242e4230283da5acb | TypeScript | owid/owid-grapher | /packages/@ourworldindata/core-table/src/OwidTableSynthesizers.ts | 2.75 | 3 | import {
sampleFrom,
getRandomNumberGenerator,
range,
countries,
OwidVariableDisplayConfigInterface,
ColumnSlug,
} from "@ourworldindata/utils"
import { TimeRange } from "./CoreTableConstants.js"
import { ColumnTypeNames } from "./CoreColumnDef.js"
import { OwidTable } from "./OwidTable.js"
impo... |
a6a4f724277bf39fb17d0353d46f5305bf13cc0a | TypeScript | Commodity-Metaverse/arsnova.click-v2-frontend | /src/app/pipes/justafew/justafew.pipe.ts | 2.515625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'justafew',
})
export class JustAFewPipe implements PipeTransform {
public transform<T>(value: Array<T>, start: number): Array<T> {
if (!start || value.length < start) {
return value;
}
return value.slice(0, start);
}
}
|
af61985412c80e666ece135f683d4f4a14747eda | TypeScript | tomaszwpasternak/ng2-iban | /projects/ng2-iban/src/lib/pipe/iban/ng2-iban.pipe.ts | 2.5625 | 3 | import {Pipe, PipeTransform} from '@angular/core';
import * as IBAN from 'iban';
import {Ng2IbanOptionInterface} from './ng2-iban-option.interface';
@Pipe({
name: 'ibanConverter'
})
export class Ng2IbanPipe implements PipeTransform {
readonly DEFAULT_OPTIONS: Partial<Ng2IbanOptionInterface> = {
locale: null,
... |
23dfcdd1f6258ad8c077707ad76e98ae46938b7d | TypeScript | ngnhuuthai/nodesrv | /src/mob/race/eventConsumer/halfling/halflingMvBonusEventConsumer.ts | 2.53125 | 3 | import { injectable } from "inversify"
import {EventType} from "../../../../event/enum/eventType"
import {createModifiedMobMoveEvent} from "../../../../event/factory/eventFactory"
import EventConsumer from "../../../../event/interface/eventConsumer"
import EventResponse from "../../../../event/messageExchange/eventResp... |
c16e39332c1e385a0357e4f6ec9f40e659a95600 | TypeScript | Sammons/barkcount | /src/redux/soundSubscriptionStore.ts | 2.734375 | 3 | import { ReducerTemplate } from './helpers/reducerHelpers';
import { SoundService } from '../services/SoundService';
enum ActionTypes {
setSubscription
}
let soundSubscriptionTemplate = new ReducerTemplate({
subscriptions: {} as {[id: string]: number}
});
export type SoundSubscriptionState = typeof soundSubscript... |
85b17fd35b8a1f9a5ab0b083184bb98522253dd4 | TypeScript | JamesBonddu/nestjs-book | /src/helpers/hash.helper.ts | 2.859375 | 3 | import bcrypt from 'bcryptjs'
export class HashHelper {
private static salt = 10
static async encrypt(str: string): Promise<string> {
return await bcrypt.hash(str, HashHelper.salt)
}
static async compare(plain: string, encrypted: string): Promise<boolean> {
return await bcrypt.compare(plain, encrypte... |
5234c22d639ab227f7932abdaf30a4418e3ffcca | TypeScript | itershukov/redux-communications | /src/strategies/base.ts | 2.796875 | 3 | import { connect } from 'react-redux';
import { IAction, IBuilderConfig, IFullState, IReducers, IStrategy } from '../types';
import { getStateBranchName } from '../helpers';
export class BaseStrategy<InjectedProps> implements IStrategy<InjectedProps> {
public readonly config: IBuilderConfig;
constructor(config: ... |
770a07008fc1d9bf8dd8dcfa05f62314186ddb4a | TypeScript | nguyer/aws-sdk-js-v3 | /clients/node/client-dynamodb-node/types/_AutoScalingTargetTrackingScalingPolicyConfigurationUpdate.ts | 2.90625 | 3 | /**
* <p>Represents the settings of a target tracking scaling policy that will be modified.</p>
*/
export interface _AutoScalingTargetTrackingScalingPolicyConfigurationUpdate {
/**
* <p>Indicates whether scale in by the target tracking policy is disabled. If the value is true, scale in is disabled and the target... |
3a2ec93ce1cdc879b32a889143f18d608c2b2cec | TypeScript | PalKriah/Automatons | /src/classes/Stack.ts | 3.671875 | 4 | export class Stack<T> {
private storage: T[] = [];
constructor() { }
push(item: T): void {
this.storage.push(item);
}
pop(): T | undefined {
return this.storage.pop();
}
peek(): T | undefined {
return this.storage[this.size() - 1];
}
size(): number {
... |
7f48e25fdf7afc26728123031405030899a1274e | TypeScript | seebees/aws-sdk-js-v3 | /packages/client-xray-node/types/_Http.ts | 2.515625 | 3 | /**
* _Http shape
*/
export interface _Http {
/**
* _String shape
*/
HttpURL?: string;
/**
* _NullableInteger shape
*/
HttpStatus?: number;
/**
* _String shape
*/
HttpMethod?: string;
/**
* _String shape
*/
UserAgent?: string;
/**
* ... |
33d7890e1adfe6e8c7a71b5c5b3b138bc19b21b8 | TypeScript | louisbeullens/KonAInenHokken | /player4.ts | 2.953125 | 3 | import { IPlayer, IGamestate, EDieSymbol, BasePlayer } from "./shared"
const generateTrueOrFalse = () => Math.random() < 0.5? true : false
class Player extends BasePlayer implements IPlayer {
name: string = "Monkey"
async doContinue(gameState: IGamestate) {
return generateTrueOrFalse()
}
async pickHutch(g... |
fcd1f4f67d3a05053ead9969b0286364fd4cbf70 | TypeScript | bobbylight/DragonWarriorJS | /src/app/dw/mapLogic/overworld.ts | 2.609375 | 3 | import DwGame from '../DwGame';
import AbstractMapLogic, { NpcTextGeneratorMap } from './AbstractMapLogic';
import { NpcText } from './MapLogic';
const talks: NpcTextGeneratorMap = {
npc: (game: DwGame): NpcText => {
return [
'I speak with... \\ddelays...',
'Did you notice that?'
];
... |
fd282b57f1093728e4f0dafdbfea822aabe79f3f | TypeScript | jasonbyrne/whamsauce | /public/app/rule.ts | 3.109375 | 3 |
namespace Whamsauce {
export class Rule {
public pattern:RegExp;
public componentName:string;
public componentPath:string;
protected rawPattern:string;
protected params:Array<string> = [];
/**
*
* @param pattern
* @param component
... |
3e288965e208278c3e104b3fb153f4c0d267723c | TypeScript | thaytuandm/antiutils | /src/internal/types/asEqualFunction.ts | 2.6875 | 3 | import { as } from './as';
import { EqualFunction } from './types';
/**
* An identity function that downcasts a value to an `EqualFunction`.
*/
export const asEqualFunction: <T>(
value: EqualFunction<T>,
) => EqualFunction<T> = as;
|
8b4f2bff3f40e9b2f701492e3c1854d59f238e92 | TypeScript | jacobx1/of-sdk | /packages/of-types/src/Document.ts | 2.609375 | 3 | import FileWrapper from './FileWrapper';
export default interface Document {
close: (didCancel: (() => void) | null) => void;
save: () => void;
makeFileWrapper: (
baseName: string,
type: string | null
) => Promise<FileWrapper>;
undo: () => void;
redo: () => void;
show: (resultFunction: (() => voi... |
d2ac8bb7453367de3f9e3ef2e40cdc31bd199a06 | TypeScript | ColtonProvias/TSJS-lib-generator | /src/helpers.ts | 2.8125 | 3 | import * as Browser from "./types";
export function filter(obj: any, fn: (o: any, n: string | undefined) => boolean): any {
if (typeof obj === "object") {
if (Array.isArray(obj)) {
return mapDefined(obj, e => fn(e, undefined) ? filter(e, fn) : undefined);
}
else {
co... |
c9576cde743887e92c1d245287a9486efce87228 | TypeScript | stoyan-krusharski/angular-recipes-nutrition | /src/app/core/calculation.service.ts | 2.78125 | 3 | import { Injectable } from '@angular/core';
import { Nutrition } from '../models/nutrition';
@Injectable()
export class CalculationService {
public constructor() { }
shortenNutritionValues(nutrition: Nutrition): Nutrition {
for (const key in nutrition) {
if (nutrition.hasOwnProperty(key)... |
339369132bdb8fcb7a16ce23f5f5ea2c2815b7c5 | TypeScript | itslenny/GA-TypeScript-Angular | /day1_typescript/examples/one_basics/moudles.ts | 3.375 | 3 | module TimeUtils {
export function getCleanTime():string {
var d = new Date();
return d.toLocaleTimeString();
}
}
module CatParty {
export function letsParty(): void {
// console.log(whatever() + " The Cat Party has Started " + something.random(other.maxRandom));
console.log... |
61c95b6d6996cdd7d515db023f534f32561b9fb7 | TypeScript | th4t-gi/apcsa-lotr-game | /ts-version/src/index.ts | 3.015625 | 3 |
function printHealths(combatants: Warrior[]): void {
let maxs: number[] = combatants.map(w => {
let numTabs: number = `${w.getName()} (${w.getType()})`.length / 8
return Math.floor(numTabs) + 1
})
let maxTabs = maxs.reduce((prev, curr) => (prev > curr) ? prev : curr)
let healthboard = combatants.m... |
71db79a8c06638863af127af89def06719783a58 | TypeScript | ruslan547/async-race | /async-race/src/pages/winners/t-body/t-body.ts | 2.546875 | 3 | import { Component, Winner } from '../../../shared/interfaces';
import { StoreService } from '../../../shared/services/store.service';
import { UtilService } from '../../../shared/services/util.service';
import { TRow } from '../t-row/t-row';
export class TBody implements Component {
private storeService = new Store... |
642387d0febc9ff749c8036bee300b03d6e9a180 | TypeScript | bsunam/notepad-automate | /src/app/shared/reducers/notes.reducers.ts | 2.59375 | 3 | import { createEntityAdapter, EntityState } from '@ngrx/entity';
import { createReducer, on } from '@ngrx/store';
import { Note } from '../models/note';
import * as noteActions from '../actions/notes.actions';
export interface NotesState extends EntityState<Note> {
selectedNoteId: number,
searchValue: String
}... |
9d67f7a77b4f63400909493f08050a6d300c3ae1 | TypeScript | qiYuei/rich-text | /src/util/EventEmitter.ts | 3.015625 | 3 | class EventEmitter{
public listeners:{
[key: string]: Function[]
}
constructor(){
this.listeners = {}
}
on(event:string, cb:Function){
const listeners = this.listeners
if (listeners[event] instanceof Array) {
if (listeners[event].indexOf(cb) === -1) {
listeners[event].push(cb)
... |
6dbd05fb043076098467ab410fb337e06c3bcfa7 | TypeScript | nagimi-net/chirami | /src/interfaces/Source.ts | 2.53125 | 3 | import { Book, BookChapter, BookPage } from './Book';
export enum RestrictionType {
DEV = 'dev',
NORMAL = 'normal',
EXPLICIT = 'explicit',
}
export interface SourceOptions {
/** id of source manager */
id: string;
/** url source */
url: string;
/** icon source */
logo: string;
/** restriction */
labe... |
f032f68965720c7a3e10029f607abaf7354fd423 | TypeScript | flycatto/dikenang-server | /dikser/src/relationship/relationship.service.spec.ts | 2.65625 | 3 | import { Test, TestingModule } from '@nestjs/testing'
import { getRepositoryToken } from '@nestjs/typeorm'
import { User } from '../users/entities/user.entity'
import { UsersService } from '../users/users.service'
import { CreateRelationshipInput } from './dto/create-relationship.input'
import { DeleteRelationshipRespo... |
c61652e4fab3ab2f2f463ac77bbd706a17becb19 | TypeScript | BeeRadLeeLLC/testapi6 | /src/components/output/Schema.ts | 2.671875 | 3 | import { context } from "@/Context";
import chalk from "chalk";
import { toJsonSchema } from "../doc/DocUtils";
import { Tag } from "../Tag";
/**
* Print schema of data
*
* ```yaml
* - Vars:
* obj: {
* name: "test",
* age: 123
* }
*
* - Schema: ${obj}
* ```
*/
export class Schema exte... |
8f2777c0bd18dddee5eefbb99fd2fe68212a50d1 | TypeScript | frontity/frontity | /packages/html2react/__tests__/types.test.ts | 3.484375 | 3 | import { expectType } from "frontity/types/helpers";
import { Processor, Node, Element, Text, Comment } from "../types";
// 1. Processor by default accepts Element, Text or Comment.
const proc1: Processor = {
test: ({ node }) => {
expectType<"element" | "text" | "comment">(node.type);
if (node.type === "ele... |
5de18e819a3894eee62afa67eaab607ecea865c0 | TypeScript | mengzhiwu/vue-app-example | /src/Router.ts | 2.546875 | 3 | import Vue from 'vue';
import VueMeta from 'vue-meta';
import VueRouter from 'vue-router';
import { RawLocation, Route, RouteConfig, RouterMode, RouterOptions } from 'vue-router/types/router'; // tslint:disable-line
import store from 'store';
import SignIn from 'components/pages/sign-in/SignIn.vue';
import SignUp fro... |
2f515e5db37677e6bbe1b0b31fb7cad0079e4df3 | TypeScript | ameernuri/prefix | /packages/client/theme/theme.ts | 2.640625 | 3 | import { ThemeProps } from 'styled-components'
export interface Theme {
colors: {
primary?: string
background?: string
foreground?: string
light?: string
}
}
export const colors = (props: ThemeProps<any> = { theme: darkTheme }) => {
return props.theme.colors
}
export const darkTheme: Theme = {
... |
39f210b563aff15888025ec6eb23672e169218e8 | TypeScript | A-aras/PM_AWS | /UI/project-management/projects/shared-api/src/lib/rules/ClassRuleBuilder.ts | 2.625 | 3 | import { IReactiveClassModel } from "../model/IReactiveClassModel";
import { ClassRule } from "./ClassRule";
export abstract class ClassRuleBuilder<TModel extends IReactiveClassModel>{
public Build(): ClassRule<TModel> {
let target = new ClassRule<TModel>();
this.ApplyImpl(target);
ret... |
201e353f7f3abcdcab73f4e798b366b3f27ed505 | TypeScript | EvilPalace/GuessSmallest | /assets/scripts/Test/Test1.ts | 2.65625 | 3 |
const {ccclass, property} = cc._decorator;
// 【描述作用】
@ccclass
export default class Test1 extends cc.Component {
@property(cc.Label)
private tip : cc.Label = null;
startTime = 0;
start(){
this.startTime = Date.now();
}
update(dt){
this.tip.string = "从开始到现在:" + (Date.now() -... |