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 |
|---|---|---|---|---|---|---|
3ad1343277362a51ea307a358e2f1627491ed11e | TypeScript | Yeulma/findParisRestrooms-frontend | /src/app/model/route.ts | 2.828125 | 3 | export class Route {
intersections: Array<any>;
distance: number;
duration: number;
constructor(intersections: Array<any>, distance: number, duration: number) {
this.intersections = intersections;
this.distance = distance;
this.duration = duration;
}
} |
64c8bf0804f168d9af10955a7781d3102401bdd3 | TypeScript | sdileep/authpack | /packages/admin/src/screens/UpdatePermission.ts | 2.640625 | 3 | import * as yup from 'yup'
import { createElement as create, FC, useEffect } from 'react'
import {
useSchema,
Layout,
Control,
InputString,
testAlphanumeric,
Page,
} from '@authpack/theme'
import { createUseServer } from '../hooks/useServer'
export const UpdatePermission: FC<{
id: string
change?: (id?:... |
eaf0cee12a7d6585795a09955e450fd4c1e8707d | TypeScript | Mushorwell/Bitcube-TypeScript-Exercise-1 | /app/validate.ts | 2.9375 | 3 | import * as Helpers from './utility';
import Person from './person';
export function Validate(){
const user = new Person();
user.forenames = Helpers.getValue("forename");
user.surname = Helpers.getValue("surname");
user.nickname = Helpers.getValue("nickname");
user.email = Helpers.getValue("email")... |
db1fc7b15f7d51e4a10623ddbbb30351d98ebc53 | TypeScript | ahape/scrabble-core | /src/functions/getnextturn.ts | 3.265625 | 3 | export function getNextTurn(
teams: number,
teamTurn: number,
oppositeDirection: boolean
): number {
if (oppositeDirection) {
return (teamTurn - 1) % teams || teams;
}
// Ensure non-zero (e.g. if 3 teams: 1 -> 2 -> 3 -> 1)
return (teamTurn + 1) % teams || teams;
}
|
f18be0b2f05832739082b6cd5059f59054b7a7cf | TypeScript | npmcdn-to-unpkg-bot/myContact | /app/app.component.ts | 2.609375 | 3 | import {Component} from '@angular/core';
import {Contact} from './contact';
const CONTACTS:Contact[] = [
{mobile: 454567, name: "jomon"},
{mobile: 768874, name: "Sijo"},
{mobile: 8764587, name: "Sumesh"},
{mobile: 988567576, name: "Sreeja"},
{mobile: 9768745665, name: "Rekha"},
{mobile: 878735... |
85b5080bbe9f1f35d355ddebbeed945420a7e35d | TypeScript | julien-c/klaus | /node/app/TemplateInfo.ts | 2.671875 | 3 | import * as util from 'util';
import * as child_process from 'child_process';
import { Context } from './Context';
import { Repo } from './Repo';
import { c } from '../lib/Log';
import { Utils } from '../lib/Utils';
const __exec = util.promisify(child_process.exec);
/**
* Info not directly linked to the `context` its... |
5ed52db069479290efd5391277ba9159e8b8b4ba | TypeScript | barylyak/IT-blog | /src/app/shared/services/posts.service.ts | 2.53125 | 3 | import { Injectable } from '@angular/core';
import {IPost} from '../interfaces/post.model';
import {Subject} from 'rxjs';
import {FAKE_POSTS_LIST} from '../constants/posts.constant';
@Injectable({
providedIn: 'root'
})
export class PostsService {
public list: IPost[] = FAKE_POSTS_LIST;
public postUpdated$ = new... |
7358636dd43fb9e60905d3cc958276e1718e2467 | TypeScript | JulianLeviston/fast-check | /test/unit/check/arbitrary/FrequencyArbitrary.utest.spec.ts | 2.65625 | 3 | import * as fc from '../../../../lib/fast-check';
import { Arbitrary } from '../../../../src/check/arbitrary/definition/Arbitrary';
import { Shrinkable } from '../../../../src/check/arbitrary/definition/Shrinkable';
import { frequency } from '../../../../src/check/arbitrary/FrequencyArbitrary';
import { Random } from ... |
3ae02416b4a4902569bfa9a37d17b0e49f91ece0 | TypeScript | copyit/homura | /src/utils/index.ts | 2.640625 | 3 | import fetch from 'node-fetch';
import { parse } from 'node-html-parser';
export async function getFaviconByUrl(url: string): Promise<string | undefined> {
if (!url.length) return undefined;
const linkRes = await fetch(url);
const html = await linkRes.text();
const root = parse(html);
const links... |
a79bcacb0fe32b5af6748a0a081a9055d9568566 | TypeScript | franck-co/boulangeries-front | /src/utils/easy-peasy-decorators/create-store.ts | 2.765625 | 3 | import * as easyPeasy from "easy-peasy";
import { ToStoreType } from './types';
//import { metadataStorage } from "./metadata-storage";
export function createStore<T extends object = {} , C extends object = {}>(storeModel?:C) {
const store = easyPeasy.createStore<any>(storeModel);
return store as easyPeasy.St... |
77a90daecfbd289dc60a8d550e71ad2a6e620c12 | TypeScript | MaksimMandSC/nestjs-ws-wrapper | /example/nest-socket-test/src/jwt.strategy.ts | 2.5625 | 3 | import { ExtractJwt, Strategy } from 'passport-jwt';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable } from '@nestjs/common';
import { UserService, User } from './user/user.service';
const cookieExtractor = (req: any) => {
let token: null | string = null;
if (req && req.cookies && req.coo... |
a5d1ae2b698c09cc17ced33e469053ce6ab8705a | TypeScript | lanemt/definitelytyped.github.io | /types/binary-split/index.d.ts | 2.5625 | 3 | // Type definitions for binary-split 1.0
// Project: https://github.com/maxogden/binary-split#readme
// Definitions by: Krisztián Balla <https://github.com/krisztianb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 3.2
/// <reference types="node" />
import { Transfor... |
e065d0bf16cb9b402c3b7e2b9eec6124c9f2f898 | TypeScript | kaplantm/guitar-practice | /src/hooks/useInterval.ts | 2.859375 | 3 | import React from "react";
import { Nullable } from "../lib/constants/types";
// via https://overreacted.io/making-setinterval-declarative-with-react-hooks/
export default function useInterval(
callback: () => void,
delay: Nullable<number>
) {
const savedCallback = React.useRef<any>(null);
// Remember the lat... |
f505b093468403736e9f83526df2da1775350e6c | TypeScript | ericlewis/Relay.swift | /relay-compiler-language-swift/src/swiftJSX.ts | 2.9375 | 3 | export interface SwiftElement {
type: string | SwiftComponent;
props: any;
}
export type SwiftChild = SwiftElement | string;
export type SwiftNode = null | undefined | SwiftChild | SwiftFragment;
export type SwiftFragment = SwiftNode[];
export type SwiftComponent<Props = any> = (props: Props) => SwiftElement | null... |
892e7ac65d4edaa38901d1b247001a622605163a | TypeScript | joost-de-vries/mst-bookstore-ts | /src/stores/BookStore.test.ts | 2.640625 | 3 | import * as fs from "fs"
import { when } from "mobx"
import { ShopStore } from "./ShopStore"
const bookFetcher = () => Promise.resolve(JSON.parse(fs.readFileSync("./public/books.json", "UTF-8")))
it("bookstore fetches data", done => {
const store = ShopStore.create({}, { fetch: bookFetcher })
when(
()... |
e79b6cc42cb462b8f749f6b71382cca5be2b302c | TypeScript | alairon/XieraBot | /xiera/components/Event/Events.ts | 2.65625 | 3 | import quests = require('./Quests');
import casino = require('./Casino');
import WebJSON = require('../Network/WebJSON');
import Search = require('./SearchEvents');
import { UTCStrings } from '../Core/Date/UTCStrings';
import { Messages } from '../Core/Messages/Messages';
import { TimeStrings } from '../Core/Date/TimeS... |
5b226358d9b1f4233845f2ec766fc6c1fcdc2f4b | TypeScript | sindresorhus/type-fest | /source/has-required-keys.d.ts | 4.03125 | 4 | import type {RequiredKeysOf} from './required-keys-of';
/**
Creates a type that represents `true` or `false` depending on whether the given type has any required fields.
This is useful when you want to create an API whose behavior depends on the presence or absence of required fields.
@example
```
import type {HasRe... |
5bdfa90ee8d0ee0920af60c643c869bbc9778368 | TypeScript | joshhunt/clips-destiny | /app/components/utils.ts | 2.671875 | 3 | /* eslint-disable import/prefer-default-export */
import fs from 'fs';
import path from 'path';
import util from 'util';
import { sortBy } from 'lodash';
const readdir = util.promisify(fs.readdir);
const VIDEO_REGEX = /^Destiny 2 (?<year>\d{4})\.(?<month>\d{2})\.(?<day>\d{2}) - (?<hour>\d{2})\.(?<minute>\d{2})\.(?<se... |
4d12109cdbefba18e0267a8bc77a60c230fc6377 | TypeScript | mpajunen/advent-of-code | /2020/day9.ts | 3.21875 | 3 | import { Grid, Input, Num, List, Str, Vec2 } from '../common'
const findContiguousSum = (nums: number[], target: number): number[] => {
for (let i = 0; i < nums.length; i++) {
let sum = nums[i]
for (let j = i + 1; j < nums.length; j++) {
sum += nums[j]
if (sum === target) {
return nums.sl... |
48aec81745b881fbef0a956a6909ef8da63b525f | TypeScript | fpaschos/simple-bank-system | /react-ui/src/services/hooks.ts | 3.3125 | 3 | import {useEffect, useRef, useState} from "react";
// From https://usehooks.com/usePrevious/
export let usePrevious: (value: any) => any;
usePrevious = (value: any) => {
// The ref object is a generic container whose current property is mutable ...
// ... and can hold any value, similar to an instance propert... |
92544a485959b3647f1b34a5735e75f8359c5191 | TypeScript | kong2630929821/message | /src/chat/server/tests/db_test.ts | 2.828125 | 3 | import { EnumType, TabMeta, Type } from '../../../pi/struct/sinfo';
import { Bucket, createMemoryBucket, createPersistBucket } from '../../utils/db';
import { UserInfo } from './foo.s';
const test_basic_db_operation = () => {
const m = new TabMeta(new EnumType(Type.Str), new EnumType(Type.Str));
// memory db... |
ad3c243da881a2a8fda8dff34f903157c8527bbf | TypeScript | bsorrentino/mac-cleaner | /src/main.ts | 2.71875 | 3 |
import 'zx/globals'
import inquirer, { Answers } from 'inquirer';
import { Stats } from 'fs';
import { EMPTY, from, Observable, map, mergeMap } from 'rxjs';
import {basename} from 'path'
import { Command } from 'commander';
import untildify from 'untildify'
type SearchOptions = {
excludeDirs:Array<RegExp>
o... |
1071efa02f4f52957d0b4fe0026d6e948267edf2 | TypeScript | krishanmarco/object-param-parser | /__tests__/parsers/ParamParser.spec.ts | 2.90625 | 3 | /** Created by Krishan Marco Madan [krishanmarco@outlook.com] [http://www.krishanmadan.com] [29-Jun-18|4:43 PM] © */
import {
ParamParser,
Parser,
Validators,
} from '../../src';
describe('parsers/ParamParser', () => {
it('Should parse values correctly', () => {
const { a } = new ParamParser()
.get(... |
b2fd6840ec12cc6e4ca557db13f9fbb0045f4786 | TypeScript | Keemluvr/pokedex | /src/services/pokemons.ts | 2.859375 | 3 | import { Dispatch, SetStateAction } from "react"
import http from "@/helpers/http"
import {
PokemonColor,
PokemonColorList,
PokemonList,
ThemeCardBackground
} from "@/types"
import { Pokemon } from "@/types"
export const listPokemons = async (
path?: string,
setLoading?: Dispatch<SetStateAction<boolean>>
)... |
dfa65012f29cd8b8cc6968cfc6f16ac1852b453e | TypeScript | alessandrapaulaf/scheduling-job | /src/helpers/jobs/index.ts | 2.71875 | 3 | import IJob from "../../models/job";
const filterAndSortbyDate = (jobs: IJob[], init: Date) => {
return jobs
.filter((job: IJob) => job.maxDate >= init)
.sort((a, b) => {
return (a.maxDate as any) - (b.maxDate as any);
});
};
const convertToJobModel = (object: any): IJob => {
return {
id: pa... |
1f038ad105473c0a7f850c2d5fec67c5e3e6599d | TypeScript | HZ-HBO-ICT/formula-1-racing-game | /src/app.ts | 3.671875 | 4 | /// <reference path="Car.ts" />
/// <reference path="KeyboardListener.ts" />
class Game {
// Necessary canvas attributes
private readonly canvas: HTMLCanvasElement;
private readonly ctx: CanvasRenderingContext2D;
// KeyboardListener so the player can move
private keyboardListener: KeyboardListener;
// th... |
6738fac1addda0f306ff3bd15ae6b1273ae0b0ea | TypeScript | AUSdomgarcia/angular2-journey | /038 Exercise/angular2-quiz/src/question.component.ts | 2.609375 | 3 | import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Question } from './question.model';
@Component({
selector: 'question',
template: `
<p>
<strong>{{question.text}}</strong>
</p>
<div class="indent">
<div *ngFor="let option of question.options">
<label>
... |
05cf68a5242ca24c4aac403e0787f0eccd0f8a61 | TypeScript | xXD4rkC0d3rXx/ab-testing | /src/modules/CacheTest.ts | 2.53125 | 3 | import Test from "../core/Test";
import {ICacheTest, ITestField, ITestFieldAdapter} from "../../types";
import {checkLocalStorage, checkWindowSupport} from "../helpers/checkSupports";
export default class CacheTest extends Test implements ICacheTest {
private readonly storage: Storage | undefined
constructor... |
92d5321bd874a6075511f341528b779b50c7785f | TypeScript | AlaaSayed794/image-processing-api-udacity-nd | /src/tests/indexSpec.ts | 2.5625 | 3 | import supertest from 'supertest';
import app from '../index';
import { getImage, getImagesDir } from '../utils/fsUtils';
import fs from 'fs';
import path from 'path';
const request = supertest(app);
describe('Test endpoint responses', () => {
const validFile = 'fjord';
const invalidFile = 'nonExistingFile';
co... |
f2d19a45fff9b9abaee8ff4e8aa1ad70df350d70 | TypeScript | selfrefactor/rambda | /source/indexBy-spec.ts | 3.203125 | 3 | import {indexBy} from 'rambda'
const list = [{a: {b: '1'}}, {a: {c: '2'}}, {a: {b: '3'}}]
describe('indexBy', () => {
it('happy', () => {
const result = indexBy(x => x.a.b, list)
const curriedResult = indexBy<any>(x => x.a.b)(list)
result.foo?.a.b // $ExpectType string | undefined
curriedResult // $... |
0077a76f759d8a26d48275a0e1a1722b838f78af | TypeScript | angular/angular | /packages/benchpress/test/validator/regression_slope_validator_spec.ts | 2.546875 | 3 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Injector, MeasureValues, RegressionSlopeValidator} from '../../index';
{
describe('regression slope valida... |
b7286b3f2084c43803a1df8b900be07f78427cf6 | TypeScript | uwdata/draco-tuner | /src/model/collection-item.ts | 2.921875 | 3 | import _ from 'lodash';
import { Chart, ChartObject } from './chart';
import { ConstraintMapObject } from './constraint-map';
import { Pair, PairObject } from './pair';
import { DracoSolution, ViolationMap } from './spec';
export interface CollectionItemObject {
type: CollectionItemType;
}
export class CollectionIt... |
f0884c370052047e828e30b2e1e208732bb65205 | TypeScript | KonstantinKliukach/js-warm-up | /passwordValidation.ts | 3.484375 | 3 | /*
You need to write regex that will validate a password to make sure it meets the following criteria:
At least six characters long
contains a lowercase letter
contains an uppercase letter
contains a number
Valid passwords will only be alphanumeric characters.
*/
function validate(password: string) {
return /^(?=... |
3a28f620348e1afe3761c02cb200b5d55e7b53f3 | TypeScript | minimizelab/sincerewines | /www/src/utils/functions.ts | 3.375 | 3 | import { WineType } from '../types/types';
export const wineType = (type: WineType): string | null => {
if (type === 'Red') return 'RÖDA VINER';
if (type === 'White') return 'VITA VINER';
if (type === 'Rose') return 'ROSÉVINER';
return null;
};
export const createArrayString = (array: Array<string>): string =... |
da97436caf2f2e479e955e2343a45ca33589dbb4 | TypeScript | aws/jsii | /packages/jsii/test/negatives/neg.implementation-changes-types.3.ts | 3.1875 | 3 | export class Superclass {}
export class Subclass extends Superclass {}
export interface ISomething {
takeSomething(argument: Superclass): void;
}
export class Something implements ISomething {
public takeSomething(_argument: Subclass): void {
// Nothing
}
}
|
81d5755690a833bf1fe0c713132667ae7c59188b | TypeScript | willowv/aeronauts-test | /src/simulation/map/map.test.ts | 3.015625 | 3 | import { Dijkstras } from "./map";
let testMapAdjacency = [
[false, true, true, false], // start node is adjacent to 2 and 3
[true, false, false, true], // mid nodes are adjacent to start and end, but not eachother
[true, false, false, true],
[false, true, true, false],
]; // end node is adjacent to 2 and 3
t... |
d72ded4ee9a5112a2e33b282379a762d9a52c00e | TypeScript | abdukhashimov/simple-todo-backend | /src/controllers/TodoGroupController.ts | 2.5625 | 3 | import { Request, Response, NextFunction } from 'express'
import { IRequest } from '../lib/Request'
import TodoGroup, { ITodoGroup } from '../models/TodoGroup'
import { ApiResponse } from '../lib/ApiResponse'
import { isValidObjectId } from 'mongoose'
export default class {
async create(req: IRequest, res: Respons... |
5a550ba6ea0602ba5e1722bb4fa5f7ced632a0a1 | TypeScript | isoundy000/BehaviourTree-ai | /source/src/behaviourTree/decorators/Decorator.ts | 2.65625 | 3 | module behaviourTree {
export abstract class Decorator<T> extends Behavior<T>{
public child!: Behavior<T>;
public invalidate(){
super.invalidate();
this.child.invalidate();
}
}
}
|
71ef7ac95f7480a9538e02b8096aaa707a77c462 | TypeScript | abhishekkanal1805/Jen | /services/utilities/timingUtility.ts | 2.765625 | 3 | /*!
* Copyright © 2019 Deloitte. All rights reserved.
*/
import * as log from "lambda-log";
import * as moment from "moment";
import { Constants } from "../../common/constants/constants";
import { errorCodeMap } from "../../common/constants/error-codes-map";
import * as config from "../../common/objects/config";
imp... |
1f6b026bcaacf0d512c742c4e6a28a754a7364eb | TypeScript | paulreitz/gw2-craft-angular | /src/app/models/node.model.ts | 2.8125 | 3 | import { ItemModel } from './item.model';
import { RecipeModel } from './recipe.model';
export class NodeModel {
item_id: number;
children: Array<NodeModel>;
id: string;
item: ItemModel;
constructor(item_id: number) {
this.item_id = item_id;
this.id = (parseInt(Math.random() * Math... |
5512ae46ec2b5198d17c96377e2e1665e60cca12 | TypeScript | CanadianCommander/rbtgen | /client/src/lib/report/sql/NodeOutputSqlGenerator.ts | 2.75 | 3 | import NodeOutput from "@/lib/report/reportModel/NodeOutput";
import {FieldType} from "@/lib/report/databaseModel/FieldType";
import ReportNode from "@/lib/report/reportModel/ReportNode";
import TemplateUtil from "@/lib/report/sql/TemplateUtil";
import ReportQueryService from "@/lib/report/ReportQueryService";
export ... |
bed91cad141b81f3741ea9d5ec7d8dd6d26f6ded | TypeScript | magland/sortingview-gui | /src/plugins/sortingview/gui/extensions/timeseries/TimeseriesViewNew/Mda.ts | 3.1875 | 3 | class Mda {
_N1: number = 1
_N2: number = 1
_N3: number = 1
_N4: number = 1
_N5: number = 1
_totalSize: number = 1
_data: Float32Array | Float64Array | Int16Array = new Float32Array(1)
constructor(n1?: number, n2?: number, n3?: number, n4?: number, n5?: number) {
this.allocate(n1 || 1, n2 || 1, n3, n4, n5)
}... |
0dde316defebc56d7f9bf51cbf956132a9f49cb6 | TypeScript | antvis/G2Plot | /__tests__/unit/plots/rose/pattern-spec.ts | 2.515625 | 3 | import { Rose } from '../../../../src';
import { salesByArea } from '../../../data/sales';
import { createDiv } from '../../../utils/dom';
describe('rose: pattern', () => {
const rose = new Rose(createDiv(), {
width: 400,
height: 300,
data: salesByArea,
xField: 'area',
yField: 'sales',
meta: ... |
98536fabc7c77a017139cb3ab4156bcbf4b23e49 | TypeScript | faverill/attendApp | /ClientApp/app/components/courses/courses.service.ts | 2.515625 | 3 | // import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import { Course } from './course.model';
import { ActivatedRoute, Router } from '@angular/router';
import { OnInit } from '@angular/core';
export class CoursesService {
coursesChanged = new Subject<Course[]>();
myCourse: Cour... |
6a033e1f08ffd7a5348592cffb759fe555c29d68 | TypeScript | story-ai/story-frontend-old | /src/strings/i18n.ts | 2.71875 | 3 | import { STRINGS } from "../config";
function replace(s: string, data: any[], i: number = 0): any[] {
if (i >= data.length) return [s];
const subs = s.split(`\${${i}}`).map(sub => replace(sub, data, i + 1));
const result = [subs[0]];
for (let subi = 1; subi < subs.length; subi++) {
result.push(data[i]);
... |
790a156e7317e96ac019dec76db8b3a6c712278c | TypeScript | EitanElbaz/json-2-yup | /src/tests/types/date/nullable.test.ts | 2.890625 | 3 | import { DateSchema, NumberSchema } from 'yup';
import { toYup } from 'src/toYup';
import { DateTypeSchema } from 'src/types';;
const schemaNullable: DateTypeSchema = {
type: 'date',
min: [''] as any, //purposely wrong for code coverage
max: [''] as any, //purposely wrong for code coverage
strict: true... |
511c8ee7118e865ffdeb41fbed3d8e76f6e61a8b | TypeScript | ducin-public/itcorpo-angular-app | /src/app/api/employees.mock.ts | 2.546875 | 3 | import { Employee } from "./dto";
export const mockEmployees: Employee[] = [{
id: 1,
nationality: 'US',
departmentId: 2,
keycardId: 'ABC123',
account: '123456789',
salary: 100000,
office: ['San Francisco', 'United States of America'],
firstName: 'John',
lastName: 'Doe',
title: '... |
eae7c53b0a521676a2186be5a61f412153ca59df | TypeScript | Motke84/Experimental-Twitter | /FrontEnd/app/Infra/Pipes/summary.pipe.ts | 2.703125 | 3 | import { Pipe, PipeTransform } from '@angular/core'
@Pipe({
name: 'summery'
})
export class SummaryPipe implements PipeTransform {
endSummary = "...";
delemiter = " ";
transform(value: string, args: string[]): string {
if (value) {
var wordsCount = args && args.length > 0 ?
... |
aaa3daa911ea729f9491dede427d510b3fe7fe4e | TypeScript | makstraw/Friday.TypeScript | /Friday.Base/Extensions/Array/LINQ/Methods/GroupBy.ts | 3.09375 | 3 | ///<reference path="../../../../Collections/KeyValuePair.ts"/>
interface Array<T> {
GroupBy<TKey>(keySelector: SelectorWithIndex<T, TKey>): Array<Friday.Collections.KeyValuePair<TKey, Array<T>>>;
GroupBy<TKey>(keySelector: SelectorWithIndex<T, TKey>, elementSelector: SelectorWithIndex<T, T>, compareSelector?: ... |
60cf467c8f752ae23a57f3d3f220d3a8402eae6e | TypeScript | Wesleyss071299/FotonBooks | /server/src/schemas/User.ts | 2.609375 | 3 | import Mongoose, { Schema, model, Document } from 'mongoose'
interface UserInterface extends Document {
name: string
email: string
password:string,
}
const UserSchema = new Schema({
name: String,
email: String,
password: String,
}, {
timestamps: true
})
export default model<UserInterface>('User'... |
aa7b618b21d9b8d944cbf00e1c2edf1a6988d012 | TypeScript | HugoMontes/curso-typescript | /07_herencia.ts | 3.6875 | 4 | // Crear la clase padre
class Padre{
// Atributos de clase
public nombre:string
public edad:number
// Constructor de clase
constructor(nombre:string, edad:number){
this.nombre = nombre
this.edad = edad
}
// Metodo de clase
mostrarDatosPadre():void{
console.log(`No... |
9c9af8fa070379772458a1785937f6b656fe4f26 | TypeScript | jsfuentes/Next-Base | /src/utils/time.ts | 2.890625 | 3 | import * as Sentry from "@sentry/react";
const debug = require("debug")("app:utils:time");
export function secondsToString(secs: number): string {
const hours = Math.floor(secs / (60 * 60));
const divisor_for_minutes = secs % (60 * 60);
const minutes = Math.floor(divisor_for_minutes / 60);
let timeStr = "";
... |
23d3448e4fd2a7869ccc7e6b9ec953ff05699d73 | TypeScript | lanemt/definitelytyped.github.io | /types/wav/wav-tests.ts | 2.5625 | 3 | import { createReadStream } from 'fs';
import { Reader, Writer, FileWriter } from 'wav';
const file = createReadStream('track01.wav');
const reader = new Reader();
const reader2 = new Reader();
const writer = new Writer({
sampleRate: 16000,
channels: 1
});
const fileWriter = new FileWriter('./test.wav', {
samp... |
0c4cbd55d5e1c99f43e9a3c28fff732361bad2a6 | TypeScript | SlepoRus/alla_pugacheva | /src/helpers/actions.ts | 2.765625 | 3 | import {Character} from "../core/Character";
import {WeaponSpecial} from "../types/items";
import {GameEvents} from "../core/Event";
export function getDamageOnFight(ch1: Character, ch2: Character) {
const dmg = ch1.getCharacterDamage();
const def = ch2.getCharacterDefence();
return Math.max(dmg - def, 0)... |
d4b54c90d24bafc16c91883680da776de3ad42d2 | TypeScript | jambit/wdio-cucumber-selected-steps | /packages/library/src/support/elements/selectOption.ts | 3.125 | 3 | import { ElementQuery } from '../elementQuery';
import { failMessage } from '../failMessage';
const TYPE_HANDLERS = {
name: (element: ElementQuery, value: string) => element().selectByAttribute('name', value),
value: (element: ElementQuery, value: string) => element().selectByAttribute('value', value),
tex... |
310a6c27a52a1e1fb29331da1c1a125024cf1d8d | TypeScript | mark-ting/228-discord-bot | /src/commands/Help.ts | 2.640625 | 3 | import { CommandDetailEmbed } from '@embeds/CommandDetailEmbed'
import { CommandListEmbed } from '@embeds/CommandListEmbed'
import { Command, Parameter } from '@models/Command'
import { Core } from '@src/Core'
import { Message, PermissionString } from 'discord.js'
import { Arguments } from 'yargs-parser'
class HelpCom... |
562fc8f9c72fcd48f432d807b9f6cce5de7bc102 | TypeScript | AmyAssist/Amy-Web | /src/app/Plugins/Navigation/Components/departure-planner/departure-planner.component.ts | 2.59375 | 3 | import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { NavigationDataService } from '../../Services/navigation-data.service';
import { NavPath } from '../../Objects/navPath';
import { BestTransportResult } from '../../Objects/bestTransportResult';
import { combineLatest, Observable } from 'rxjs'... |
0273eea71c8e96528f72753056957c7963559bd8 | TypeScript | takumi-maki/techpit-form | /front/src/domain/entity/alert.ts | 2.515625 | 3 | export type AlertState = {
severity: AlertSeverity;
message: string;
open: boolean;
};
export type AlertSeverity = "error" | "success"; |
b98e2f59ad8fad018e664ba14b889b4792ec66e9 | TypeScript | Julien5151/bros-node-server | /src/utils/middlewares/auth.ts | 2.75 | 3 | import { RequestHandler } from "express";
import jwt, { Secret } from "jsonwebtoken";
import { User } from "../../models/user";
import { SpecialUsers, UserRole } from "../types/enums";
import { CustomError } from "../types/interfaces";
export const authController: RequestHandler = async (req, res, next) => {
// Ex... |
2913924c1498f0adb79bf2695975d7a8d55006ef | TypeScript | lauri3new/light-fp | /src/Arrow/index.ts | 3.109375 | 3 | // import { Either, Left, Right } from '../Either'
// import { Context } from './Server/index'
// // Orthogonal
// // Composable
// type naka = { ok: number }
// type yela = { ok: 123, nok: 'xhe' }
// const af = <A, B, D>(f: (_:A) => B, g: (_:B) => D) => (v: A) => g(f(v))
// const toStuff = (): yela => ({ ok: 123, no... |
a5ec4a558aae64608388ce2f2d4fd94719136509 | TypeScript | magicly/ts-egg-demo | /app/service/home.ts | 2.578125 | 3 | import { Service } from 'egg';
interface NewsResult {
success: boolean;
data: Array<{
id: string;
author_id: string;
content: string;
title: string;
create_at: string;
author: {
loginname: string;
avatar_url: string;
};
}>;
}
export default class Home extends Service {
... |
c11549de0171e9688563443ca79e6e3410a9c05d | TypeScript | growyourlist/gyl-admin-ui | /src/common/api.ts | 2.625 | 3 | import { apiRequest } from "./apiRequest"
export interface List {
name: string
id: string
sourceEmail: string | null
}
export const fetchListsList = async (): Promise<List[]> => {
const response = await apiRequest('/admin/lists')
const lists = await response.json()
return <List[]>lists
}
export const postList ... |
87f07349b83f847dd8e9b829ca9f77df00bbf6a2 | TypeScript | JR-Pikachu/JR-Blog | /src/app/article.service.ts | 2.515625 | 3 | import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
interface ArticleEditResponse {
success: boolean;
}
@Injectable({
providedIn: 'root'
})
export class ArticleService {
private _api = 'http://localhost:3000/';
private httpOptions = {
headers: new H... |
32f27429453ccca20e4a2037dfc469c873f356a0 | TypeScript | CarlosWGama/ionic2-lista-compras | /src/providers/compras.ts | 2.5625 | 3 | import { Injectable } from '@angular/core';
import { Compra } from './../models/compra.model';
declare var firebase;
@Injectable()
export class Compras {
private db;
private usuarioID;
constructor() {
console.log('Hello Compras Provider');
this.db = firebase.database();
this.usuarioID = firebase.... |
ebc23d0e8f19eeff2de655ef06fef2f5cf066611 | TypeScript | mjwbenton/mattb.tech-graphql-api | /api-lambda/src/SpotifyApi.ts | 2.640625 | 3 | import axios from "axios";
import doAndCache from "./doAndCache";
import { getAccessToken } from "@mattb.tech/graphql-api-oauth-lib";
import { KeyValueCache } from "@apollo/utils.keyvaluecache";
export type Playlist = {
id: string;
name: string;
description: string;
tracks: Array<Track>;
link: string;
};
ex... |
8defd46ef2924f0fcaae661149a87d0174a52ec1 | TypeScript | sujithreddy9493/ngbatch | /typescript/interface.ts | 3.40625 | 3 | function interconnect(data:number, b:number ){
console.log(typeof data);
data ="nameDetails"
console.log(typeof data);
}
interconnect("content", 10);
interconnect(10,"20");
let dataInfo:string[] =["suji","nani"]
let details:[string,string] = ["",""]
let name_2:string;
name_2 =10;
console.log("name... |
03baa223c8bb8186ad44d7bcf56ab3724b47ddaa | TypeScript | stnswz/nextjs-examples | /components/hooks/useDataLoadAPI.ts | 2.609375 | 3 | import { useState, useEffect } from 'react';
import axios, {AxiosResponse} from 'axios';
const useDataLoadAPI = (preloadedData:any, initialURL:string, initialSearchText:string): Array<any> => {
console.log('useDataLoadAPI')
const [url, setURL] = useState(initialURL);
const [searchText, setSearchText] = useState... |
3f373c9d38ae93945c0a90c20f3251c28a8b8b30 | TypeScript | nomanHasan/datatable | /ng-datatable/src/app/table-data/table-data.model.ts | 3.265625 | 3 | // import * as randomWords from 'random-words';
// const randomWords = () => 'CELL';
const word = (length = 7) => {
if (!length) {
length = num(10);
}
const vowels = 'aeiou';
const constants = 'qwrtpsdfghjklzxcvbnm';
let text = '';
Array(length)
.fill(0)
.forEach(... |
082dc8902c88f0a34f03a40dd971ff83bdccf5e3 | TypeScript | dorward/intercode | /app/javascript/CmsAdmin/queries.generated.ts | 2.5625 | 3 | /* eslint-disable */
import * as Types from '../graphqlTypes.generated';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
export type CmsAdminBaseQueryQueryVariables = Types.Exact<{ [key: string]: never; }>;
export type CmsAdminBaseQueryQuery = (
{ __typename: 'Query' }
& { convent... |
1adf9797d326a65f192233ea169f3c28c21c1be3 | TypeScript | arcanist123/transpiler | /packages/transpiler/src/keywords.ts | 2.78125 | 3 | import * as abaplint from "@abaplint/core";
/** Replaces javascript keywords in ABAP source code, in-memory only */
export class Keywords {
public handle(reg: abaplint.IRegistry) {
reg.parse();
for (const o of reg.getObjects()) {
if (!(o instanceof abaplint.ABAPObject)) {
continue;
}
... |
48a553d83bec568b136c585fbb8e4e1866a0ad39 | TypeScript | andirsun/nestjs-rest-api | /src/modules/time/application/time.service.ts | 3.015625 | 3 | import { Injectable } from "@nestjs/common";
/*JS Moment dependence */
const moment = require('moment-timezone');
/*Additional interfaces*/
import { UserPromCodeInterface } from "../../../barbers/user/domain/interfaces/user-promcode.interface";
@Injectable()
export class TimeService{
/*
This function takes as ... |
e4ed61e2bf12da0c43e1087b44ae588e63c222f1 | TypeScript | omerman/simple-forgein-exchange-positions-table | /packages/client/src/typings/common/data-table.ts | 2.8125 | 3 | export type IOrderDirection = 'asc' | 'desc';
export interface IGetDataOptions<T> {
page: number,
rowsPerPage: number,
orderBy?: keyof T,
orderDirection?: IOrderDirection,
searchPhrase?: string,
}
export interface IDataTable<T> {
getTotalCount: () => Promise<number>;
getData: (options: IGetDataOptions<T>... |
108099097c54b2bd4eb80f847cd6cadc213c0ff1 | TypeScript | anhquandlqb2001/roadmap-server-nodejs | /src/controllers/user.ts | 2.609375 | 3 | import { Request, Response } from "express";
import { formValidate } from "../lib/util/formValidate";
import findOneAndUpdateOrCreate from "../lib/util/findOneAndUpdateOrCreate";
import { IFormDataToClientSuccess, EProvider } from "../lib/types/form.type";
import User from "../models/user";
// POST: Dang ky - Provider... |
ba4529e3a27a16bb9e5c4f662700463fa58b26d8 | TypeScript | SINHASantos/fusionjs | /fusion-core/src/sanitization.ts | 2.84375 | 3 | /** Copyright (c) 2018 Uber Technologies, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
/*
We never want developers to be able to write `ctx.template.body.push(`<div>${stuff}</div>`)`
because that allows XSS attacks by defaul... |
f4ef7647bac62ff041fef73d015ce5f373f33db0 | TypeScript | gitEllE-if/TypeScript_lessons | /src/scripts/search-results.ts | 2.5625 | 3 | import { renderBlock, insertBlock, removeBlockChilds } from './lib';
import { Place } from './domain/place';
import { placeStorage } from './storage';
export function renderSearchStubBlock(): void {
renderBlock(
'search-results-block',
`
<div class="before-results-block">
<img src="img/start-search... |
3aa40516d907f947a99f8c083673dea8f90d1c38 | TypeScript | mcampster/angular-routing | /src/state/stateComparer.ts | 2.71875 | 3 | /// <reference path="../refs.d.ts" />
/// <reference path="state.ts" />
class StateComparer {
public buildStateArray(state, params) {
function extractParams() {
var paramsObj = {};
if (current.route) {
forEach(current.route.params, (param, name) => {
... |
0179103b57d4469f24819667f37b8d49822e78f1 | TypeScript | Fowindev/grin-server | /src/controller/index.ts | 2.90625 | 3 | import express from 'express';
import { RouteEntry, RoutesMetadata } from "../methods";
interface ControllerMetadata {
basePath?: string;
middlewares?: express.RequestHandler[];
routes: RouteEntry[];
}
interface ControllerOptions {
middlewares?: express.RequestHandler[];
overwrite?: boolean;
}
/**
* Clas... |
f71784c56b0c384d710c3b05effeb45d56e539e4 | TypeScript | chriswa/voxel2 | /src/common/v3.ts | 3.4375 | 3 | const EPSILON = 0.000001
export default class v3 {
a: Float32Array
constructor(x = 0, y = 0, z = 0) {
this.a = new Float32Array([ x, y, z ])
}
get x() { return this.a[0] }
get y() { return this.a[1] }
get z() { return this.a[2] }
set x(v: number) { this.a[0] = v }
set y(v: number) { this.a[1] = v }
set z(... |
7ba200069665e65448b6cbfcd7dea81ca766e3d9 | TypeScript | marcelomanchester/ToDoList | /todo-app/src/app/todo-list/todo-list.component.ts | 2.515625 | 3 | import { Component} from '@angular/core';
@Component({
selector: 'todo-list',
templateUrl: './todo-list.component.html',
styleUrls: ['./todo-list.component.css']
})
export class TodoListComponent {
atividade: string = '';
nova: string = '';
listaAtividades:Array<string> = [];
pesquisa: string = '';
li... |
e1520738691e720a999e270751ef5fcd5864c99a | TypeScript | angulardynamic/DataBroker | /src/filter/jsonata.ts | 2.625 | 3 | // TODO: Implement JSONata
// //var jsonata = require("jsonata");
// import * as jsonata from 'jsonata';
// import { Injectable } from '@angular/core';
// @Injectable()
// export class Jsonata
// {
// filter(query: string, item: any, data: any): boolean
// {
// let expression = jsonata(query);
// ... |
253061f94efd6fe702fe1ae0e7a8d648c0ee94a2 | TypeScript | htndev/server-toolkit | /src/graphql/types/exists.type.ts | 2.78125 | 3 | import { Field, ObjectType } from '@nestjs/graphql';
@ObjectType({ description: 'API response, that something exists or not.' })
export class ExistsType {
@Field(() => Boolean)
exists!: boolean;
}
|
402038fe233f9ed7223ec5c4eaed5a8dde99a326 | TypeScript | doubleproject/cli | /src/tests/lib/utils/compat.test.ts | 2.546875 | 3 | import * as os from 'os';
import test from 'ava';
import * as compat from '../../../lib/utils/compat';
test('should be able to untildify path', t => {
const home = os.homedir();
t.is(compat.untildify('~'), home);
t.is(compat.untildify('~/hello'), `${home}/hello`);
t.is(compat.untildify('~/hello/~/world'), `... |
8c720f95c7e8d9ca2a099e98960b752f2c70ec0c | TypeScript | LudmilaSchlegelova/Attribute-Directives-Angular-project | /attributeDirectives/src/app/custom-directive/custom-directives-item/custom-directives-item.component.ts | 2.5625 | 3 | import { Component, OnInit } from '@angular/core';
import { customAnimation } from 'src/app/customanimation';
interface Countries {
id: number;
title: string;
visible: string;
}
@Component({
selector: 'app-custom-directives-item',
templateUrl: './custom-directives-item.component.html',
styleUrls: ['./cust... |
947f1bbcffc35c97a94b8698066c369abcfe89c3 | TypeScript | toteach/client-ui | /src/types.ts | 2.546875 | 3 | export type TColorModifiers =
'white' |
'black' |
'light' |
'dark' |
'primary' |
'info' |
'success' |
'warning' |
'danger' |
'text';
export type TSizes =
'small' |
'medium' |
'large';
export type TPositions =
'top' |
'left' |
'bottom' |
'right';
exp... |
a4b33ede88ac15c51a2f89895652578198f67bb2 | TypeScript | fltenwall/pnpm | /packages/supi/src/install/createVersionsOverrider.ts | 2.71875 | 3 | import { Dependencies, PackageManifest, ReadPackageHook } from '@pnpm/types'
import parseWantedDependency from '@pnpm/parse-wanted-dependency'
import semver from 'semver'
export default function (overrides: Record<string, string>): ReadPackageHook {
const genericVersionOverrides = [] as VersionOverride[]
const ver... |
c311ebacc0fb6d027f58fb3a49997d21eec09363 | TypeScript | Nasisolo/vscode-database | /src/extension/engine/mysql-ssl.ts | 2.59375 | 3 | import * as fs from 'fs';
import { createConnection, ConnectionConfig } from 'mysql';
import {MySQLType} from './mysql-pass';
import { AnyObject } from '../../typeing/common';
export class MySQLSSLType extends MySQLType {
public ca: string;
public key: string;
public cert: string;
constructor() {
... |
63fc186d8f4025a9b00656daeca998e84e75e3fc | TypeScript | danicv94/hitTheButton | /src/app/multi/multi.page.ts | 2.609375 | 3 | import { Component } from '@angular/core';
@Component({
selector: 'app-multi',
templateUrl: './multi.page.html',
styleUrls: ['./multi.page.scss'],
})
export class MultiPage {
showStart: boolean = true;
showCountdown: boolean = false;
showGame: boolean = false;
timeout: number = 3;
timeLeft: number = 5... |
618264f8457a3bf046210f8d2787fd7d7fdd80e8 | TypeScript | nilaymaj/git-playground | /src/simulator/git-repository/index-file/index.test.ts | 2.953125 | 3 | import IndexFile from './index';
import { FileBlob } from '../../file-system';
import { createSampleFS } from '../../file-system/index.test';
import ObjectStorage from '../object-storage';
import { hashBlobObject } from '../object-storage/hash-object';
import { InvalidArgError } from '../../utils/errors';
const create... |
ccd5c67f094df0a8e826edeb4e8e376fe9313f79 | TypeScript | Shomrey/Remote-laboratory-engineer-thesis | /Server/src/user/error/user-not-found.error.ts | 2.53125 | 3 | import {HttpException, HttpStatus} from "@nestjs/common";
export class UserNotFoundError extends HttpException {
constructor(userId: number) {
super(`User with ID ${userId} was not found`, HttpStatus.NOT_FOUND);
}
} |
c1c968353a285f3ccecde08b2cc6346e8aa51335 | TypeScript | matejanajdanov/Finanse-app | /src/resolvers/User.ts | 2.71875 | 3 | import {
UseMiddleware,
ObjectType,
Resolver,
Mutation,
Field,
Query,
Ctx,
Arg,
} from "type-graphql";
import { AuthMiddleware } from "../middlewares/authMiddleware";
import { RequestResponseExpress } from "../types";
import { hash, verify } from "argon2";
import { User } from "../entity/User";
@Objec... |
c772c30274a18b06cdae1f0f0513219148656141 | TypeScript | future4code/Lucas-Campioto | /semana19/FutureBook/src/business/usecase/user/deleteFriendshipUC.ts | 2.75 | 3 | import { UserDB } from "../../../data/userDataBase";
export class DeleteFriendshipUC {
constructor(private db: UserDB){}
public async execute(input: DeleteFriendshipInput): Promise<DeleteFriendshipOutput>{
try{
await this.db.deleteFriendship(input.userId, input.friendId)
await... |
34635df4ebae0ca582458af4c4126070df7164f0 | TypeScript | dlabaj/patternfly-react | /packages/react-integration/demo-app-ts/src/components/demos/TopologyDemo/layouts/defaultLayoutFactory.ts | 2.59375 | 3 | import {
Graph,
Layout,
LayoutFactory,
ForceLayout,
ColaLayout,
ConcentricLayout,
DagreLayout,
GridLayout,
BreadthFirstLayout
} from '@patternfly/react-topology';
import { ColaGroupsLayout } from '@patternfly/react-topology/dist/esm/layouts/ColaGroupsLayout';
const defaultLayoutFactory: LayoutFactory... |
afb89e1799ff1a2c0f59b57fc077a85b9adf4260 | TypeScript | Simply-divine/Bower_in_Production | /production/bower_components/amcharts4/src/.internal/charts/elements/FlowDiagramLink.ts | 2.640625 | 3 | /**
* FlowDiagramLink module
*/
/**
* ============================================================================
* IMPORTS
* ============================================================================
* @hidden
*/
import { Sprite } from "../../core/Sprite";
import { Container, IContainerProperties, IContaine... |
4a5cf3d883b36c53ac9dfdc5520f9f89ef91cf35 | TypeScript | leomleao/pricingIC | /src/users/users.service.ts | 2.890625 | 3 | import { Inject, Injectable, BadRequestException} from '@nestjs/common';
import { Repository } from 'typeorm';
import { User } from './user.entity';
import * as bcrypt from 'bcrypt';
@Injectable()
export class UsersService {
constructor( @Inject('UserRepositoryToken') private readonly userRepository: Repository<User... |
2409c4b3cad95c0351572fc9214edc4eb0891938 | TypeScript | kuboosoft/fx_cast | /ext/src/lib/options.ts | 3.3125 | 3 | "use strict";
import defaultOptions, { Options } from "../defaultOptions";
/**
* Fetches `options` key from storage and returns it as
* Options interface type.
*/
async function getAll (): Promise<Options> {
const { options }: { options: Options } =
await browser.storage.sync.get("options");
... |
eace868b2065d46ca8d865b78ded52766cd2c3c9 | TypeScript | Swiftx/koa-restful-router | /src/decorators.ts | 3.078125 | 3 | export const RESTfulType = Symbol();
export const RESTfulName = Symbol();
export const RESTfulCheck = Symbol();
export const MethodArgs = Symbol();
/**
* REST资源控制器
* @param {string} path
* @param {Object} where
* @returns {(target: Function) => void}
* @constructor
*/
export const RESTful = (path:str... |
851ae37234b55b16028f95b63a66afbee4cfbc7e | TypeScript | osharper/SignalR4SimpleWebRtc | /Scripts/EventEmitter.ts | 3.453125 | 3 | interface IEventEmitter
{
on(eventName: string, callback: (...args: any[]) => void) : IEventEmitter;
emit(eventName: string, ...args: any[]);
off?(eventName: string, exCallback?: Function);
}
class EventEmitter implements IEventEmitter {
protected events: { [event: string]: Function[] } = {};
on(event: string... |
d5c936ada3e5d6fef773430f9312a5a7fc6fab53 | TypeScript | thierry-capgemini/jump-the-queue-nextjs | /pages/api/visitor.ts | 2.6875 | 3 | import {environment} from '../../environments/environment'
import fetch from 'isomorphic-unfetch'
export default async (req, res) => {
// Get data from your database
const { visitor } = await req.body
console.log('visitor was here', visitor)
const baseUrl = environment.baseUrlRestServices;
... |
693272fd9000d9c18fc512661b8b60cf2f1ce387 | TypeScript | scottostler/conspirator | /test/game.ts | 2.65625 | 3 | import { expect } from 'chai';
import * as cards from '../src/cards';
import { Copper, Estate } from '../src/sets/common';
import * as testsupport from './testsupport';
import * as util from '../src/utils';
import expectEqualCards = testsupport.expectEqualCards;
import expectPlayerHandSize = testsupport.expectPlayerH... |
06f9f0807b7fd6902b11e4522367e7283b06c24d | TypeScript | yeomann/nestjs-oauth2 | /src/apps/oauth2/modules/oauth2/utils/index.ts | 2.671875 | 3 | import { Response } from 'express';
import { ResponseModes } from '../constants';
import * as qs from 'querystring';
import { AuthRequest } from '../auth.request';
/**
* Handle consent redirect, based on response_mode param
* Available modes:
* * query (default): return the params as querystring
* * fragment: retu... |