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 |
|---|---|---|---|---|---|---|
7bc11136cef9ff5fe073d5b8ab825d114e3fe7ad | TypeScript | ORCID/orcid-angular | /src/app/shared/pipes/contributors-pipe/contributors.pipe.ts | 2.546875 | 3 | import { Pipe, PipeTransform } from '@angular/core'
import { Contributor } from 'src/app/types'
import { RolesAndSequences } from '../../../types/common.endpoint'
import {
Role,
ContributionRoles,
_LEGACY_ContributionRoles,
} from '../../../types/works.endpoint'
@Pipe({
name: 'contributorsPipe',
})
export clas... |
61062bc7ca75a4866084b77edafd999b51f9974e | TypeScript | Shin-Ogata/fieldwork | /packages/extension/template-bridge/tests/unit/tools.ts | 2.53125 | 3 | import {
TemplateResult,
html,
render,
} from '@cdp/extension-template';
import { dom, DOM } from '@cdp/dom';
export { DOM };
const body = document.body;
class TestCustomElement extends HTMLElement {
private readonly _root: ShadowRoot;
constructor() {
super();
this._root = this.att... |
e686548751f24f5a407e9a4c4ac712ff4ae2f8de | TypeScript | pnpm/pnpm | /config/matcher/src/index.ts | 3.34375 | 3 | import escapeStringRegexp from 'escape-string-regexp'
type Matcher = (input: string) => boolean
type MatcherWithIndex = (input: string) => number
export function createMatcher (patterns: string[] | string): Matcher {
const m = createMatcherWithIndex(Array.isArray(patterns) ? patterns : [patterns])
return (input) ... |
26febc7d590e758ca2a1818c2ac25420d9c05a40 | TypeScript | xi-cygni/wits-currency-trading-platform | /src/logic/helpers/generatePrice.ts | 2.875 | 3 | export const generatePrice = (oldPrice: number, volatility: number = .1): number => {
const rnd = Math.random();
let changePercent = 2 * volatility * rnd;
if (changePercent > volatility) {
changePercent -= (2 * volatility);
}
return Math.max(0, oldPrice * (1 + changePercent));
};
|
41b29668559de4b3d23cb0aeceab7dbf4b85311b | TypeScript | brainthinks/reddit-service-backend | /src/lib/schemas/fields.ts | 2.515625 | 3 | import {
SchemaField,
SchemaFields,
} from '../../types';
export const RecordAuditFields: SchemaFields = {
actor: {
name: 'actor',
title: 'Actor',
description: 'user who took the action',
type: 'reference',
reference: 'User',
required: true,
},
at: {
name: 'at',
title: 'At',
... |
9cd48ec32c2daf56cf85ee3b41f0f1e79094566d | TypeScript | portabled/portabled | /persistence/tests/dom/base64Encoding.ts | 2.625 | 3 | namespace tests.dom.base64Encoding {
export function generateTests() {
return {
parseBase64,
parseBase64Star
};
/*
fileContentBase64: data(' /path.txt [base64]\nYmFzZTY0', '/path.txt', 'base64'),
fileContentBase64Star: data(' /path.txt [base64]\n*YmFzZTY0', '/path.txt', 'base64')
*/
... |
afd4f4ce3590bd7ea405e1ef84c6e9262fb7759d | TypeScript | Happy-Ferret/firefox-addons-sdk.d.ts | /src/app.ts | 2.625 | 3 | /// <reference path="../ts.d/node.d.ts"/>
export = AsdkTypedApp;
import fs = require('fs');
import event = require('events');
import os = require('os');
import cluster = require('cluster');
import path = require('path');
/**
*
*/
class AsdkTypedApp extends event.EventEmitter {
private running: boolean = false;
... |
71bd0e87049ad195d1253689a1246f0b4767dcdf | TypeScript | thruthesky/firebase-backend | /functions/src/modules/user/user.router.ts | 2.796875 | 3 | // import * as admin from 'firebase-admin';
// import { Request, Response } from 'express';
import * as E from '../core/error';
import { Base } from './../core/base';
import { User, USER_DATA, USER_REGISTER } from './user';
import { ROUTER_RESPONSE } from '../core/core';
import { Library as _ } from './../library/libr... |
a6553a9f11f8835ce0cefc0db3dd5f3cbf411eae | TypeScript | swc-project/swc | /crates/swc_ecma_transforms_base/tests/ts-resolver/tsc/computed/property/name/11/output.ts | 2.671875 | 3 | var s__2: string;
var n__2: number;
var a__2: any;
var v__2 = {
get [s__2] () {
return 0;
},
set [n__2] (v__4){},
get [s__2 + s__2] () {
return 0;
},
set [s__2 + n__2] (v__7){},
get [+s__2] () {
return 0;
},
set [""] (v__10){},
get [0] () {
return ... |
50069f9cf654e7c5eeed3598b32d75a7b971db13 | TypeScript | Log234/AI960-Client | /src/app/Layout/LayoutContainer.ts | 2.515625 | 3 | import * as io from "socket.io-client";
import { RootState } from "app/reducers";
import { Layout } from "app/Layout/Layout";
import { connect } from "react-redux";
import { LayoutActionTypes } from "app/Layout/LayoutActions";
function mapStateToProps(state: RootState) {
return {};
}
const mapDispatchToProps = (d... |
d779365a03afe51dd0b6603f59058005329b1210 | TypeScript | JustinStephenson/leetcode-solutions | /Typescript/Problems/Valid_Palindrome.ts | 3.734375 | 4 | function isPalindrome(s: string): boolean {
s = s.toLowerCase();
s = s.replace(/[^a-zA-Z\d]/g, '');
let result: boolean = true;
let endPointer: number = s.length - 1;
for (let i = 0; i < s.length / 2; i++) {
if (s[i] !== s[endPointer]) {
result = false;
break;
}
endPointer--;
}
return result;
}
|
e5ec82c1a6dd1981eeaa38a3f18bef93758a8489 | TypeScript | jtenner/as-pect | /packages/core/src/transform/createAddReflectedValueKeyValuePairsMember.ts | 3.03125 | 3 | import {
AssertionKind,
BlockStatement,
ClassDeclaration,
CommonFlags,
FieldDeclaration,
MethodDeclaration,
NodeKind,
ParameterKind,
Range,
Statement,
Token,
TypeNode,
} from "./assemblyscript";
import { createGenericTypeParameter } from "./createGenericTypeParameter";
import { djb2Hash } from "... |
f8873a8e155d5f449cd8b4141edc2791ace2206f | TypeScript | NS-MPaille/todosList | /src/app/todo/todo-api.service.ts | 2.6875 | 3 | import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable, of } from "rxjs";
import { delay } from "rxjs/operators";
export interface ITodo {
id: number;
title: string;
description?: string;
completed: boolean;
}
@Injectable({
providedIn: "root",
})
... |
fadb913a44f37b1d5be143843c4e5e9145d6e549 | TypeScript | i-codeit/toh-visualize | /Server/src/backend.ts | 3.359375 | 3 | import { EventInterface } from "./eventInterface";
/**
* Recursive function which saves data (returns) in an array
* depicting the movement of blocks
* @param lenSrc number of blocks
* @param srcTower source Tower
* @param destTower destination tower
* @param auxTower auxilary tower
* @param data array to save... |
d7574877081f0b97223ae1567096b2c8546093b3 | TypeScript | benforcapita/salad-shop | /src/Types/index.ts | 2.828125 | 3 |
export type StoreType = {
open: boolean;
Items: Array<SaladIngredientsItem>;
amount: number;
}
export type SaladIngredientsItem = {
name: string;
price: number;
amount:number
}
export enum Constants {
OPEN_DRAWER = 'OPEN',
ClOSE_DRAWER = 'ClOSE',
ADD_ITEM = 'ADD',
REMOVE_ITEM = 'REMOVE',
... |
d409ec058b96526d6695531fec3d7441a3699fd2 | TypeScript | CPqD/inovathon-8 | /health-front/src/app/services/navigation.service.ts | 2.625 | 3 | import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
export interface IMenuItem {
id?: string;
title?: string;
description?: string;
type: string; // Possible values: link/dropDown/extLink
name?: string; // Used as display text for item and title for separa... |
efbf7471f0ede054009197a757b14e7028254aef | TypeScript | 4rtw/sport-wager-front | /src/app/shared/services/Utils/custom-operator.ts | 2.828125 | 3 | import { defer, Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
export function tapOnce<T>(fn: (value) => void): any {
return (source: Observable<any>) =>
defer(() => {
let first = true;
return source.pipe(
tap<T>((payload) => {
if (first) {
fn(payload);
... |
33f183cfce289e3d91f384b4799b432248dfc144 | TypeScript | Solaris5959/Software | /src/corner_kick/src/types/state.ts | 2.609375 | 3 | /***
* This file specifies the format of the application state
*/
import { ILayer } from './canvas';
import { IROSParam } from './rosParams';
import { IRobotStatus } from './status';
/**
* The application state
*/
export interface IRootState {
canvas: ICanvasState;
thunderbots: IThunderbotsState;
rosP... |
9ff58d135843f75f684bacba4c19362ff9c9f318 | TypeScript | nknapp/aikido-exam | /src/utils/shuffling/shuffle.test.ts | 2.921875 | 3 | import { shuffleAndSelect } from "./shuffle";
import shuffle from "lodash/shuffle";
import { Technique } from "../../model/Technique";
import { TechniqueList } from "../../model/TechniqueList";
const mockShuffle = shuffle as jest.MockedFunction<typeof shuffle>;
jest.mock("lodash/shuffle", () => {
return {
__esM... |
bb4de159f5277f69cb74f42642a613859e27f425 | TypeScript | buroz/web-components-codebase | /src/validators/auth.ts | 2.8125 | 3 | import { IsNotEmpty, IsEmail, IsString } from "class-validator";
import { RegisterRequest, LoginRequest, ForgotPasswordRequest } from "../_interfaces";
export class AuthLoginForm {
@IsEmail()
public email = "";
@IsNotEmpty({ message: "Please enter your password" })
public password = "";
constructor(request... |
efac4c8bf3c3a5147461feaab9cedd54da0fedd6 | TypeScript | lukke-dev/tests-with-jest-typescript | /src/dip-dependency-inversion/classes/interfaces/customer.spec.ts | 3.09375 | 3 | import { IndividualCustomer, EnterpriseCustomer } from './customer';
const createIndividualCustomer = (
firstName: string,
lastName: string,
cpf: string,
): IndividualCustomer => {
return new IndividualCustomer(firstName, lastName, cpf);
};
const createEnterpriseCustomer = (
name: string,
cnpj: string,
):... |
9c521e01c8a72ffa2727649920237f311edad711 | TypeScript | dorshinar/deno-flex | /src/args.ts | 3.234375 | 3 | import { FlexArgs } from "./types.ts";
/**
* Parse arguments. If args is not an array, or not an array an error is thrown.
* Command name must be separated from the command arguments with "--":
* $ flex start -- Hello
*
* @param args arguments to parse
* @returns parsed arguments.
*/
export function parseArgs(a... |
b86f3c7ba50854591738bacdd7978756e9f11c76 | TypeScript | interfacewerk/ng1-decorators | /src/decorators/inject.ts | 2.78125 | 3 | import {makeInject} from './util';
export function Inject(injected?: string | Object) {
return function (
targetClass: {
constructor: Function & {
injections?: {[injectedString: string] : string},
$inject?: (string | Object)[]
},
},
propertyName: string
) {
injected = injected || propertyName... |
87917faae25b47deb2ca4417a7c98f78a7cf882e | TypeScript | lywsbcn/Jsocket-ts | /jsocketInterface.ts | 3.09375 | 3 |
/**
* websocket 收到报文后封装的一个数据模型
* 在Jsocket 类中的数据层的基本数据结构
* */
interface JsmInterface {
/**
* 每个请求自动累计一个值,用来判断是否为该请求
* 注意:这个需要服务端的支持
* */
what: number;
/**
* websocket 收到的数据
* 经过 JSON.parse() 处理
* */
original: any;
}
/**
* Jsocket 中回调数据结构
* */
interface JscInterface ... |
77029883b461ddb9d2ad595ceb8a923f969f0d08 | TypeScript | rootulp/exercism | /typescript/space-age/space-age.ts | 3.140625 | 3 | class SpaceAge {
public seconds: number
private ORBITAL_PERIOD_IN_EARTH_YEARS = Object.freeze({
Mercury: 0.2408467,
Venus: 0.61519726,
Mars: 1.8808158,
Jupiter: 11.862615,
Saturn: 29.447498,
Uranus: 84.016846,
Neptune: 164.79132
})
private SECONDS... |
d1f45058927234e96abb015c334f6b11e6fcf5b9 | TypeScript | pstromberg98/atom-node-debug | /lib/v8-protocol/messenger.ts | 2.8125 | 3 | import { IResponse } from './interfaces/IResponse';
export default class Messenger {
public events = {};
public callbacks = {};
private seq = 0;
private isOpen = false;
constructor(private socket) {
this.callbacks = {};
socket.onopen = (event) => {
this.isOpen = true;
if (this.events['o... |
de8162168b1ce770da4de0a7e3dd44e3e50a97dc | TypeScript | Dev-MarkoF/FUDGE | /Miscellaneous/Experiments/Jascha/WebEngineCoreStructures/src/Engine/BufferSpecification.ts | 2.8125 | 3 | namespace WebEngine{
/**
* Small interface used by Material- and Mesh-classes to store datapullspecifications
* for a WebGLBuffer.
*/
export interface BufferSpecification {
size: number; // The size of the datasample.
dataType: number; // The datatype of the sample (e.g. gl... |
a206cb5d9c83a1335b84f53da1bceb6e859ca408 | TypeScript | Nikaple/javascript-obfuscator | /src/declarations/threads.d.ts | 2.53125 | 3 | declare module 'threads' {
type PostMessage <U> = (data: U) => void;
type SpawnCallback <T, U> = (data: T, postMessage: PostMessage <U>) => void;
type ResponseCallback <U> = (response: U) => void;
class Thread <T, U> {
public killed: boolean;
public send (data: T): Thread <T, U>;
... |
8e045bd83b9aaf5fa80281a0454ecd6f6e8e71dd | TypeScript | seanwallawalla-forks/frontend | /hassio/src/components/hassio-ansi-to-html.ts | 2.671875 | 3 | import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators";
interface State {
bold: boolean;
italic: boolean;
underline: boolean;
strikethrough: boolean;
foregroundColor: null | string;
backgroundColor: null | string;
}
@customElem... |
7429f33ab2076784e8551642d81cd59667db520a | TypeScript | gabriellopes00/umbriel | /src/modules/senders/useCases/SetDefaultSender/SetDefaultSender.spec.ts | 2.609375 | 3 | import { Email } from '@modules/senders/domain/sender/email'
import { Name } from '@modules/senders/domain/sender/name'
import { Sender } from '@modules/senders/domain/sender/sender'
import { InMemorySendersRepository } from '@modules/senders/repositories/in-memory/InMemorySendersRepository'
import { SetDefaultSender ... |
77780eeaabbf4842427294af9ef557d8c965752a | TypeScript | davidkpiano/RxAnimate | /src/utils/mapValues.ts | 3.15625 | 3 | export default function mapValues<T, R>(
object: Record<string, T>,
project: (value: T, index: string) => R
): Record<string, R> {
const result: Record<string, R> = {};
Object.keys(object).forEach(key => {
result[key] = project(object[key], key);
});
return result;
}
|
c8c8e5f31c954a343b91f63b70ab2fd05598bb19 | TypeScript | jumodada/date-picker | /src/utils/extend.ts | 2.828125 | 3 | export function extend<T, U>(sourceObj: T, targetObj: U): T & U {
for (const key in sourceObj) {
// es5
;(targetObj as T & U)[key] = sourceObj[key] as any
}
return targetObj as T & U
}
|
47cac27ce84cd9d658f8ad3389fec434985e8120 | TypeScript | Enhmunh-E/tsparticles | /shapes/heart/src/HeartDrawer.ts | 3 | 3 | import type { IShapeDrawer } from "tsparticles/Core/Interfaces/IShapeDrawer";
import type { IParticle } from "tsparticles";
export class HeartDrawer implements IShapeDrawer {
draw(context: CanvasRenderingContext2D, particle: IParticle, radius: number) {
const x = -radius;
const y = -radius;
... |
438913348b05b1487af868356a812bea0c6e4026 | TypeScript | bohyeon-n/youngint-lesson | /src/modules/Pattern4ShapePattern.ts | 3.078125 | 3 | // 출력 예시
// ****
// ****
// ****
// ****
import BaseShapePattern from "./BaseShapePattern";
export default class Pattern4ShapePattern extends BaseShapePattern {
constructor(totalNumber: number, shape: string) {
super(totalNumber, shape);
}
protected countShapesInLines = (): number[] => {
const { ... |
c1d7d5b8f54961d62bdb5d46a5141d03cd8ebc8c | TypeScript | bastilavarias/travel-buddy | /src/components/profile/model.ts | 2.8125 | 3 | import Profile from "../../database/entities/Profile";
import {
IProfileImageSoftDetails,
IProfileModelSaveDetailsPayload,
IProfileModelSaveImageDetailsPayload,
IProfileSoftDetails,
} from "./typeDefs";
import ProfileImage from "../../database/entities/ProfileImage";
import { getRepository } from "typeorm";
co... |
76db77723d013830848805ff91d55659f5171740 | TypeScript | nitreojs/puregram | /packages/puregram/src/common/structures/pre-checkout-query.ts | 2.734375 | 3 | import { Inspect, Inspectable } from 'inspectable'
import * as Interfaces from '../../generated/telegram-interfaces'
import { Structure } from '../../types/interfaces'
import { User } from './user'
import { OrderInfo } from './order-info'
/** This object contains information about an incoming pre-checkout query. */... |
8502e145171bb3203cad14414685fb7ba627782c | TypeScript | imclab/three-story-controls | /lib/Damper.d.ts | 3.4375 | 3 | export interface DamperValues {
/** A value to dampen, set to its initial state */
[key: string]: number | null;
}
export interface DamperProps {
/** Values to be dampened */
values: DamperValues;
/** Multiplier used on each update to approach the target value, should be between 0 and 1, where 1 i... |
91c0de9db0f39608b394ac2cf0d1671612f24a6f | TypeScript | Rahul-D78/Conduit_Typescript | /src/controllers/comments.ts | 2.9375 | 3 | import { getRepository } from "typeorm";
import { Article } from "../entities/Article";
import { Comment } from "../entities/Comment";
import { User } from "../entities/User";
import { sanitization } from "../utils/security";
interface CommentData {
body: string,
}
export async function createComment(data: Comment... |
04a0c0face62de48acc9cab20211b8cec79756b4 | TypeScript | JakeGill70/CosmicArk-Advanced | /CosmicArkAdvanced/app.ts | 2.921875 | 3 | module CosmicArkAdvanced {
/**
* @description The setup for the game context
* @property game {Phaser.game} - The game context used by everything else in the game.
*/
export class MyGame {
game: Phaser.Game;
private static AUTO_SCALING = true; // Debug var
... |
fdffa5569d0e7d1f6d612eeedbcd3e0544fb3828 | TypeScript | ElSimpatico/react_app_03 | /src/reducers/reducer-test.ts | 2.65625 | 3 | import { TestState } from '../shared/models';
import { TestActions } from '../actions';
import { SET_TEST } from '../actions';
const INIT_TEST_STATE: TestState = {
name: 'testName'
};
export function TestReducer(
state: TestState = INIT_TEST_STATE,
action: TestActions
): TestState {
switch (action.typ... |
b61dfee9a6e0404c474712ecb084ed7bc4161146 | TypeScript | andrescass/miralosmorweb | /frontend/src/app/services/lists.service.ts | 2.65625 | 3 | import { Injectable } from '@angular/core';
import { ListsComponent } from '../components/lists/lists.component';
import { HttpClient } from '@angular/common/http';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class ListsService {
constructor(private http: HttpClient){}
... |
cba5c539b148dda5c99d7750a1c450f247dd2fce | TypeScript | jfouche/covoit | /app/typings/webcomponents.d.ts | 2.5625 | 3 | interface Document {
registerElement(tagName: string, obj: any): void;
}
interface HTMLElement {
createdCallback(): void;
attributeChangedCallback(attributeName: string, oldValue: any, newValue: any): void;
} |
e3e1c3c8f13197c261e8b4aedcafbeb26274de92 | TypeScript | spencerjbeckwith/bionicle | /src/client/graphics/shader.ts | 2.65625 | 3 | import { gl, createShader } from './gl';
/*
How palette swapping works:
You must provide a palette texture to the shader. This is the basis for recoloration. The top row (palette 0) of pixels is your base colors. When drawing an image with those colors present, if the palette index is not set to 0, each occur... |
e4a29d96e092f6b05570b4508b3f87fa4927e2ef | TypeScript | eqot/json-rpc | /src/bearers/Bearer.ts | 2.578125 | 3 | import { IframeBearer } from './IframeBearer'
import { WebBearer } from './WebBearer'
import { ReactNativeBearer } from './ReactNativeBearer'
export interface Bearer {
send(message: any | string): void
onReceived(callback: (args: any) => void): void
}
export function generateBearer(webview: any): Bearer {
if (w... |
7df5799abd5f60a4a93d3d539b01cf00946ae6a3 | TypeScript | otissv/state-subscriptions | /packages/react/src/useSubscribe/storePublish/storePublish.ts | 2.53125 | 3 | import { ActionType } from '../../types'
export function storePublish<Store extends Record<string, any>>(store: Store) {
return <Type extends string>(eventType: Type) => (
actions: readonly ActionType[]
): void => store.publish([eventType, actions])
}
|
5f9d70f416f94571ecafd6dae04ccb1807bf6b6a | TypeScript | Rhadow/nature_of_code | /src/experiments/particle.ts | 2.59375 | 3 | import * as numjs from 'numjs';
import { ICanvasState } from '../components/Canvas/CanvasInterfaces';
import { ICreature, IEnvironment } from "../elements/ElementInterface";
import { width, height } from '../constants/world';
import ParticleSystem from '../elements/ParticleSystem';
import Repeller from '../elements/Rep... |
2b0d18b54f3c3950cc8cba49087e6002005e9a32 | TypeScript | lboshuizen/frht2011 | /src/domain/claim.ts | 2.59375 | 3 |
interface Location {
Description: "industrial area" | "rural area"
}
interface Address {
Location?: Location;
}
interface Party {
Firstname: string;
ClaimIntoxication: boolean;
Address: Address;
}
interface Reference {
Reference: string;
}
interface Object {
Vin: string;
ListPrice: ... |
15f6dd24d846e94998e4664c383a4667ebf29b4d | TypeScript | tangx/vue3-course | /src/components/12_hook/comps/hooks/usePoint.ts | 3.125 | 3 | import { onMounted, onUnmounted, reactive } from 'vue';
export default function () {
// 设定鼠标坐标
let point = reactive({
x: 0,
y: 0
})
// 方法。
// 必须使用命名方法。 匿名方法将会认为是【两个】独立行为相同的方法。
function savePoint(event: any) {
point.x = event.pageX
point.y = event.pageY
... |
df50133ce3881e30136197dabde61f9ba1956075 | TypeScript | Ediezzle/Angular-Data-binding | /src/app/server-element/server-element.component.ts | 2.53125 | 3 | import {
Component,
OnInit,
Input,
ViewEncapsulation,
OnChanges,
SimpleChanges,
DoCheck,
AfterContentInit,
AfterContentChecked,
AfterViewInit,
AfterViewChecked,
OnDestroy,
ViewChild,
ContentChild,
ElementRef
} from "@angular/core";
@Component({
selector: "app-server-element",
template... |
13c6e04129854726971387bad160940adf01a5be | TypeScript | bgotink/lit-html-brackets | /src/lib/binding.ts | 3.3125 | 3 | export interface Binding<T> {
set(value: T): void;
get(): T;
}
interface BindingImpl<T> extends Binding<T> {
__binding: true;
}
export function isBinding(obj: any): obj is Binding<any> {
return obj != null && (obj as BindingImpl<any>).__binding === true;
}
export function bind<O extends object, K extends key... |
29a95d823e0d02843b8ec3be1942f279c9905e81 | TypeScript | fossabot/deno-events | /events.ts | 3.390625 | 3 | export type Priority = "high" | "normal" | "low";
export type EventResult = "cancelled" | any[];
export type ListenerResult = "cancelled" | any[] | void;
export type Listener = (...args: any[]) => ListenerResult;
export type OpenEventEmitter<T> = EventEmitter<T> | EventEmitter<any>;
export function emitter<T>(): Open... |
d04a0517fb918527a0ef99f97a8bef400a04154a | TypeScript | PatrickDCullen/beginning-typescript | /lesson3/index.ts | 3.671875 | 4 | // Literal Type
const flipCoin = () => (Math.random() < 0.5 ? "Head" : "Tail");
console.log(flipCoin());
enum Suit {
HEARTS,
SPADES,
DIAMONDS,
CLUBS,
}
// type Suit = "hearts" | "spades" | "diamonds" | "clubs"; // Literal type with unions
// console.log(Suit.SPADES);
const suitMeaning = (suit: Suit) => {
i... |
87b9ab9469484101468f0ad76789de8e3a16203f | TypeScript | JoaoptGaino/easy-recipe | /src/Controllers/RecipesController.ts | 2.6875 | 3 | import { Request, Response } from 'express';
import db from '../database/connections';
export default class RecipesController {
async index(req: Request, res: Response) {
const recipes = await db('recipes').select('*');
if (recipes.length <= 0) {
return res.status(404).json({ message:... |
a10ba08baa3d3f20de92eac179bafdaae34084de | TypeScript | stitchfix/flotilla-os | /ui/src/helpers/FlotillaClient.ts | 2.515625 | 3 | import axios, { AxiosInstance, AxiosError, AxiosResponse } from "axios"
import * as qs from "qs"
import { has, omit, Omit } from "lodash"
import {
HTTPMethod,
CreateTaskPayload,
RequestArgs,
Run,
ListRunParams,
ListRunResponse,
RunLog,
LaunchRequestV2,
Task,
ListTaskResponse,
ListTaskRunsResponse,... |
7ab3e594f2abc96c12517478d252f660662350b4 | TypeScript | KiaraGrouwstra/typical | /src/tuple/Prepend.ts | 2.890625 | 3 | import { List } from '../util/List';
import { IncIndex } from './IncIndex';
/**
* Prepend an element to a tuple-like type, returning a numerical object.
* Presumes the list is already zero-indexed, otherwise needs `ZeroIndex`.
*/
export type Prepend<
R extends List<any>,
T
> = { 0: T } & IncIndex<R, 1>;
|
ac09dfb18075ab4b57abdd5cf561add1680dd828 | TypeScript | LisaCao0513/Robot-Simulator-Code | /src/config.ts | 3 | 3 | 'use strict';
import path from 'path';
import * as types from './types';
/**
* Config object
* It consists of configs for:
* Robot class
* Messenger class
* Playground class
*/
//interfaces
export class Config implements types.BaseConfig{
app : types.App;
playground : types.basePlayground... |
b793b7538cc5be3db6dd696a27ee064c88a66bcc | TypeScript | joryphillips/joryphillips.github.io | /test/project_list.test.ts | 2.765625 | 3 | import { expect } from '@open-wc/testing';
import { listHasSearchValues } from '../src/components/project_list/project_list';
describe('listHasSearchValues', ()=> {
describe('single search value', ()=> {
it('returns false if search value not present', ()=> {
const searchValue = 'boop';
const stringsT... |
4c701da086e698e4beab6bad1032e54778bf6eab | TypeScript | dvsherbakov/nau-v | /src/features/auth/authReducer.ts | 2.859375 | 3 | import { EMAIL_AUTH, FAIL_AUTH, FAIL_REGISTER, FIRST_NAME_AUTH, LAST_NAME_AUTH, LOGIN_AUTH, LOGOUT_AUTH, MY_AUTH, PASSWD_AUTH, REGISTER_AUTH } from './actionTypes'
import { SetEmailAction, AuthActionTypes, SetPasswdAction, LoginAction, FirstnameAction, LastNameAction } from './types'
const initialState = {
email: ''... |
0d5cc68e54c5d69c7a6585e2646ac114b46d9c8c | TypeScript | jordanmchiu/NaloxZone | /src/LocationHandler.ts | 3.078125 | 3 | import Pharmacy from "./util/Pharmacy";
import Location from "./util/Location";
import PharmacyManager from "./PharmacyManager";
import { createClient, GoogleMapsClient } from "@google/maps";
import GoogleMapsAPIKey from "./GoogleMapsAPIKey";
declare var Promise: any;
export default class LocationHandler {
private... |
30651df043a74d120353ee46a54a99b2c5ae5795 | TypeScript | YancaHernandez/back_movil | /src/models/user.shemas.ts | 2.734375 | 3 | import * as mongoose from 'mongoose';
import * as bcrypt from 'bcrypt';
export const UserSchema = new mongoose.Schema({
name: {
type: String,
default: 'Admin',
required: [true, 'El nombre es requerido']
},
email:String,
password:String,
type:{
type: String,
d... |
3d9e629b73be5b8d916d688df8dd50ffac4e35e7 | TypeScript | labjhipster/nhipster2 | /src/main/webapp/app/entities/artist/service/artist.service.ts | 2.53125 | 3 | import { Injectable } from '@angular/core';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { isPresent } from 'app/core/util/operators';
import { ApplicationConfigService } from 'app/core/config/application-config.service';
import { createRequestOption } from... |
ef6e4803c77dd34c4767d45042c26ef94daef35d | TypeScript | adriansalamon/gymnasiearbete | /generator/candidates.ts | 3.421875 | 3 | import {Ideology, IdeologyWithProbabilities, IdeologyWithCandidates, Candidate} from './interfaces'
// Creates the parties and assigns them an ideology based on their relative sizes.
export function createCandidates(numberOfCandidates: number, ideologies: Ideology[]): Candidate[] {
const tempIdeologies: IdeologyWi... |
0a506ac52eb9f8479267b61ef7a0f77588f6ffa3 | TypeScript | Zebradil/DictorClient | /src/app/cache.ts | 2.96875 | 3 | import { of } from 'rxjs/observable/of';
import { Observable } from 'rxjs/Observable';
import log from './log';
class CacheValue {
data: any;
observable: Observable<any>;
}
interface CacheCollection { [key: string]: CacheValue; }
export class Cacher {
private data: CacheCollection = {};
@log({ logId: 'Cache... |
bde665ddb4c2d395feb98a998c6b8115692e8e6a | TypeScript | kvesskrishna/te-sr-common-20210529 | /tsintro.ts | 2.59375 | 3 | {
console.log("typescript");
let age: number = 90;
let uname: string = "john";
let nums: any[] = [1, 2, 3];
nums.push("w");
let isLogged: boolean = true;
console.log(uname);
}
|
96e01ec29589a6367f5717f6ac96d282a99ceebc | TypeScript | soufDev/frontend-test | /src/Redux/Selectors/index.ts | 2.515625 | 3 | import { groupByDate } from "../../utils";
import { IRootState, IActivity } from "../../types";
export const sortedActivitiesSelector = (state: IRootState) =>
Array.from(
groupByDate(
state.entity.activities.filter(
(activity: IActivity) => !activity.is_archived
)
)
);
export const sor... |
c1897cc2653b6425b5b667d95ac5af6b6b792d10 | TypeScript | lake2/tskoa | /src/decorators/Authorized.ts | 2.859375 | 3 | import { Controller, Meta } from "../Controller";
import { Class } from "../types";
export function Authorized(target: Class<Controller>): void;
export function Authorized(target: any, key: string, descriptor: PropertyDescriptor): void;
export function Authorized(value?: boolean): any;
export function Authorized(): an... |
bebd3af32687efb885d63b9e2c046a2388a96b0e | TypeScript | valours/roller-coaster | /src/utils/parseFile.ts | 2.8125 | 3 | import fs from 'fs';
import { Data } from '../main';
export const parseFile = (path: string): Promise<Data> => new Promise((res, rej) => {
try {
const fileContent = fs.readFileSync(path, 'utf8').split('\n')
const [configuration, ...queue] = fileContent;
const [numberPlacesPerTurn, turnsPerDay, queueSize]... |
fe8533885dd6abf56731cbd6cc814372c1a9e817 | TypeScript | DefinitelyTyped/DefinitelyTyped | /types/wuzzy/wuzzy-tests.ts | 2.890625 | 3 | import { jarowinkler, levenshtein, ngram, pearson, jaccard, tanimoto } from 'wuzzy';
declare const aString: string;
declare const aStringArr: string[];
declare const bString: string;
declare const bStringArr: string[];
jarowinkler(aString, bString, 0.5);
jarowinkler(aString, bStringArr);
jarowinkler(aStringArr, bStri... |
dc62d26ad79b88a5bf3116c337fae781330dcdab | TypeScript | SophieDel/orion | /server/src/backends/concepts/backend.ts | 2.59375 | 3 | import {Router, Request, Response} from 'express'
import {
concept_nodesAttribute,
modulesAttribute,
definition_valuesAttribute,
timeseries_valuesAttribute,
labelized_valuesAttribute,
suggestion_valuesAttribute,
} from '../../../../models/db'
import {
sequelize,
ConceptNodes,
Concep... |
064ec86ffe4d7e3f6953b87986ec4bb3e09bb68e | TypeScript | lds-ulbra-torres/Apae-Site | /client/src/app/pipes/procurar-categoria.pipe.ts | 2.609375 | 3 | import { ICategory } from './../../domain/interfaces/ICategory';
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'searcher'
})
export class ProcurarCategoriaPipe implements PipeTransform {
transform(items: ICategory[], procuraTexto: string): ICategory[] {
if (!items) return[];
if (!proc... |
821a8a057c2adb5690de2580e599d35e90c2e022 | TypeScript | nkunalic2/CarApp | /src/app/signup/step-three/step-three.component.ts | 2.546875 | 3 | import { Component, OnInit } from '@angular/core';
import {Router} from "@angular/router";
import {FormGroup} from "@angular/forms";
import {SignupService} from "../signup.service";
/* defining interface for options array */
interface Option {
name: string;
}
@Component({
selector: 'app-step-three',
templateUr... |
e0dace79a0f730e90b92a6b5f1674c256d36a403 | TypeScript | humandetail/linkup | /src/config/mahjong.ts | 2.578125 | 3 | /*
* @FilePath: \linkup-ts\src\config\mahjong.ts
* @Description: mahjong config
* @Author: humandetail
* @Date: 2021-03-19 22:45:02
* @LastEditors: humandetail
* @LastEditTime: 2021-03-25 23:17:34
*/
import { IMahjongItem } from '../../types';
// 底图素材
export const mahjongPic = './assets/img/mahjong.png';
// 单个... |
b6d87097a0f7d8fa3d0df5dfec045e75822f27cf | TypeScript | darrenmce/advent2020 | /9/index.ts | 3.25 | 3 | import { getTextInput } from '../lib/util';
const input = getTextInput(__dirname, 'input.txt');
function parseInput(input: string): number[] {
return input.split('\n').filter(Boolean).map((n) => parseInt(n, 10));
}
function validateNumber(preamble: number[], num: number): boolean {
return preamble.some((x, i) =>... |
0699717e8118772a914a36d707cbd1439b61da92 | TypeScript | ayaz345/momentum2 | /cli/commands/upgrade/upgrade.command-controller.ts | 2.796875 | 3 | import { Command, Injectable } from "../../deps.ts";
import { CommandController } from "../command-controller.interface.ts";
import { UpgradeCommandHandler } from "./upgrade.command-handler.ts";
import { UpgradeCommandParameters } from "./upgrade.command-parameters.ts";
@Injectable({ global: false })
export class Upgr... |
3ea0589ccdd38dbbc4f2f4b7d527dd72833812f4 | TypeScript | dtm0110/read-vietnamese-number | /src/Utils.ts | 3.546875 | 4 | /**
* Loại bỏ kí tự `char` đầu chuỗi `str`.
* @returns Chuỗi đã thực hiện loại bỏ.
* @param str Chuỗi bất kì.
* @param char Kí tự cần loại bỏ.
*/
function trimLeadingChars(str: string, char: string): string {
if (str === '')
return ''
let pos = 0
while (str[pos] === char[0])
pos++
r... |
0c3ae1023777f9de30e54fbc9025319dcafdc99b | TypeScript | rtwhite10/example-repo | /src/OrderPage/context/actions.ts | 2.5625 | 3 | // WHY IS ENUM GIVING A ERROR
import moment from 'moment';
export type ACTIONTYPE =
| { type: 'changeTab'; payload: number }
| { type: 'toggleStorePickUp' }
| { type: "changeDate"; payload: moment.Moment };
// enum ActionTypes {
// changeTab
// };
export type Action = {
type: string,
// need to add bett... |
e7b7a6355ca2a7d5134b9377ff0c4c8987169624 | TypeScript | agui1940/shadowsocks-global | /src/reducers/proxyReducer.ts | 2.703125 | 3 | import { createAction, createReducer } from "@reduxjs/toolkit";
import uuid from "uuid/v4";
export type Shadowsocks = {
id: string;
host: string;
port: number;
method: string;
password: string;
name?: string;
plugin?: string;
plugin_opts?: string;
regionCode?: string;
};
export type Subscription ... |
82ed2fda45f8dda7a65e720ac0dbc55f416a6345 | TypeScript | RicardoMiguel/url-shortener | /src/functions/cleanUrls.test.ts | 2.578125 | 3 | import * as td from 'testdouble';
import { expect } from 'chai';
import {UrlService} from "../service/urlService";
import cleanUrls from "./cleanUrls";
describe('cleanUrls', function () {
beforeEach(function () {
this.urlService = td.object<UrlService>();
});
afterEach(() => td.reset());
it('... |
a0c1282e92fcc8f07a76395202675655eeadfead | TypeScript | kembek/html-css-js | /TS/src/5-interface.ts | 3.890625 | 4 | interface Person {
firstName: string;
lastName: string;
age: number;
}
function debugPerson(person: Person) {
console.dir("This person", person);
}
const luke = {
firstName: "Luke",
lastName: "Sky Waker",
age: 21
};
debugPerson(luke);
interface User {
firstName: string;
lastName: string;
age: nu... |
f1c276778b94bcbcc42306be86edfb80ad084f97 | TypeScript | palantir/plottable | /src/interactions/pointerInteraction.ts | 2.84375 | 3 | /**
* Copyright 2014-present Palantir Technologies
* @license MIT
*/
import { Component } from "../components/component";
import { Point } from "../core/interfaces";
import * as Dispatchers from "../dispatchers";
import * as Utils from "../utils";
import { Interaction } from "./interaction";
export type PointerCal... |
edab648d30a436fbd5b28acec6787054754c83d2 | TypeScript | yktoo/infopi | /src/app/_pipes/time-ago.pipe.ts | 3.296875 | 3 | import { Pipe, PipeTransform } from '@angular/core';
/**
* Translate the provided date into the 'xxx time ago' string.
*/
@Pipe({
name: 'timeAgo',
})
export class TimeAgoPipe implements PipeTransform {
transform(d: Date | null | undefined): string {
if (!d) {
return '';
}
... |
824e0bd0009c4015cf874d3bb3d26f5ff796aeda | TypeScript | wjbaker101/permidea | /src/frontend/ts/component/TitleTextboxComponent.ts | 2.53125 | 3 | import { NoteService } from '../service/NoteService';
import { StateService } from '../service/StateService';
export const TitleTextboxComponent = (elementSelector: string) => {
const titleTextbox: HTMLInputElement
= document.querySelector(elementSelector);
const events = {
onInput(): void... |
c08929c6b4eec510eef12009ac3cd0d170cd4c61 | TypeScript | shanushalini011/type-script | /src/06_declaration_types/type_assertion.ts | 3.28125 | 3 | /*
{
"created_at" : "14 April 2017",
"aim_of_script" : "To represent Type Assertion in TypeScript",
"coded_by" : "Rishikesh Agrawani",
}
*/
var strNum = "1235x";
console.log(typeof strNum)
/*
type_assertion.ts(10,5): error TS2322:
Type 'string' is not assignable to type 'number'.
*/... |
08abf79e9361aeb1f1019ee4ddcbb7d6522ea0e5 | TypeScript | martinbojnansky/sheetspi | /backend/src/framework/models.ts | 2.53125 | 3 | import { ApiAction } from "../../../api/api";
import { TableQuery } from "../../../api/models";
export type Controller<TPayload> = (action: ApiAction<TPayload>) => unknown;
export interface Repository<T> {
getAll: (query: TableQuery) => T[];
getById: (id: string) => T;
create: (item: T) => T;
delete: (id: str... |
ae0922703686f4b2cf0428aff6cdc5213e0ebc61 | TypeScript | MeasureAuthoringTool/fhir-typescript-models | /src/models/fhir/classes/TerminologyCapabilitiesSoftware.ts | 2.75 | 3 | /* eslint-disable import/prefer-default-export, import/no-cycle */
import {
BackboneElement,
Extension,
FhirField,
ITerminologyCapabilitiesSoftware,
PrimitiveString,
FhirType
} from "../internal";
@FhirType("TerminologyCapabilitiesSoftware", "BackboneElement")
export class TerminologyCapabilitiesSoftware e... |
0ea21b32baabd53aa5b4299b8c60b0c026bdb32d | TypeScript | RubyBe/meal-tracker | /app/app.component.ts | 2.734375 | 3 | // import Component code from angulary library
import { Component, EventEmitter } from 'angular2/core';
import { Meal } from './meal.model';
import { MealListComponent} from './meal-list.component';
// annotation
@Component({
selector: 'my-app',
directives: [MealListComponent],
template: `
<div class = "cont... |
9ac17f1f1b75ffe916dd8898b1a84f00d093103e | TypeScript | 1z2x3c4v5b6n7m8/yesno | /commands-old/eval.ts | 2.765625 | 3 | import Spark from 'sparkbots'
import Discord from 'discord.js'
const Command = Spark.command("eval")
Command.setLevel(10)
Command.allowDms(true)
Command.setDescription('**Aliases**: none\n**Description**: Evals js code\n**Arguments**: Code to eval (required)\n**Example**: `!!eval message.reply(\'hi\')`')
module.exports... |
68f8739b9a117c5a6aba1c863b7e4ba51a911e11 | TypeScript | sharvit/patternfly-react | /packages/react-catalog-view-extension/src/helpers/util.ts | 3.09375 | 3 | import * as React from 'react';
/**
* @param {string} prefix - String to prefix unique ID with
*/
export function getUniqueId(prefix = 'pf') {
const uid =
new Date().getTime() +
Math.random()
.toString(36)
.slice(2);
return `${prefix}-${uid}`;
}
/**
* Returns the given React children prop a... |
aa4e0b88ec34f2dedc975c9701275167adf7884a | TypeScript | Unkgod/typescript | /pregunta1.ts | 3.046875 | 3 | //PREGUNTA # 1
var equip1:string = "Bayern Munich";
var equip2:string = "Borrussia Dortmud";
//Tarea #1
var jugadores1: Array <string> = ['Neuer', 'Pavard', 'Martinez', 'Alaba', 'Davies',
'Kimmich', 'Goretzka', 'Coman', 'Muller', 'Gnarby', 'Lewandowski'];
var jugadores2: Array <string... |
c51fba3f1ab60a8d19662c586e3b85d9b89d8e09 | TypeScript | NeerajVyas/workin--rms | /Case-study/rms-angular/src/app/login-form/authentication.service.ts | 2.703125 | 3 | import { Injectable } from '@angular/core';
import { HttpClient,HttpHeaders } from '@angular/common/http';
import { map } from 'rxjs/operators';
import { BehaviorSubject } from 'rxjs';
import Links from '../links.module';
export class User{
constructor(
public userId:string,
public userEmail:string,
pu... |
7d15d735a4424d084020c798baeb6e7b4f8b85d6 | TypeScript | Neekky/file_migrate | /TypeScript/ts基础部分/poker.ts | 3.453125 | 3 | // import { printDeck, createDeck } from "./funcs";
// const deck = createDeck();
// printDeck(deck)
/**
* 扑克牌小练习
* 1.创建一副扑克牌(不包括大小王),打印该扑克牌
* 2.使用枚举创造程序
* 3.使用模块化
* 4.用接口改造程序,加入大小王
* 5.用类改造程序 ,增加洗牌功能
*/
import { Deck } from "./deck"
const deck = new Deck();
deck.shuffle();
console.log("===========洗牌之后========... |
a8ffbd85e6e7475fd31326bb073549ca40711b06 | TypeScript | cyps1000/test-app | /src/utils/choice.ts | 3.203125 | 3 | /**
* Handles picking a random number from an array
*/
export const choice = (arr: any) => {
const randomIndex = Math.floor(Math.random() * arr.length);
return arr[randomIndex];
};
|
e014dd395c86cb8532065232b418df894ec44572 | TypeScript | drecocoa/dpainter | /src/scripts/Data.ts | 3.03125 | 3 | import { LineStore } from './Line';
export class Layer{
name:string="";
alpha:number=1;
data:any={};
}
export class VectorLayer extends Layer{
}
export class Storable{
id:number=0;
layer:number=0;
type:string=this.constructor.name;
//todo!//
static is<T exten... |
13c0ab8a3d42c7611ea07ec10027329fa4f01953 | TypeScript | njgheorghita/ethpm.js | /src/package/resolver/index.ts | 2.625 | 3 | /**
* @module "ethpm/package/resolver"
*/
import { IpfsService } from 'ethpm/storage/ipfs';
import { v3 } from 'ethpm/manifests/v3';
import { Package, Sources, SourceWithContent, SourceWithUrls } from 'ethpm/package';
import { URL } from 'url';
interface ResolvedBuildDependencies {
[key: string]: ResolvedPackage;... |
6bbccfa34869c3948c3f5d47f0533372b0c101b5 | TypeScript | otomad/otomad.github.io | /math/turntable/js/money.ts | 3.03125 | 3 | 'use strict';
/// <reference path="money.d.ts" />
declare var jQuery: (selector: string) => any;
interface Number {
getPrefix(name?: boolean): number | string;
getValidValue(full?: boolean): number;
}
interface Math {
// trunc(n: number): number;
social(n: number): number;
}
interface CSSRule {
style: any;
selec... |
f446def5de6b1af35acbe52886c6e0851d7b2075 | TypeScript | chase-moskal/event-decorators | /source/interfaces.ts | 2.859375 | 3 |
export type EventDetails<T extends CustomEvent>
= T extends CustomEvent<infer D> ? D : never
export type Dispatcher<E extends CustomEvent> = (
options?: CustomEventInit<EventDetails<E>>
) => void
export interface EventListener {
name: string
target: EventTarget
handler: (event: Event) => void
options?: boolean |... |
60eb800572fa3452a0aefc1ee3e6ebfa8b7f96c4 | TypeScript | fctucker/challenge | /src/app/weather/weather.ts | 2.796875 | 3 | import {Driver} from "../util/driver";
import {appWidth} from "../util/constants";
import {Subscription} from "rxjs/Subscription";
export abstract class Weather {
public enabled: boolean = false;
public gravity: {} = {dx: 0, dy: 5};
private subscription: Subscription = null;
isTransitioningOut: bool... |
cce681b894710a3150d82ca6ef4ef2312a2addfd | TypeScript | FernandoBasso/programming-how-to | /typescript/ts50/ch05-generics/l30d-index-types.ts | 3.328125 | 3 | export const NAME = "l30d Generic Constraints - Index Types";
const log: Console["log"] = console.log.bind(console);
type VideoFormatURLs = {
format360p: URL;
format480p: URL;
format720p: URL;
format1080p: URL;
};
type SubtitleURLs = {
english: URL;
german: URL;
french: URL;
};
//
// Observe that both... |
d6d08dfdca86f76f0e9982e5fe4158701692cc7a | TypeScript | Pringmore/demo-app-two | /src/app/app.component.ts | 2.53125 | 3 | import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.sass']
})
export class AppComponent implements OnInit {
title = 'demo-app-two';
checkOne(param: number) {
switch (param) {
case 12:
return pa... |
062d409399c7fb7e1c586d66dbb7a3449319e6b7 | TypeScript | reececomo/transl8r | /src/helpers/fetch.ts | 2.703125 | 3 | import { Translate, TranslateRequest } from '@google-cloud/translate/build/src/v2';
import { config, Dict } from '../config';
import { preparePlaceholders, resolvePlaceholders } from './placeholders';
const translate = async (text: string, options: TranslateRequest): Promise<string> => {
const client = new Translate... |