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 |
|---|---|---|---|---|---|---|
92256be6b13d3ec82050748439c3ca382109f74a | TypeScript | mario-jerkovic/inventory-manger | /src/components/NewArticleForm/NewArticleForm.types.ts | 2.75 | 3 | export type NewArticle = {
name: string,
quantity: number,
}
export type NewArticleFormProps = {
/**
*
* @default "false"
*/
isOpen?: boolean,
/**
*
* @default ""
*/
onClose: () => void,
/**
*
* @default ""
*/
onSubmit: (newArticle: NewArticl... |
fd51f63bcd686770ce3ace0c75bc15ea460b18fe | TypeScript | mateuspiresl/libquality | /src/helpers/datetime-helper.ts | 2.515625 | 3 | export const SECOND_MS = 1000;
export const MINUTE_MS = 60 * SECOND_MS;
export const HOUR_MS = 60 * MINUTE_MS;
export const DAY_MS = 24 * HOUR_MS;
export function timeToDaysString(time: number): string {
return `${Math.round(time / DAY_MS)}d`;
}
|
f69aab5829ecd6dbea261fa29f9fe08e2e04906e | TypeScript | lukeautry/tserial | /test/metadata/interface/null.spec.ts | 2.671875 | 3 | import { runGetMetadata } from "../run";
import { assertNull, assertObject } from "../guards";
/**
* @serializable
*/
export interface ITestInterface {
nullProp: null;
}
it("[interface] null", () => {
const { values } = runGetMetadata(__filename);
expect(values.length).toBe(1);
assertObject(values[0], obje... |
c29b2258defe17b0bf9d933b52a21680dac081d0 | TypeScript | RMS92/Legix | /backend/src/security/functions/user-ability.function.ts | 2.78125 | 3 | import {
Ability,
AbilityBuilder,
AbilityClass,
ExtractSubjectType,
InferSubjects,
} from '@casl/ability';
import { User } from '../../users/schemas/user.schema';
import { Action } from '../enums/action.enum';
import { Role } from '../enums/role.enum';
import { Scan } from '../../scans/schemas/scan.schema';
... |
99297040e01ef781fc24d4d391fcff62a6665510 | TypeScript | scottbenton/Pomodoro | /src/utils/timeUtils.ts | 3.34375 | 3 | export function convertMillisecondsToFriendlyTime(mills: number) {
let remainingTime = mills;
const hours = Math.floor(remainingTime / (1000 * 60 * 60));
remainingTime -= hours * (1000 * 60 * 60);
const minutes = Math.floor((remainingTime + 500) / (1000 * 60));
remainingTime -= minutes * (1000 * 60)... |
15b99465b6028dd136f6e5a974a6b015b67a0969 | TypeScript | GunnarWeisskamp/MyFirstVueJS | /my-first-app/src/types/User.ts | 3.046875 | 3 | export class User {
constructor(name:string) {
this.userName = name;
}
userName!:string;
// isLogged() {
// return this.logged;
// }
// isAdmin() {
// return this.roles.includes('admin');
// }
// setAsAdmin() {
// const index = this.roles.indexOf('admin');
// if (index === -1... |
208af98d765f12a9981d03956086068aec8dfce5 | TypeScript | IoT-Stuff/iot-user-provisioner | /src/validators/errors/messages.ts | 2.921875 | 3 | export default function generateValidationErrorMessage(errors) {
const error = errors[0];
if (error.keyword === 'required') {
return `The '${error.dataPath}.${error.params.missingProperty}' field is missing`;
}
if (error.keyword === 'type') {
return `The '${error.dataPath}' field must be of type ${erro... |
288a791acf062cf1bab57592c8a51d2376e2adc3 | TypeScript | mikleee/rodnikov-ng-node | /src/client/src/app/modules/shared/transform/currency.pipe.ts | 2.5625 | 3 | import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'currency'
})
export class CurrencyPipe implements PipeTransform {
transform(value: unknown, ...args: unknown[]): unknown {
let number = Number(value)
if (isNaN(number)) {
return value;
} else {
return number.toFixed(2);
... |
c6ee3e986c6697098f08cf40ee98df0630d5b98f | TypeScript | huaweicloud/huaweicloud-sdk-nodejs-v3 | /services/vpc/v2/model/NeutronFirewallRule.ts | 2.546875 | 3 |
export class NeutronFirewallRule {
public id?: string;
public name?: string;
public description?: string;
public action?: NeutronFirewallRuleActionEnum | string;
public protocol?: string;
private 'ip_version'?: number;
public enabled?: boolean;
private 'public'?: boolean;
private '... |
37e1d95f3fc0ba6cb48968ceba76bd5258e934ea | TypeScript | sjoedwards/microservices-node-course | /ticketing/tickets/src/routes/__tests__/update.test.ts | 2.578125 | 3 | import { natsWrapper } from "./../../nats-wrapper";
import { createTicket } from "./../../test/utils";
import mongoose from "mongoose";
import request from "supertest";
import { app } from "../../app";
import { Ticket } from "../../models/ticket";
jest.mock("../../nats-wrapper.ts");
let id: string;
beforeEach(() => ... |
f79847935bc9d150b1ce1d2d23d6056b7252e386 | TypeScript | vivienhaese/phone | /src/context/reducers.ts | 3.1875 | 3 | import type { ActionMap } from "./context";
export enum Types {
SignIn = "SIGN_IN",
SignOut = "SIGN_OUT",
}
// Auth state definition
export type AuthType = {
authenticated: boolean;
};
// Auth state initial value
export const authInitialState: AuthType = {
// todo: check if token has expired
authenticated:... |
e43018a79891190af3becf1c5e0206e497aa7dac | TypeScript | Ericlkl/Movie.Info | /server/src/routes/movies.ts | 2.65625 | 3 | // Import modules
import { Router } from 'express';
// Middlewares
import { movieRouteChecker, rankingRouteChecker } from '../middlewares';
// Controllers
import { getMovie, getMovieRank } from '../controllers/movies';
const router = Router();
// @route GET api/movies/:id
// @desc GET specfic movies information
/... |
236a9008dd0ad37e749adc3fdd0e8d78b400989c | TypeScript | Puv0/todoappxyz | /server/src/user/user.controller.ts | 2.578125 | 3 | import { UserDto } from './dto/user.dto';
import { UserService } from './user.service';
import { Controller, Post, Body, Get, Delete, Param,Put } from '@nestjs/common';
@Controller('user')
export class UserController {
constructor(private userService:UserService){}
@Post()
async create(@Body() userDto:Us... |
76683d084ee9520f861abcbd613740c3506d14e0 | TypeScript | pashkas/rpgorganizer | /src/app/shared/datestring.pipe.ts | 2.671875 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import * as moment from 'moment';
@Pipe({
name: 'datestring'
})
export class DatestringPipe implements PipeTransform {
transform(dt: any, ...args: any[]): any {
if (dt === undefined || dt === null) {
return "";
}
let date = new Date(dt);
... |
cef404dca10d043f419571cb6e77f4d59b46eb80 | TypeScript | redeswan/peliculas | /src/app/services/peliculas.service.ts | 2.578125 | 3 | import { Injectable } from '@angular/core';
import { LoadJsonService } from "./load-json.service";
import {IConfig} from "../interfaces/config.interface";
import {IPelicula} from "../interfaces/pelicula.interface";
import {ISearch} from "../interfaces/search.interface";
@Injectable({
providedIn: 'root'
})
export cl... |
74e450ca88169f8b50be1761b34968e2b4af8b31 | TypeScript | joshball/geo-ball | /packages/graph-core/src/core/Graph.ts | 3.484375 | 3 | import { VertexLabelMaps } from "./VertexLabelMaps";
import { IGraph } from "./IGraph";
// type VertexLabel = Map<Integer,String>
export abstract class Graph implements IGraph {
protected numVertices!: number;
protected numEdges!: number;
// optional association of String labels to vertices
protecte... |
4f4edef5833bfeeecd1b5443e7eca3842481fa01 | TypeScript | IronOnet/codebases | /codebases/invisionapp.com(dashboard)/src/hooks/useIntersectionObserver/index.ts | 2.765625 | 3 | /* global IntersectionObserver */
/* eslint-disable react-hooks/exhaustive-deps */
import { useState, useCallback, useRef } from 'react'
interface State {
isInView: boolean
entry?: IntersectionObserverEntry
}
interface UseIntersectionObserverReturn extends State {
ref: (node?: Element | null) => void
}
const i... |
6a712c2fd0d59de737f3f2a657fb266ae323163c | TypeScript | ishuhacode/Trajans-Marketplace_Angular.js | /server/src/controllers/categoryController.ts | 2.515625 | 3 | import helper from './_controllerHelper';
import categoryRepository from '../repositories/categoryRepository';
export default {
getAllCategories,
getPrimaryCategory,
getSecondaryCategory,
getTertiaryCategory
};
async function getAllCategories(req, res) {
try {
let categories = await categoryReposit... |
e691d5b97d8310d416746e3a40873167eca888e3 | TypeScript | AlexPinkus/BolsaTec | /src/app/validators/match-email.directive.ts | 2.59375 | 3 | import { Directive } from '@angular/core';
import { AbstractControl, FormGroup, NG_VALIDATORS, ValidationErrors, Validator, ValidatorFn } from '@angular/forms';
/** A hero's name can't match the hero's alter ego */
export const matchEmailValidator: ValidatorFn = (control: FormGroup): ValidationErrors | null => {
con... |
b0e6e280172631bf526fb0c603f0d23cf78ae0ad | TypeScript | bgauslin/moon | /src/js/modules/DataFetcher.ts | 3.015625 | 3 | import SunCalc from 'suncalc';
import tzLookup from 'tz-lookup';
import {AppDate, DateUtils} from './DateUtils';
export interface MoonData {
hemisphere: string,
illumination: number,
moonrise: string,
moonset: string,
percent: number,
phase: string,
sunrise: string,
sunset: string,
}
interface Moonris... |
85b1309998cde749a4a5d140ac17f65286f3318e | TypeScript | YBFACC/MyLeetCode | /ts/27-easy.ts | 3.203125 | 3 | /*
* @lc app=leetcode.cn id=27 lang=typescript
*
* [27] 移除元素
*/
//提示--双指针
// @lc code=start
function removeElement(nums: number[], val: number): number {
let left = 0, right = 0
for (let i = 0; i < nums.length; i++) {
if (nums[i] === val) {
right++
continue
}
nums[left++] = nums[right+... |
d27d1e91a19b2c3fa55f34c9dc08a920f5fe3612 | TypeScript | fal-works/howlongdidittake-js | /src/format/common-types.ts | 2.65625 | 3 | export type Unit = "s" | "ms" | "ns";
export type Duration = `${number} ${Unit}`;
export type Formatter = (ms: number) => Duration;
|
3c6440683654c6aed9522c07dd852fe148d3e992 | TypeScript | tamura2004/ogisuinote | /src/models/User.ts | 3.109375 | 3 | export default class User {
public static collectionName = 'users';
public static valid(init: any): init is User {
return typeof init.name === 'string' &&
init.name.length > 0 &&
typeof init.email === 'string' &&
init.email.length > 0 &&
typeof init.manager === 'boolean';
}
public ... |
a44a7adc9d06c797574ef353136c8084cc702b32 | TypeScript | amihaescu/it-step-angular | /src/app/conference/conference.component.ts | 2.59375 | 3 | import { Component, Input, OnInit } from '@angular/core';
import { Conference, Participant} from '../participant.model';
@Component({
selector: 'app-conference',
templateUrl: './conference.component.html',
styleUrls: ['./conference.component.css']
})
export class ConferenceComponent implements OnInit {
@Input... |
6efcb092910d64760b01f4aa9f6e927c1d89730c | TypeScript | calebrussel77/e-commerce-shop | /frontend/src/store/reducers/userEditReducer.ts | 2.765625 | 3 | import * as actionTypes from "../actions/actionsTypes";
import { updateObject } from "../../utils/updateObject";
import { IUser } from "../../types/types.models";
interface actionType {
type: string;
payload: any;
}
interface IIniatialUserState {
isLoading: boolean;
error: boolean;
userEdit: Partial<IUser |... |
d007f5287a3111bdcb3bdd500859e6ca003c9373 | TypeScript | michalwielgus/angular2-contacts-list | /src/app/contacts.service.ts | 2.5625 | 3 | import { Injectable } from '@angular/core';
export interface Contact {
id: number;
name: string;
age: number;
email: string;
}
@Injectable()
export class ContactsService {
contacts: Array<Contact> = [
{
id: 1,
name: 'Michal Wielgus',
age: 27,
... |
ce79935a5791e69994859b4f2b67e20c500be8eb | TypeScript | thiagobustamante/typescript-rest-swagger | /src/utils/decoratorUtils.ts | 3.03125 | 3 | import * as ts from 'typescript';
export function getDecorators(node: ts.Node, isMatching: (identifier: DecoratorData) => boolean): Array<DecoratorData> {
const decorators = node.decorators;
if (!decorators || !decorators.length) { return []; }
return decorators
.map(d => {
const resul... |
e31b43877b5ce4d4ee19331ff4ed33a6abc925c6 | TypeScript | lironsh11/FrontEndProject | /src/app/search.pipe.ts | 2.625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'search'
})
export class SearchPipe implements PipeTransform {
transform(arr: any[], val: string): any[] {
let arr2=[]
val = val.toString().toLowerCase();
if (arr != undefined) {
for (let i = 0; i < arr.length; i++) {
... |
5bf811f8a5ed77e565dfacace442e36d4d6802e0 | TypeScript | asutekku/Rainfall | /src/ts/interact/messageSchema.ts | 3.0625 | 3 | import {Actor} from "../actors/Actor";
export interface IDefaultMessage {
msg?: string;
}
export class MessageStr implements IDefaultMessage {
public msg: string;
constructor(msg: string) {
this.msg = msg;
}
}
export class DeathMessage implements IDefaultMessage {
public type = 'death';
... |
13a37be4d87cd8ed9078aa116e88401e428d5f42 | TypeScript | geohot/optimism-monorepo | /packages/core-utils/src/app/time-bucketed-counter.ts | 3.78125 | 4 | /**
* Implements a time-based counter that can keep an accurate rolling count
* of how many per X milliseconds.
*
* It does this by breaking X milliseconds into Y time-buckets and
* 1) Incrementing the appropriate time bucket based on the current time
* 2) Clearing time buckets that are more than X milliseconds o... |
83540bff153076b4da55770b151fe4f61320d502 | TypeScript | Mitch90/rocket-nuimo-node | /src/bluetooth/gatt.ts | 2.828125 | 3 | /**
* Services available on Nuimo devices
* @internal
*/
export enum DeviceService {
BatteryStatus = '180f',
LED = 'f29b1523cb1940f3be5c7241ecb82fd1',
Nuimo = 'f29b1525cb1940f3be5c7241ecb82fd2',
}
/**
* Battery status service characteristics
* @internal
*/
export e... |
6b7ae50305721830a3e4e9987b6020c97402f89d | TypeScript | craydent/Node-Library | /modules/methods/sum.ts | 3.484375 | 3 | import error from '../methods/error';
import isNumber from '../methods/isnumber';
export default function sum(arr: number[]): number {
/*|{
"info": "Array class extension to perform summation of all the values (any value which is not a number is 0).",
"category": "Array",
"featured": true,
... |
43c491e7e0be89b1788c21051e2a6c051b05d69b | TypeScript | grow-team/graph | /src/shape/path.ts | 3.015625 | 3 | import { Shape } from './shape';
export class Path extends Shape {
protected args: number[];
constructor(ctx, x,y, ...args) {
super(ctx, x,y);
this.draw(x, y, ...args);
console.log('...constructor() Path');
}
draw(x, y , ...args) {
super.start();
this.ctx.mo... |
75471ccac08fbe1f494537a8c4e797e9e0379adf | TypeScript | mengdu/validator.js | /src/utils.ts | 3.296875 | 3 | export function isArr (val: any) {
return Array.isArray ? Array.isArray(val) : Object.prototype.toString.call(val) === '[object Array]'
}
export function isObj (val: any) {
return typeof val === 'object'
}
export function isFun (val: any) {
return typeof val === 'function'
}
export function isAsyncFun (val: an... |
2aee4961d1ce72e535ed2e6cf524fa15f8fe8485 | TypeScript | d-rowe/brnstn | /test/Interval.spec.ts | 3.03125 | 3 | import {Interval, Pitch} from '../src';
import {PitchCoordinate} from '../src/types';
describe('Interval', () => {
describe('#constructor', () => {
it('should calculate coord from name correctly', () => {
const nameCoordExpectations: [string, PitchCoordinate][] = [
['P1', [0, 0]... |
e04cdb0d348644d46237a27ec7618d2aece931cd | TypeScript | pixilab/blocks-script | /user-archive/Flock.ts | 2.546875 | 3 | /*
Basic Flock API integration.
IMPORTANT: You MUST enter your credentials into the corresponding
configuration file in files/Flock.config.json in order to use this
service.
Created 2018 by Samuel Walz
*/
import {SimpleHTTP} from "system/SimpleHTTP";
import {SimpleFile} from "system/SimpleFile";
import {Script... |
e36b7ee6fcbb9e89c8b21556f8aa35e5594c430f | TypeScript | microsoft/screenshots-diff-toolkit | /screenshots-diff/example.ts | 2.546875 | 3 | import diffScreenshots from "./index";
import { logError } from "./log";
const args = process.argv.slice(2);
const paths = {
baseline: args[0],
candidate: args[1],
diff: args[2]
};
const threshold = parseFloat(args[3]);
const isInvalidArgs =
args.length !== 4 || isNaN(threshold) || threshold < 0 |... |
9f6a14e2b8d4a8ce61afc723676be6fe39140744 | TypeScript | future4code/dumont-labenu-system23 | /src/endpoints/createMission.ts | 2.78125 | 3 | import {Request, Response } from 'express';
import insertMission from '../data/insertMission'
export default async function createMission(
req:Request,
res:Response
)
{
try{
//validar entradas da requisição
if (
!req.body.name||
!req.body.start_date||
!req.body.end_date||
... |
58522e90ac10f2e9ffba9a693c14467e2707e8a3 | TypeScript | ourai/holysheet | /src/abstract-table/helper.ts | 2.96875 | 3 | import { TableCell, InternalRow } from './typing';
function generateCell(): Omit<TableCell, 'id'> {
return {};
}
function generateRow(): Omit<InternalRow, 'id' | 'cells'> {
return {};
}
const CHAR_BASIS = 'A'.charCodeAt(0);
const BASE_MAX = 26;
function convertNumberToName(num: number): string {
return num <=... |
a119cae86e8a569f5da06bd7b50af4fff37d14ac | TypeScript | MrRefactoring/jira.js | /src/version2/models/functionReferenceData.ts | 3.078125 | 3 | /** Details of functions that can be used in advanced searches. */
export interface FunctionReferenceData {
/** The display name of the function. */
displayName?: string;
/** Whether the function can take a list of arguments. */
isList?: string;
/** The data types returned by the function. */
types?: string... |
871c8a1ba34628cb6bf5ed66da14f27586d45863 | TypeScript | tinymce/tinymce | /modules/alloy/src/main/ts/ephox/alloy/behaviour/toggling/TogglingTypes.ts | 2.578125 | 3 | import { Optional } from '@ephox/katamari';
import * as Behaviour from '../../api/behaviour/Behaviour';
import { AlloyComponent } from '../../api/component/ComponentApi';
import { BehaviourCellState } from '../common/BehaviourCellState';
export interface TogglingBehaviour extends Behaviour.AlloyBehaviour<TogglingConf... |
78f3d1eaa1e24c67354d7a4331c37d67139b58e6 | TypeScript | BardaDash/Angular_Training | /Q5DigitalClock.ts | 2.765625 | 3 | //Q.5 Create a digital clock using typescript.for example your output should be like this on
// console.(9:15:56 AM)
let currentdDate : string= new Date().toLocaleTimeString();
console.log(currentdDate); |
0f96b31a684bff88be72ad149cd9ef8817101917 | TypeScript | polyglotm/coding-dojo | /coding-challange/leetcode/medium/~2022-06-04/142-linked-list-cycle-ii/142-linked-list-cycle-ii.ts | 3.84375 | 4 | /*
142-linked-list-cycle-ii
leetcode/medium/142. Linked List Cycle II
URL: https://leetcode.com/problems/linked-list-cycle-ii/
NOTE: Description
NOTE: Constraints
NOTE: Explanation
NOTE: Reference
- The number of the nodes in the list is in the range [0, 104].
- -105 <= Node.val <= 105
- pos is -1 or a valid in... |
849865900e2559124a88cec9307444183adccfcc | TypeScript | kierstone/RamenRanger | /RamenRanger/src/data/horizontalFoodCourt/FoodCourtBuddy.ts | 2.859375 | 3 | class FoodCourtBuddy{
public portrait:RandomPortrait; //随机头像
public body:string; //角色在地图上的造型
public favourType:FoodCourtDishType;
public favourLevel:number;
public hunger:number;
public isPlayer:boolean = false;
constructor(isPlayer:boolean = false){
this.isPlayer = isPlayer;
... |
95cd4440d6dbb5bafe861beb1ca27f35abcb73aa | TypeScript | walsh93/MoodBuddy | /src/app/users.ts | 3 | 3 | export class User{
name: string;
email: string;
buddy: string;
color: string;
constructor(){
this.name = "";
this.email = "";
this.buddy = "";
this.color = "";
}
setUser(name: string, email: string, buddy: string, color: string){
this.name = name;
... |
0cf5f479885b8784e3e8db1fb294398cb0a0fee1 | TypeScript | thornyweb/react-addressbook | /src/types/contacts.ts | 3.171875 | 3 | /**
* Data model for a single contact record
* Schema designed based on specification for address book.
*/
export interface Contact {
_id: string,
uid: string,
name: string,
email?: string,
telephone?: string,
address_line1?: string,
address_line2?: string,
address_town?: string,
address_county?: s... |
a172891f817af32182e8589356ea3019aef58592 | TypeScript | zaida04/voicechat-moderator | /src/events/message.ts | 2.953125 | 3 | import { Message } from "discord.js";
import incorrectUsageEmbed from "../Internals/Embed/incorrectUsageEmbed";
export default async (message: Message) => {
if (message.author.bot) return;
if (!message.guild) return message.channel.send("Sorry, but I can only be used in a server.");
let prefix = await mes... |
093e045d817c45c3563d606b8300c1b495ef3254 | TypeScript | Ogiwara-CostlierRain464/NodeJs | /todoTest/src/app/todo-service.ts | 2.609375 | 3 | import { Injectable } from '@angular/core';
import {Todo} from "./model/Todo";
import {Headers,Http} from "@angular/http";
import 'rxjs/add/operator/toPromise';
/**
* TodoのデータProvider!
*/
@Injectable()//DI
export class TodoService {
private todoesUrl = 'api/todoes';
private headers = new Headers({'Content-Type... |
c1f85c95929172f925776469b4a4749ea6dd0b9f | TypeScript | vue-styleguidist/vue-styleguidist | /packages/vue-docgen-api/src/script-handlers/eventHandler.ts | 2.65625 | 3 | import * as bt from '@babel/types'
import { NodePath } from 'ast-types/lib/node-path'
import { visit } from 'recast'
import Documentation, {
BlockTag,
DocBlockTags,
EventDescriptor,
ParamTag,
ParamType,
Tag
} from '../Documentation'
import getDocblock from '../utils/getDocblock'
import getDoclets from '../utils/g... |
cb9b68f6789270c2a4d359d93800411847c84a76 | TypeScript | timpeq/teli-node | /src/channel-group/builders/index.ts | 2.59375 | 3 | import HttpClient from "../../shared/http/http-client.ts";
import IChannelGroupBuilder from "../contracts/channel-group-builder.interface.ts";
import CreateChannelGroupDto from "../models/create-channel-group.dto.ts";
import UpdateChannelGroupDto from "../models/update-channel-group.dto.ts";
import ChannelGroup from ".... |
b7772be0d7cb606470c0ee481adb189c9e5971bc | TypeScript | chas-academy/u07-recipe-app-stenwall | /src/app/services/token.service.ts | 2.546875 | 3 | import { Injectable } from '@angular/core';
import { environment } from '../../environments/environment';
@Injectable({
providedIn: 'root'
})
export class TokenService {
private issuer: object;
private u08ApiUrl: string;
constructor() {
this.u08ApiUrl = environment.U08_API_URL;
this.issuer = {
... |
d806b0c58bd342a25ebd38baef75852b812f2c8b | TypeScript | cmillauriaux/javascript-story-engine | /src/controllers/engine.ts | 2.796875 | 3 | import { Condition } from "../models/Condition";
import { Choice } from "../models/Choice";
import { ContextModel } from "../models/Context";
import { SequenceModel } from "../models/Sequence";
import { Consequence } from "../models/Consequence";
import { ConsequenceRules } from "./consequence.rules";
import { Conditio... |
16b8d814dc6b9780da5e9b089c3c3abeba87a53f | TypeScript | SudoDotDog/Sudoo-Internationalization | /test/unit/format.test.ts | 2.90625 | 3 | /**
* @author WMXPY
* @namespace Internationalization
* @description Format
* @package Unit Test
*/
import { expect } from "chai";
import * as Chance from "chance";
import { SudooFormat } from "../../src/format";
describe('Given a {Format} class', (): void => {
const chance: Chance.Chance = new... |
ad83d553fecb58f1c17955bee0feab03197cbb20 | TypeScript | hkoketsu/ubc-insights | /src/layers/service/dataset/DatasetService.ts | 2.65625 | 3 | import DatasetRepository from "../../repository/DatasetRepository";
import Dataset from "../../domain/Dataset";
import {InsightDatasetKind, NotFoundError} from "../../../controller/IInsightFacade";
export default abstract class DatasetService {
protected datasetRepository: DatasetRepository;
protected constru... |
4260ae923f78b9bf4e8f236dad45381d13222082 | TypeScript | eventfarm/javascript-sdk | /src/Api/Type/Virbela.ts | 2.515625 | 3 | /**
* This file was auto generated, please do not edit it directly.
**/
export interface VirbelaRoleTypeInterface {
slug: string;
name: string;
description?: string;
isMember: boolean;
isAdmin: boolean;
isSuspended: boolean;
isModerator: boolean;
isLeader: boolean;
}
export class Virbela {
VirbelaR... |
4916604379787fb2d4690228382b61ef59af1de3 | TypeScript | plc-dev/aladin | /backend/helpers/NumberGenerators.ts | 3.390625 | 3 | import seedrandom from "seedrandom";
export class RNG {
private rng: Math["random"] | seedrandom.prng;
constructor(seed?: any) {
this.rng = seed ? seedrandom(seed) : Math.random;
}
public coinFlip() {
return this.floatBetween(0, 1) > 0.5;
}
public floatBetween(min?: number, m... |
963b40ab7fa2249cbc93e2c1b2b62ca28dfc2745 | TypeScript | EquipeCagece/BackEnd | /src/modules/teams/services/UpdateTeamService.ts | 2.625 | 3 | import { injectable, inject } from 'tsyringe';
import AppError from '@shared/errors/AppError';
import Team from '../infra/typeorm/entities/Team';
import ITeamsRepository from '../repositories/ITeamsRepository';
interface Request {
id: string;
name: string;
}
@injectable()
class UpdateTeamService {
constructo... |
4a15952198eddfbd9f4e1c25843b02cda9347687 | TypeScript | webdude21/TypeScript-demos | /src/types/tuples.ts | 3.453125 | 3 | export function makePair(key: number, value: string): [number, string] {
return [key, value];
}
export function triplet(one: number, two: string, three: number): [number, string, number] {
return [one, two, three];
}
let res = triplet(5, 'Why', 3);
res[0] = res[0] + res[2];
export function useTuples(tuple: ... |
58ca3371867e9533dc54e2f3941144af5f4f5e8d | TypeScript | nemodaattila/bookwebshop-frontend | /src/app/components/complexSearchBrowser/criteria-select-input/criteria-select-input.component.ts | 2.6875 | 3 | import {ChangeDetectionStrategy, Component, Input, OnInit} from '@angular/core';
import {ComplexSearchBrowserService} from "../../../services/book/complex-search-browser.service";
@Component({
selector: 'app-criteria-select-input',
templateUrl: './criteria-select-input.component.html',
styleUrls: ['./criteria-se... |
282b19d2e510794ad98c54299e75d05c126e9f7d | TypeScript | Lazyuki/DiscordStatsBot_EN_JP | /src/commands/botOwner/database.ts | 2.65625 | 3 | import { errorEmbed, successEmbed } from '@utils/embed';
import { BotCommand } from '@/types';
import { parseSubCommand } from '@utils/argumentParsers';
import { fetchAnyQuery, runAnyQuery } from '@database/statements';
import { codeBlock } from '@utils/formatString';
const command: BotCommand = {
name: 'database',
... |
25a9df90fe5ef5d1bae9c523039257c6be65439e | TypeScript | Mathias9807/WebGLPlayground | /src/geometry.ts | 2.65625 | 3 | import { gl } from "./main";
import { setUniformMat, currentShader } from "./shaders";
import { Mesh } from "webgl-obj-loader";
import { vec3, mat4 } from 'gl-matrix';
export interface Model {
indices: Array<number>;
vertices: Array<number>;
normals?: Array<number>;
colors?: Array<number>;
uvs?: Array<number>;
... |
595fd71f85dc3e4f4bf827a16e62d66e5743a06f | TypeScript | YanceyOfficial/leetcode-trip | /src/data-structures/HashMap/types.ts | 3.265625 | 3 | export interface IHashMap<T> {
put(key: string, value: T): void
remove(key: string): boolean
get(key: string): T | undefined
}
|
30ff4b01954b4bb615e535749ec3155f2d6085b6 | TypeScript | xiehaitao0229/anu-react-hooks-ie8 | /src/hooks/useRedux.ts | 2.640625 | 3 | import { useReducer } from 'react'
interface Action {
type: string,
payload: object,
mutations: object
}
function reducer(state: object, { type, payload, mutations }: Action) {
return mutations[type](state, payload)
}
export const useRedux = (model: string) => {
const { state, actions, mutations } = requir... |
6ab70cda3f0fe34f064418a361a5ac882246c9ea | TypeScript | pashoo2/utilities | /src/types.ts | 3.265625 | 3 | export type TObjectKeys = string | number | symbol;
export type TSimpleTypes = number | string | boolean | null | undefined;
export type TDictionary<T> = Record<TObjectKeys, T>;
export type ConstructorType<R, A extends Array<any> = any[]> = new (
...args: A
) => R;
export type MaybeError = Error | void;
export i... |
9c9df78a22d9324956a85f8dce968cac5f044472 | TypeScript | microsoft/fluentui | /packages/merge-styles/src/DeepPartial.ts | 3.328125 | 3 | /**
* TypeScript type to return a deep partial object (each property can be undefined, recursively.)
*/
export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[] ? DeepPartial<U>[] : T[P] extends object ? DeepPartial<T[P]> : T[P];
};
|
fb0d023149446457fcdae7ba42e4417120e43eff | TypeScript | linyupark/ts-vue-class-component-wp4-mobx-starter | /src/libs/vue-rem-plugin.ts | 2.921875 | 3 | /**
* Vue 插件:开启关闭rem支持
* @author linyupark@gmail.com
*/
/**
* 参数内容定义
*/
interface RemPluginOptions {
// 1rem = ??px
pxToRem?: number;
// 自动启用 rem?
auto?: boolean;
}
const dpr = window.devicePixelRatio || 1;
const docEl: HTMLElement = document.documentElement!; // ts请相信我这个不会是null
export default {
/**
... |
15d168fe0d58264dc0de151890bd7f338fb034f5 | TypeScript | dnkm/recipeplus | /app/shared/recipe.ts | 2.890625 | 3 | let counter = 0;
export class Recipe {
static allTags = ['all','seafood','bbq','one pot','chicken'];
id: number;
rating: number;
constructor(
public title: string,
public website: string,
public url: string,
public ingredients: Ingredient[],
public directions: s... |
46bfb768f9d87dc13244cd355f18df8265a61fec | TypeScript | ArchitectureMining/CoRA | /client/static/js/lib/Shapes/Line.ts | 3.203125 | 3 | /// <reference path='./TwoPointShape.ts'/>
class Line extends TwoPointShape
{
public Curvature : number;
public constructor(a : Point, b : Point)
{
super(a, b);
this.Curvature = 0;
}
protected SetPath(ctx : CanvasRenderingContext2D)
{
let c = this.GetCurvePoint();
... |
0db698c244adf1de4241925836834b7b89aae032 | TypeScript | BrunoMCarnauba/sistema_restaurante | /mobile/src/providers/produtos.ts | 3.15625 | 3 | import { number } from 'prop-types';
import { APIProviders } from './api';
import Produto from '../models/produto';
export class ProdutosProvider extends APIProviders{
/**
* Cadastra um novo produto
* @param produto
*/
public async cadastrar(produto: Produto): Promise<boolean>{ //Como é uma fun... |
444c4e92ec9fd5f59b7b397027d1aa8c7a05c997 | TypeScript | AndrewZurn/dexcom-vue-prototype | /src/app/supportForm/mutations.ts | 2.703125 | 3 | import { ISupportFormState } from './state';
export interface ISupportFormMutations {
SET_INCREMENT_PENDING(state: ISupportFormState, pending: boolean): void;
SET_DECREMENT_PENDING(state: ISupportFormState, pending: boolean): void;
SET_COUNT(state: ISupportFormState, count: number): void;
SET_APP_INFO(state... |
0d20b78bbef625acec71634e349180b94b1f51bf | TypeScript | tamert/TypeScript-4-Design-Patterns-and-Best-Practices | /chapters/chapter-1_Getting_Started_With_Typescript_4/removeDuplicateVars.ts | 3.1875 | 3 | function removeDuplicateChars(input: string) {
const result: string[] = [];
//const result = ["a"];
let seen = new Set();
for (let c of input) {
if (!seen.has(c)) {
seen.add(c);
result.push(c);
}
}
}
console.log(removeDuplicateChars("aarfqwevzxcddd"));
|
627204802da5e3a864494254ca5fb2cf35b77f60 | TypeScript | yemenPython/piworld-ts-server | /client/src/apps/shared/modules/statuspicker/statuspicker.component.ts | 2.5625 | 3 |
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { SelectItemDisable } from '../../SelectItemDisable';
export enum UserStatus {
disabled = 0,
enabled = 1,
pending = -1
}
@Component({
selector: 'app-status-picker',
template: `
<p-dropdown [options]="list... |
daa1183d73ff3e95526e7e5652bf932f3baa2bb5 | TypeScript | dmitriyrepin/node_async | /src/tests/warranty.test.ts | 2.515625 | 3 | import { expect, assert } from 'chai';
import { Server } from 'http';
import * as Utils from './utils/request-async';
import { Assert } from './utils/assert';
import * as Request from 'request';
import { ServerFactory, HttpServer } from '../server-factory';
import { Warranty, WarrantyData } from '../routes/data/warra... |
b30e410f03b542cc22115ec2e7710d7898dab66c | TypeScript | pablocid/berry_server | /src/routes/berry-analyzer/berry-analyzer.route.ts | 2.640625 | 3 | import { BaseRoute } from '../../models/class.route'
import { NextFunction, Request, Response, Router } from 'express';
import { exec } from 'child_process';
import { readFileSync, unlink } from 'fs';
import * as Multer from 'multer';
interface OpenCV {
readImage(path: string, callback: any): void;
}
const cv = <... |
dfe5cb6c1b710008ad66c043685ea5db9a30c51f | TypeScript | BogusCurry/mapillary-js | /src/state/StateService.ts | 2.53125 | 3 | /// <reference path="../../typings/browser.d.ts" />
import * as rx from "rx";
import {Node} from "../Graph";
import {ILatLonAlt} from "../Geo";
import {
FrameGenerator,
IStateContext,
IFrame,
IRotation,
StateContext,
State,
} from "../State";
interface IContextOperation {
(context: IState... |
dca0b150c3635a3a5ef43680a4fc38215b099fdb | TypeScript | tctram1/Fall2017-Repo | /cost-analysis/src/pages/calculator/calculator.ts | 2.515625 | 3 | import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-calculator',
templateUrl: 'calculator.html',
})
export class CalculatorPage {
quantity1;
quantity2;
quantity3;
quantity4;
quantity5;
price1;
price... |
354c3ae864d378a704fb97fb6f5fef1761268056 | TypeScript | uhh-lt/narrativity-frontend | /src/schemas/book.ts | 2.859375 | 3 | // Schemas for books for which we have pre computed events
import { Expose } from "class-transformer";
export class Book {
@Expose()
id: string
@Expose()
author: string
@Expose()
title: string
@Expose()
releaseYear: string
constructor(id: string, author: string, title: string, rele... |
50dfe806a79e759a1073063c0b0a20bc5e2bb15a | TypeScript | evdhiggins/pg-structure | /test/type/composite-type.test.ts | 2.84375 | 3 | import { Db, CompositeType, Column } from "../../src/index";
import getDb from "../test-helper/get-db";
let db: Db;
let compositeType: CompositeType;
let field4: Column;
beforeAll(async () => {
db = await getDb();
compositeType = db.schemas.get("public").types.get("udt_composite") as CompositeType;
field4 = com... |
44066b87485b1d2fa57dbb8051596f38ecebb1af | TypeScript | algolia/hn-search | /app/javascript/utils/useClickOutside.ts | 2.765625 | 3 | import * as React from "react";
const useClickOutside = (
ref: React.RefObject<any>,
callback: (e?: React.MouseEvent<HTMLElement>) => void
) => {
/**
* Alert if clicked on outside of element
*/
const handleClickOutside = event => {
if (ref.current && !ref.current.contains(event.target)) {
callb... |
1785def131b2bb89e0d8f43e56c2fc9c1eb78021 | TypeScript | green-fox-academy/yasmin-e | /week-03/day-04/recursion/recursionExercises/bunnies/bunnies-again.ts | 4.34375 | 4 | /* We have bunnies standing in a line, numbered 1, 2, ...
The odd bunnies (1, 3, ..) have the normal 2 ears.
The even bunnies (2, 4, ..) we'll say have 3 ears, because they each have a raised foot.
Recursively return the number of "ears" in the bunny line 1, 2, ... n
(without loops or multiplication). */
function bunn... |
d5370d258382708dcd3d9392ba30e7c6715a9cb1 | TypeScript | bellstrand/singorwing | /utils/src/functions/url-encode-object.ts | 2.765625 | 3 | export function urlEncodeObject(obj: { [key: string]: string }) {
return Object.keys(obj)
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`)
.join("&")
}
|
f4fe458ce93f1f2b9ff1be603da12faeba20af74 | TypeScript | mehmeteyupoglu/ui-components | /src/components/otp-field/helpers.ts | 3.375 | 3 | export function formatCode(code: string): string {
return [code.slice(0, 3), ' ', code.slice(3)].join('');
}
const ANIMATION_TIME = 1000; // in ms
/**
* Compute the circle perimiter that needs to be filled according to the time left
* period. Normally, this would simply be (timeLeft / validityPeriod) * perimiter.... |
6e1a35e97fac27c2a71b3e06da95cc0f07600b13 | TypeScript | guorui007/stockapp | /src/main.ts | 2.65625 | 3 | // const http=require('http')
// const server=http.createServer((request,response)=>{
// response.writeHead(200,{
// 'Content-Type':"text/html;charset=utf-8"
// })
// const data={
// book:"自由万岁",
// price:"30",
// id:1
// }
// const jsondata=JSON.stringify(data)
// ... |
91385cfe028d390e35220b5db70d03e2bff5945c | TypeScript | iWinston/typeorm-plus | /test/github-issues/3654/entity/User.ts | 2.71875 | 3 | import { StringDecoder } from "string_decoder";
import { Column, Entity, PrimaryColumn } from "../../../../src";
@Entity()
export class User {
@PrimaryColumn("binary", {
length: 16
})
public _id: Buffer;
get id(): string {
const decoder = new StringDecoder("hex");
return decod... |
e0dc9f66a4c20dc880311547b186da9ec0506ad4 | TypeScript | kGe-z/graduation_service | /libs/common/src/error/error.enum.ts | 2.90625 | 3 | /* 自定义异常枚举 */
export enum ErrorTypeEnum {
ERROR_TYPE_DEFAULT = 500,
ERROR_TYPE_400 = 400,
ERROR_TYPE_401 = 401,
ERROR_TYPE_403 = 403,
ERROR_TYPE_404 = 404,
}
/* 常用异常默认信息枚举 */
export enum ErrorValueEnum {
ERROR_TYPE_DEFAULT = '服务器错误',
ERROR_TYPE_400 = '请求参数错误',
ERROR_TYPE_401 = '授权失败',
ERROR_TYPE_403 ... |
bfe2aaed70038b15dd6431360decced851fc19a7 | TypeScript | thiagoblima/graphql-projects | /remote-graph/integration-tests/service1.ts | 2.75 | 3 | const { ApolloServer, gql } = require('apollo-server');
const typeDefs = gql`
type Book {
title: String
author: String
}
type Query {
getAllBooks: [Book!]!
getBooksBy(author: String!): [Book!]!
}
`;
const books = [
{
title: 'Harry Potter and the Chamber of Secrets',
author: 'J.K. Rowling',
... |
0848bb5da7b35fd22cc3d2101942a9f82145cd69 | TypeScript | marceloadsj/jsxstate | /src/hooks/useValue/index.test.ts | 2.859375 | 3 | import { renderHook } from '@testing-library/react-hooks'
import { renderHookWithMachines } from '../../../testUtils'
import useValue from '.'
import { TState } from '../../types'
describe('useValue', () => {
it('is truthy', () => {
expect(useValue).toBeTruthy()
})
it('throws error when used with no contex... |
a082124cecec5c96ef5eb40b6bbcf2b50ad7f9d9 | TypeScript | nguyer/aws-sdk-js-v3 | /clients/browser/client-datasync-browser/types/UpdateTaskInput.ts | 2.515625 | 3 | import { _Options } from "./_Options";
import { _FilterRule } from "./_FilterRule";
import { BrowserHttpOptions as __HttpOptions__ } from "@aws-sdk/types";
import * as __aws_sdk_types from "@aws-sdk/types";
/**
* <p>UpdateTaskResponse</p>
*/
export interface UpdateTaskInput {
/**
* <p>The Amazon Resource Name (... |
41ccd2b7ac6a537c8ac9b09ec957dc9612b78201 | TypeScript | NaldsonChagas/overnightjs-simple-api | /src/repositories/PersonRepository.ts | 2.828125 | 3 | import { Person } from '@src/entities/Person'
import { getManager } from 'typeorm'
export class PersonRepository {
private entityManager = getManager()
public async create(person: Person): Promise<Person> {
return await this.entityManager.save(Person, person)
}
public async findById(id: number): Promise<... |
8c61acf2f669253f1b001685c8b22d2a89635e52 | TypeScript | kling-igor/auth-playground | /src/file/dto/file-upload.response.dto.ts | 2.59375 | 3 | import { ApiResponseProperty, ApiProperty } from '@nestjs/swagger';
import { IsObject, IsString, ValidateNested, IsInt } from 'class-validator';
import { Exclude, Expose } from 'class-transformer';
export class FileUploadStatus {
@ApiResponseProperty()
@IsString()
public id: string;
@ApiResponseProperty()
@... |
25890a073ca61b61a414dce7f36e61eaa10a9ff3 | TypeScript | ElTonyto/Webstore | /src/api/ApiRequest.ts | 2.546875 | 3 | import axios from "./axios"
// Catalogs
export const allCatalogs = () => axios.get("catalogs")
export const oneCatalog = (id: string) => axios.get(`catalogs/${id}`)
// Offers
export const allOffers = () => axios.get("offers?isActive=true")
export const oneOffer = (id: string) => axios.get(`offers/${id}?isActive=true`... |
9e7e34a2b5b60d9012d3909b64f00d28ab76ab3b | TypeScript | steelsojka/ug-layout | /packages/ug-layout/src/dom/ConfiguredRenderable.ts | 3.46875 | 3 | import { Type } from '../di';
import { Renderable } from './Renderable'
import { RenderableArg } from '../common';
import { isFunction } from '../utils';
/**
* A container that holds a Renderable class and a configuration to
* use when it is instanatiated.
* @export
* @class ConfiguredRenderable
* @template T A s... |
564b8efd737bfb47fb36fddffbf4ad9c42dc6716 | TypeScript | gitrojones/validplus | /src/util/casts/toRegexp.ts | 3.078125 | 3 | export function toRegexp (value: any): (RegExp | null) {
if (value instanceof RegExp) return value;
if (typeof value === 'string' && value.length > 0) {
if (/^\/.+\/i?g?m?s?u?y?$/.test(value)) {
const pieces = value.split('/');
if (pieces.length === 3) {
return new RegExp(pieces[1], pieces[2... |
e66b9e2a71d1c025ed10cac3d42bd377b2c21edb | TypeScript | skyjur/playground | /typescript-rpc/src/server.ts | 2.703125 | 3 | require('source-map-support').install();
import * as WebSocket from 'ws';
import * as http from 'http';
import { ServiceInterface } from "./common";
class Api implements ServiceInterface {
async add(a: number, b: number) {
return a + b;
}
async repeat(a: string, b: number) {
return a.repea... |
4ec4f8701844ce51aa16a35ad56ef45dc5575ad8 | TypeScript | joeskeen/guess-who | /src/app/app.component.ts | 2.578125 | 3 | import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
import { debounceTime, map, mergeMap } from 'rxjs/operators';
import { from } from 'rxjs';
import { hash } from './hash';
import { DataService, Person } from './data.service';
@Component({
selector: 'app-root',
templateUrl: '.... |
d83583f1c9f2ed60a901992b54564fb509b4fd56 | TypeScript | abstractor97/eeyorefun_cli | /eeyore_cli/src/Utils/Queue.ts | 3.984375 | 4 | class Queue<T> {
private items: T[] = [];
public constructor() {
}
/**
* 入队
*/
public enqueue(obj: T) {
this.items.push(obj);
}
/**
* 出队
*/
public dequeue(): T {
let result = this.items.shift();
return result;
}
public isEmpty(): Boolean {
return this.items.length == 0;
}
/**
* 返回队首元素
... |
ac6822386379dc624e1470b22a6f883a185aeb01 | TypeScript | Martin161195/TeamSoft | /desarrollo/SW_ModeloDeCalidad-ISO9126/4. Fuentes/calidad-unms-master/src/shared/models/type-of-application/type-of-application.class.ts | 2.8125 | 3 | import { ITypeOfApplication } from './type-of-application.interface';
export class TypeOfApplication {
id: number;
name: string;
description: string;
code: string;
enabled: number;
status: number;
createdAt: Date;
updatedAt: Date;
// tslint:disable-next-line:cyclomatic-complexity
constructor(obj?: ... |
6db701ec4882f013b24360cba6bba609504f23e6 | TypeScript | wd055/2021_1_LonelyBoiz | /public/sw.ts | 2.65625 | 3 | const assetUrls = ['index.html', '/', '/main.js', '/login'];
interface ExtendableEvent extends Event {
waitUntil(fn: Promise<any>): void;
}
interface FetchEvent extends Event {
request: Request;
respondWith(response: Promise<Response> | Response): Promise<Response>;
}
self.addEventListener('install', (e:... |
ecfb4e1571846eb2fee1e0dd924cfcdda3fd1546 | TypeScript | iparitosh-singh/PathFinding_Clement | /src/components/animations.ts | 2.703125 | 3 | import {
changeNormal,
makeAlgorithmGrid,
getStatus,
animate,
checkStart,
setDirectionPath,
setStartOrFinishInstant,
changeNode
} from "./helper"
import { gridNode, algorithmNode, returnValue, algoType} from "../interfaces"
import { nodeTypes, algorithms, mazeAlgorithms, actionType } fr... |
8407372da26e0c63a57ccb34e04115430160bb29 | TypeScript | jesus2801/calculate-distance-coordinates | /js/src/app.ts | 3.15625 | 3 | class UserInterface {
public x1Val: HTMLInputElement = document.getElementById('x1')! as HTMLInputElement;
public y1Val: HTMLInputElement = document.getElementById('y1')! as HTMLInputElement;
public x2Val: HTMLInputElement = document.getElementById('x2')! as HTMLInputElement;
public y2Val: HTMLInputElement = do... |