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 |
|---|---|---|---|---|---|---|
13bdfcc86edde6c1a0c815373f6d50b1238c9489 | TypeScript | WTAMUComputerScienceDepartment/AngularWALL | /app/public/services/assembler.service.ts | 2.734375 | 3 | import { Injectable } from "@angular/core";
@Injectable()
export class AssemblerService {
private assembledCode: string[] = []; //Assembled Byte Code resulting from Pass Two
private labelAddrMap: Object = {}; // Contains the mapped values of Label Strings to Hex Address String
private OPERATIONS: Object = ... |
046613c50bf62106d8993d2f1f1f07588ffb4035 | TypeScript | eugbyte/movie_react_app | /src/store/thunks/movieThunk.ts | 2.96875 | 3 | import { Action } from "redux";
import { Movie } from "../../models/Movie";
import { ThunkAction, ThunkDispatch } from "redux-thunk";
import { ACTIONS } from "../actionEnums";
import { HTTP } from "../httpEnums";
import { ApiError } from "../../models/ApiError";
import { errorAction, IErrorAction } from "../actions/err... |
846e2dae409b9eb7d414e0e0a62826c13a35a360 | TypeScript | storycraft/advanced-calculator | /src/component/expression.ts | 2.53125 | 3 | /*
* Created on Tue Jun 22 2021
*
* Copyright (c) storycraft. Licensed under the MIT Licence.
*/
import { Factor, Variant } from "./mod.ts";
export type Expr<T> = {
operator: string;
values: [T, T];
};
export type Term = {
child?: [Term, Term];
} & (OperatorNode | ValueNode);
type OperatorNode =... |
da75da66b3daabf5f7ad572e7ac73416ff7e9fc6 | TypeScript | realglobe-Inc/sheeted | /packages/core/src/web/Paths.ts | 2.890625 | 3 | export type SheetPathParams = {
sheetName: string
}
export type EntityPathParams = {
sheetName: string
entityId: string
}
export type ActionPathParams = {
sheetName: string
actionId: string
}
export const ApiPaths = {
CURRENT_USER: '/api/currentUser',
SHEETS: '/api/sheets',
SHEET_ONE: '/api/sheets/:s... |
0c27bea8ee62d7f434d540310abb379a0ab57efa | TypeScript | hamano/asn1-ts | /source/codecs/x690/decoders/decodeObjectIdentifier.ts | 2.84375 | 3 | import ObjectIdentifier from "../../../types/ObjectIdentifier";
import * as errors from "../../../errors";
import splitBytesByContinuationBit from "../../../utils/splitBytesByContinuationBit";
import { OBJECT_IDENTIFIER } from "../../../macros";
import { decodeUnsignedBigEndianInteger, decodeBase128 } from "../../.... |
0ba9c194faa6cdbe4cd694de17c23084af97d1cb | TypeScript | anzha12f/shoppingCart | /src/app/services/cart.service.ts | 2.796875 | 3 | import { Injectable } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { IItems } from "../models/items.model";
@Injectable({
providedIn: "root",
})
export class CartService {
items: Array<IItems> = [];
constructor(private http: HttpClient) {}
addToCart(product, qtyCount?: numb... |
cb4561f0461b1cb4c0f1f736a42238174e429954 | TypeScript | asmeza/clases_nodejs | /src/models/User.ts | 2.75 | 3 | import { Model, DataTypes } from 'sequelize';
import { database } from '../database/db';
import { Client } from './Client'
const bcrypt = require('bcryptjs');
export class User extends Model {
public name!: string;
public document!: string;
public dateBirthday!: string;
public gender!: string;
public ... |
6d24253b7fdb50a888decbcc3aa4a0defde4d63f | TypeScript | iam-kevin/react-chat-potato | /typings/index.d.ts | 2.921875 | 3 | // Types in the application
export interface PotatoProviderProps {
children: any
}
export interface PotatoChatProps {
initialMessages: Messages,
}
/**
* Information that is to the entire
* chat across a potato instance
*/
export declare namespace Potato {
/**
* Valide Composer Types
*/
... |
354c1fec15d8811f5a7187e897a8d97f478261f8 | TypeScript | Thaborak/team-viewer | /src/app/containers/SportsDBForm/types.ts | 2.78125 | 3 | import { Team } from 'types/Team';
/* --- STATE --- */
export interface SportsDbFormState {
teamname: string;
loading: boolean;
error?: TeamErrorType | null;
teams: Team[];
}
export enum TeamErrorType {
RESPONSE_ERROR = 1,
TEAM_NOT_FOUND = 2,
TEAMNAME_EMPTY = 3,
TEAM_HAS_NO_DATA = 4,
SPORTSDB_RATE_LI... |
37147101531daa787658eec8ea53038a81e2bbcd | TypeScript | saikumarsandra/my-activty | /src/app/model/media.model.ts | 2.578125 | 3 | export class media {
title:string;
description:string;
tags:string;
filename:string;
constructor(title:string,description:string, tags:string,filename:string)
{
this.title=title;
this.description=description;
this.tags=tags;
this.filename=filename;
}
} |
e37fe35443062501ae49f683a88fab7494c9adef | TypeScript | lineupninja/ninjafire | /src/serializers/json.ts | 2.8125 | 3 |
import { Serializer } from './serializer';
export class JSONSerializer extends Serializer {
public serialize(value: {}): string {
if (typeof value !== 'object') {
throw Error(`serializing ${value} got ${typeof value} but expected object`);
}
return JSON.stringify(value);
}
... |
ff9ea284e74376a2e02ee3dd4937fb567c7f7715 | TypeScript | koiomi/react-ssr | /src/http/index.ts | 2.921875 | 3 | import HttpError from "./HttpError";
import {
CONTENT_TYPE_JSON,
CONTENT_TYPE_TEXT,
CONTENT_TYPE_STREAM,
HEADER_CONTENT_TYPE,
ErrorResponse,
} from "./types";
export function request<T = any>(
url = "",
options?: RequestInit | string,
body?: Record<string, unknown>
): Promise<T> {
if (typeof options ... |
21b7ae1b3444dd8c865928ceea3a0bda673a452b | TypeScript | HairyRabbit/waya | /package/shared/src/webpack-resolve-fallback-plugin.ts | 2.6875 | 3 | import * as webpack from 'webpack'
import * as path from 'path'
import * as createDebugger from 'debug'
const debug = createDebugger('resolve-fallback-plugin')
declare module 'webpack' {
namespace compilation {
interface Module {
resource: string
buildInfo: {
cacheable: boolean
}
}... |
66826c850a5dcc33d3c48d1ce57685bc0a50cdba | TypeScript | tp/node-ay-auth-sdk | /src/index.ts | 2.65625 | 3 | import * as crypto from 'crypto';
import {HKDF} from './lib/hkdf';
import {base64Encode} from './lib/base64Encode';
function createSalt(length: number): Buffer {
return crypto.randomBytes(length);
}
export function createASRParameter(
params: {appSecret: string; info: string; salt?: Buffer},
payload: any,
) {
... |
11be229f7a23f2cb54e26ded973c513e124f1570 | TypeScript | jbrown1618/vector | /src/solvers/Substitution.ts | 3.46875 | 3 | import { assertSquare } from '../utilities/ErrorAssertions';
import { Matrix } from '../types/matrix/Matrix';
import { Vector } from '../types/vector/Vector';
import { LinearSolution, SolutionType } from './LinearSolution';
/**
* Uses forward substitution to solve the linear system _Lx=b_ for a lower-triangular matri... |
dd7e6c56c276f3b3b4919fdcfbe9f3f49fccca51 | TypeScript | okancancoskun/Nest-React-Private_Chat_Room | /backend/src/api/Generic/generic.service.ts | 2.640625 | 3 | import {
Aggregate,
Document,
FilterQuery,
QueryOptions,
UpdateQuery,
} from 'mongoose';
import { IGenericRepository } from './generic.repository';
export interface IGenericService<M, D, U> {
create(dto: D): Promise<M>;
findAll(filter: FilterQuery<M>, options: QueryOptions): Promise<M[]>;
findOne(filte... |
c63ce3dab9afe4afa7932bffdbf871e91009957d | TypeScript | Haringat/AE08 | /frontend/src/theme/util/Vector2D.ts | 3.5 | 4 | export interface IVector {
length: number;
clone(): IVector;
scale(scale: number): IVector;
normalize(): IVector;
add(other: IVector): IVector;
subtract(other: IVector): IVector;
angleToVector(other: IVector): number;
multiply(scalar: number): IVector;
multiply(vector: IVector): numb... |
a88f0f4992a46f766921f205232e76a2b181dd8a | TypeScript | reynaldo-94/adminpro-udemy | /src/app/components/incrementador/incrementador.component.ts | 2.921875 | 3 | import { Component, OnInit, Input, Output, EventEmitter, ViewChild, ElementRef } from '@angular/core';
@Component({
selector: 'app-incrementador',
templateUrl: './incrementador.component.html',
styles: []
})
export class IncrementadorComponent implements OnInit {
// Este elemento recibe como parametro una ref... |
976d8d07574f7366919b45b2dcd845ae94cf7eed | TypeScript | tw1ttt3r/shopping-cart | /lib/changeQuantityItemCart.ts | 2.5625 | 3 | import { ContextInitialApp } from "@/types/ContextInitialApp";
import { ItemCart } from "@/types/ItemCart";
import { Product } from "@/types/Product";
import { setLocalStorageCart } from "./manageLocalStorageCart";
export default function changeQuantityItemCart(product: Product, action: string, context: ContextInitial... |
53807ce5c82912d67ed2c133a5f939b313d30f2c | TypeScript | Lily-f/Awhina_Mobile_app | /Awhina_mobile_app/src/hooks/PromotionHooks.ts | 2.59375 | 3 | import { UserContext } from './../App';
import { useState, useContext } from 'react';
export function PromotionHooks() {
const user = useContext(UserContext)
const [title, setTitle] = useState<string>("")
const [contents, setContents] = useState<string>("")
// verify that event to create is valid and send to ... |
b84dd82df4ccda1a1dc9bcf9fe6eaeeae47163bc | TypeScript | KIlyaA/team4 | /client/domain/user-model.ts | 2.75 | 3 | import { action, observable } from 'mobx';
import RPC from '../utils/rpc-client';
class UserModel {
public static fromJSON(user) {
const userModel = new UserModel(user.id);
userModel.update(user);
return userModel;
}
@observable public isFetching;
public id: number;
publ... |
0e3afc497fd41c627c80c88ba53d0385fb16e658 | TypeScript | KartheiningerT/swaSmartHome | /src/app/interfaces/IData.ts | 2.65625 | 3 | export interface IData {
dates: ConsumptionDate[];
}
interface ConsumptionDate {
date: string;
consumptions: Consumption[];
}
interface Consumption {
time: string;
watt: number;
}
|
e7a6bda00aa6221b8d51b94e547534e0f4a79364 | TypeScript | HugoWith/pwa-storefront-ui-template | /hooks/useIntersectionObserver.ts | 2.796875 | 3 | import { useEffect, useRef, useState } from 'react'
type IntersectionObserverHook = {
callback: (entry: IntersectionObserverEntry) => void
root?: Document | Element | null
rootMargin?: string
threshold?: number[] | number
}
export function useIntersectionObserver({
callback,
root,
rootMargin,
threshol... |
f849b049f6c544c8266857e55fd0eff6bf6e19a1 | TypeScript | anantsaini222/Banking-login-registration-website-project-Javascript | /JSP/StringNumbers.ts | 4.03125 | 4 | // let str:string = 'Hello TypeScript';
// str.charAt(0); // returns 'H'
// str.charAt(2); // returns 'l'
// "Hello World".charAt(2); //returns 'l'
//concat
let str1:string = 'Hello';
let str2:string = 'TypeScript';
str1.concat(str2); // returns 'HelloTypeScript'
str1.concat(' ', str2); // returns 'Hello Ty... |
9d149391f995d25effa4aeb08ec7ed58b74021ea | TypeScript | TamuGeoInnovation/Tamu.GeoInnovation.js.monorepo | /libs/veoride/scraper/src/lib/collectors/base-mds.collector.ts | 2.65625 | 3 | import { BaseEntity } from 'typeorm';
import { Log, LogType, dateDifferenceGreaterThan, mdsTimeHourToDate } from '@tamu-gisc/veoride/common/entities';
import { AbstractMdsCollector, AnyPromise } from './abstract-mds.collector';
import { AbstractCollectorConstructorProperties, BaseRequestParams } from '../types/types'... |
48a513391f1f79194110740ce2dd2f62d0ea05b6 | TypeScript | refercrast/chat | /client/src/store/redusers/AuthReducer.ts | 2.890625 | 3 | import { AuthState } from "../../interfaces";
import { AuthActionTypes } from "../actions/actionTypes";
import { RootAction } from "../types/types";
const INITIAL_STATE: AuthState = {
token: null,
error: null,
loading: false
};
export const authReducer = (state: AuthState = INITIAL_STATE, action: RootActi... |
c73066ccea2fab19e1edf157bbf3f35f4c6b0ec1 | TypeScript | swehq/corona-game | /frontend/src/app/services/formatting.service.ts | 3.09375 | 3 | import {ApplicationLanguage} from '../../environments/defaults';
export interface InstantTranslateService {
currentLang: string;
instant(str: string): string;
}
export class FormattingService {
protected milKey = ' mil.';
protected bilKey = ' mld.';
get locale() {
return this.translateService.current... |
ed6702ac8aebfc02fbde32b62940413348561053 | TypeScript | EugeneMalin/tic-tac-toe | /src/data/Analyzer.ts | 3.265625 | 3 | import { IWinStatus } from './interface/IWinStatus';
import {IFieldParams} from './interface/IFieldParams';
import { Player } from './Player';
import { ICheckedPoint } from './interface/ICheckedPoint';
/**
* Number of directions
*
* example of minimum size handling
* 0 1 2
* N ... |
9224ab3f31577f75eb59a53a00252b6ba4a81adb | TypeScript | Swapnilr1/Slack-Tracking | /ClientExtracted/src/ssb/touchbar.ts | 3.203125 | 3 | /**
* @module SSBIntegration
*/ /** for typedoc */
import { remote } from 'electron';
import { logger } from '../logger';
import { ITouchBarButton,
ITouchBarColorPicker,
ITouchBarGroup,
ITouchBarLabel,
ITouchBarPopover,
ITouchBarSlider,
ITouchBarSpacer
} from './touchbar-interfaces';
// To be replaced o... |
70bab93c10459a76e84a6522810be598bd7b8cad | TypeScript | richardweaver/prisma-schema-dsl | /src/builders.spec.ts | 2.78125 | 3 | import { ScalarType } from "./types";
import {
createScalarField,
createObjectField,
OPTIONAL_LIST_ERROR_MESSAGE,
} from "./builders";
const EXAMPLE_NAME = "EXAMPLE_NAME";
const EXAMPLE_SCALAR_TYPE = ScalarType.String;
const EXAMPLE_TYPE = "EXAMPLE_TYPE";
describe("createScalarField", () => {
test("fails for ... |
347ac78bba6ce8ddcdf527b8f88bf92e2ce73e50 | TypeScript | ReshmaReghunathaPanicker/todo-app | /src/app/app.component.ts | 2.59375 | 3 | import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'todo-list';
todoList: Array<string>= [];
newTodo: string = '';
error: boolean= false;
constructor() {
this.to... |
38c8f113fab0b858aab6d2b051ed70231a7259cf | TypeScript | Weslley-Borges/Labmistry | /client/src/services/UserLogin.validate.ts | 2.53125 | 3 | import API from './api'
interface LoginValuesDTO {
email: string
password: string
}
export default async function validateLogin(values: LoginValuesDTO ) {
const data = {
"email": values.email,
"userpassword": values.password,
}
return (await API.post('user/signIn', data)).data
} |
1267fb86399773d989700ba77ecd284a1d060bb0 | TypeScript | AkramWaheed/lab2 | /myClass.ts | 3.828125 | 4 | import {myQueue}from "./interface";
class myclass implements myQueue
{
myArray:Array<string>= [];
addTask(task:string):number{
this.myArray.push(task);
console.log("Item added " + task)
return this.myArray.length;
}
listAllTasks()
{
//for (leti =0 ; i=myArray.length;i++)
for(let item of... |
e9da11faf00576c2b151c1004ebfcced5af055a3 | TypeScript | joostlubach/quizmaster-remote | /pkg/api/src/authentication.ts | 2.578125 | 3 | let authToken: string | null = null
export function setAuthToken(token: string) {
authToken = token
}
export function getAuthToken(): string | null {
return authToken
}
export function clearAuthToken() {
authToken = null
} |
acb9a25a8d5e342efd5b2cb4c6878ad507c82560 | TypeScript | 4erem6a/RichCommands | /src/Parser.ts | 3.328125 | 3 | import { InputStream } from "./InputStream";
import { ParserOptions, Lexeme } from "./types/ParserOptions";
import {
CommandPart,
CommandFlag,
CommandArgument,
StringArgument,
Command
} from "./types/types";
/**
* The flag parsing mode.
* @ignore
*/
const FLAG_MODE = Symbol("FLAG_MODE");
/**
* Class for... |
1840edce26f4490975f924cadbecefc4b54af9b0 | TypeScript | pj-martins/PaJaMa | /Angular2/src/pajama/pipes/enum-to-list.pipe.ts | 2.59375 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { ToCamelCasePipe } from './to-camel-case.pipe';
@Pipe({ name: 'enumToList' })
export class EnumToListPipe implements PipeTransform {
transform(value: any) {
let vals: string[] = [];
let toCamelCasePipe = new ToCamelCasePipe();
for (let e in value) {
... |
a47bead57487558884ef870f417e57303cd7bf1e | TypeScript | YunS-Stacy/smartselect-react-redux-rxjs-2018 | /src/reducers/slider/fetched.ts | 2.625 | 3 | import {
DATA_FETCH_FULFILLED,
DATA_FETCH_CANCELLED,
DATA_FETCH_REJECTED
} from '../../constants/action-types';
import { Action } from 'redux';
const initialState = false;
export default (state = initialState, { type, payload }: Action & { payload?: any}) => {
switch (type) {
case DATA_FETCH_FULFILLED:
... |
23a4a3ef705eb2e8f9478c66a9817a44e7c6478e | TypeScript | theintern/common | /src/lib/request.ts | 2.75 | 3 | /**
* This module exports an API similar to that of @dojo/core/request that is
* based on axios.
*/
import axios, {
AxiosRequestConfig,
AxiosProxyConfig,
AxiosResponse,
} from 'axios';
import qs from 'qs';
import Task, { CancellablePromise } from './Task';
import Evented from './Evented';
export type Request... |
a1196b4c96cda3259ad05561ca5c64ca6e782fc3 | TypeScript | bobzap66/RDSSchedulingFront | /MorganizeAngularApp/src/app/pipes/datetime.pipe.ts | 2.875 | 3 | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'datetime'
})
export class DatetimePipe implements PipeTransform {
monthString:string[] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
transform(value: number):string {
let dt = new Date(value);
... |
484e7db7e7be22d8e4bd00074d9b791ee7ac4ab4 | TypeScript | abritopach/ionic-todo-loopback | /src/providers/todo-service/todo-service.ts | 2.5625 | 3 | import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
import { Environment } from '../../environments/environment'
/*
Generated class for the TodoServiceProvider provider.
See https://angular.io/docs/ts/latest/guide/dependency-injection.html
for more ... |
49312deea11ada04f18f4e13ee7a50ea7fb5da0d | TypeScript | wellflat/imageprocessing-labs | /ml/autoencoder/spec/Tests/da_test.ts | 2.859375 | 3 | /// <reference path="../scripts/typings/jasmine/jasmine.d.ts" />
/// <reference path="../../deeplearning/scripts/vector.ts" />
/// <reference path="../../deeplearning/scripts/matrix.ts" />
/// <reference path="../../deeplearning/scripts/da.ts" />
describe("DenoisingAutoEncoder",() => {
var da: ml.Denoising... |
5c4aa83f12b1ccc66f0f5c84df267e68518d8c10 | TypeScript | geometryzen/stemcstudio-jshint | /build/main/lib/EventEmitter.d.ts | 2.625 | 3 | export declare class EventEmitter {
_events: {
[type: string]: any;
};
_maxListeners: number;
constructor();
setMaxListeners(n: number): this;
emit(type: string, event: any, listener?: Function): boolean;
on(type: string, listener: Function): this;
once(type: string, listener: Fu... |
faaad5f7ad028133d625a7b6912d21792ed2a568 | TypeScript | tjinauyeung/cn-jokes | /src/tests/helpers.ts | 2.84375 | 3 | import { Joke } from "../models/Joke";
export const makeJoke = (): Joke => {
return {
categories: [],
id: Math.random()
.toString(36)
.substring(8),
joke: Math.random()
.toString(36)
.substring(8)
};
};
export const makeJokes = (length = 10): Joke[] =>
Array.from({ length }).... |
92a0177f5fda2aedf7271d3af25e56b2f7c008b2 | TypeScript | tspotify/spotify-api-types | /v1/payloads/track.ts | 3.0625 | 3 | import type { SimplifiedArtistObject } from './artist';
import type { SimplifiedAlbumObject } from './album';
import type { ExternalUrlObject, ExternalIdObject, BaseRestrictionObject, BaseSavedObject } from './misc';
export interface LinkedTrackObject {
/**
* Known external URLs for this track
*/
external_ur... |
de68cbc9717456f2dd3fd4f6e783df4f601d4de8 | TypeScript | homebab/app-client | /utils/functions.ts | 3.078125 | 3 | export function* chunk(collection: Array<any>, size: number): Generator<any[], void, any[]> {
for (let i = 0; i < collection.length; i += size) {
yield collection.slice(i, i + size);
}
}
export function chunkArray<T>(myArray: Array<T>, chunk_size: number): T[][] {
const copiedArray = [...myArray... |
003ed1c29a88c8f2956d43651f12728d3ed1dd34 | TypeScript | marishibata/phone-number-letter-converter | /client/src/store/actions.ts | 2.75 | 3 | import { PhoneWordsActionTypes } from "./types";
export const fetchPhoneWordsStart = () => ({
type: PhoneWordsActionTypes.FETCH_PHONEWORDS_START
});
export const fetchPhoneWordsSuccess = (letters: string) => ({
type: PhoneWordsActionTypes.FETCH_PHONEWORDS_SUCCESS,
payload: letters
});
export const fetchPhoneWo... |
669ae4e764f51ddd8b1ea5c6c8263d608c70aa1f | TypeScript | Rajendra37/chatApp | /client/chatapp/src/Reducer/ChatReducer.ts | 2.53125 | 3 | const messages :any=[]
const ChatReducer=(state=messages,action:any)=>{
switch(action.type)
{
case "STORE_MESSAGE":
state=[...state,action.payload]
return state
default:return state;
}
}
export default ChatReducer; |
9bdf3c28d97a9a63f9e33059a949929d7d4e7248 | TypeScript | jhta/pseudo | /src/Interpreter.ts | 2.71875 | 3 | import Parser from "./parser";
import Visitor from "./parser/visitor";
import Lexer from "./Lexer";
export default class Interpreter {
interpret(str: string) {
const lexer = new Lexer(str);
const parser = new Parser(lexer);
const abstractTree = parser.parse();
return new Visitor().visit(abstractTre... |
781485f327518c50969bb488d9b588e1ce289c9e | TypeScript | montalvomiguelo/cli | /packages/cli-kit/src/private/node/content-tokens.test.ts | 2.5625 | 3 | import {LinkContentToken} from './content-tokens.js'
import {describe, expect, test} from 'vitest'
describe('LinkContentToken', () => {
test('the link includes spaces between the URL and the parenthesis for command/control click to work', () => {
// When
const got = new LinkContentToken('Shopify Web', 'https... |
b5c7743019b4da9b27456328ea144a0b5ffce771 | TypeScript | WangHL0927/grafana | /public/app/plugins/datasource/loki/query_utils.test.ts | 2.90625 | 3 | import { parseQuery, getHighlighterExpressionsFromQuery } from './query_utils';
import { LokiExpression } from './types';
describe('parseQuery', () => {
it('returns empty for empty string', () => {
expect(parseQuery('')).toEqual({
query: '',
regexp: '',
} as LokiExpression);
});
it('returns ... |
7cb282e35736ab061063bb4de87bb76377ea26fd | TypeScript | Ha-Young/learn-typescript | /src/function.ts | 4.625 | 5 | // 인자에 타입 정의
function add(x: number, y: number) {
return x + y;
}
// 반환되는 타입은 인자로 유추되지만 따로 정의 할 수 있다.
function add2(x: number, y: number): number {
return x + y;
}
const result = add(1, 2);
const result2 = add2(3, 4);
function buildUserInfo(name: string, email: string) {
return { name, email };
}
// 아무런 값도 주지 ... |
808898c0c0781d7a6b14c7b98aa5c720de6daabd | TypeScript | FrederikVigen/Troupe | /rt/src/Asserts.ts | 2.640625 | 3 | import { Thread, Capability } from './Thread';
const __unitbase = require('./UnitBase.js');
const { isListFlagSet, isTupleFlagSet } = require ('./ValuesUtil.js');
const proc = require('./process.js');
const ProcessID = proc.ProcessID;
import { Level } from './Level';
import { Authority } from './Authority'
import opti... |
8136276dbd50c9af081dd8303eb20014d025bee9 | TypeScript | josuebouchard/EarthExplorer | /Src/main.ts | 2.625 | 3 | import { clamp, pointToLongLat, getPlace } from "helpers";
import * as THREE from "three";
import { InputState } from "input";
let raycaster = new THREE.Raycaster();
var displacementCamera = { x: 0, y: Math.PI / 2 };
var cameraRadius = 5;
var radius = 1.000000000000000001;
let scene = new THREE.Scene();
let camera =... |
5140315a37db7717c6281aa99bb5444910751e1c | TypeScript | rostgoat/treez-api | /src/inventory/inventory.service.ts | 2.703125 | 3 | import { Injectable } from '@nestjs/common';
import { Repository } from 'typeorm';
import { InventoryEntity } from './inventory.entity';
import { InjectRepository } from '@nestjs/typeorm';
import { InventoryDTO } from './inventory.dto';
/**
* Inventory Service
*/
@Injectable()
export class InventoryService {
con... |
54fa9fd829774e9c06ca89f9344255bc54a77eeb | TypeScript | n1ru4l/dungeon-revealer | /src/dm-area/overmind/note-editor/note-editor-state.ts | 2.578125 | 3 | import { Derive } from "overmind";
import { NoteType, NoteRecord } from "../note-store/note-store-state";
import { isSome, Maybe } from "../util";
const tryParseJson = (input: any) => {
try {
return JSON.parse(input);
} catch {
return null;
}
};
const getInitialActiveNoteId = () => {
const maybeId = t... |
5ea955a79a117d6d91c329da9fe94eb9a2229f67 | TypeScript | douglash93/public-delivery-api | /src/entities/Order.ts | 2.546875 | 3 | export class Order {
id?: number;
user_id: number;
payment_type: string;
address: string;
status: string;
price?: number;
constructor(props: Omit<Order, 'id'>, id?: string) {
Object.assign(this, props);
}
} |
40b797b57736d4f306dae44d2596967411c0eaac | TypeScript | jpete/MDDL | /packages/api-service/src/services/users/authorization.ts | 2.5625 | 3 | import { User } from '@/models/user'
import { APIGatewayRequest, setContext } from '@/utils/middleware'
import { emailIsWhitelisted } from '@/utils/whitelist'
import createError from 'http-errors'
import {
hasDelegatedAccessToUserAccount,
requireUserData,
} from '@/services/users'
import { hasAnyGrantToUsersCollect... |
c39d3e40248dca878804c620bd67d527562455f3 | TypeScript | ownsources/code-snippets | /builders/android-push-builder.ts | 2.65625 | 3 | export class AndroidPushBuilder implements PushBuilderType {
public ApplicationId: string;
public MessageRequest: Pinpoint.MessageRequest;
public init(): this {
this.MessageRequest = new EmptyPushAndroidRequest();
return this;
}
public setAddresses(...addresses: string[]): this {
... |
d31b69e6695c4dff4cb8caf1c9df1f289684e261 | TypeScript | lmeireles/ionic-helpers | /pipes/search-array.ts | 2.96875 | 3 | import {Pipe} from "@angular/core";
import {StringHelper} from "../helpers/string-helper";
import {ObjectHelper} from "../helpers/object-helper";
/*
* Usage:
* array | searchArray:text:properties
* Examples:
* {{ array<string> | searchArray:'Jhon Doe'}}
* {{ array<{desc: string, name: string, ag... |
8f64347326ba27a44ecb7d6952cf5b8ad50cc8aa | TypeScript | nitrotm/thrift | /lib/ts/thrift.ts | 2.90625 | 3 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ma... |
0150e6c9ef7554a284e4de1fdb184829bd4fbbe5 | TypeScript | Sfeir/sfeirschool-typescript-100 | /correction/03-variable-declaration.correction.ts | 3.6875 | 4 | import { expect } from 'chai';
describe('about var, let and const', () => {
it('let should be available only in the block it is declared in', () => {
var myVar = 1;
let myLet = 2;
if (true) {
var myVar = 3;
let myLet = 4;
}
expect(myVar).to.equal(3);
expect(myLet).to.equal(2);
... |
f130a2c090ded045fbc26eeea11efb94044bdf48 | TypeScript | ayakovlenko/wf | /xml.ts | 3.21875 | 3 | class Element {
constructor(
public readonly name: string,
public readonly children: string | number | Element[],
public readonly attrs: Record<string, string | undefined>,
) {}
toString(): string {
return '<?xml version="1.0"?>\n' + toStringRecur(this, 0);
}
}
function el(
name: string,
c... |
963bb20194b457ff36fb000683480ea64c01a447 | TypeScript | DocDerrick/PowerBIDataImage | /src/visual.ts | 2.546875 | 3 | module powerbi.extensibility.visual {
"use strict";
export class ImageVisual implements IVisual {
private target: HTMLElement;
private settings: VisualSettings;
constructor(options: VisualConstructorOptions) {
this.target = options.element;
... |
889db7db37968b33d2ebee3216df2c5f778f3d13 | TypeScript | ArvinHsieh/TypeScriptSample | /TypeScriptAngularJsStarting/Scripts/app/Sample.Factory.ts | 2.796875 | 3 | module SampleApp.Factories {
export interface ISampleFactory {
Sum: (a: number, b: number) => number;
}
export class SampleFactory {
static $inject = ["$timeout"];
static ServiceFactory(
$timeout: ng.ITimeoutService): ISampleFactory {
return {
... |
f1417bc5499f82d82452a9bc92f2d20fb5261d78 | TypeScript | TianrenWang/employee-manager | /client/app/components/employee-form/employee-form.component.ts | 2.765625 | 3 | // This component displays and allows user to interact with an input form
// to fill out employee information. This is used for creating new employees,
// modifying existing employees, and also filtering employees by their properties.
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
impo... |
560bd30158a3a14f778912b9943c7e3bffa3e3d8 | TypeScript | pnowak2/learnjs | /frameworks/client/angular2/ngbook2/_book-examples/redux/angular2-redux-chat/app/ts/components/ChatMessage.ts | 2.515625 | 3 | /**
* Copyright 2016, Fullstack.io, LLC.
*
* This source code is licensed under the MIT-style license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import {
Component,
OnInit
} from '@angular/core';
import { Message } from '../models';
/**
* ChatMessage is a component that sho... |
ce7406ee7710eb2b96f9c1d388a2bc210057f433 | TypeScript | Vinci-da-Gama/Angu7-Comic-Hub | /src/contracts/models/comic.ts | 2.71875 | 3 | import { Character } from '../interfaces/charactor';
export class Comic {
public id: string;
public slug: string;
public name: string;
public description: string;
public issueNumber: string;
public pages: string;
public price: string;
public releaseDate: string;
public image: string;
public characters: Chara... |
23f41769bfb5c98ca93a685d13369ba00b4e63ee | TypeScript | panagosg7/TypeScript-1.0.1.0 | /tests/cases/compiler/commentsOnObjectLiteral3.ts | 2.734375 | 3 | // @comments: true
var v = {
//property
prop: 1,
//property
func: function () {
},
//PropertyName + CallSignature
func1() { },
//getter
get a() {
return this.prop;
},
//setter
set a(value) {
this.prop = value;
}
};
|
ca1fd9434b77ea22d6c47ed191d7afffc50e9a0e | TypeScript | ryohey/ts-wasm-runtime | /packages/wasm-parser/src/misc/number.ts | 3.078125 | 3 | import { range } from "@ryohey/array-helper"
export const zeroPad = (binary: string, bitWidth: number): string => {
return (
range(0, bitWidth - binary.length)
.map(_ => "0")
.join("") + binary
)
}
export const binToHex = (str: string) =>
zeroPad(str, Math.ceil(str.length / 8) * 8)
.match(/.... |
7eea6859dd595fa7fe19816eb02cf6c668da6ebf | TypeScript | rick-liyue-huang/Task-Management-Angular4-Redux | /src/app/actions/user.action.ts | 2.796875 | 3 |
// similar as the tasklist action
import { Action } from '@ngrx/store';
import { type } from '../utils/type.util';
import {Project, User, Task} from '../domain';
// define the relationship between user and project
export interface UserProject {
user: User;
projectId: string;
}
// forcus on the projectId un... |
c3685fa416a1aab283ef6000ae9ecc0081919ede | TypeScript | RealShadowNova/framework | /src/lib/types/Enums.ts | 2.78125 | 3 | export enum CooldownLevel {
Author = 'author',
Channel = 'channel',
Guild = 'guild'
}
export enum PluginHook {
PreGenericsInitialization = 'preGenericsInitialization',
PreInitialization = 'preInitialization',
PostInitialization = 'postInitialization',
PreLogin = 'preLogin',
PostLogin = 'postLogin'
}
/**
* Th... |
453d37184d87f6c5a32f3eb0deb543a02ece096e | TypeScript | georgyfarniev/manggis | /src/validation.ts | 2.546875 | 3 | import assert from 'assert';
import mongoose, { Connection, Schema } from 'mongoose';
import type { IValidationContext, IValidationOptions } from './types';
/**
* TODO list:
* 0. Get rid off context and pass only used parameters explicitly
* 1. Optionally allow to specify query filters (by exposing lower level api)... |
5ec6e131159743feea6a69137cce47ab8db9918e | TypeScript | devbitbet/Testingzoo | /packages/contracts/utils/yieldMatrix.ts | 2.625 | 3 | import { GoogleSpreadsheet } from 'google-spreadsheet';
import fs from 'fs';
import credentials from '../credentials.json';
// Load Zoo rarity, animal and yield data from Google Sheet:
// https://docs.google.com/spreadsheets/d/14wCL5RYul5noZ6BhN2NUcYKaw23YwvcItm7bGG-O9ZM
(async function() {
const doc = new GoogleSp... |
fb9dff583f861b04b53e52257806837cafeedf93 | TypeScript | Khenblack/contacts-CRUD-project | /server/src/utils/validations.ts | 2.71875 | 3 | const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
const PHONE_REGEX = /^[0-9]{9}$/;
export const validateEmail = (email: string) => {
return EMAIL_REGEX.test(email);
};
export const validatePhone = (phone: string) => {
return PHONE_REGEX.test(phone);
};
|
0d987c5f7228949ea9eb2b1f4a52f090f69b2e2c | TypeScript | astrellon/links | /src/scripts.ts | 2.53125 | 3 | // Add tooltips from alt attributes on images.
if (typeof(document.querySelectorAll) === 'function')
{
const backgrounds = document.querySelectorAll('.background');
const offset = -Math.random() * 60 + 's';
for (let i = 0; i < backgrounds.length; i++)
{
(backgrounds[i] as HTMLElement).style.anim... |
e52223c29c04fba090454d9524462367c94605a2 | TypeScript | seneca-srl/mqtt-sdk | /web-client/src/app/pipes.ts | 2.65625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { IMqttMessage } from 'ngx-mqtt';
@Pipe({ name: 'toVal', pure: false })
export class ToVal implements PipeTransform {
transform(message: IMqttMessage): number {
try {
let payload: any = JSON.parse(message.payload.toString());
return payloa... |
60e0e9e7df96d98f8da82f452d5cdfe016289c8b | TypeScript | ctapus/LinearAlgebra | /src/exercises/artificialNeuralNetwork.ts | 3.046875 | 3 | class Dendrite {
public weight: number;
public neuron: Neuron;
public constructor(neuron: Neuron) {
this.weight = Math.random();
this.neuron = neuron;
}
}
class Neuron {
public dendrites: Dendrite[];
public bias: number = Math.random() - 0.5;
public value: number;
public constructor(previousLayer: Layer) {
... |
0fd77e7eb61e8b47d397b975ff16b5e868cb9d49 | TypeScript | OnePair/secp256k1-message | /src/publickey-verifiers/raw-publickey-verifier.ts | 2.5625 | 3 | import EthCrypto from "eth-crypto";
export class RawPublicKeyVerifier {
private compressed: boolean;
constructor(options?: object) {
this.compressed = options && options["compressed"] || false;
}
public verifyPublicKey(rawPublicKey: string, publicKey: string): boolean {
if (this.compressed)
raw... |
99e1633377a078fc4c165f7c4238082ec77ef643 | TypeScript | liuweitao111/leetcode | /97.交错字符串.ts | 3.375 | 3 | /*
* @lc app=leetcode.cn id=97 lang=typescript
*
* [97] 交错字符串
*/
// @lc code=start
function isInterleave(s1: string, s2: string, s3: string): boolean {
if(s1.length + s2.length !== s3.length) {
return false;
}
const dp: boolean[][] = [];
dp[0] = [true];
for(let i = 1; i < s1.length + 1; i++) {
if... |
ba13806feaaa80313fe60ea37fe1f6104c8e22b2 | TypeScript | chrisd08/TypeScriptToLua | /src/lualib-build/util.ts | 2.640625 | 3 | import * as tstl from "..";
export function isExportTableDeclaration(node: tstl.Node): node is tstl.VariableDeclarationStatement & { left: [] } {
return tstl.isVariableDeclarationStatement(node) && isExportTable(node.left[0]);
}
export function isExportTable(node: tstl.Node): node is tstl.Identifier {
return ... |
550ae45d5ef02ccc2dc7cd76db9f426781725377 | TypeScript | david-boles/jsQR | /src/index.ts | 2.53125 | 3 | import { binarize } from "./binarizer";
import { BitMatrix } from "./BitMatrix";
import { QRColors, retrieveColors } from "./color-retriever";
import { Chunks } from "./decoder/decodeData";
import { decode } from "./decoder/decoder";
import { extract } from "./extractor";
import { locate, Point } from "./locator";
exp... |
1e68260adc3d7aeb2e86f94cf0ac9de735f5f53a | TypeScript | sergeylem/patterns | /src/facade/balance.ts | 3.203125 | 3 | import { IAdd, IRemove } from "./interfaces";
export class Balance implements IAdd, IRemove {
private balance: number = 0;
constructor() { }
// constructor(balance: number) {
// this.balance = balance;
// }
public add(email: string, m: number): number {
console.log(`Here is implementation of add o... |
75813f754a98328871dc04b094185b9770e70e25 | TypeScript | graphiti-api/spraypaint.js | /test/unit/attributes.test.ts | 3.03125 | 3 | import { expect, sinon } from "../test-helper"
import {
attr,
Attribute,
STRICT_EQUALITY_DIRTY_CHECKER
} from "../../src/attribute"
describe("Attributes", () => {
describe("Initializing Attribute", () => {
it("accepts undefined options", () => {
const anyAttr: Attribute<never> = attr()
expect(... |
e2d9cbbb79175d82d89fb79f633cd44e89db1e7d | TypeScript | mike-ward/Nancy3 | /src/App/js/services/compare-service.ts | 3.4375 | 3 | export const compareService = {
compareAny: compareAny,
naturalStringCompare: naturalStringCompare,
naturalStringCompareIgnoreCase: naturalStringCompareIgnoreCase,
locale: () => locale
}
const locale = 'en';
function compareAny(a: any, b: any): number {
if (a === b) return 0;
// NaN, and only NaN, will ... |
d534ae1ae9b7746ea099f0be17c55e3bd5787470 | TypeScript | jhgyun/Three.js-Typescript-version | /Three.ts/Three.ts/extras/core/Path.ts | 3.21875 | 3 | /// <reference path="curvepath.ts" />
/*
* @author zz85 / http://www.lab4games.net/zz85/blog
* Creates free form 2d path using series of points, lines or curves.
*
**/
namespace THREE
{
export class Path extends CurvePath
{
currentPoint: Vector2;
constructor(points?: Vector2[])
{
... |
e270b592493258afb439b1d0ec6e727086a592f5 | TypeScript | mehdizj2000/somestuff | /src/app/services/post-service.service.ts | 2.515625 | 3 | import { Post } from './../comm-data/posts.interface';
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class PostServiceService {
ur... |
5de8562250230a937611034dd40a153b88b90790 | TypeScript | DocLabyrinth/real-time-data | /src/slices/realtimeDataSlice.ts | 2.59375 | 3 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import { AppThunk, RootState } from '../app/store'
import { fetchUserBrowserData, fetchUserDeviceData } from '../utils/google'
import { BarGraphData, SunburstData } from '../types'
interface RealtimeState {
userBrowserData: BarGraphData
userDeviceData: ... |
cd774129ef4ced2236dc3152d26279d62e5fb752 | TypeScript | geekcheng/erdiagram | /src/test/erdiagram/converter/oop/code-converter/typescript/type/parseTypeScriptType.unit.spec.ts | 3.09375 | 3 | import parseTypeScriptType from '@/erdiagram/converter/oop/code-converter/typescript/type/parseTypeScriptType';
describe('Well formatted types', () => {
it.each([
// Primitives
['boolean'],
['number'],
['string'],
['undefined'],
['null'],
// Classes
['Date'],
['HTMLElement'],
// Arrays of primitiv... |
cd674ef49f49471adb8f17da636bc6329bc491a0 | TypeScript | ProMastersss/GoF-patterns | /src/3.Builder/Misha.ts | 2.765625 | 3 | import { Builder } from "./Builder";
export class Misha implements Builder {
implementSingleton() {
console.log("Миша создал синглтон");
}
implementFactoryMethod() {
console.log("Миша создал фабричный метод");
}
implementAbstractFactory() {
console.log("Миша создал абстрактную фабри... |
4f04d4f52976278758cde3352a7acd736015ef09 | TypeScript | MihaiBlebea/typescript-translation-parser | /src/TranslationParser.ts | 3.171875 | 3 | import fs from 'fs'
type Payload = { [key : string] : any}
export default class TranslationParser
{
async execute(path : string)
{
try {
let payload = await this.getContent(path)
// Init empty object
let result : Payload = {}
// Parse to a pure objec... |
a3755b4f678708e087ad8b72a38c2590bb0e6645 | TypeScript | zombieJ/valve-vpk | /src/FileReader.ts | 3.125 | 3 | const FS = require('fs');
const BUFFER_MAX_LEN = 2048;
class FileReader {
path: string;
fileDef: number;
index: number = 0;
buffer: Buffer;
bufferLen: number;
bufferIndex: number;
done: boolean = false;
constructor(path) {
this.path = path;
this.fileDef = FS.openSync(this.path, 'r');
}
getBuffer(mi... |
9203c4e2b2e7b4318b8f4b3e7cdf5160e48f5374 | TypeScript | psioniclimited/palace_app_ionic | /src/models/movies.ts | 2.59375 | 3 | import {MovieDetails} from "./movieDetails";
export class Movies {
id: string;
name: string;
file_path: string;
movie_details: MovieDetails[] = [];
constructor(id: string = "",
name: string = "",
file_path: string = ""){
this.id = id;
this.name = name;
this.file_path ... |
e3644f92c48d8b22ea0c25d46a8370f282064646 | TypeScript | milocosmopolitan/nx-workspace | /libs/ui/src/lib/common/node/node.class.ts | 2.515625 | 3 | export abstract class AbstractNodeWithChildren<Meta> {
private _meta: Meta;
public get meta() { return this._meta; };
public set meta(value: Meta) {
this._meta = value;
}
}
export abstract class AbstractNode {} |
50e436d8797fae1e82c000f549e93f4ba337cc16 | TypeScript | GBurgardt/simpleMouseFE | /src/pages/home/home.ts | 2.53125 | 3 | import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { AuthService } from '../../services/authService';
import { ConfigPage } from '../config/config';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
// Tipo de mouse. 'mou... |
dd7c8ba2bbdc00df6c25344ffe5037feffa134bb | TypeScript | Asitha92/creative-image-selector | /react-redux-demo/src/redux/vehicles/carReducer.ts | 2.734375 | 3 | import { UPDATE_VEHICLES, UPDATE_INPUT, TAGS, SEARCH_LIST } from "./carTypes";
type Tag = {
id: string;
Name: string;
};
type Vehicle = {
id: string;
type: string;
Name: string;
url: string;
tags: Tag[];
};
export interface VehicleState {
vehicleResults: any[];
input: string;
tags: Tag[];
}
cons... |
ac3fd3774b3c2ba63af2a3987f92a53858dc939b | TypeScript | Ishadijcks/test | /src/ig-template/features/statistics/StatisticsValueType.ts | 2.53125 | 3 | /**
* Add more types if statistics need to have different values
*/
export type StatisticsValue = number | number[]; |
4e0c6bd52333166663492dc1a3614f94f261e849 | TypeScript | EmpiteMilan/arabCart | /src/shared/api/responseHandler.ts | 2.734375 | 3 | import {statusHandler} from './statusHandler';
/**
* Success Response Handler
*
* @param {*} response
* @returns
* @memberof RestClient
*/
export const responseHandler = (response: any) => {
console.log('rest client response ', response);
const {hasError, errorMessage} = statusHandler(response);
if (hasErr... |
180579d529d15e458501d3ad9a7a1709d8daa8cb | TypeScript | nrgonzalez777/react-calendar | /src/entities/appointments/reducer.ts | 2.75 | 3 | import { combineReducers, AnyAction, Reducer } from 'redux';
import { appointmentEditorTypes } from 'components/AppointmentEditor/store';
import { Appointments, AppointmentMap, Appointment } from './state';
const byId = (
state: AppointmentMap = {},
action: AnyAction
): AppointmentMap => {
switch (action.type)... |
7d3e6ce5691ebcfa8a152ca000a7497e0961b1d3 | TypeScript | alkamiRumman/medilab | /src/config/Config.ts | 2.578125 | 3 | import {FileProperty} from "../schema/FileProperty";
import {Notification} from "./Notification";
export enum METHOD {
POST = 'POST',
GET = 'GET'
}
export class Config {
public pageScript?: { js: string[], css: string[] }[] = new Array<{ js: string[], css: string[] }>();
public render?: string;
public title?: st... |
8f7819eae8e201fedbc36fad6740bb02e7aeac88 | TypeScript | kossnocorp/typesaurus | /src/tests/update.ts | 2.6875 | 3 | import { schema, Typesaurus } from '..'
describe('update', () => {
interface User {
name: string
address: { city: string }
visits: number
guest?: boolean
birthday?: Date
}
interface Post {
author: Typesaurus.Ref<User, 'users'>
text: string
date?: Date | undefined
tags?: (stri... |