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 |
|---|---|---|---|---|---|---|
d563ef7c861d81b073e2ee1de6d4b2d1f0b94e67 | TypeScript | jjPlusPlus/not-trello | /src/actions/columns.ts | 2.78125 | 3 | import * as constants from "../constants";
import { Card, Column } from "../types";
export interface NewColumn {
type: constants.NEW_COLUMN;
}
export interface AddColumn {
type: constants.ADD_COLUMN;
payload: {
name: string;
};
}
export interface RemoveColumn {
type: constants.REMOVE_COLUMN;
payload: {... |
ae6f8c7c048e14c7545902d886909fcb2567416b | TypeScript | arknotts/TypeScript-Angular-Utilities | /source/services/test/mockAsync.tests.ts | 2.828125 | 3 | import { Observable } from 'rxjs';
import { mock, IMockedRequest } from './mockAsync';
import { rlFakeAsync } from './fakeAsync';
interface ITestType {
value: number;
}
interface ITestDataService {
request1: IMockedRequest<ITestType>;
request2: IMockedRequest<ITestType>;
}
describe('mockAsync', () => {
it('shou... |
a395559ce9491e7f4ec164cbf82ba310eca0868b | TypeScript | darky/Nothing | /index.d.ts | 2.78125 | 3 | interface INothing {
(): INothing;
(p1: any): INothing;
(p1: any, p2: any): INothing;
(p1: any, p2: any, p3: any): INothing;
(p1: any, p2: any, p3: any, p4: any): INothing;
(p1: any, p2: any, p3: any, p4: any, p5: any): INothing;
(p1: any, p2: any, p3: any, p4: any, p5: any, p6: any): INothing;
(p1: any... |
a8dcfad231c7ee14e6979d8940cafd458a4c59d8 | TypeScript | GoogleChrome/workbox | /packages/workbox-webpack-plugin/src/lib/get-asset-hash.ts | 2.59375 | 3 | /*
Copyright 2018 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
import crypto from 'crypto';
import type {Asset} from 'webpack';
/**
* @param {Asset} asset
* @return {string} The MD5 hash of the ass... |
fe3902dcc22410e72b65df4719fdc0b5204badb8 | TypeScript | tylerhubert/rsql-criteria-typescript | /src/files/rsql-criteria.ts | 3 | 3 | import { RSQLFilterList } from './rsql-filter-list';
import { RSQLOrderByList } from './rsql-order-by-list';
import { RSQLBuildOptions } from './rsql-build-options';
/**
* Main class for bringing together API filtering, sorting and pagination.
*/
export class RSQLCriteria {
public orderBy: RSQLOrderByList;
publi... |
68785522a5948ddc2856bbec33759f8c8650e76e | TypeScript | thomas-crane/sgml | /src/syntax/syntax-kind.ts | 2.59375 | 3 | export enum SyntaxKind {
// tokens
FirstToken,
EOF,
Unknown,
// literals
IntLiteral,
RealLiteral,
HexLiteral,
StringLiteral,
Identifier,
TrueLiteral,
FalseLiteral,
// misc
Dot,
Semicolon,
Colon,
Comma,
Bang,
QuestionMark,
Hash,
At,
// variables
Equals,
PlusEquals,
Minus... |
dec44f63c94987c2dc1dd952067d3a7fdef49a17 | TypeScript | christinebelle/MaxTodoListe | /src/app/service/dataliste.service.ts | 2.578125 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { BehaviorSubject, Observable, of } from 'rxjs';
import { Projet } from '../modeles/Projet';
import {map} from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class DatalisteService {
public projetl... |
6bbeb9ca3bb0cc33000264cf4fc0d97f525e05c7 | TypeScript | jubran/demo-react-redux-saga-ts | /src/components/login/loginReducer.ts | 2.84375 | 3 | import {ActiveUserType} from "./LoginTypes";
import {LOGIN_FAIL, LoginReducerActionTypes} from "./loginActionTypes";
const defaultLoginState: ActiveUserType = {
isLoginFailed: false
};
export const loginReducer = (state = defaultLoginState, action: LoginReducerActionTypes): ActiveUserType => {
switch (action... |
85e215113bdec19228ae5c105e9f90f86289dbd2 | TypeScript | riiiiion/spotify-mix-automation | /lib/type/handler.ts | 2.78125 | 3 | import type { NextApiRequest, NextApiResponse } from 'next';
interface SessionContent {
userId: string,
accessToken: string
refreshToken?: string,
authedTs: string,
expiresIn: number,
}
interface Request<T> extends NextApiRequest {
body: T,
session: {
set: (
name: strin... |
8df813341660793c1f9566df88dd50ad5bab5cac | TypeScript | Gaubee/Simple-OMS | /src/app/md-dev-com/core/portal/portal-errors.ts | 3.0625 | 3 | import {MdError} from '../errors/error';
/** Exception thrown when attempting to attach a null portal to a host. */
export class MdNullPortalError extends MdError {
constructor() {
super('Must provide a portal to attach');
}
}
/** Exception thrown when attempting to attach a portal to a host that is already... |
1d7ebd79eed159b6277af871252b1975e247c9f4 | TypeScript | PaulKovalov/codehub-frontend | /src/app/accounts/userform-utils.ts | 2.671875 | 3 | import { FormGroup, ValidationErrors, ValidatorFn } from '@angular/forms';
export interface FormControlError {
control: string;
error: string;
value: any;
}
export function getFormValidationErrors(form: FormGroup) {
const result: FormControlError | ValidationErrors[] = [];
if (form.errors) {
result.push... |
5dcb700bda2a02ae749f0ba61155536674351f18 | TypeScript | adjust/web_sdk | /src/sdk/smart-banner/utilities.ts | 3.21875 | 3 | /**
* Wraps JSON.parse() with try-catch.
* Returns parsed object if successfully parsed and null otherwise.
*/
export function parseJson(str?: string | null): any {
if (!str) {
return null
}
try {
return JSON.parse(str)
} catch (error) {
return null
}
}
|
49bbd8e3a8b2bbd57ac7b2a0fb202394780e6367 | TypeScript | elJuanjoRamos/-OLC2-Proyecto-1 | /src/app/jison/tools/sentences/Call.ts | 2.65625 | 3 | import { Console } from './Console';
import { TablaSimbolosController } from 'src/app/components/controller/tablasimbolo.conroller';
import { Expression } from '../abstract/expression';
import { Instruction } from '../abstract/instruction';
import { Ambit } from '../id/ambit.identifier';
import { Literal } from '../exp... |
81ec061ad8f65fefa8486727579d89393b5eaf9f | TypeScript | wildex999/Derange.io | /src/common/sync/syncobject.ts | 3.328125 | 3 | /**
* Place as decorator on properties to sync which are an object.
* The object type to sync must have a @SyncedObject placed on it.
* They are essentially groups of synced properties.
*/
export function SyncObject(target: any, key: string) {
//TODO: Same as Sync, but should call the target's Encode/Decode met... |
2104d6cdd6a0a218efad9ce342906b3b9def40d4 | TypeScript | haohaaorg/frontend-dataform | /src/store.ts | 2.640625 | 3 | import { createStore, applyMiddleware } from "redux";
import { composeWithDevTools } from "redux-devtools-extension";
import thunk from "redux-thunk";
import rootReducer from "./reducers";
const initialState = {};
const middleware = [thunk];
const store = createStore(
rootReducer,
initialState,
composeWithDevT... |
fe43f2f78429603a2976d4aaee342ef7cbe5ca17 | TypeScript | shakya008/data-prefetch | /src/producer.ts | 2.90625 | 3 | /**
* This is an abstract class with one method as abstract.
* fetchdata() should be implemented by integration class whitch has implementation to fetch data
* from destination resource like server.
* @author Shyam Singh<singh.shakya008@gmail.com>
*/
import { Observable } from 'rxjs/Observable';
export abstract class ... |
bb61128716605e85be67d0c402a3d7a97055b13b | TypeScript | yorni/indicators | /lib/src/providers/percent-rank.d.ts | 2.515625 | 3 | /**
* Returns the percentile of a value. Returns the same values as the Excel PERCENTRANK and PERCENTRANK.INC functions.
*/
export declare class PercentRank {
private period;
private values;
private fill;
constructor(period: number);
nextValue(value: number): number;
momentValue(value: number)... |
e2fd38c2692ea251125008dd3c5f77a588639013 | TypeScript | Ciantic/model-validation | /test/example-with-typescript.ts | 3.03125 | 3 | import * as V from '../index';
interface Address {
city : string
street : string
}
var addressValidator = V.object<Address>({
city : V.required(V.string),
street : V.string,
});
interface User {
id: number
name: string
email: string
address: Address
}
var userValidator = V.object<Use... |
efa57effb29080b3347f0082af27e5f1fab3e5a9 | TypeScript | pmill/ml-ui | /src/app/core/models/abstract.model.ts | 2.640625 | 3 | import {Model} from './model.interface';
import {getMetadataMap} from './decorators/model-decorators.helpers';
export class AbstractModel implements Model {
fillFromApiResponseData(apiResponseData: Object): void {
getMetadataMap(this).forEach((propertyMetadata, propertyKey) => {
const apiKey = ... |
aadb7cb5743c73ce2219078c6748e44b0b5a858c | TypeScript | alepim-dev/NLW-Together | /src/services/CreateUserService.ts | 2.859375 | 3 | import { getCustomRepository } from "typeorm";
import { UserRepositories } from "../repositories/UsersRepositories";
import{hash} from"bcryptjs";
interface IUserRequest{
name:string;
email:string;
password:string;
admin?: boolean;
}
class CreatUserService{
async execute({name,email,admin=false,pa... |
8b1015de0be501845f912d1cda09fd3c1a7916a7 | TypeScript | nosteiner/four-in-a-row | /src/app/models/Player.ts | 2.984375 | 3 | import { Color } from './Color';
export class Player {
id: Number;
isTurn: Boolean;
color: Color;
constructor(id, color) {
this.id = id;
this.isTurn = false;
this.color = color;
}
changeTurn() {
this.isTurn = !this.isTurn;
}
}
|
57bac391e90e3670e64ba202747da93351e243a3 | TypeScript | mariusmoe/polling-stations | /client/src/app/services/search.service.ts | 2.875 | 3 | import {
HttpClient,
HttpErrorResponse,
HttpHeaders,
} from '@angular/common/http';
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { throwError } from 'rxjs';
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
}),
};
@Injectab... |
7a047795c4fbc28fe3933c3c12eaeefd6c27a992 | TypeScript | kronick/race-playback | /src/utilities/vessel-data.test.ts | 2.984375 | 3 | import { interpolatePosition } from "./vessel-data";
import { PositionsArray } from "../shared-types/race-data";
// Fixtures
const twoPointsFixture = (): PositionsArray => [
{ timestamp: 0, coordinates: [0, 0], heading: 0, speed: 0 },
{ timestamp: 1, coordinates: [1, 1], heading: 1, speed: 0 }
];
const threePoints... |
e8edf9aae7a9ebbb168fdeb89985e9248b1e48b5 | TypeScript | MarlonReis/MarvelDeveloper | /test/infrastructure/database/orm/repository/user/FindUserAccountByEmailORMRepository.test.ts | 2.578125 | 3 | import {
FindUserAccountByEmailORMRepository
} from '@/infrastructure/database/orm/repository/user/FindUserAccountByEmailORMRepository'
import {
MySQLTypeOrmConnection
} from '@/infrastructure/database/orm/connection/MySQLTypeOrmConnection'
import {
CreateUserAccountORMRepository
} from '@/infrastructure/databa... |
fabbcd3d8e44daf9fe9b8bb0a106a860b8a0abdf | TypeScript | RobLoach/twing | /test/tests/unit/node/expression/test.ts | 2.640625 | 3 | import {Test} from "tape";
import TwingMap from "../../../../../src/map";
import TwingNodeExpressionConstant from "../../../../../src/node/expression/constant";
import TwingTestCompilerStub from "../../../../compiler-stub";
import TwingNode from "../../../../../src/node";
import TwingNodeExpressionTest from "../../../.... |
b0b8c9e4dd89e0ee9b9d6dbe051750add426df44 | TypeScript | Troyan37/recipe-app | /src/app/shopping-list/shopping-list.service.ts | 2.78125 | 3 | import { Subject } from "rxjs";
import { Ingredient } from "../shared/ingredient.model";
export class ShoppingListService {
shoppingItemAdded = new Subject<Ingredient[]>();
private ingredients : Ingredient[] = [
new Ingredient('Apples', 5),
new Ingredient('Tomates', 4)
];
addIngred... |
1cde28cf7ac0a043ebb4d50f9f231440039d4622 | TypeScript | lodka17/uchi-ru | /src/api/API.types.ts | 2.625 | 3 | type Method = (url: string, payload?: object, queryParams?: object) => Promise<any>
export interface MethodDescriptor extends PropertyDescriptor {
value?: Method | undefined
}
export namespace Endpoint {
export type Id = number
export type Body = string
}
export interface IInstanceAPI {
readonly endp... |
201a0a18426e2324442a44877bd155d54d460996 | TypeScript | birdofpreyru/react-global-state | /__tests__/ts-types/GlobalState/get.ts | 3.1875 | 3 | import { expectError, expectType } from 'tsd-lite';
import GlobalState from 'src/GlobalState';
type ValueT = 'value-a' | 'value-b';
type StateT1 = {
some: {
path: ValueT;
};
};
const gs = new GlobalState<StateT1>({ some: { path: 'value-a' } });
expectType<StateT1>(gs.getEntireState());
expectError(() => gs... |
3a7a1d55721f553813cffc0204da0e47d098e513 | TypeScript | hduprat/advent-of-code-2020 | /20/image.ts | 2.703125 | 3 | import { toNumber } from "../utils/number";
import { Tile } from "./tile";
export const getImage = (
arrangementMap: Map<string, Tile>,
gridSize: number
): string[] => {
let [xmin, ymin, xmax, ymax] = [0, 0, 0, 0];
arrangementMap.forEach((_, coords) => {
const [x, y] = coords.split(",").map(toNumber);
... |
856b7894f179ef9c70dcc598f345e69128089b2e | TypeScript | sinnatrix/dex | /app/src/helpers/general.ts | 2.734375 | 3 | import { BigNumber } from '@0x/utils'
import { IDexOrder, IMarket } from 'types'
import format from 'date-fns/format'
export const DAI_SYMBOL = '⬙'
export const ETHER_SYMBOL = 'Ξ'
export const MIN_POINTS_TO_DRAW_CHART = 2
export const getQuoteAssetSymbol = (market: IMarket): string =>
market.quoteAsset.symbol === '... |
1ceb85eca790d1c4129539bd01f88eeb6344c0ad | TypeScript | korny-yana/nodejs | /other/app2(promises).ts | 2.640625 | 3 | const http = require('http');
const fs = require('fs').promises;
const host = 'localhost';
const port = 1000;
let indexFile;
const requestListener = function (req, res) {
switch (req.url) {
case "/": fs.readFile(__dirname+'/index.html')
.then(contents => {
indexFile = contents;
res.setH... |
f1e8bbec4dc6732c29f693a5ef6081387352f896 | TypeScript | nmanumr/nodegtk-types | /@types/node-gtk/Gtk/Viewport.d.ts | 2.84375 | 3 | import * as Gtk from '../Gtk';
export declare interface Viewport extends Gtk.Bin, Gtk.Scrollable { }
/**
* The Gtk.Viewport widget acts as an adaptor class, implementing
scrollability for child widgets that lack their own scrolling
capabilities. Use Gtk.Viewport to scroll child widgets such as
Gtk.Grid, Gtk.Box, and... |
81948a5811f73df16135abdf795bb7e14585d7cb | TypeScript | greenbech/signal | /src/main/helpers/areEqualShallow.ts | 3.015625 | 3 | // https://stackoverflow.com/a/22266891/1567777
export function areEqualShallow<T>(a: T, b: T): boolean {
for (var key in a) {
if (a[key] !== b[key]) {
return false
}
}
return true
}
|
509282f812ba1b6df758c4902b1ada6da79b33fd | TypeScript | primefaces/primevue | /components/lib/confirmdialog/ConfirmDialog.d.ts | 2.6875 | 3 | /**
*
* ConfirmDialog uses a Dialog UI with confirmDialog method or <ConfirmDialog> tag.
*
* [Live Demo](https://www.primevue.org/confirmdialog)
*
* @module confirmdialog
*
*/
import { VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { ButtonPassThroughOptions } from '../button';
im... |
63d2f4c6548b5bf301793d4e817a0281912739c0 | TypeScript | jurliyuuri/cerke_online_alpha | /src/protective_cover.ts | 2.734375 | 3 | export type MembraneState = {
protective_cover_over_field: boolean,
protective_tam_cover_over_field: boolean,
protective_cover_over_field_while_asyncawait: boolean,
protective_cover_over_field_while_waiting_for_opponent: boolean,
}
const MEMBRANE_STATE: MembraneState
= sessionStorage.getItem('membrane_state_backu... |
638715c5a35d494896e650460a75db3caf5da1d3 | TypeScript | jacob-shuman/music-search | /src/music.ts | 2.8125 | 3 | export interface MusicArtist {
id: number;
name: string;
artUrl?: string;
}
export interface MusicAlbum {
id: number;
name: string;
trackCount?: number;
artUrl?: string;
artistId?: number;
}
export interface MusicSong {
id: number;
name: string;
// Track index in album
track?: number;
//... |
2b08315a18238176620d322400ad2b1c463d122e | TypeScript | ajlao11/react-js-crud-todo-list | /src/domain/usecases/addTaskUsecase.ts | 2.65625 | 3 | import { TodoRepository } from "../repositories/todoRepository"
import { Todo } from "../entities/todo"
export class AddTodoUseCase {
todoRepo: TodoRepository
constructor(todoRepo: TodoRepository) {
this.todoRepo = todoRepo
}
execute(name: string): Promise<Todo> {
const newTodo = new To... |
492e95a40773dfd51c5b317a29f84bb5a7c20c4a | TypeScript | green-fox-academy/smnkrisz | /algorithm exercise/multiplyMatrix.ts | 4.125 | 4 | /*
Write a method called multiplyMatrix() that takes a matrix of non-negative integers (any matrix is allowed, including square matrices) as a parameter.
The function should:
multiply each odd (1, 3, 5, 7, 9, ...) number by 2 in each odd indexed row
multiply each even (2, 4, 6, 8, 10, ...) number by 2 in each even in... |
7c55dfcdf618ba7c1257353c5aef9a28d9c90df0 | TypeScript | andywyatte17/virtual_tube_explorer | /src/app/route-tab/station-model.ts | 2.546875 | 3 | import { Naptan, MakeTubeNaptans } from "../naptans/naptans";
import { HttpClient } from "@angular/common/http";
export class StationModel {
filteredStations = new Array<Naptan>();
selectedStationId_: string = null;
selectedStation: Naptan = null;
filter: string = null;
lines: Array<string> = null;... |
73044fcca039db4e9c186a67fcdf84c1e46338a9 | TypeScript | Karnaukhov-kh/deprecation-manager | /packages/deprecation-crawler/src/lib/log.ts | 2.75 | 3 | import * as kleur from 'kleur';
import { CrawlConfig, CrawledRelease } from './models';
export function logError(message: string) {
console.log(kleur.red(message));
}
const maxWidth = 40;
const headingIntend = 2;
const stepIntend = 3;
const headingSpacer = '-';
export function printHeadline(message: string) {
co... |
64171e9d7beb929515c8ca13f1c3a5fccc98dbd6 | TypeScript | raynode/graphql-logging-app | /src/index.ts | 2.515625 | 3 |
import { InMemoryCache } from 'apollo-cache-inmemory'
import { ApolloClient } from 'apollo-client'
import { WebSocketLink } from 'apollo-link-ws'
import { isAfter } from 'date-fns'
import gql from 'graphql-tag'
import * as Parser from 'rss-parser'
import { SubscriptionClient } from 'subscriptions-transport-ws'
import ... |
7c7b10133244fba35f290aa7ce054663f4f53fb6 | TypeScript | jmchandonia/generix-ui | /src/app/shared/models/provenance-graph/homepage-node.ts | 2.8125 | 3 | import { Node, ClusterOptions } from 'vis-network/standalone';
export interface HomepageNode extends Node {
/*
Extension interface to provide metadata to nodes to
enable search and interaction with generix system. This
is a wrapper for the VisJS Node interface that will allow
us to use nodes wit... |
329a1f18f9b6f69c00dbf7ac2824c218d963d5eb | TypeScript | fstfwd/sheets | /src/lib/snapshot.ts | 2.71875 | 3 | import { SecurityHelpers } from './types';
import { RefService } from './ref';
export class DataSnapshot {
private isRef = false;
private input: any;
constructor(input: RefService | any, securityHelpers?: SecurityHelpers) {
this.input = input;
if (input instanceof RefService) {
this.isRef = true;... |
4510baf125d372484af0b01864e0f19bfcfe58f8 | TypeScript | Ahmedhamed77/MyContacts | /src/redux/user/action.ts | 2.640625 | 3 | import {User} from '../../api/contacts/types';
import {AppThunk} from '../store/types';
import {login, register} from '../../api/contacts';
import AsyncStorage from '@react-native-async-storage/async-storage';
import {Alert} from 'react-native';
export const userIsLoading = (state: boolean) =>
<const>{
type: 'US... |
23360763b9c85e14f0609f19475e8533ff27190b | TypeScript | boutainaLemrabet/composite-expected | /src/main/webapp/app/shared/model/with-id-string.model.ts | 2.75 | 3 | export interface IWithIdString {
id?: string;
}
export class WithIdString implements IWithIdString {
constructor(public id?: string) {}
}
|
d777c380e56117e86a46fd72c3e5e34b62b44d83 | TypeScript | mdzzohrabi/azera-js | /packages/cms/src/bundle/portal/public/lib/Strings.ts | 3.46875 | 3 | const REGEX_WORD = /([A-Za-z]+?)(?=[A-Z_\-\\\/0-9]|\b|\s)/g;
/**
* camelCase an string
* @param value String to convert
*/
export function camelCase(value: string) {
let result = '';
value.replace(REGEX_WORD, (m, w) => {
result += w.charAt(0).toUpperCase() + m.slice(1).toLowerCase();
ret... |
fbfb2f49ba35899e88304633746e03a8a01224af | TypeScript | dmgolembiowski/edgedb-ui | /src/renderer/store/resizablePanel.ts | 2.703125 | 3 | import { Module, VuexModule, Action, Mutation } from 'vuex-class-modules'
@Module
export class ResizablePanelModule extends VuexModule {
layout: 'vertical' | 'horizontal' = 'vertical'
isCollapsed = true
size: number = 50
@Mutation
setCollapsed(collapsed?: boolean) {
this.isCollapsed = collapsed ?? !th... |
400ad9250ae7a01fb0ca7ac52cac5289c324e0c7 | TypeScript | captain-igloo/betfair-ts | /src/sport/PlaceInstructionReport.ts | 2.65625 | 3 | /**
* Copyright 2020 Colin Doig. Distributed under the MIT license.
*/
import JsonMember from '../JsonMember';
import InstructionReportErrorCode from '../sport/enum/InstructionReportErrorCode';
import InstructionReportStatus from '../sport/enum/InstructionReportStatus';
import OrderStatus from '../sport/enum/OrderS... |
e88d06391cc1fec062eee678f832385f7889f066 | TypeScript | Coursemology/coursemology2 | /client/app/types/course/disbursement.ts | 2.703125 | 3 | /**
* Data types for disbursement data retrieved from backend through API call.
*/
export interface ForumDisbursementFilters {
startTime: Date;
endTime: Date;
weeklyCap: string;
}
export interface ForumDisbursementUserData {
id: number;
name: string;
level: number;
exp: number;
postCount: number;
... |
520a3938cd2c9ba3366899838799c8f66cf36c6b | TypeScript | avivbiton/RandomContentGenerator | /src/__tests__/ContentGenerator.test.ts | 2.890625 | 3 | import { ContentGenerator } from "../ContentGenerator";
import { InvalidParserException } from "../Exceptions/InvalidParserException";
import { InvalidSchemaFormatException } from "../Exceptions/InvalidSchemaFormatException";
import mockSchema from "./mockData/mockSchema.json";
import { Schema } from '../Schema';
impo... |
89fe53046ca0b241b89e42e897a795b67303ed58 | TypeScript | Tankzorx/PhilipsHueFun | /server/hueSockets/hueSockets.ts | 2.59375 | 3 | import { HueApi, lightState } from "node-hue-api"
import config from '../config'
export const server = require('http').createServer();
// var io = require("socket.io")(server)
import * as io from 'socket.io'
import { request } from "http";
const ioServer = io(server)
/**
* Set up hue api and socket.io
*/
const... |
77d1dc85e18ab96d0444e1646e1425ee4ce881ac | TypeScript | travetto/schema | /src/decorator/field.ts | 2.734375 | 3 | import { CommonRegExp, SchemaRegistry, ClassList, ValidatorFn } from '../service';
function prop(obj: { [key: string]: any }) {
return (f: any, p: string) => {
SchemaRegistry.registerPendingFieldFacet(f.constructor, p, obj);
};
}
function enumKeys(c: any): string[] {
if (Array.isArray(c) && typeof c[0] === ... |
2074a0a7de28419887227729b2fd77fe3a827719 | TypeScript | ALJCepeda/ts-generator | /src/services/schema/generateTypeMetadata.ts | 2.8125 | 3 | import {ReferenceSchema, ScalarSchema} from "../../extensions";
import {isReferenceSchema, isScalarSchema} from "../../guards";
export function generateTypeMetadata(schema:ScalarSchema | ReferenceSchema, options:GeneratePropertyMetadataOptions = {}): TypeMetadata {
if(isReferenceSchema(schema)) {
const parts = s... |
5ad8c2c375859f0cb63f3c4afa6563dc5be8352a | TypeScript | tanukichi5/react-accordion-typescript | /src/components/tab/helpers/uuid.ts | 2.859375 | 3 | // Get a universally unique identifier
let count = 0;
export default function uuid() {
//ランダムなIDを生成
const randomID = Math.random().toString(36).slice(2);
return `${randomID}--${count++}`;
}
export function reset() {
count = 0;
} |
663213a72f90edff1f26311660b0b6397dcc7cf5 | TypeScript | tamrat-bay/wix-challenge-1 | /server/src/middlewares/verifyToken.ts | 2.765625 | 3 | import jwt from "jsonwebtoken";
import axios from "axios";
import { Request, Response, NextFunction } from "express";
const facebookAuthType = "facebook";
const verifyToken = (req: Request, res: Response, next: NextFunction): void => {
const authHeader: string | undefined = req.headers.authorization;
const token:... |
1b5f4475ba43506ac585756d3a2334f39573e351 | TypeScript | mjunior/front-end-test | /src/app/core/models/item.ts | 2.5625 | 3 | export class Item {
id: number;
listId: number;
name: string;
done: boolean;
// tslint:disable-next-line:ban-types
constructor(values: Object = {}) {
Object.assign(this, values);
}
}
|
c97e6de4c3aef6f2c0d157b903b6d2b4afbbc694 | TypeScript | newbeea/gl-widget | /src/Attribute.ts | 2.96875 | 3 |
class Attribute {
array: Uint32Array | Float32Array
itemSize: number
normalized: boolean
constructor(itemSize: number, normalized: boolean = false) {
this.itemSize = itemSize
this.normalized = normalized
}
setXY ( index, x, y ): Attribute {
index *= this.itemSize;
this.array[ index + 0 ] = ... |
0a1699cdf8ca6a1aa08290e8883f1fa1d0145919 | TypeScript | ismail-codar/qlike | /qlike-core/src/utils/query-utils.ts | 2.8125 | 3 | import { DbType, FieldType, IFieldLike, ParamType, ValueStringFn } from '..';
import {
AllQueryTypes,
isInsertQuery,
isSelectQuery,
isUpdateQuery,
} from '../lib/builders/builder-check';
import {
deleteQueryToString,
insertQueryToString,
selectQueryToString,
updateQueryToString,
} from '../lib/builders/... |
c42a6e2abbcc9f3f9463552a03fea4f54370032a | TypeScript | jokester/scala-web-playground | /web/src/commonutil/async/index.ts | 2.875 | 3 | export function wait(delayMs: number) {
return new Promise<void>(f => setTimeout(f, delayMs));
}
export function timeout<FakeRetType = never>(delayMs: number) {
return new Promise<FakeRetType>((f, e) =>
setTimeout(e, delayMs, new Error(`timeout after ${delayMs}`)));
}
export async function withTimeout<T>(p: T... |
2eed72104dc5238853a4c14f15e81d7f5332bff9 | TypeScript | WildCodeSchool/projet2_carcassonne | /src/app/deck.service.ts | 2.5625 | 3 | import { Injectable } from '@angular/core';
import { tilesDeck } from './tuilesData';
@Injectable({
providedIn: 'root'
})
export class DeckService {
constructor() { }
pickTile() {
let numTile = Math.floor(Math.random() * tilesDeck.length)
let keepNumTile = tilesDeck[numTile]
const removedTiles = t... |
1299d77184f590f5c25075eb67aef89955e08462 | TypeScript | AhzamSalik786/nest-project | /nest-js/src/books/books.controller.ts | 2.59375 | 3 | import { Controller, Post, Body, Get , Param} from '@nestjs/common';
import { BooksService } from './books.service';
@Controller('books')
export class BooksController {
constructor(private readonly booksServices: BooksService) {}
@Post()
async addBook(
@Body('bookName') bookBookName: string,
@Body('image'... |
3f782bb47137c23f24daf85cdb5263c45fdfda89 | TypeScript | NamXH/TypeScriptBrownbag | /my-app2/src/demo3_complete.ts | 3.984375 | 4 | //-- strictNullChecks --//
// TS compilers performs control-flow based type analysis
function countLines(text?: (string | null)[]): number {
let count = 0;
if (text) {
for (const line of text) {
if (line && line.length !== 0) {
count = count + 1;
}
}
}
... |
81fdf8361d4520d06456fb544b4beae40d115217 | TypeScript | eflauzo/afterglow | /ts/ui_widget.ts | 2.703125 | 3 | import { CxUIElement } from './ui_element'
import { CxScene } from './scene'
// widget is element with dimensions (it repots dimenstions)
// think about label, parent won't know how much space label need
// label knows, it can report to parent so it could be properly aligned
export class CxUIWidget extends CxUIElement... |
953352db6d1b0a6c4e275629a3811e9e66b78cf6 | TypeScript | Devsper/w3-projekt-frontend | /src/app/edit-settings/edit-settings.component.ts | 2.578125 | 3 | import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { forkJoin } from 'rxjs';
import { AssignmentService } from '../_services/assignment.service';
import { Assignment } from '../_models/assignment';
import { TaskService } from '../_services/task.service';
@Component({
... |
4bbca45dbf868df2616af7d2dd599882160918fa | TypeScript | amirmohsen/repo-manager | /src/helpers/promptSoloOption/index.ts | 2.53125 | 3 | import { AutoComplete, AutoCompleteChoices } from 'enquirer';
export interface PromptOptionsParams {
message: string;
choices: AutoCompleteChoices;
}
const promptSoloOption = ({
message,
choices,
}: PromptOptionsParams): Promise<string> => {
const prompt = new AutoComplete({
message,
choices,
mu... |
1532faa2ecd7b41186e3cffae485dc2d9c2e2bf5 | TypeScript | JClap7/myFirstGit | /src/pages/tutor/tutor.ts | 2.5625 | 3 | import{ Component } from '@angular/core';
import{ Admin} from '../admin/admin';
import { Course } from '../course/course';
import { Schedule } from '../schedule/schedule';
import { Department } from '../department/department';
@Component({
selector: 'Tutor',
templateUrl:'tutor.html'
})
export class Tutor extends... |
1551267f1e28a1c4aa23a385c2d19df750c1e7d5 | TypeScript | believer/habitica | /src/habitica.ts | 2.625 | 3 | import { HttpMethod, User, ArmoireResult, Party, Spell } from './types'
import config from './config'
const hasItems = (items: { [key: string]: number }): Array<string> => {
const data = new Set<string>()
for (const [item, value] of Object.entries(items)) {
if (value <= 0) continue
data.add(item)
}
r... |
f45345331118801c10aab4e08a6e9458088fd742 | TypeScript | rostacik/CodeCon2014TSSamples | /CodeConTSSamples/01-BasicTypes/file1.ts | 3.84375 | 4 | //bool
var isDone: boolean = false;
//number
var height: number = 6;
//string
var name: string = "bob";
name = 'smith';
//array
var list: number[] = [1, 2, 3];
var list2: Array<number> = [1, 2, 3];
//enum
enum Color { Red, Green, Blue, White };
var c: Color = Color.Green;
c = Color.Red;
c = Color.White;
//any
var... |
6e99d030dff931aa32fb333c6923c2ff69d66118 | TypeScript | JOple/LRT-1-Bot-Assistant | /scripts/modules/default_dialog.ts | 2.5625 | 3 | import { BotModule, IBotModuleContext, DialogTypes } from "./bot_module";
import { sendCards } from "../utils/send_cards";
export const CONFIG = {
rejectThreshold: 0.5,
noneIntent: "none"
}
export class DefaultDialogModule extends BotModule {
constructor() {
super(CONFIG.noneIntent, "none")
}
... |
09b2454340188faafb0dd725066b356fc5ebdde0 | TypeScript | sergiomarmu/winter_latitude | /WinterLatitude_Backend/src/pages/home/home.ts | 2.625 | 3 | /**
* Imports de Angular y Ionic necesarios
*/
import { Component } from '@angular/core';
import { NavController,MenuController } from 'ionic-angular';
/**
* Imports necesarios para la utilización y ejecución de Firebase
*/
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
/**
... |
de87eaaf90ae79a75e772378307ef53e0b6da4f5 | TypeScript | hectorMurillo/Angular2Cli | /src/app/validators/custom-validators.ts | 2.796875 | 3 | import { FormControl, AbstractControl } from '@angular/forms';
export class CustomValidators {
static formatoNumero(control: FormControl): any{
let exp: any = /^[0-9]+$/
if(control.value !== undefined && !exp.test(control.value)) {
return {'formatoNumero': true, 'currentValue': control.value};
}
return nul... |
f48dc36170ff691ea68d47d97dd86ec1e5bcdb06 | TypeScript | briangtn/b12normalize | /src/B12Normalizer.ts | 3.390625 | 3 | export type ParserFunction = (value: any, args?: any) => any;
export type ParserList = Map<string, ParserFunction>;
export interface Rule {
action?: ParserFunction;
parser?: string;
arguments?: any;
}
export class B12Normalizer {
constructor(private _parsers: ParserList = new Map()) {}
/**
* Return the ... |
24d04b96f1e884e7e1b57023339df767be0c3621 | TypeScript | OdatNurd/ts-game-engine | /ts/engine/Preloader.ts | 3.140625 | 3 | module nurdz.game.Preloader
{
/**
* The type of a callback function to invoke when all images and sound loading is complete. The
* function takes no arguments and returns no value.
*/
export type DataPreloadCallback = () => void;
/**
* The type of a callback function to invoke when an i... |
c611bedb64a8dbcf36657034c8c6b6427e2462f8 | TypeScript | valen-developer/newspaper-backend-node | /src/context/User/domain/valueObject/UserPassword.valueObject.ts | 3.171875 | 3 | import { HTTPException } from '../../../shared/domain/HTTPException';
import { ValueObject } from '../../../shared/domain/valueObjects/valueObject.interface';
export class UserPassword implements ValueObject {
public readonly value: string | null | undefined;
constructor(value: string | null | undefined) {
th... |
af74178d61355fd699ca30f86b1d888f1694666f | TypeScript | bahtirek/StartNG | /src/app/directives/format.directive.ts | 2.640625 | 3 | import { Directive, HostListener} from '@angular/core';
import { NgControl } from '@angular/forms';
@Directive({
selector: '[appFormat]'
})
export class FormatDirective {
constructor (private ngControl: NgControl) {
}
@HostListener('keypress', ['$event'])
keyEvent(event: KeyboardEvent) {
console.log(... |
11dea584c1d7b641d918a283845122b39e202687 | TypeScript | RiteshSolanki1987/demo-app-products | /src/app/pipes/split-text.pipe.ts | 2.9375 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'splitText' })
export class SplitText implements PipeTransform {
/**
* Split text if length greater than 50 and add elipsis after 50 characters
* @param textContent Text string
*/
transform(textContent: any): any {
if (t... |
bf7acbe09395e333909688f8d22fbb5ed968edf8 | TypeScript | ng-model/vscode-stencil-tools | /src/snippets/snippets-component.ts | 3.125 | 3 | import { Snippet } from "./interface";
export const LIFECYCLE_SNIPPETS: Snippet[] = [
{
name: 'component-will-load',
title: 'Component Lifecycle: componentWillLoad',
description: [
"The component is about to load and it has not rendered yet.\n",
"This is the best pla... |
6c046177c5ab259c25b5663cc25916928597ec7d | TypeScript | rmirville/stocks-ng-ionic | /src/app/shared/market/services/stock-const-loader.service.ts | 2.515625 | 3 | import { Observable } from 'rxjs';
import { STOCKS } from '@shared/market/types/data/stocks';
import { Stock } from '@shared/market/types';
import { Dictionary } from '@shared/types';
import { StockLoaderService } from './stock-loader.service';
export class StockConstLoaderService implements StockLoaderService {
... |
feb668f3d91e795bb29a14087ff31ab86a93e4d3 | TypeScript | hotNipi/automation-uibuilder | /uibuilder/uibuilder/src/utils/Calc.ts | 3.359375 | 3 | class Calc {
static range(n: number, p: {minin: number; maxin: number; minout: number; maxout: number}, type: 'roll' | 'clamp', round: boolean, fixto: number): number {
if (type == 'clamp') {
if (n < p.minin) {
n = p.minin;
}
if (n > p.maxin) {
n = p.maxin;
}
}
if (type == 'roll') {
var d:... |
03c626fdc69dbb11b6211ddadb94ae2f84a3b68c | TypeScript | nomis51/graphql-typed-client | /src/render/typeMap/objectType.ts | 2.609375 | 3 | import {
getNamedType,
GraphQLInterfaceType,
GraphQLObjectType,
isEnumType,
isInterfaceType,
isScalarType,
GraphQLInputObjectType,
GraphQLArgument,
GraphQLField,
} from 'graphql'
import { RenderContext } from '../common/RenderContext'
import { ArgMap, Field, FieldMap, Type } from './renderTypeMap'
ex... |
f19009cd06b352f302f117c579d56a35511a54f6 | TypeScript | avjaz/mmd | /src/model/Position.ts | 3.234375 | 3 | import Orientation = require("./Orientation");
/**
* A position class
*/
class Position {
private _xPos: number;
private _yPos: number;
private _orientation: string;
constructor(xPos: number, yPos: number, orientation: string) {
this._xPos = xPos;
this._yPos = yPos;
this._or... |
974f9b7675b72fb92b93b01a9282d1665a86c0fd | TypeScript | topmonroe9/mk3_core | /src/middleware/logger.middleware.ts | 2.515625 | 3 | import { Injectable, NestMiddleware, Inject } from "@nestjs/common";
import { WINSTON_MODULE_PROVIDER } from "nest-winston";
import { Logger } from "winston";
// import { Request, Response, NextFunction } from 'express';
@Injectable()
export class AppLoggerMiddleware implements NestMiddleware {
constructor(@Inject(W... |
56ebd1c79ee9f78d2feb7556186f6e0b92f0be3f | TypeScript | mihailik/pe.js | /tests/testLong.ts | 2.59375 | 3 | namespace tests.Long {
export function constructor_succeeds() {
var lg = new pe.Long(0, 0);
}
export function constructor_assigns_lo_602048() {
var lg = new pe.Long(602048, 0);
if (lg.lo !== 602048)
throw lg.lo;
}
export function constructor_assigns_hi_2130006() {
var lg = new pe.Long(0, 2130006);
... |
97fc075e05c8552eb70078185145b4c095b8ef86 | TypeScript | DeepInThought/swim | /swim-system-js/swim-core-js/@swim/interpolate/main/InterpolatorInterpolator.ts | 2.59375 | 3 | // Copyright 2015-2020 SWIM.AI inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed ... |
b4c281a51ba2e02a2af6bd25a34efc82e659bbbc | TypeScript | tayduivn/hawkeye-mobile | /src/environments/environment.ts | 2.65625 | 3 | // This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.p w z wrod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false,
// apiUrl: 'http://192.168.3.18/api/... |
3dd2ce09bde250aaf712cc40c429d6208a96031c | TypeScript | bluelovers/ws-mega | /packages/mega-nz-url-parse/index.ts | 2.59375 | 3 | /**
* Created by user on 2020/5/24.
*/
import LazyURL from 'lazy-url'
import { parseSubPath, parseLinkHash, parseLinkHash2 } from './lib/util';
const defaultHostname = [
'mega.nz',
'mega.co.nz',
]
export interface IParseMegaLink
{
url: LazyURL;
root: {
key: string;
directory: boolean;
downloadID: string;... |
42bcb469e58f8f00d4d58721a63df8ab8ca601b7 | TypeScript | Ee-Chee/Inventur-CRUD-NgRx-app | /src/app/root-store/quantity-store/selectors.ts | 2.53125 | 3 | import { createFeatureSelector, createSelector, MemoizedSelector } from '@ngrx/store';
import { State } from './state';
const getError = (state: State): any => state.error;
const getIsLoading = (state: State): boolean => state.isLoading;
const getQuantity = (state: State): number[] => {
return state.qua... |
090d912c114667a19c8feaf4493d86f08d18d122 | TypeScript | orbitjs/orbit | /packages/@orbit/immutable/test/immutable-map-test.ts | 3.125 | 3 | import { ImmutableMap } from '../src/immutable-map';
const { module, test } = QUnit;
module('ImmutableMap', function () {
test('it can be instantiated with no data', function (assert) {
let map = new ImmutableMap<string, any>();
assert.ok(map, 'map exists');
});
test('records can be added and removed',... |
44e2aebf541b5f8f0d0ba3fd1e66030f7932b5c4 | TypeScript | rahulkmr/ts_musings | /merging.ts | 2.78125 | 3 | class Album {
label: Album.Label
}
namespace Album {
export class Label { }
}
function buildLabel(name: string): string {
return buildLabel.prefix + name + buildLabel.suffix
}
namespace buildLabel {
export const suffix = ''
export const prefix = 'Hello, '
} |
1a15f9516b491432a7f6bff0451650fb6c3a764a | TypeScript | GhostRealm/rotmg-sandbox | /src/common/asset/rotmg/data/Stats.ts | 2.71875 | 3 | export class Stats {
hp: number = 0;
mp: number = 0;
atk: number = 0;
dex: number = 0;
spd: number = 0;
def: number = 0;
vit: number = 0;
wis: number = 0;
getAttacksPerSecond() {
return 1.5 + 6.5 * (this.dex / 75);
}
getAttackDamage(damage: number) {
return Math.floor(damage * (0.5 + this.atk / 50));
... |
16941287853da8c6129cf93ba67e5a2fe5caeb3e | TypeScript | ginkgoch/node-map | /src/shared/Opener.ts | 3.015625 | 3 | export abstract class Opener {
opened: boolean = false;
async open() {
if (!this.opened) {
await this._open();
this.opened = true;
}
}
protected abstract async _open(): Promise<void>;
async close() {
if (this.opened) {
await this._close(... |
4dbe4a15b11d8f28a625c3ed762fb396c572686a | TypeScript | ezolenko/rollup-plugin-typescript2 | /src/icache.ts | 2.84375 | 3 | export interface ICache <DataType>
{
exists(name: string): boolean;
path(name: string): string;
match(names: string[]): boolean;
read(name: string): DataType | null | undefined;
write(name: string, data: DataType): void;
touch(name: string): void;
roll(): void;
}
|
6c14c319c3bcceebb46a5a16504066af3c5758b8 | TypeScript | KiichiHamanaka/todo-nest | /src/todo/todo.repository.ts | 2.625 | 3 | import { Injectable } from '@nestjs/common';
import { TodoOutputType } from '../interface';
import { PrismaClient } from '@prisma/client';
// リポジトリ層はデータストアを扱う
@Injectable()
export class TodoRepository {
async getTodo(id: string): Promise<TodoOutputType> {
const prisma = new PrismaClient();
return await pris... |
86bbdcedea87719f148fd9d336347074289c3538 | TypeScript | pesoklp13/gloomhaven-tracker | /libs/common-library/src/lib/data-structures/linked-list.ts | 3.6875 | 4 | import {Iterable, Iterator} from "./iterator";
interface ListNode<T> {
value: T;
previous?: ListNode<T>;
next?: ListNode<T>;
}
class LinkedListIterator<T> implements Iterator<T> {
private previous: ListNode<T> | undefined;
constructor(private current: ListNode<T>, private onRemove: (isHead: bo... |
b7aefeb60020ccf7ea127ee303fb9331d41d854d | TypeScript | villager/Edna-Moda | /plugins/plugins/battle/teams.ts | 2.859375 | 3 | import * as Storage from './storage';
export let teams = Object.create(null);
const mergeTeams = () => {
for (let i in Storage.teams) {
let team = Storage.teams[i];
if (teams[team.format]) teams[team.format] = [];
teams[team.format].push(team.packed);
}
};
const addTeam = (name: string, format: string, packe... |
787a814a3d9114eceae4bd92ec85c50e10f47292 | TypeScript | absathiam15/Live-Angular | /src/app/pipes/time-left.pipe.ts | 2.703125 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'timeLeft'
})
export class TimeLeftPipe implements PipeTransform {
transform(value: Date ): string {
const currentTime = new Date();
const diff = currentTime.getTime() - value.getTime();
const y = Math.floor(diff/1000/60/60/24/365);
... |
ef876369b26d605f0a09378d61c6aa7d14ad323a | TypeScript | RYRAJESH/QAAssessment | /qa-test-assessment-master/e2e/steps/searchPage.steps.ts | 2.6875 | 3 | import { Given, When, Then } from 'cucumber';
import { searchPage } from "../pages/searchPage.po";
import { characterResultsPage } from "../pages/characterResultsPage.po";
import { planetResultsPage } from "../pages/planetResultsPage.po";
import { setDefaultTimeout } from "cucumber";
const chai = require('chai').use(r... |
3b3e7936cb7dc1715f5fd823bc15fb7d6fb7f2a8 | TypeScript | vinely/go-webntp | /_example/webntp.ts | 2.9375 | 3 | module WebNTP {
export interface Response {
id: string;
it: number; // Initiate Time
st: number; // Send Time
leap: number;
next: number;
step: number;
}
export interface Result {
delay: number;
offset: number;
}
interface Request {
... |
87322574f3dc769e95ff04291329087b61ada507 | TypeScript | Hash-Nomads/edge-index-frontend | /utils/shortenAddress.ts | 2.640625 | 3 | export function shortenAddress(address: string): string {
return `${address.substring(0, 8)}...${address.substring(42 - 4)}`;
} |
e7374f44edf6218fa5bc5a4bd0622187976ac5a9 | TypeScript | ConaGo/Quizflip | /apps/api/src/app/question/entities/userToQuestionStats.entity.ts | 2.59375 | 3 | import { Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { BaseEntity } from '../../typeorm/base.entity';
import { User } from '../../user/entities/user.entity';
import { Question } from './question.entity';
@Entity()
export class UserToQuestionStats extends BaseEntity {
@Column()
public... |