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 |
|---|---|---|---|---|---|---|
2105fe61a2ad6629ee6ab1693a159ddd226e7d61 | TypeScript | haakon-gun/bachelor2021 | /src/common/d3.ts | 2.65625 | 3 | import { D3Edge, LabelTransform } from '../types/d3/simulation';
import { GraphEdge, GraphNode, Ontology, UniqueObject, Edge } from '../types/ontologyTypes';
import { mapIdToEdge } from './node';
export const mapOntologyToGraphEdge = (ontology: Ontology): GraphEdge => {
const edge = mapIdToEdge(ontology.Predicate.id... |
f7d2cdfaf558bcb97d3bca5d010a01c7cc4f5379 | TypeScript | TXZdream/websocket-echo-server_end | /static/xterm/src/EscapeSequences.ts | 3.046875 | 3 | /**
* @license MIT
*/
/**
* C0 control codes
* See = https://en.wikipedia.org/wiki/C0_and_C1_control_codes
*/
export namespace C0 {
/** Null (Caret = ^@, C = \0) */
export const NUL = '\x00';
/** Start of Heading (Caret = ^A) */
export const SOH = '\x01';
/** Start of Text (Caret = ^B) */
export const... |
0a9ccf28760ae70915a88cbbedcca4dff2ea3737 | TypeScript | YeZhikang/im-server | /src/util/time.ts | 3.125 | 3 | export const isEqualDate = (a, b) => {
if(a.length !== b.length || a.length !== 3){
return false
}
for(let i = 0; i < a.length; i++){
console.log(parseInt(a[i]), parseInt(b[i]))
if(parseInt(a[i]) !== parseInt(b[i])){
return false
}
}
return true
}
expor... |
828308d9fee1782fe4a8325accfbfa039f924bcd | TypeScript | detochko/ts-utils | /src/dom/getWindow.ts | 2.90625 | 3 |
let cache: Window|null|undefined;
/**
* @returns {Window|undefined}
*/
export const getWindow = (): Window|undefined => {
if (undefined === cache) {
cache = typeof window !== 'undefined' ? window : null;
}
return cache || undefined;
};
|
c40c415329093abd1975882391e797a178bc5f79 | TypeScript | kichkinproject/wsm2-client | /src/app/models/controller.ts | 2.671875 | 3 | import {ControllerType} from './entity-type';
export class Controller {
id: number;
// uniqId: string;
name: string;
description: string;
type: ControllerType;
master: number;
constructor(id: number, /*uni: string,*/ name: string, description: string, type: ControllerType = ControllerType.CONTROLLER_TYP... |
e0364b33c2fdbde6b2a1b538a8bfd9b72f29c31f | TypeScript | MaxBrokhman/excel-js | /src/components/dashboard/Dashboard.ts | 2.546875 | 3 | import map from 'lodash/map'
import {Wp} from '../../core/Wp';
import {localStorageManager} from '../../core/LocalStorageManager';
class Dashboard extends Wp {
private tableRecords: Array<string>
constructor() {
super()
this.tableRecords = localStorageManager.getAllTableRecords()
}
get dashboardHeade... |
3d3e380684b31ade0ac141b702f4e990e1a84eef | TypeScript | HPDell/baidu-business-circle | /routes/model/BusinessCircle.ts | 3.140625 | 3 | export interface BusinessCircle {
/**
* 商圈所在的坐标范围,Point数组。
*/
coordinate: Point[];
/**
* 商圈所在城市名。
*/
city: string;
/**
* 商圈所在的区域。
*/
district: string;
/**
* 商圈的类型。
*/
type: string;
}
interface Point {
lng: number;
lat: number;
} |
b0d790faa1a795c31a373876a7239a2755422fab | TypeScript | cmh114933/airbnb-basic-typeorm | /src/entity/Review.ts | 2.59375 | 3 | import {Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn} from "typeorm";
import { Property } from "./Property";
@Entity()
export class Review {
@PrimaryGeneratedColumn()
id: number;
@Column()
rating: number;
@Column()
remark: string;
@ManyToOne(type=> Property, property =>... |
829e249dd2f9acb7cde33e787d2b7378f3e02472 | TypeScript | im-cuttlefish/libroJS | /src/screen/background/index.ts | 2.734375 | 3 | import * as PIXI from "pixi.js";
import * as Animation from "../Animation";
import { Display } from "../interface/Display.interface";
import { BackgroundData } from "../../interface/BackgroundData.interface";
export class BackgroundDisplay implements Display {
readonly container: PIXI.Container;
private width: num... |
df630ab2c3e809cda5cefe996dc30fff5fa58ea6 | TypeScript | jimmy818/mexico-angular | /soloperformance/soloperformance-solo-performance-frontend-12ba8ff551a0/projects/admin/src/app/modules/auth/shared/auth.validators.ts | 3.03125 | 3 | import { FormGroup } from '@angular/forms';
export class AuthValidators {
/**
* Validador de confirmación de contraseña.
* @param g Formulario con los campos correspondientes: contraseña y confirmación.
* Es necesario que los campos se llamen 'password' y 'passwordConfirm' respectivamente.
*/... |
ba4cd40409bfe321fc555fee1b31f485d46abca1 | TypeScript | Silvestr-b/async-dicontainer | /src/tests/get.ts | 2.859375 | 3 | import { expect } from 'chai'
import * as sinon from 'sinon'
import { Container } from '../'
import { Interfaces } from './data/interfaces/index'
import { TYPES } from './data/types/index'
import { Dog } from './data/entities/Dog'
import { Cat } from './data/entities/Cat'
import { Sheep } from './data/entities/S... |
85e336db7c63784adeed3e2842ced72d501f6ad5 | TypeScript | ChicoState/CareerFair | /career-fair-app/src/app/about/volunteer.component.ts | 2.59375 | 3 | import { Component,Input } from '@angular/core';
class Volunteer {
firstName: string;
lastName: string;
constructor (first: string, last: string)
{
this.firstName = first;
this.lastName = last;
}
}
@Component({
selector: 'volunteer',
templateUrl: './volunteer.component.html',
st... |
c9f22aaab7ef21a43aace240aa5309d4fe4ef50f | TypeScript | zeroEvidence/SOLID_ToyRobot | /src/ui/interfaces/UserInterfaceAdapterFactory.interface.ts | 2.59375 | 3 | import { ISurface } from "../../entities/surface/interfaces/Surface.interface";
import { IToy } from "../../entities/toy/interfaces/Toy.interface";
import { ICommand } from "../../interfaces/Command.interface";
/**
* IUserInterfaceAdapterFactory defines the specification for
* user interface adapter factories.
*
*... |
5e94a636144802c01026ee4434ce81fa1150670a | TypeScript | gpasq/deno-sendgrid | /test.ts | 2.59375 | 3 | import {
assertEquals,
assertStrictEq,
assert,
} from "https://deno.land/std/testing/asserts.ts";
import {
sendMail,
IRequestBody,
sendSimpleMail,
ISimpleRequestBody,
} from "./mod.ts";
// This is a throwaway key for testing a limited number of emails only,
// from a throwaway account. Sorta like givin... |
d3cbc3d61d7a979c42db4b26c7ed1348a056cc0b | TypeScript | pasha-shestakov/WebpackTutorial | /src/test.ts | 2.734375 | 3 | class test{
var testInt: number;
testInt = 5;
var testString: string = "hello world 31 this works";
console.log(testString);
document.getElementById("test").innerHTML = "Test = " + testString;
} |
8cb55f7ab94912fe14a492d2006cf7aa430161f6 | TypeScript | cgiovanni96/Ruddit | /server/src/resolver/user/forgotPassword.ts | 2.671875 | 3 | import argon2 from 'argon2'
import { Arg, Ctx, Mutation, Resolver } from 'type-graphql'
import { v4 } from 'uuid'
import Context from '../../app/server/context'
import { isEmail, sendEmail } from '../../app/util/email'
import User from '../../database/entity/User'
import UserResponse from '../../database/schema/respons... |
93d8785c205479bc16e5324c3533cb975984cd07 | TypeScript | ByDSA/datune | /packages/core/src/time/symbolic/rhythm/pattern/cache.ts | 2.578125 | 3 | import { Arrays, StringHashCache } from "@datune/utils";
import Pattern from "./Pattern";
type HashingObject = Arrays.Number;
const cache = new StringHashCache<Pattern, HashingObject>( {
hash(hashingObject: HashingObject): string {
return hashingObject.toString();
},
toDto(pattern: Pattern): HashingO... |
be96973cdcad77e51a1c61ba5b6eb46ae661c3a2 | TypeScript | zhanglijie5997/zhanglijie123 | /api/posts/apiDeletePost.ts | 2.53125 | 3 | import { RequestHandler } from "express";
import { DataStore } from "../../data/data";
import { publicInfo, apiError } from "../../model/todo/message";
export const apiDeletePost:RequestHandler = (req,res,next) => {
const postIndex = DataStore.post.findIndex((item:any) => {
return item.id == ... |
e7b859f21e8187295f0f1a743be78805484eeeda | TypeScript | Noah-1994/web-utils | /src/object/index.ts | 2.953125 | 3 | /* eslint-disable no-unused-expressions */
/* eslint-disable no-restricted-syntax */
/* eslint-disable guard-for-in */
/* eslint-disable no-self-compare */
/* eslint-disable no-use-before-define */
export function clone(obj:any) {
if (typeof obj === 'function') {
return obj;
}
const result:any = Array.isArray... |
dfa025d297dc4d257df3a486d6bfb3d07d2187b7 | TypeScript | marckassay/DemoOfIonicIssues | /e2e/src/helpers/WebView.ts | 3.046875 | 3 | import Gestures from './Gestures';
export const CONTEXT_REF = {
NATIVE: 'native',
WEBVIEW: 'webview',
};
const DOCUMENT_READY_STATE = {
COMPLETE: 'complete',
INTERACTIVE: 'interactive',
LOADING: 'loading',
};
class WebView {
constructor() {
}
/**
* Wait for the webview context to... |
1c53e94a6cfec17527155e803020eda883bea0c9 | TypeScript | okumurakengo/til | /js/ts/02_doc/119_compability.ts | 3.15625 | 3 | let identity = function<T>(x: T): T {
return x;
}
let reverse = function<U>(y: U): U {
return y;
}
identity = reverse; // OK, because (x: any) => any matches (y: any) => any
|
760ad2d7a5e603766e18b5d3609287cc63140fd6 | TypeScript | reddybushan/employeedeptfrontend | /src/app/Employee.ts | 2.6875 | 3 | import { Department } from "./Department";
export class Employee {
employeeId: number;
firstName: string;
lastName: string;
phoneNumber: string;
managerId: number;
salary: number;
department: Department;
email: string;
constructor(employeeId: number, firstName: string, lastName:str... |
f23dd75a3b1dd6c4652e057c8ae36256d6b3a45c | TypeScript | expo/expo-cli | /packages/expo-cli/src/appleApi/pushKey.ts | 2.671875 | 3 | import { Keys } from '@expo/apple-utils';
import chalk from 'chalk';
import dateformat from 'dateformat';
import CommandError from '../CommandError';
import Log from '../log';
import { ora } from '../utils/ora';
import { AppleCtx, getRequestContext } from './authenticate';
export type PushKeyInfo = {
id: string;
... |
7e05535d36797cd57b16457a22cb448781529a10 | TypeScript | xiaoxin0573128/egret-framework | /source/src/ECS/Components/Camera.ts | 2.59375 | 3 | ///<reference path="../Component.ts"/>
class Camera extends Component {
private _zoom;
private _origin: Vector2;
private _transformMatrix: Matrix2D = Matrix2D.identity;
private _inverseTransformMatrix = Matrix2D.identity;
private _minimumZoom = 0.3;
private _maximumZoom = 3;
privat... |
7608f04e247e71172bac36e57ab3ce7271b9d57e | TypeScript | RomanAVolodin/HoldingEvents | /backend/src/user/repositories/user.repository.ts | 2.5625 | 3 | import { EntityRepository, Repository } from 'typeorm';
import { UserEntity } from '@app/user/entity/user.entity';
import { HttpException, HttpStatus } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
@EntityRepository(UserEntity)
export class UserRepository {
constructor(
@InjectReposi... |
4f21c51f236055669b6479e8826cfc6a7121f5f7 | TypeScript | tiagomaradei/design-patterns | /src/FactoryMethod/Pizza.ts | 3.078125 | 3 | abstract class Pizza {
protected name: string;
protected dough: string;
protected suace: string;
protected topPings: string[] = [];
public prepare(): void {
console.log(`Preparing... ${this.getName()}`);
console.log(`Tossing dough...`);
console.log(`Adding sauce...`);
console.log(`Adding t... |
01ad33e991d9232f366c053277001191d71ffb1b | TypeScript | chrisguttandin/subscribable-things | /src/factories/on.ts | 2.703125 | 3 | import { TEventHandler, TEventType, TOnFactory } from '../types';
export const createOn: TOnFactory = (wrapSubscribeFunction) => {
return (target, type, options) =>
wrapSubscribeFunction((observer) => {
const listener: TEventHandler<typeof target> = (event) => observer.next(<TEventType<typeof t... |
afaaace68297e072a55b1cbf3a24b504819767d9 | TypeScript | DarkMatterBridge/BiddingSystem | /src/app/model/Bidding.ts | 2.890625 | 3 | export class Bidding {
nodes = [];
bids = [];
index: number;
constructor() {
this.index = 0;
}
addBid(nextBid) {
this.bids.push(nextBid[0]);
this.nodes.push(nextBid[1]);
this.index++;
}
getLastBid() {
return (this.index);
}
getBid(... |
ac6591117b84bd3ff8e79d5844f5fa8c3f8e56a9 | TypeScript | aleksandr-yakovlev/mf.messenger.praktikum.yandex | /src/utils/render.ts | 2.78125 | 3 | interface IBlock {
hide: () => void;
show: () => void;
getContent: () => HTMLElement;
}
export const render = (query: string, block: IBlock, element = document): HTMLElement => {
const root = element.querySelector(query);
return root ? root.appendChild(block.getContent()) : block.getContent();
};
|
38d82a36cd2ca9b56a39cced93e909defd914704 | TypeScript | duffman/bi-realtime-module | /new-backend/src/core/socket-message.ts | 2.65625 | 3 | /**
* Copyright (c) Patrik Forsberg <patrik.forsberg@coldmind.com> - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
*/
export interface ISocketMessage {
jsonObj: any;
}
export class SocketMessage implements ISocketMessage {
... |
3bb74ac083c20f5d60fe753e5f24b87fca463aaf | TypeScript | andyjia/leetcode-typescript | /solutions/maximum_subarray_test.ts | 2.671875 | 3 | import { test } from "https://deno.land/std/testing/mod.ts";
import { assertStrictEq } from "https://deno.land/std/testing/asserts.ts";
import maxSubArray from "./maximum_subarray.ts";
test("53. Maximum Subarray", () => {
assertStrictEq(maxSubArray([-2, 1, -3, 4, -1, 2, 1, -5, 4]), 6);
assertStrictEq(maxSubArray([... |
f041dfd33dc51e90b8701983c533e8d16ee6d5f6 | TypeScript | indrimuska/ng-toolkit | /src/input/input.ts | 2.546875 | 3 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { ValueAccessor } from '../utility';
enum InputType {
text = 'text',
}
const InputTypesArray: InputType[] = Object.keys(InputType).map(type => InputTyp... |
3b258c02733f3bb91c9ca9f2fb4d0394ba40863a | TypeScript | FoalTS/foal | /packages/core/src/sessions/http/check-user-id-type.spec.ts | 2.8125 | 3 | import { strictEqual, throws } from 'assert';
import { checkUserIdType } from './check-user-id-type';
describe('checkUserIdType', () => {
context('given the user ID type is "string"', () => {
it('should return the user ID if it is a string.', () => {
const userId = '123';
const userIdType = 'string'... |
b905a1fd2ba3d58139541d29e1c1bb04563cb8bc | TypeScript | spacejack/m-carousel | /src/ts/components/carousel-page.ts | 2.8125 | 3 | import * as m from 'mithril'
import carousel from './carousel'
import panel from './panel'
/** Contents for each panel in the carousel */
const CONTENTS = [
{title: "Panel One", image: 'panel1.jpg', body: "Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repud... |
96b3ca439001ec452fbd714846c758a99fa3a798 | TypeScript | tianfenglin/commonts | /src/baseclass/https/browser.ts | 2.71875 | 3 | /**获取配置信息等 */
class Browser {
/**
* 获取flash版本
*/
public getFlashVersion(): number {
let version;
try {
version = navigator.plugins["Shockwave Flash"];
version = version.description;
} catch (ex) {
try {
version = new ActiveXObject(
"ShockwaveFlash.ShockwaveFlas... |
0ead075681b86de9f574a1a9b365528a482de3ae | TypeScript | rsksmart/rif-storage-pinner | /src/cli/db-migration.ts | 2.5625 | 3 | import fs from 'fs'
import path from 'path'
import { flags } from '@oclif/command'
import { OutputFlags } from '@oclif/parser'
import { loggingFactory } from '../logger'
import BaseCommand from '../utils'
import { Migration } from '../migrations'
const logger = loggingFactory('cli:db-migration')
const MigrationTempl... |
6abbb56b83893276a1bae9d19ab74f6b7714acc2 | TypeScript | HMSConnect/hms-widget-sdk | /app/reducers-redux/observation/observationHeartRateCard.reducer.ts | 2.984375 | 3 | type ObservationHeartRateCardType =
| 'INIT_PATIENT_SUMMARY'
| 'SET_STRUCTURE_OBSERVATION_HEART_RATE_CARD'
interface IObservationHeartRateCardAction {
type: ObservationHeartRateCardType
payload: any
}
export interface IObservationHeartRateCardStructure {
headerIconField: boolean
dateTimeField: boolean
}
... |
ec42e430555c2557cc8653fe069d59f3c39298bf | TypeScript | stephen-ying/signalwire-js | /packages/web-api/src/rooms/createRoomFactory.ts | 2.921875 | 3 | import { HttpClient, RoomResponse } from '../types'
interface CreateRoomOptions {
name: string
displayName?: string
maxParticipants?: number
deleteOnEnd?: boolean
startsAt?: string
endsAt?: string
}
export type CreateRoom = (options: CreateRoomOptions) => Promise<RoomResponse>
type CreateRoomFactory = (cl... |
24c128d438f05b47c5bbd728dab91e433ef7e271 | TypeScript | adam-stanek/chobot | /packages/chobot/src/utils/match.ts | 3.09375 | 3 | import { defaultFilter } from '../paramTypes/defaultFilter'
import { ParamDescriptor } from '../paramTypes/ParamDescriptor'
import { MatchingNode } from './MatchingNode'
export interface Match {
matchedLength: number
rank: number
params: { [k: string]: any }
}
// Matcher
export function match(
str: string,
... |
2f9ede3f820aa83c9c11c0cdf1c2e343b64d8a95 | TypeScript | invoke-ai/InvokeAI | /invokeai/frontend/web/src/common/util/randomInt.ts | 2.71875 | 3 | const randomInt = (min: number, max: number): number => {
return Math.floor(Math.random() * (max - min + 1) + min);
};
export default randomInt;
|
a8295cde7e56f5e0df24fcd751b5c2b36b1eb79c | TypeScript | frydlewicz/AutoComplete | /public/js/jquery.autoComplete.ts | 2.5625 | 3 | declare const jQuery: any;
(($: any): void => {
if (typeof $ === 'undefined') {
throw new Error('No jQuery library found!');
}
const prefix = 'autoComplete';
const className = `${prefix}__list`;
const classNameItem = `${prefix}__list-item`;
const classNameActiveItem = `${prefix}__list-... |
c9ec111750527aa4e1fbe59555b518dc205310fd | TypeScript | flooper68/nestjs-playground | /src/cqrs/aggregate-root.ts | 2.71875 | 3 | import { IEvent } from './interfaces';
export abstract class AggregateRoot {
private _uncommittedEvents: IEvent[] = [];
dispatch<T extends IEvent>(event: T) {
this._uncommittedEvents.push(event);
}
getUncommittedEvents(): IEvent[] {
return this._uncommittedEvents;
}
}
|
775f72cf431b4d9c8e0c6a174122d170b943d63f | TypeScript | AndyRightNow/babel-plugin-transform-nej-amd | /src/helpers.ts | 2.8125 | 3 | import * as t from 'babel-types';
import { forOwn } from 'lodash';
export function createInjectedNejParamAssignment(varName: string, index: number): t.Statement {
let rightHandSide: t.FunctionExpression | t.ObjectExpression | t.ArrayExpression = t.objectExpression([]);
switch (index) {
// Injected fun... |
2ab66618011c66d3fbdff2acc827bf06a12e28e1 | TypeScript | felipeleite11/theme-switcher-typescript | /src/utils/usePersistedState.ts | 3.140625 | 3 | import { useEffect, useState, Dispatch, SetStateAction } from 'react'
type Response<T> = [
T,
Dispatch<SetStateAction<T>>
]
function usePersistedState<T>(key: string, defaultValue: T): Response<T> {
const [state, setState] = useState(() => {
const storagedValue = localStorage.getItem(key)
if(storagedValue) {
... |
4428f049ae113ad43b676fe9f0fe65394bc2b8ea | TypeScript | zhikunmen/basketball | /src/sub_game/facebook/FacebookStorage.ts | 2.546875 | 3 | class FacebookStorage {
static highestScore: string = "highestScore";
static ownSkin: string = "ownSkin";
static usingSkin: string = "usingSkin";
static GAME_COIN: string = "gameCoin";
private static _instance: FacebookStorage;
public static getInstance(): FacebookStorage {
... |
6d58cb4d158d0cf95930ae419edfbf1417b55761 | TypeScript | kornatskyi/authentication | /src/models/user.model.ts | 2.78125 | 3 | import { MysqlError } from "mysql";
import sql from "./db";
class User {
email: string;
name: string;
password: string;
constructor(email: string, name: string, password: string) {
this.email = email;
this.name = name;
this.password = password;
}
static create = (newUser: User, result: Functi... |
ef389a438c7fa19d1d16c9b04a4a15febb14e15b | TypeScript | samuraimasa/nestJS | /src/tasks/task.entity.ts | 2.5625 | 3 | import {
BaseEntity,
BeforeInsert,
Column,
CreateDateColumn,
DeleteDateColumn,
Entity,
Generated,
IsNull,
ManyToOne,
Not,
OneToMany,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { User } from '../auth/user.entity';
import { HashId } from '../utils/hash_id';
import { Todo ... |
7ad8497429e806b17ffcda6d11de75a342125c42 | TypeScript | dariya-maslyukova/nestjs-angular | /client/src/app/models/products-query.model.ts | 2.5625 | 3 | import { BasicQueryModel } from './basic-query.model';
import { ProductsFilters } from '../interfaces/product/product-filters.interface';
export class ProductsQueryModel extends BasicQueryModel {
queryParams?: ProductsFilters = {};
constructor(params: any) {
super(params);
const attrs = [
'parentCat... |
ca0996875710b709363804c001443cabf976e3be | TypeScript | VagrantAI-c/ng-carousel-cdk | /projects/ng-carousel/src/lib/private/service/helpers/drag-offset/drag-offset-snapshot.spec.ts | 2.625 | 3 | import { CarouselAlignMode } from '../../../../carousel-align-mode';
import { CarouselWidthMode } from '../../../../carousel-width-mode';
import { dragOffsetSnapshot } from './drag-offset-snapshot';
describe('dragOffsetSnapshot test suite', () => {
// Imitate y = 2x function so we can predict results
const be... |
ee2ce4df496349a3748a7d9b67e8352faca046ee | TypeScript | furkleindustries/twine-tree | /src/AbstractSyntaxTree/isAbstractSyntaxTree.ts | 2.515625 | 3 | import {
isAbstractSyntaxContent,
} from './isAbstractSyntaxContent';
import {
isProgram,
} from './isProgram';
import {
isStylesheet
} from './isStylesheet';
import {
TAbstractSyntaxTree,
} from './TAbstractSyntaxTree';
export function isAbstractSyntaxTree(maybe: any): maybe is TAbstractSyntaxTree {
return ... |
8814e461de9529e0056578915fb83db1e48e1395 | TypeScript | galganif/arcs | /src/runtime/test/manifest-parser-test.ts | 2.765625 | 3 | /**
* @license
* Copyright (c) 2017 Google Inc. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* Code distributed by Google as part of this project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io... |
d86851f9596d28169dde5e901faebd5a6190b39f | TypeScript | betagouv/delta-v | /front/src/stores/users/useCase.store.ts | 2.625 | 3 | /* eslint-disable import/no-cycle */
import jwtDecode from 'jwt-decode';
import { StoreSlice } from '../store';
import { USER_EMPTY_STATE } from './appState.store';
export interface UsersUseCaseSlice {
setUserFromToken: (accessToken: string, refreshToken: string) => Promise<void>;
clearUser: () => Promise<void>;... |
d31255c2800bf426f29979b00299ea1c7d26acae | TypeScript | abhisekp/yup-phone | /src/yup-phone.ts | 2.96875 | 3 | import * as Yup from 'yup';
import gPhoneNumber from 'google-libphonenumber';
const phoneUtil = gPhoneNumber.PhoneNumberUtil.getInstance();
declare module 'yup' {
export interface StringSchema {
/**
* Check for phone number validity.
*
* @param {String} [countryCode=IN] The country code to check ... |
06613d1bed379df72d9ae30ce6d6edd3a0f6377a | TypeScript | chrsep/statmin | /src/redux/user/userAction.ts | 2.5625 | 3 | import { ActionsUnion, createAction } from "../actionHelpers"
export const SET_TOKEN_USER = "SET_TOKEN_USER"
export const LOGIN_USER = "LOGIN_USER"
export const UserActions = {
login: () => createAction(LOGIN_USER),
setAcessToken: (token: string) => createAction(SET_TOKEN_USER, token)
}
export type UserActions =... |
cb81d8496dcfe039bf81910e35ba4174a3ada871 | TypeScript | standardgalactic/svg | /src/demo/rotating.ts | 2.59375 | 3 | import { Canvas } from '../lib/svg/canvas';
import { Line } from '../lib/svg/line';
import { Color } from '../lib/color/color';
import { Shape } from './shape';
import { TweenConfig } from '../lib/tween/tween';
import { Tweens } from '../lib/tween/tweens';
import { Back, Bounce, Circ, Quad } from '../lib/tween/ease';
i... |
f958d9fc41c5e54b02fae319fdfe9fb1ac7cc68d | TypeScript | maxint137/KanjiNav | /views/scripts/localDictionary.ts | 2.65625 | 3 | import { DbKanji, DbWord, IJapaneseDictionary, JlptLevel } from "./knApi";
import { kanjis, words } from "./data";
export class LocalDictionary implements IJapaneseDictionary {
private static loadKanji: (word: string) => any = (word: string) => {
return kanjis.filter((k: any) => 0 <= word.indexOf(k.chara... |
1a7f06f416eb37c1c0355d8ebde17631a45a8b03 | TypeScript | nguyer/aws-sdk-js-v3 | /clients/browser/client-eventbridge-browser/types/_BatchArrayProperties.ts | 3 | 3 | /**
* <p>The array properties for the submitted job, such as the size of the array. The array size can be between 2 and 10,000. If you specify array properties for a job, it becomes an array job. This parameter is used only if the target is an AWS Batch job.</p>
*/
export interface _BatchArrayProperties {
/**
* ... |
82ebcc1b5e4e321d8755f996a0e159a110acaedc | TypeScript | riccardo-gallini/Screens | /Screens.Hosting.WebTerm/wwwroot/scripts/terminal.ts | 2.875 | 3 | class Terminal
{
conn: any; //signalR connection that receives updates from server
termControl: HTMLElement; //term dom element used for display
height: number;
width: number;
constructor(conn, term: HTMLElement)
{
this.conn = conn;
this.conn.on("Beep", ()=>this.... |
f236214359f8f000e245363878e3ad37f1fe8267 | TypeScript | HubSpot/hubspot-api-nodejs | /codegen/automation/actions/models/InputFieldDefinition.ts | 2.546875 | 3 | /**
* Custom Workflow Actions
* Create custom workflow actions
*
* OpenAPI spec version: v4
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { FieldTypeDefinition } from '../models/Fie... |
4a23bd3dd2e598168861b51a8402976f58deda9b | TypeScript | StevenLOL/VisualDL | /frontend/packages/mock/data/text/text.ts | 2.5625 | 3 | /**
* Copyright 2020 Baidu Inc. All Rights Reserved.
*
* 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 applica... |
9d62dd70a232ee730aeb7ff4a32a765b07b97c1f | TypeScript | jgke/fgj21 | /front/src/morning.ts | 2.96875 | 3 | import { distance } from './distance';
import { hideDrunk } from './drunkCanvas';
function h2(text: string) {
const elem = document.createElement("h2");
elem.textContent = text;
return elem;
}
function span(text: string) {
const elem = document.createElement("span");
elem.textContent = text;
... |
77e22b6a6f2ee2b7cb404c54d063024d5dcb451f | TypeScript | yadavsarika93/News-Widget | /src/app/data.service.ts | 2.515625 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Inews } from './inews';
import { mergeMap, groupBy, reduce } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class DataService
{
public article :object;
... |
97fb947643f00526bd6a74b44ddf3a3a9565dacc | TypeScript | lambdulus/core | /src/lexer/errors.ts | 3.0625 | 3 | import { PositionRecord } from "./position"
export class InvalidIdentifier extends Error {
constructor (
public readonly value : string,
public readonly position : PositionRecord,
) { super() }
}
export class InvalidNumber extends Error {
constructor (
public readonly value : string,
public rea... |
fd45b6179fda545d1f1336744edf0a474395e167 | TypeScript | fogre/TypeScript | /Patientor/backend/src/routes/patients.ts | 2.578125 | 3 | import express from 'express';
import patientService from '../services/patientService';
const router = express.Router();
router.get('/', (_req, res) => {
res.json(patientService.getNonSensPatients());
});
router.get('/:id', (req, res) => {
res.json(patientService.getPatient(req.params.id));
});
/* eslint-disable ... |
47f195297b4da05b59be0302823695c2640aee33 | TypeScript | bugzpodder/ui-lib | /src/utils/url-utils/url-util-get-query.spec.ts | 2.53125 | 3 | import { getQuery } from "./url-util";
describe("getQuery", () => {
it("handles no search query", () => {
expect(getQuery()).toEqual({});
});
it("handles props with no location", () => {
expect(getQuery({})).toEqual({});
});
it("handles props with location but no location", () => {
const props = ... |
da41cc7ae906f30f941a9d70fd6d24497b34b498 | TypeScript | meirkr/angular2Labs | /step6.1/src/app/common/ellipsis.pipe.ts | 2.90625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: "ellipsis"
})
export class EllipsisPipe implements PipeTransform {
// adds ... if the string length > lettersLength
transform(val:string, lettersLength:number=10) {
return val.length > lettersLength ? val.substring(0, lettersLength... |
6e330e641184caed02d8ff13dd09869757a0faaa | TypeScript | mschilling/chrome-developers-assistant | /functions/src/services/people-service.ts | 2.859375 | 3 | import { Person } from "../models/person";
import { CoreService } from "./abstract-service";
import { FirestoreCollections } from "../enums/firestore-collections";
import { GenericCard } from "../models/card";
export interface IPeopleService {
getPeople(limit?: number): Promise<Person[]>;
getPerson(id: string): Pr... |
b597dc8da80ffdc7dafbd71d02cd1a32bf3932eb | TypeScript | AmadeusITGroup/xjs | /src/pre-processors/md.ts | 2.578125 | 3 | import { XjsParamHost, XjsParamDictionary, XjsPreProcessorCtxt, XjsCData } from './../xjs/types';
import marked from 'marked';
import { createElement, createParam, addParam, XjsParserContext, parse } from '../xjs/parser';
const U = undefined;
const RX_S_QUOTE = /\&\#39;/g,
RX_BANG = /\!/g,
RX_SLASH = /\\\//g,... |
3de4005b1e6175502ba73498d5cc46e1c7d62135 | TypeScript | enwrought/continual2 | /src/server/entities/CalendarEntry.ts | 2.6875 | 3 | import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { User } from './User';
import { ModifyEntryDTO } from '../dto';
/**
* CalendarEntries can be exported from other sources and are not shown to the public.
*/
@Entity()
export class CalendarEntry {
... |
6f0a31ca10b87cdaa3f35cc169e9b1095a877310 | TypeScript | azangru/advent-of-code-2020 | /challenges/day6/solutions.ts | 2.6875 | 3 | import fs from 'fs';
import path from 'path';
import {
countAllDistinctAnswers,
countAllCommonAnswers
} from './count';
const fileContent = fs.readFileSync(path.resolve(__dirname, 'input.txt'), { encoding: 'utf8' });
const solvePart1 = () => {
return countAllDistinctAnswers(fileContent);
};
const solvePart2 =... |
2b3a84997acaa53f28cafd4b25adbdf5f16ebd26 | TypeScript | mkmukesh892/AngularRoutingExample | /src/app/users/users.service.ts | 2.546875 | 3 | import {Injectable , OnInit} from '@angular/core';
import {Subject} from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class UsersService implements OnInit {
/*user: {id: number, name: string} ;
// onChanged = new EventEmitter<{id: number, name: string} []>();*/
private users = [
{id: 1, name: 'Max'},
... |
80883594ca107ac317beb704cffe6cd1506f1d5c | TypeScript | electron/sheriff | /src/helpers.ts | 2.734375 | 3 | import { RepositoryCreatedEvent } from '@octokit/webhooks-types';
export const isMainRepo = (repo: RepositoryCreatedEvent['repository']) => {
// electron/electron or foo/foo
return repo.name === repo.owner.login;
};
type HookContext = {
log: (...args: any[]) => void;
error: (...args: any[]) => void;
};
expor... |
697ca5b428e3b89be6bd964d03611262c6204f1d | TypeScript | pissang/tweakpane | /src/main/js/controller/monitor-binding.ts | 2.609375 | 3 | import MonitorBinding from '../binding/monitor';
import LabeledView from '../view/labeled';
import {MonitorController} from './monitor/monitor';
interface Config<In> {
binding: MonitorBinding<In>;
controller: MonitorController<In>;
label: string;
}
/**
* @hidden
*/
export default class MonitorBindingController<... |
fbc82b9ddd03130793557f82b11270c883e920fd | TypeScript | RinatRezyapov/recognize-client | /src/api/domain/User.ts | 2.53125 | 3 | import ProtocolObject from './ProtocolObject';
import TypeId from './TypeId';
import { Option } from 'fp-ts/lib/Option';
import Id from './Id';
import Course from './Course';
export default class User extends ProtocolObject {
static $Type = new TypeId<User>({ value: 'User' });
name: string;
email: string;
avat... |
77a894c3ddc860cb063862b4b06be1c44df4b035 | TypeScript | hgehlhausen/student-manager-crud | /src/services/database.service.ts | 2.71875 | 3 | import {Client, ClientConfig, QueryResult} from "pg";
/**
* @type {string}
*/
const connectionString: string = 'postgres://studentmgr:studentmgr@localhost:5432/studentmgr';
export class PgClient {
private client: Client;
private static clientConfig: ClientConfig = {
connectionString: connectionStrin... |
7552e571ae0a864bbcfac60db70b87f2b666d428 | TypeScript | iamvishnusankar/next-sitemap | /packages/next-sitemap/src/utils/array.ts | 3.5625 | 4 | import { matcher } from './matcher.js'
/**
* Split an array based on size
* @param arr
* @param chunkSize
* @returns
*/
export const toChunks = <T>(arr: T[], chunkSize: number): T[][] => {
return arr.reduce<Array<T[]>>(
(prev, _, i) =>
i % chunkSize ? prev : [...prev, arr.slice(i, i + chunkSize)],
... |
9525f3793d84dc4045a3115152f32e63caaf402a | TypeScript | cbodtorf/shopify-klaviyo-order-sync | /src/KlaviyoApi.ts | 2.6875 | 3 | import axios from 'axios';
import { Event } from './Event'
import { I$CustomerProperties, IOrder, IOrderLineItem, RequestInterface, IEventLineItem } from './contracts'
export class KlaviyoApi {
urlBase: string = 'https://a.klaviyo.com/api/track';
constructor(public publicApiKey: string) {}
// https://github.co... |
9ac6002a2b36f7b95ccd1323868f85be97564cbf | TypeScript | mengtest/home3 | /core/clientLaya/game/src/commonGame/net/request/scene/unit/CUnitStopMoveRequest.ts | 2.59375 | 3 | namespace Shine
{
/** 客户端单位停止移动消息(generated by shine) */
export class CUnitStopMoveRequest extends CUnitRRequest
{
/** 数据类型ID */
public static dataID:number=GameRequestType.CUnitStopMove;
/** 停止的客户端位置 */
public posDir:PosDirData;
constructor()
{
super();
this._dataID=GameRequest... |
3814b65e4bc0babdc557c4b8e689c5f947eb661c | TypeScript | ThiagoGuy/typescript-generator | /src/app/generator/models/instance.ts | 2.671875 | 3 | export class Instance {
className: string;
fieldName: string;
constructor(fieldName: string, className: string) {
this.fieldName = fieldName;
this.className = className;
}
} |
64319b150bf6e0da207e778c58b756726ca60299 | TypeScript | RodrigoMattosoSilveira/space-monad | /src/option.ts | 3.734375 | 4 | import { Err, Ok, Result } from './result'
import { iteratorSymbol, singleValueIterator } from './iterator'
export interface Option<A> extends Iterable<A> {
/**
* Returns the value contained in this Option.
* This will always return undefined if this Option instance is None.
* This method never throws.
*... |
6a08b335b613ebe056981d8a79f1fa3b3ba691c1 | TypeScript | SoundFractures/DoneAndDoneServer | /src/utils/controller.functions.ts | 2.734375 | 3 | export type MakeJSON = {
message: string
}
export const makeJSON = (message: string): MakeJSON => {
return {
message
}
}
|
7d29c0491611125e0e8fcab94cd5b6eabea70f5a | TypeScript | Tullerpeton/units-autumn-2021 | /src/utils/sortOrders.test.ts | 3.296875 | 3 | import {getSortFunction, sortByItemCount, sortByDate, sortTypes, sortOrders} from './sortOrders';
describe('sortOrders', () => {
it('valid sort function', () => {
const func = jest.fn();
sortOrders([{}, {}], func);
expect(func).toHaveBeenCalledTimes(1);
});
it('valid sort function of empty list', () => {
c... |
947c5324a5579758cff05f0224e4460ce53e4e9c | TypeScript | Chili1995/TypeScriptDemo | /demo10.ts | 4.0625 | 4 | /**
* 类的构造函数
*/
class Per{
// public name: string;
// constructor(name: string) {
// this.name = name
// }
constructor(public name:string){}
}
// 子类一定要写super调用父类构造函数
class perex extends Per{
constructor(public age:number){
super('子的名字')
}
}
// const per1 = new Per('你的名字')
const per1 = new perex... |
2c8be46cb0af44994feb394fcd970b5256437a41 | TypeScript | ondfavourmachine/WPE-App | /src/services/eventService/events.service.ts | 2.53125 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import * as eventsJson from '../../app/event.json'
@Injectable({
providedIn: 'root'
})
export class EventsService {
constructor(private http: HttpClient) {
}
getEvents(): Observ... |
84fff090723742ba3d0b777f4b32b46d3b69c085 | TypeScript | robert-harbison/super-validator | /lib/core/Validator.test.ts | 3 | 3 | /* eslint-disable @typescript-eslint/no-unused-vars */
import { max, min, required } from '..'
import { ErrorReturnTypes, exportedForTesting, validateSchema, ValidatorSchema } from './Validator'
const { processSingleValidator, processListOfValidators, validateSingle } = exportedForTesting
describe('Validator:processS... |
8d253bc9bade1b482e16b6ae34af20e216baba8d | TypeScript | cancerberoSgx/javascript-documentation-examples | /examples/events-002/src/index.ts | 3.328125 | 3 | // # Documenting Events
// (Part of [this project](https://github.com/cancerberoSgx/javascript-documentation-examples))
// IMO, this is the best way of documenting events with typedoc. See the [typedoc output result](https://cancerberosgx.github.io/javascript-documentation-examples/examples/events-002/docs/interfaces... |
c33da0ab96fde1692344c946f8d451360ee4eb91 | TypeScript | lrenc/leetcode | /ts/67.add-binary.ts | 3.5625 | 4 | function addBinary(a: string, b: string): string {
let lA = a.length - 1;
let lB = b.length - 1;
let flag = 0;
let sum = '';
while (lA >= 0 && lB >= 0) {
const itemA = a[lA];
const itemB = b[lB];
let res = parseInt(itemA) + parseInt(itemB) + flag;
if (res >= 2) {
flag = 1;
res -= 2... |
3706f9584cbdbdd074f67edb1008034f5bd2bc81 | TypeScript | IronPTSolutions/auth-web | /src/app/shared/services/auth.service.ts | 2.515625 | 3 | import { User } from './../models/user.model';
import { Http, RequestOptions, Headers } from '@angular/http';
import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs/Rx';
import { environment } from '../../../environments/environment';
const CURRENT_USER_KEY = 'currentUser';
@Injectable(... |
f08c2112faaee456217216ccb7778d7954e8d50c | TypeScript | alonethending/joker.front | /test/src/core/parser/element.test.ts | 2.703125 | 3 | import { Parser } from "@joker/template-compiler";
import { Component } from "@joker/core/src/component";
import { TemplateParser } from "@joker/core/src/parser/index";
import { ElementNodeInfo } from "@joker/core";
class TestView extends Component {
model = {
attr1: "v1",
attr2: "v2",
clas... |
ea512311706e529fdd66e03deec4f5b582597015 | TypeScript | ovikariy/bewell | /src/modules/securityService.ts | 2.515625 | 3 | import { AES, HmacSHA256, enc, lib } from 'crypto-js';
import { ErrorCode, ErrorMessage, StoreConstants } from './constants';
import * as SecureStore from 'expo-secure-store';
import { consoleColors, consoleLogWithColor, isNullOrEmpty } from './utils';
import { isNumber, toNumber } from 'lodash';
import { AppError } fr... |
f25bbb5a05ba3101e84b1538c880b88b8e030212 | TypeScript | muzea/aliyun-sdk-node | /dist/ros/SetStackPolicy/req.d.ts | 2.65625 | 3 | interface SetStackPolicyRequest {
/**
* 资源栈所属的地域ID。您可以调用[DescribeRegions](~~131035~~)查看最新的阿里云地域列表。
* @example `cn-hangzhou`
*/ "RegionId": string;
/**
* 资源栈ID。
* @example `4a6c9851-3b0f-4f5f-b4ca-a14bf691f2ff`
*/ "StackId": string;
/**
* 包含资源栈策略主体的结构,最小长度为1个字节,最大长度为16384个字节。
... |
fb9de83935982f57b585af06f3079d957daa4112 | TypeScript | Yarden-Tal/fullstack-itc-may21 | /05-Node/99-Assignments/04-Online-Store/Yaniv1/models/usersModel.ts | 2.6875 | 3 | export {};
const { v4: uuidv4 } = require("uuid");
const fs = require("fs");
const path = require("path");
const usersJsonPath = path.resolve(__dirname, "../users.json");
const storeJsonPath = path.resolve(__dirname, "../store.json");
const { readStoreJson, Product, Store } = require('./storeModel');
const readUsers... |
566adb7087d66ccee842d5c4cca5b1957963e4d7 | TypeScript | Halithor/wc3-tower-defense | /src/lib/projectile.ts | 2.75 | 3 | /** @noSelfInFile **/
import {
doPeriodically,
Subject,
forDestructablesInCircle,
forUnitsInRange,
vec3,
Vec3,
} from 'w3lib/src/index';
import {Destructable, Effect, Unit, Vec2} from 'w3lib';
const interval = 0.03;
export class Projectile {
fx: Effect;
private releaseTimer: (this: void) => void;
pr... |
62fdd90d0d8b00725d2f917f6ef1e570c24d1a89 | TypeScript | bizon/selling-partner-api-sdk | /clients/product-pricing-api-v0/src/api-model/models/prime-information-type.ts | 2.53125 | 3 | /* tslint:disable */
/* eslint-disable */
/**
* Selling Partner API for Pricing
* The Selling Partner API for Pricing helps you programmatically retrieve product pricing and offer information for Amazon Marketplace products.
*
* The version of the OpenAPI document: v0
*
*
* NOTE: This class is auto generated by... |
7bd718c9b3f7fc98de4d4f205be1935dee671a74 | TypeScript | future4code/Paulo-Oliveira | /semana15/aula43/src/endpoint5.ts | 2.625 | 3 | import express, { Request, Response } from "express"
import cors from "cors"
import { countries } from "./countries"
const app = express()
app.use(express.json())
app.use(cors())
app.delete("/countries/:id", (req: Request, res: Response) => {
let errorCode: number = 400
try {
if (!req.headers.author... |
88c721ab7980927585da51840d4467c8996d17e6 | TypeScript | deshion/strapi | /packages/core/data-transfer/src/strapi/providers/local-source/links.ts | 2.6875 | 3 | import { Readable } from 'stream';
import type { ILink } from '../../../../types';
import { createLinkQuery } from '../../queries/link';
/**
* Create a Readable which will stream all the links from a Strapi instance
*/
export const createLinksStream = (strapi: Strapi.Strapi): Readable => {
const uids = [...Object... |
86047d21e79ca69a562560789c1c6672041422cc | TypeScript | mariourena/red-blue-green | /src/types/types.game.ts | 3.015625 | 3 | export enum CellState {
Blue = "Blue",
Green = "Green",
Red = "Red",
}
export enum GameState {
NotWon,
Won,
}
export interface CellCoords {
x: number;
y: number;
}
export interface GameCell {
state: CellState;
coords: CellCoords;
}
export type GameGridCells = GameCell[][];
|
f00d83f2379920a3f38e8eab55184f2032e581a2 | TypeScript | JonyCoding/lg-javascript | /typescript/jspang/demo6.ts | 3.96875 | 4 | /* =============================================================================
#
# Author: xie yanpeng
# Date: 2020-10-03 22:33:26
# LastEdit: enter your name
# LastEditTime: 2020-10-03 22:34:15
# Description:
#
============================================================================= */
const numberArr: number... |
dab34253c1a29c7fb7197b304643961a91fc8ab5 | TypeScript | sanjithpk/opvizor | /frontend/src/utils/statusCodes.ts | 2.546875 | 3 | export const statusCodes: StatusCode = {
done: {
code: "Recently Done",
color: "#64a338" // green
},
inProgress: {
code: "In Progress",
color: "#3865a3" // blue
},
dueDatePassed: {
code: "Due Date Passed",
color: "#e03b24" // red
},
todo: {
code: "Todo",
color: "#ffcc00" //... |
36e3de43df0882d2263bb5b1a797dbe2d53bc589 | TypeScript | robots-ju/fll-scoreboard | /src/js/2021/specs.ts | 2.8125 | 3 | import {FllScorer} from "./scorer";
const scorer = new FllScorer();
/**
* Robot Game 2021 specifications test suite, based on the official scoring guide
* @see https://www.first-lego-league.org/en/season/robot-game/missions.html
*/
describe('Robot Game 2021 specifications', function () {
describe('Scorer initia... |