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 |
|---|---|---|---|---|---|---|
ec065383b6699ed13b44c05cf03ccc12f8997cca | TypeScript | diosney/node-iproute | /src/commands/link/virtual-link-types/erspan-ip6erspan.interfaces.ts | 2.828125 | 3 | import { ErspanDirections } from '../../link.constants';
/**
* Add link erspan & IP6 erspan type arguments.
* @category Interfaces
*/
export interface AddLinkErspanIp6erspanTypeArgs {
/** Specifies the remote address of the tunnel. */
remote: string;
/**
* Specifies the fixed local address for tunneled pac... |
85c65533bf00711559ea313d0ef51a2b2829f80a | TypeScript | exportarts/ngx-prismic | /libs/universal/src/lib/routes.ts | 2.90625 | 3 | import { PrismicDocument } from '@prismicio/types';
import { getPrismicUids, resolveDocumentIds } from './prismic-uids';
import { RouteConfig, DEFAULT_EXTRA_OPTIONS, PrismicRoute } from './routes.model';
/**
* Loads all documents with the provided doc types from Prismic,
* maps them with the provided mapping functio... |
93a7b71dc73723bc484ac9f5d427fd570ce13d22 | TypeScript | zachweintraub/tap-room | /src/app/price.pipe.ts | 2.671875 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { Keg } from './models/keg.model';
@Pipe({
name: "price",
pure: false
})
export class PricePipe implements PipeTransform {
transform(input: Keg[], desiredPrice) {
let output: Keg[] = [];
if(desiredPrice == "budget"){
... |
3e9a90f315c01f281a7de7dff31e5491cc8e9694 | TypeScript | LiamWiddop/__old__study | /server/entities/diagnostic.ts | 2.578125 | 3 | import {Entity, PrimaryGeneratedColumn, Column, OneToMany, OneToOne, JoinColumn, BaseEntity, ManyToMany} from "typeorm";
import disease from "./disease";
@Entity()
export default class Diagnostic extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;
@Column({ default: "" })
name: string;
@... |
75863ce7a25708256b894a975379532fad88509d | TypeScript | htoooth/typescript-study | /src/test9/main.ts | 2.828125 | 3 | import Express from './Express';
function main() {
let a = Express.of(3)
let b = Express.of(4)
let c = Express.of(5)
let d = Express.of(6)
let e = Express.of(a, '+', b)
let f = Express.of(c, '-', d)
let g = Express.of(e, '*', f)
let h = Express.of(f, '/', g)
console.log(h.toString(), ' = ', h.calc... |
5a35bff392855fea95947cd84fb134f7e88b4586 | TypeScript | WIStudent/rxjs-examples | /01-example.ts | 2.84375 | 3 | import {from} from 'rxjs';
// Observable that emits 1 to 3
const observable = from([1,2,3]);
const subscription = observable.subscribe({
next(value) {
console.log(value);
},
complete() {
console.log('complete')
},
error(e) {
console.log(e)
}
});
|
7a12cef1631d2475dcb8fc41cd601f9751978571 | TypeScript | BisiDavi/reminisce | /server/src/controllers/posts.ts | 2.5625 | 3 | import express, { Request, Response } from "express";
import mongoose from "mongoose";
import { IPost } from "../types";
import { PostMessage } from "../imports";
const router = express.Router();
export const getPosts = async (req: Request, res: Response): Promise<any> => {
try {
const postMessages = await Pos... |
a82b2fdaaa5efa28649cbe84d74d73dc32479066 | TypeScript | xmtrinidad/Ionic-N10-007 | /src/data/resources.ts | 2.609375 | 3 | import { Resource } from '../models/resource';
export const RESOURCES: Resource[] = [
{
"objectiveNumber": "1.1",
"title": "Introduction to IP",
"description": "We rely on IP as the fundamental protocol on today’s networks. In this video, you’ll learn about the fundamentals of IP, TCP, UDP, and ICMP.",... |
f2fc9605f0b728059f67da836273f11bf7494416 | TypeScript | gsanta/silhouette-people | /tests/QuadraticLineEquation.test.ts | 2.9375 | 3 | import { QuadraticLineEquation } from "../src/model/math/QuadraticLineEquation";
describe('Solving quadratic equation', () => {
it ('gives two roots', () => {
const quadratic = new QuadraticLineEquation(2, -5, -3);
expect(quadratic.solve()).toEqual([3, - 0.5]);
});
it ('gives one root if... |
b967932c2b31a1689666f497c9948eb370620193 | TypeScript | Pjaerr/Politico-Final-Year-Project | /src/systems/GameDataManager/GameDataManager.ts | 2.71875 | 3 | import IGameDataManager from "./IGameDataManager";
import IGameData from "../../interfaces/IGameData";
import IProvince from "../../interfaces/IProvince";
import Provinces from "../../data/Provinces";
import {
generateRandomPopulation,
generateRandomHappiness,
generateRandomPopulationDensity,
generateRa... |
02c28fadd4289606ee4f0c44872919650baa56ea | TypeScript | fabioparra/TypeScript | /tests/cases/fourslash/quickInfoOnCircularTypes.ts | 2.65625 | 3 | /// <reference path='fourslash.ts' />
////interface A { (): B; };
////declare var a: A;
////var xx = a();
////
////interface B { (): C; };
////declare var b: B;
////var yy = b();
////
////interface C { (): A; };
////declare var c: C;
////var zz = c();
////
////x/*B*/x = y/*C*/y;
goTo.marker('B');
ver... |
dedca15d48e09dae0242327a48ae1bbee4aa2a99 | TypeScript | adamfitzpatrick/tslint-stylish | /src/ruleFailure.ts | 2.59375 | 3 | /// <reference path="../typings/stylish.d.ts" />
var _ = require("lodash");
type IPalantirRuleFailureObject = Stylish.IPalantirRuleFailureObject;
type IRuleFailureObject = Stylish.IRuleFailureObject;
type IPosition = Stylish.IPosition;
class RuleFailure {
protected fileName: string;
protected ruleName: string... |
8440d031cd0c0100ed8fcbcbcfbc0159cf6aec4b | TypeScript | musings-sphere/micro-hermes | /src/types/loggerService.d.ts | 2.71875 | 3 | export declare type LogLevel = "log" | "error" | "warn" | "debug" | "verbose";
export interface LoggerService {
log(message: any, context?: string): any;
error(message: any, trace?: string, context?: string): any;
warn(message: any, context?: string): any;
debug?(message: any, context?: string): any;
verbose?(mess... |
931c2d30680e5fc7b63578ad78c2870436319317 | TypeScript | Regesh/full-ngrx-store | /src/app/reducers/router.reducer.ts | 2.875 | 3 | import { RouterActionTypes } from '../actions/router';
export interface State {
data:any[]
}
const initialState: State = {
data: []
};
export function reducer(
state: State = initialState,
action: any
): State {
switch (action.type) {
case RouterActionTypes.pageLoaded:
return {
data: action... |
365c7826d3910d43a4de6f404b0ab84d6563c2a1 | TypeScript | mrobinson242/AngularWeatherApplication | /src/app/services/darkSky.service.ts | 2.59375 | 3 | import { Injectable, EventEmitter, Output } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class DarkSkyService
{
// Create JsonData
private jsonData: any;
// Form Information
private state: string;
private city: string;
private currentLocation: a... |
83298538edd0876eda5495117469d9da42b98ce9 | TypeScript | adinstruments/LightningDeviceSDK | /examples/devices/MentalabExplore/settings.ts | 2.59375 | 3 | import {
UnitPrefix,
IDeviceSetting,
IDeviceProxySettingsSys,
IDeviceStreamApi,
IProxyDevice,
DeviceValueType,
IDeviceStreamConfiguration
} from '../../../public/device-api';
import { UnitsInfo16Bit, UnitsInfoImpl } from '../../../public/device-units';
import { Setting } from '../../../public/devic... |
edcec877cdfafbe879d13f0cddcd97afb40889ab | TypeScript | jhoijune/algorithm | /src/Programmers/intermediateLetter.ts | 3.25 | 3 | import {} from 'module';
const solution = (s: string): string => {
/**
* 가운데 글자 가져오기
* time complexity: O(1)
* space complexity: O(1)
*/
const size = s.length;
if (size % 2 === 0) {
return s.slice(Math.floor(size / 2) - 1, Math.floor(size / 2) + 1);
}
return s[Math.floor(size / 2)];
};
|
15519d189ae30ead50c105f2db2f4805fd7e0c10 | TypeScript | zansito/detrans | /web/src/app/shared/button/button.ts | 2.6875 | 3 | import { ILabel, LabelFactory } from './../label';
import { IAction, ActionFactory } from './../action';
import { IButton } from './button.interface';
class Button implements IButton {
constructor(
public label,
public clazz='',
public icon?,
public enabled?,
public visible?,
public show?,
... |
174bca2004cba0ea1b8b06980f0c059cc168c12e | TypeScript | MarcosRochaPrimordial/decorated-router | /src/route.ts | 2.546875 | 3 | import { Response, Request, NextFunction, Express } from 'express';
import * as express from 'express';
import { DiContainer } from './diContainer';
import { Parameter } from './Action';
import { Server } from './server';
export class Route {
private server: Express;
constructor(
private instanceServ... |
0be3c7e271b6c5eaa4ccefde5013bd223a855f3f | TypeScript | coreweave/argo | /ui/src/app/shared/history.ts | 2.828125 | 3 | import {uiUrl} from './base';
import {Utils} from './utils';
/**
* Return a URL suitable to use with `history.push(..)`. Optionally saving the "namespace" parameter as the current namespace.
* Only "truthy" values are put into the query parameters. I.e. "falsey" values include null, undefined, false, "", 0.
*/
expo... |
866b3ee3ccfaf605c2a87683b44223119f124720 | TypeScript | moktadirkhan/my_portfolio | /data.ts | 2.625 | 3 | import {RiComputerLine} from 'react-icons/ri'
import { IProject, IService, ISkill } from './type'
import {FaServer} from 'react-icons/fa'
import { AiOutlineAntDesign,AiOutlineApi } from 'react-icons/ai'
import {MdDeveloperMode} from 'react-icons/md'
import {BsCircleFill} from 'react-icons/bs'
// getting the struture fr... |
96a799be5c6d8b24fc2714769f78330d24eae244 | TypeScript | Alfresco/alfresco-js-api | /src/api/model-rest-api/api/aspects.api.ts | 2.515625 | 3 | /*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. 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/lic... |
c3314bd9b096594aadae70a4bbe33f39ad822388 | TypeScript | balena-io-modules/balena-sync | /lib/shell.ts | 2.796875 | 3 | import * as child_process from 'child_process';
import * as os from 'os';
import * as Promise from 'bluebird';
import * as _ from 'lodash';
import * as rindle from 'rindle';
interface SubShellCommand {
program: string;
args: string[];
}
/**
* @summary Get sub shell command
* @function
* @protected
*
* @param {... |
1f2831fb33c7cbff3afa5d3da2e47ae83016eba4 | TypeScript | SahenJavac/Fast-track-training-with-Krish | /pet-clinic-nestjs-angular/pet-clinic-front/src/app/pet/model/animal.model.ts | 2.59375 | 3 | export interface Animal {
type: string;
breed: string;
age: number;
diagnosis: string;
} |
efacf4204812ab0f1ae08256d53988b6e8b030d9 | TypeScript | jimxshaw/samples-typescript | /LibraryManagerVS/LibraryManagerVS/app.ts | 3.4375 | 3 | function GetAllBooks() {
let books = [
{ id: 1, title: "The Hobbit", author: "J.R.R. Tolkein", available: true, category: Category.Fantasy },
{ id: 2, title: "Of Mice and Men", author: "John Steinbeck", available: true, category: Category.Fiction },
{ id: 3, title: "Dune", author: "Frank He... |
ed68e371e0bf9b4edcad97bc7b7f00854ce7a67e | TypeScript | hsneden/crosswords-game | /src/app/crosswords/services/remote-data.service.ts | 2.625 | 3 | import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Axis, Word } from '../models/word.model';
import { Crossword } from '../models/crossword.model';
import { Issue } from '../models/issue.model';
@Injectable()
export class RemoteDataService {
constructor(private _http: Http)... |
9b7030750222507e754708019122565075aa6f61 | TypeScript | vicimpa/road-keys | /lib/keyboard.ts | 2.9375 | 3 | export const keySymbols = `abcdefghijklmnopqrstuvwxyz1234567890-=+_)(*&^%$#@!/?\`'"\\|.,`
export const accessSymbols = keySymbols.split('')
accessSymbols.push(' ')
for (let sym of accessSymbols)
if (sym !== sym.toUpperCase())
accessSymbols.push(sym.toUpperCase())
accessSymbols.push('Enter')
accessSym... |
699c109f0eee33387124b31f47640d6daa71eccc | TypeScript | idledeity/renderbox | /source/render/renderer/open_gl/open_gl_renderer.ts | 2.609375 | 3 | import OpenGLContext from "./open_gl_context.js"
import Renderer from "../renderer.js"
import SolidColorProgram from "../../shader/shaders/solid_color.js";
import VertexColorProgram from "../../shader/shaders/vertex_color.js";
import OpenGLShaderProgram from "./open_gl_shader_program.js";
import Vector2 from "math/vect... |
da74b0a6a2fd9a03088d13143fd3a2c440733b9a | TypeScript | Automattic/danger-settings | /org/pr/milestone.ts | 2.8125 | 3 | // Danger ignores Danger's imports at runtime and actually would give a build
// failure if we tried to use them here and then import this file. What authors
// should do, instead, is simply assume it's there.
//
// See https://danger.systems/js/usage/extending-danger.html#writing-your-plugin
//
// In order to write te... |
606d9c6f6b3a70b9babe43bd4370a356696d3d29 | TypeScript | juanwolf/enter-the-wiki | /src/domain/items/item.ts | 2.828125 | 3 | import { Field, ObjectType } from "type-graphql";
@ObjectType()
export class Item {
@Field()
name: string;
@Field()
description: string;
@Field()
quality: string;
constructor(name: string, description: string, quality: string) {
this.name = name;
this.description = descri... |
e1bc2b02d64b12477342f4d841e27281aa2da022 | TypeScript | Adyen/adyen-node-api-library | /src/typings/payout/address.ts | 2.609375 | 3 | /*
* The version of the OpenAPI document: v68
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
export class Address {
/**
* The name of the city. Maximum length: 3000 characters.
*... |
66f3c107b686a9ee77529ae292cf0594c6044f43 | TypeScript | dsshard/reply-count-loop | /src/index.ts | 3.15625 | 3 | export interface ReplayCountLoopOptions {
attempts?: number
onError?: (err) => void
delay?: number
}
export default function replayCountLoop <T> (fn, options: ReplayCountLoopOptions = {}): Promise<T> {
if (!fn) throw new Error('first parameter (fn) is required')
let attempt = 0
async function replay () {
... |
8ec872fbd8a9221689bc37664bf403665ee249ac | TypeScript | ziccardi/json-data-validator | /test/rules/SimpleRulesPack/IsAsciiRule.test.ts | 2.578125 | 3 | import {RuleFactory} from '../../../src/rules/RuleFactory';
import {test} from '../../utils';
describe('isAscii', () => {
const rule = RuleFactory.create({
type: 'isAscii',
});
it('Should evaluate if string is an ASCII string', () => {
test(rule, {
path: 'field1.field2',
valid: ['abcdefghi 1... |
1ec221c4b89f12bc27cc8f50adbbbc9fb7c8ab61 | TypeScript | andyriffic/CNB | /src/server/src/uplift/sockets/mob-mode/points-to-player-castle.ts | 2.703125 | 3 | import { Debugger } from 'debug';
import { playerService } from '../../services/player';
import { Player } from '../../services/player/types';
import { MobGame } from './types';
function setAttackingPlayer(player: Player | undefined, log: Debugger): void {
if (!player) {
log('No Attacking player to set');
re... |
70abcbf9342e5c5a40d95aafb7b3a1ba2202ce36 | TypeScript | LIAUTAUD-Canelle/API-OpenFoodFacts | /src/app/classes/contact.ts | 2.765625 | 3 | export class Contact {
id: number;
nomFamille: string;
prenom: string;
email: string;
genre: number;
age: number;
constructor(id: number, nomFamille: string, prenom: string, email: string, genre: number, age: number) {
this.id = id;
this.nomFamille = nomFamille;
this.prenom = prenom;
th... |
470ddbf19ea091b0b3f8a4986d5380be383343b3 | TypeScript | PinaryDevelopment/torahis.life | /src/frontend/src/models/shiur.ts | 2.671875 | 3 | import { Tag } from './tag';
import { TagType } from './tag-type.enum';
import { Author } from './author';
export class Shiur {
public title: string;
public tags: Tag[];
public date: Date;
public duration: string;
public id: number;
public previousId?: number;
public nextId?: num... |
41d1c169f8f1fe2ff5f9cf8b4cff61abf7b9d6de | TypeScript | asiec-inverntory/frontend | /src/stores/listing/AttributesStore.ts | 2.890625 | 3 | import { makeAutoObservable } from 'mobx';
import keyBy from 'lodash/keyBy';
import { get } from 'utils/fetch';
import { AttributeValueType, ObjectWithIds } from 'utils/types';
export type AttributeType = {
id: string;
// AttributeValueType means type of attribute valueType
// valueType describe type of specifi... |
0d771df26adc53e1ce42539fbf30938b829101c8 | TypeScript | kabarakh/diceRollerV2 | /src/app/services/abstractStorage.service.ts | 2.6875 | 3 | import { Injectable } from '@angular/core';
import store from 'store2';
@Injectable()
export abstract class AbstractStorageService {
abstract storageName: string;
abstract storageType: string;
storage: any;
constructor() {
}
initializeObject = () => {
if (!this.storageName || !this.storageType) {
... |
6f7343a95a70d172406763889eca61313d368647 | TypeScript | NW12/spotStar | /scripts/deploy.ts | 2.59375 | 3 | // We require the Hardhat Runtime Environment explicitly here. This is optional but useful for running the
// script in a standalone fashion through `node <script>`. When running the script with `hardhat run <script>`,
// you'll find the Hardhat Runtime Environment's members available in the global scope.
import hre, {... |
bcb5553cd7f45088f6d8f15749b46c5c0921f2ff | TypeScript | darrickyee/ui | /ts/models/uetypes.ts | 2.96875 | 3 | import { types, Instance } from 'mobx-state-tree';
import { has } from 'ramda';
const arrayMapper = (props: string[] = []) =>
types
.model({})
.views((self) => ({
toArray() {
return props.map((p) =>
has('toArray', self[p])
? se... |
b888b4247949ac9b0dce288680e7270a7a9ccbcc | TypeScript | Luke-Gurgel/rn-tdd-cdd | /src/utils/make-test-id.ts | 2.703125 | 3 | export function makeTestId(str: string, pathPrefix = ''): string {
if (!str) throw Error('makeTestId(): an empty string was passed in')
return pathPrefix + str.toLowerCase().replace(/ /g, '-')
}
|
c7bbffb6876371fb5ee281aaa32afc64e6b23e2e | TypeScript | NaOH123321/angular-taskmgr | /src/app/actions/task-list.action.ts | 2.90625 | 3 | import { Action } from '@ngrx/store';
import { TaskList, User } from './../domain';
/**
* For each action type in an action group, make a simple
* enum object for all of this group's action types.
*/
export enum TaskListActionTypes {
TASKLIST_LOAD = '[TaskList] TaskList Load',
TASKLIST_LOAD_SUCCESS = '[Task... |
c8a033c5b9b9582cad4b809879f8ce49a1750a83 | TypeScript | KProskuryakov/kproskuryakov.github.io | /src/lasergame/LaserSegment.ts | 2.84375 | 3 | import Color from "./Color";
import Direction, { getOppositeDirection } from "./Direction";
import Tile, { copyTile } from "./Tile";
export default interface LaserSegment {
tile: Tile;
dir: Direction;
color: Color;
}
export function getOppositeLaserSegment(laser: LaserSegment): LaserSegment {
return { tile: c... |
450337a6ad085a09238cb96dac389d5da74ae4f0 | TypeScript | InnoCampusLife/frontend | /src/modules.ts | 2.609375 | 3 | import config from './config'
import storage from './storage'
function ajax(type: string, url: string, data: Object, successCallback: Function, errorCallback: Function): void {
const xhr = new XMLHttpRequest()
xhr.open(type, url, true)
xhr.onload = function() {
if (xhr.response && xhr.response.result) {
// con... |
3864ca0e533ea7adecbb1278ee01e0e3913c73b3 | TypeScript | MonchiLin/modern-magic | /projects/TNOA/chapter4/particle-system-406/sketch.ts | 2.515625 | 3 | import "p5"
import ParticleSystem from "./particel-system";
import Repeller from "./repeller";
let particleSystem: ParticleSystem
let repeller: Repeller
function setup() {
createCanvas(640, 640)
particleSystem = new ParticleSystem(createVector(width / 2, 50))
repeller = new Repeller(createVector(width / 2, heig... |
a43fa66eda24382f724539c727aacacc15a688b6 | TypeScript | green-fox-academy/Kerk1990 | /week1/day4_typescripts/diamonddrawing.ts | 3.421875 | 3 | export {}
'use strict';
let lineCount: number = 7;
// Write a program that draws a
// diamond like this:
//
// *
// ***
// *****
// *******
// *****
// ***
// *
//
// The diamond should have as many lines as lineCount is
let mark: string = "*";
let emptyNum: number = lineCount;
let decrease: number = lin... |
6d0c64f77faad189f6a73ecca9b5190d7c42ffe8 | TypeScript | juancri/covid19-animation-generator | /src/data/preprocessors/DatePlusPreProcessor.ts | 3.203125 | 3 |
import { DurationLike } from 'luxon';
import * as Enumerable from 'linq';
import { DataPoint, TimeSeries } from '../../util/Types';
interface DatePlusParameters
{
series: string;
plus: DurationLike;
limit?: boolean
}
/**
* Shifts the dates for a specific row
*/
export default class DatePlusPreProcessor
{
publ... |
ae8757497d65c46af552b9d53abafaa9a3ade2e0 | TypeScript | Shawn0630/react-dashboard | /__tests__/utilities/array-helper.test.ts | 3.4375 | 3 | import { flatten, groupBy } from "~utilities/array-helper";
describe("utilities/array-helper", () => {
test("should flatten the array in pure Array", () => {
const pureArray: number[] = [1, 2, 3, 4];
expect(flatten(pureArray)).toEqual([1, 2, 3, 4]);
});
test("should flatten the array", () ... |
3b15884dd48870f5c727bd8b5fb15ff045b7ca0c | TypeScript | clausejs/clausejs | /src/preds/isFn.ts | 2.65625 | 3 | export default function isFunction( x ) {
var getType = {};
// (x || false) guarantees returning of boolean type
return ( x || false ) &&
[ '[object Function]', '[object GeneratorFunction]' ].indexOf(
getType.toString.call( x )
) >= 0;
}
|
fec91aeddfce4592ba0825c8561e096cf953c21f | TypeScript | daviseford/aos-reminders | /src/factions/ogor_mawtribes/spells.ts | 2.5625 | 3 | import { tagAs } from 'factions/metatagger'
import { COMBAT_PHASE, HERO_PHASE, WOUND_ALLOCATION_PHASE } from 'types/phases'
const Spells = {
//BUTCHER SPELLS
'Blood Feast': {
effects: [
{
name: `Blood Feast`,
desc: `Casting value of 7 and a range of 18". Pick 1 friendly OGOR unit that is ... |
dfffcf3bb25b77b3246564caa2aff7303b4250d7 | TypeScript | Jagiello95/wyprawnik | /src/app/shared/directives/control.directive.ts | 2.625 | 3 | import { Directive, ElementRef, HostBinding, HostListener, OnInit } from '@angular/core';
import { NgControl } from '@angular/forms';
enum ValidityStatus {
valid= "VALID",
invalid= "INVALID"
}
@Directive({
selector: '[formControlName]'
})
export class ControlDirective implements OnInit {
public blurred: boolea... |
54e033a589a887415841b9fbdae616e7ce4fa9d0 | TypeScript | jKelio/eventobserver | /src/lib/event-subject.ts | 2.59375 | 3 | export interface EventSubject<T> {
subscribe(fn: T): void;
unsubscribe(fn: T): void;
unsubscribeAll(fn: T): void;
emit(...args: Array<any>): void; //Promise<Array<any>>;
} |
72b6b437a631603cd315b3868bede6e62dfbf1c5 | TypeScript | fluidnext/library-sport | /src/soccer/SoccerPlayer.ts | 3.09375 | 3 | import { AbstractPlayer } from "../AbstractPlayer";
import { PlayerInterface } from "../PlayerInterface";
/**
* @class SoccerPlayer
*/
export class SoccerPlayer extends AbstractPlayer implements PlayerInterface{
/**
*
* @param {string} number
* @param {string} name
*/
constructor(number... |
fef8275c3571e2576c8f0b79b35390832244d240 | TypeScript | kjirou/typescript-playground | /examples/omit.ts | 2.828125 | 3 | type Foo = {
x: number,
y: string,
z: boolean,
};
type Bar = Omit<Foo, 'y'>;
type Baz = Omit<Foo, 'x' | 'z'>;
const bar: Bar = {
x: 1,
z: true,
};
const baz: Baz = {
y: '',
};
// NG
//const unBar: Bar = {
// x: '',
// z: true,
//};
// NG
//const unBaz: Baz = {
// x: 1,
// y: '',
//};
export {}
|
3b9da1f8b75b35db69f2f5a6dd5c663db4de5cb4 | TypeScript | fivetran/typescript-closure-tools | /index/closure-library/closure/goog/demos/xpc/xpcdemo.d.ts | 2.5625 | 3 | /// <reference path="../../../../globals.d.ts" />
declare module xpcdemo {
/**
* Initializes XPC in the containing page.
*/
function initOuter(): void;
/**
* Initialization in the iframe.
*/
function initInner(): void;
/**
* Kills the peer iframe and the disposes the cha... |
026c2b8757dc196d4fc38b7f2907617e750d5a39 | TypeScript | negezor/vk-io | /packages/vk-io/src/structures/contexts/dialog-notification-settings.ts | 2.734375 | 3 | import { Context, ContextFactoryOptions, ContextDefaultState } from './context';
import { pickProperties } from '../../utils/helpers';
import { kSerializeData } from '../../utils/constants';
export type DialogNotificationSettingsContextType = 'dialog_notification_settings';
export type DialogNotificationSettingsCont... |
e90fde82d27ad97e8e29d2f7162639e55f660dd0 | TypeScript | reynardmh/db-fabricator.js | /test/fabricator.spec.ts | 2.765625 | 3 | import { Fabricator } from '../src/fabricator';
import { DataStoreAdaptor } from '../src/data-store-adaptor';
import * as Promise from 'bluebird';
import { expect } from 'chai';
class IdCounter {
static counter: Object = {};
static getId(name: string) {
if (this.counter.hasOwnProperty(name)) {
return ++t... |
443d5d28a5d820efa10d1d88e6d204919513ff33 | TypeScript | imsks/donatecart-assignment | /src/controllers/index.ts | 2.59375 | 3 | import { Request, Response } from 'express';
import moment from 'moment';
import { CampaignData } from '../interfaces';
import Campaigns from '../assets/campaigns.json';
// 1. Get all campaigns with descending order of total amount
export const getAllCampaigns = async (
request: Request,
response: Response,
): Pro... |
3a53f159b80f7186ae4c00840eefb51157e7730e | TypeScript | richinhim/ngTodo1 | /js/rxjs/05_count.ts | 3 | 3 | import {Observable} from "rxjs";
// 최종처리 operator: 한개의 최종값을 Observable로 리턴
// 최종처리 연산자-단일값으로 리턴하고, 스트림을 끝내고 싶을때 사용해야
const source = Observable.of(1, 2, 3, 4);
const result = source.count();
const subscribe = result.subscribe(val => console.log('Sum:', val));
|
13d72f789ed24efe81bc6404e8762acabb4254c7 | TypeScript | sanity-io/get-it | /src/middleware/agent/node-agent.ts | 2.921875 | 3 | import {Agent as HttpAgent, AgentOptions} from 'http'
import {Agent as HttpsAgent} from 'https'
const isHttpsProto = /^https:/i
/**
* Constructs a http.Agent and uses it for all requests.
* This can be used to override settings such as `maxSockets`, `maxTotalSockets` (to limit concurrency) or change the `timeout`.
... |
aba8bbca02ec126d6415ce323dc839faff1dd132 | TypeScript | krumyc3/ng2-project-management | /src/app/store/actions/user.actions.ts | 2.5625 | 3 | import { Injectable } from '@angular/core';
import { User } from '../../models/user';
export interface UserAction {
type: string;
payload?: any;
}
@Injectable()
export class UserActions {
static SIGN_UP_USER = 'SIGN_UP_USER';
static SING_IN_USER = 'SIGN_IN_USER';
static CLEAR_USER = 'CLEAR_USER';
static UP... |
da1efcea02ddf71b0eadbb83d92fa726fdcb0ad5 | TypeScript | developerprofile/docker-run | /src/common/error.ts | 2.671875 | 3 | import { DEFAULT_FILE_NAME } from "./constants";
export class NoFolderOrWorkspaceOpenedError extends Error {
constructor(message: string = "No folder or workspace opened") {
super(message);
this.name = 'No Folder Or Workspace Opened Error';
}
}
export class AutoGenerateConfigDisabledError exte... |
b6cf714b2237f39c78118185c8ad4b828f843bb2 | TypeScript | varyandeveloper/ts-boilerplate | /modules/api/exception/exception.ts | 3.078125 | 3 | export default class Exception extends Error {
protected _statusCode: number;
constructor(message: string, statusCode = 500) {
super(message);
this._statusCode = statusCode;
Object.setPrototypeOf(this, Exception.prototype);
}
get statusCode(): number {
return this._statusCode;
}
}
|
db4fabb0e655b4bd4cd561f034da380bb2d9966c | TypeScript | brychanthomas/game-3 | /src/player.ts | 3 | 3 | import { GameMap } from './scenes.js';
interface wasdKeys {
'W'?: Phaser.Input.Keyboard.Key,
'A'?: Phaser.Input.Keyboard.Key,
'S'?: Phaser.Input.Keyboard.Key,
'D'?: Phaser.Input.Keyboard.Key
}
/**
* Abstract class that creates sprite and scene properties
* for players.
*/
abstract class Player {
protecte... |
e0df6ec60cd3fe431814ea2d0bd2cf09b2bac0eb | TypeScript | WilliamRitson/CS-Sideprojects | /src/app/set-theory/set-parser.ts | 2.796875 | 3 | import { TokenError } from '@angular/compiler/src/ml_parser/lexer';
import { Scanner, Token, TokenType } from './set-scanner';
import * as exprs from './set-expr';
enum TokenEvalType {
infix, groupingLeft, groupingRight, rightUnary, value
}
class TokenSetting {
type: TokenEvalType;
priority: number;
... |
8e6379f4c364102238708439f5c8744d7cd5e8f1 | TypeScript | BigBadAlien/places | /src/app/actions/auth.ts | 2.671875 | 3 | import { ThunkAction } from 'redux-thunk';
import { RootState } from '../reducers';
import { AnyAction } from 'redux';
import { ApiSignInPayload } from '../models/ApiSignInPayload';
import { createAction } from 'redux-actions';
import { ApiUserResponse } from '../models/ApiUserResponse';
import { environment } from '..... |
e7022d2b304b9a7adccc4a7cc9cce8df5dc48525 | TypeScript | herculesinc/nova.azure-functions | /lib/util.ts | 2.921875 | 3 | // IMPORTS
// =================================================================================================
import { Credentials, StringBag } from '@nova/azure-functions';
// MODULE VARIABLES
// =================================================================================================
const IPV4_REGEX = /[... |
8f9810e0b0b18a9517b34ae76c21f53e2ba897bb | TypeScript | rd113267/WordOfGodForEachDayArabic | /app/bibleRef.ts | 2.703125 | 3 | export const sequence: number[] = [
1,
40,
2,
41,
3,
4,
5,
42,
6,
43,
7,
8,
44,
9,
10,
45,
11,
46,
12,
13,
14,
47,
15,
48,
16,
49,
17,
50,
18,
51,
19,
52,
20,
53,
21,
22,
54,
23,
55,
24,
25,
56,
57,
26,
58,
27,
59,
28,
60,... |
f9f78acc3df38f072484ce0e67f7e99a57aedf7d | TypeScript | randalvance/skyhigh-web | /src/app/stores/site/site.reducer.ts | 2.71875 | 3 | import { Action } from '@ngrx/store';
import { SiteActions } from './site.actions';
export interface SiteState {
siteName: string
}
const initialState: SiteState = {
siteName: 'My Awesome Site'
};
export function siteReducer(state = initialState, action: Action): SiteState {
switch (action.type) {
default:... |
ca5b2f1e5ea58f1558f94d5abffff38442e51fbc | TypeScript | teamsignprompt/sveltekit-oidc | /src/lib/_keycloak/cookie.ts | 3.078125 | 3 | const decode = decodeURIComponent;
const encode = encodeURIComponent;
var pairSplitRegExp = /; */;
/**
* RegExp to match field-content in RFC 7230 sec 3.2
*
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
* field-vchar = VCHAR / obs-text
* obs-text = %x80-FF
*/
const fieldContentRegExp = /^... |
44c40495386361ba80169137f3951e44463739c3 | TypeScript | kilometerskang/angulartist | /src/app/board/board.component.ts | 2.859375 | 3 | import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-board',
templateUrl: './board.component.html',
styleUrls: ['./board.component.css']
})
export class BoardComponent implements OnInit {
squares: string[];
selectMode: boolean;
lastI: number;
gameOver: boolean;
constructor() ... |
9aff58d3cd6c2ce209141ec80b8344905c5106ba | TypeScript | juanbelieni/if-carga-horaria-app | /src/utils/usePersistedState.ts | 3.109375 | 3 | import {
useState, useEffect, Dispatch, SetStateAction,
} from 'react';
type persistedState<T> = [T, Dispatch<SetStateAction<T>>]
export default function usePersistedState<T>(key: string, defaultValue: T) : persistedState<T> {
const [state, setState] = useState<T>(() => {
const localValue = localStorage.getIt... |
54bb9f6eb3763365fbb241e735b7ee1f0e5768c6 | TypeScript | IlieCiotir/talk.timjs.typescript | /introduction/live/live.ts | 4.0625 | 4 | let a = 5;
const b = 'awe';
for (var i = 0; i < 100; i++) {
let c = 5;
let b = 5;
}
let c: string;
let d: number;
let e: boolean;
let f: any;
let favNumbers = [1, 2, 3, 4];
enum Languages {
Java = 10, Javascript, Csharp
}
let preferredLanguage = Languages.Csharp;
function doSometh... |
25164fe4b42088eb2449dbb5d781745f063e24c3 | TypeScript | green-fox-academy/lantos14 | /week-02/day-5/hexagon/hexagon.ts | 2.953125 | 3 | 'use strict';
const canvas = document.querySelector('.main-canvas') as HTMLCanvasElement;
const ctx = canvas.getContext('2d');
// one hexagon subfunction
function drawHexa (x,y) {
ctx.beginPath();
ctx.moveTo (x,y);
ctx.lineTo (x+20,y);
ctx.strokeStyle = 'black';
ctx.stroke();
ctx.beginPath();
ctx.mov... |
0f0cbbf2cbf31d82d9ad71d46ce75cbd02aff7a3 | TypeScript | MarqusJonsson/M7011E | /backend/simulator/src/db/populate.ts | 2.578125 | 3 | import { userTypeResolver } from './resolvers/userType'
import { buildingTypeResolver } from './resolvers/buildingType'
import { generatorTypeResolver } from './resolvers/generatorType'
import { userResolver } from './resolvers/user'
import { buildingResolver } from './resolvers/building'
import { generatorResolver } f... |
05f4c56f8d58bbc9f638548ce5c8bc113c218391 | TypeScript | spacemeowx2/ikaWidget2stat.ink | /types.d.ts | 2.609375 | 3 | interface Stage {
ID: number
}
interface Game {
key: string
type: string
modeKey: string
ruleKey: string
}
interface Weapon {
ID: number
}
interface Gear {
ID: number
}
interface Skill {
ID: number
}
interface GearSkill {
main: Skill
sub: Skill[]
}
interface Player {
name: st... |
1dec855b525407cce8ce08a4b6dd93983ae1faa2 | TypeScript | mdasmendel/loopback-sdk-builder | /tests/ng2web/src/app/shared/sdk/reducers/auth.ts | 2.515625 | 3 | /* tslint:disable */
import { SDKToken, LoopbackAction } from '../models/BaseModels';
import { LoopbackAuthActionTypes } from '../actions/auth';
import { AccountActionTypes } from '../actions/Account';
const initialState: SDKToken = {
id: null,
ttl: null,
scopes: null,
created: null,
userId: null,
user: nu... |
3c78fd8bcb79d44a49d70857019e2dde50b4a0a1 | TypeScript | uploadcare/image-fns | /src/has-transparency.ts | 2.828125 | 3 | import createCanvas from './create-canvas'
const hasTransparency = (input: HTMLCanvasElement) => {
const canvasSize = 50
const {canvas, context} = createCanvas(canvasSize, canvasSize)
let transparency = false
if (context) {
context.drawImage(input, 0, 0, canvasSize, canvasSize)
const data = context.g... |
8c8c222efc14b415bf817bdc8c32443ebb081419 | TypeScript | RecuencoJones/httpr | /app/Core/Body/Form.ts | 2.875 | 3 | import {HttprBody} from '../HttprBody';
import {PlainObject} from '../../Type/PlainObject';
import {MediaTypes} from '../../Enum/MediaTypes';
import {urlEncode} from '../HttprUtils';
/**
* Form body for URL Encoded data media.
*/
export class Form extends HttprBody<PlainObject> {
public constructor(data: PlainObje... |
0cc8ecaaa50216c926e0542f26c7f03c1ba174d3 | TypeScript | wley3337/my-style-react-ts | /src/redux/AutoLogin.redux/AutoLogin.test.ts | 2.609375 | 3 | import { cloneableGenerator } from "@redux-saga/testing-utils";
import { call, put } from "redux-saga/effects";
import { createMemoryHistory } from "history";
import {
BASE_URL,
setUser,
autoLogin,
watchAutoLogin,
handleAutoLogin
} from "../actions";
import { AUTO_LOGIN } from "./AutoLogin.types";
describe("... |
1d7f3852f1d994706a05ad4bf889d7e6ad0b06e0 | TypeScript | SuperSai/egret_wqGame | /src/wqgame/modules/battle/view/item/BattleBlood.ts | 2.578125 | 3 | /**
* 战斗中的血条
*/
class BattleBlood extends BaseEuiItem {
private bar: CustomProgressBar;
private txt_blood: eui.Label;
public constructor() {
super(SkinName.BattleBloodSkin);
}
public onAwake($data: any = null): void {
super.onAwake($data);
this.bar.labelDisplay.visible = false;
this.bar.bg.source = "b... |
c5a16aa761d7f70ea8c907b52dd0ea43ce6941b4 | TypeScript | ahmedbasuny/weather-app | /Frontend-angular/weather/src/app/services/weather.service.ts | 2.78125 | 3 | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class WeatherService {
API_KEY = "47ebd0fc8b07106aa80fe498e6e86132";
API_URL = "http://api.openweat... |
0fe6b11d832fb6f6c90eb3cdcadc537cb288eb1d | TypeScript | igor-kokorin/AppointmentsManagerAPI | /utilities/lib/default-value-setter.ts | 3.21875 | 3 | export class DefaultValueSetter {
static set<T, P extends keyof T, D extends T[P]>(obj: T, propertyName: P, defaultValue: D) {
if ((typeof obj[propertyName] === 'undefined') || ((defaultValue !== null) && (obj[propertyName] === null))) {
obj[propertyName] = defaultValue;
}
}
} |
360d85b348149fe272ce613e328595e03a2ca463 | TypeScript | asynccat/project-alpha | /frontend/src/utils/ValidationSchemes.ts | 2.53125 | 3 |
import * as Yup from 'yup'
export const validationSchema = {
validationEmail:
Yup.object({
email: Yup.string()
.required('Enter your new Email')
.email('This is not email')
}),
validationPassword:
Yup.object({
oldPassword: Yup.... |
6d5f40f566d8bb5678dab89c8e4f4ef43b26806c | TypeScript | Matinho/Angular6-Pruebas | /src/app/basicas/numeros/numeros.spec.ts | 2.734375 | 3 | import { incrementar } from './numeros';
describe( 'Prueba de números' , () => {
it( 'Debe devolver 100 si el numero ingresado es mayor a 100', () => {
const res = incrementar( 300 );
expect( res ).toBe( 100 );
});
it( 'Debe devolver el numero más 1 si el numero ingresado es menor a 100... |
985c47079a7e7bbd70b46862f775e5057effd226 | TypeScript | rohits2712/Angular | /src/app/department-list/department-list.component.ts | 2.71875 | 3 | import { Component, OnInit } from '@angular/core';
import { department } from 'src/department';
import{Router,ActivatedRoute,ParamMap} from '@angular/router';
@Component({
selector: 'app-department-list',
template: `
<h3>Department list</h3>
<ul class= "items">
<li (click)="onSelect(department)" [cla... |
36bcd068d95ec9423d961742840aa69496452b09 | TypeScript | on3iro/aeons-end-randomizer | /src/aer-data/src/createNormalizedData.ts | 2.59375 | 3 | import * as types from '../../aer-types/types'
export const createNormalizedData = (
data: types.IExpansionData
): types.NormalizedData => {
const expansions = Object.keys(data)
const normalize = (array: Array<any>) =>
array.reduce(
(acc, entity) => ({
entities: {
...acc.entities,
... |
6fd7ad3b29ca72bf0e6f5022f2564e04f244fdc6 | TypeScript | tanlh/typescript-study | /generic/src/app.ts | 4.28125 | 4 | //========================================================
// Introduction about generic
const names: Array<string> = []; // equals string[]
const promise: Promise<string> = new Promise((resolve, _reject) => {
setTimeout(() => {
resolve("String");
}, 1000);
});
promise.then((data) => data.split(" "));
//====... |
067c7298da25b9c8ecab7d6b2add2765d9825937 | TypeScript | godiagonal/nations-client | /src/app/models/hours.model.ts | 3.171875 | 3 | export class Hours {
open: Date;
close: Date;
get isKnown() {
return this.open != null || this.close != null;
}
constructor(open: Date = null, close: Date = null) {
this.open = open;
this.close = close;
}
static fromObject(obj) {
if (!obj)
return new Hours();
return new Hours... |
19a421ef0d052c593b431579aa7b302f401a37ea | TypeScript | yugef3h/Novel-Map | /orm/article.ts | 2.53125 | 3 | import { Model, STRING, INTEGER, Sequelize, TEXT } from 'sequelize'
class ArtPage extends Model {
public id!: number
public title!: string
public desc!: string
public cover!: string
public tags!: string
public pid!: number
public content!: string
public state!: number
public ctime!: string
public m... |
ac939a759486b37e54a68bc371b4617c4ef0ad88 | TypeScript | cieloazul310/ol-vectortile | /src/styles/index.ts | 2.640625 | 3 | import Style from 'ol/style/Style';
import Stroke from 'ol/style/Stroke';
import Fill from 'ol/style/Fill';
import type { FeatureLike } from 'ol/Feature';
import roadStyle from './road';
import railwayStyle from './railway';
import labelStyle from './label';
export default function vtStyle(feature: FeatureLike, resol... |
6ba914d6e60161504d2bfaf552b7e57d86dedd33 | TypeScript | vihong/gented | /app/utils/array.ts | 2.828125 | 3 | export function findIndexOfWord(words: string[], wordToFind: string) {
return words.findIndex((option) => option === wordToFind)
}
|
43e086b8d45c404fe2003a4cf65d505f50c02c63 | TypeScript | babelcoder-dummy/set-007-socket | /ui/src/modules/chat/slice.ts | 2.671875 | 3 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import { AppThunk } from 'modules/reducers'
import * as ws from 'lib/web-socket'
export type ChatMessage = {
text: string
}
type ChatState = {
messages: ChatMessage[]
}
const initialState: ChatState = {
messages: []
}
const chatSlice = createSlic... |
5b67ed8bd5ffbe7f47109b7dd2ef150df705ae6b | TypeScript | eduardotrandafilov/typescript | /conceitos_basicos/propriedades_opcionais.ts | 2.921875 | 3 | function resumo(usuario:{nome:string,idade?:number}){
if(usuario.idade !== undefined){
return `Olá ${usuario.nome} , tudo bem ?! Você tem ${usuario.idade} anos`;
}else{
return `Olá ${usuario.nome} , tudo bem ?!`;
}
}
let u = {
nome:'eduardo',
};
console.log(resumo(u)); |
f3cc0a8f54ce30bb2766525e1448b77061d7f903 | TypeScript | goulash1971/typeconv | /lib/tests/ts-to-openapi.test.ts | 2.5625 | 3 | import { makeConverter, getTypeScriptReader, getOpenApiWriter } from "../"
describe( "ts-to-openapi", ( ) =>
{
it( "typescript to openapi", async ( ) =>
{
const input = `
type Thing = {
x: 6
y: string
}
export type Foo = {
a: string
b: null
c: number
d: boolean
e: Thing
}
... |
ee545392b9b1b91aca0975177d309ae586d9c1a3 | TypeScript | puphs/react-social-network | /src/redux/appReducer.ts | 2.953125 | 3 | import { ThunkType } from '../types/types';
import { getAuthUserData } from './authReducer';
import { InferActionsTypes } from './reduxStore';
const SET_INITIALIZED = 'app/SET_INITIALIZED';
const SHOW_ERROR = 'app/SHOW_ERROR';
const HIDE_ERROR = 'app/HIDE_ERROR';
const initialState = {
initialized: false as boolean,... |
a9d22cab79395874a680ae45a68aa8cd28ff60b2 | TypeScript | BuildForSDGCohort2/Team-60-BackEnd | /src/middleware/validator.ts | 2.53125 | 3 | import { check, body } from "express-validator";
import { isBoolean } from "util";
const validator: any = {};
validator.login = [
body("email")
.exists()
.withMessage("Email must be provided")
.isEmail()
.withMessage("Invalid email address.")
.trim()
.escape(),
body("password")
.exist... |
4ea8252f3311a1578addf447863c6a6c9fc8db92 | TypeScript | M0nsuta/rpgconsole | /src/personnages/Personnage.ts | 2.984375 | 3 | import { Arme } from './../armes/Arme';
export class Personnage {
_name: string;
_pv: number;
_pvMax: number
_arme: Arme
_cible?: Personnage
constructor(name: string = "", arme: Arme = new Arme()) {
this._name = name;
this._pv = Math.floor(Math.random() * 100 + 50);
thi... |
7afd7c7cf3338d0b9b97273f0c794aacbda6c5d0 | TypeScript | ChenAi29/pocket-aircraft | /major/assets/gamecommon/Script/GameCommon/SoundManager.ts | 2.703125 | 3 | import { UserData } from "./UserData";
const { ccclass, property } = cc._decorator;
@ccclass
export class SoundManager extends cc.Component {
protected static gameSoundMap: Map<string, cc.AudioClip> = new Map();
protected static readonly _dic: Map<cc.AudioClip, number> = new Map();
/**
* 播放音效 只播放一次
... |
088ec0f4ef1942a240fb74490b1c86d79671a11f | TypeScript | boldscot/angular6-weather-app | /src/app/left-panel/left-panel.component.ts | 2.625 | 3 | import { Component, OnInit, Input} from '@angular/core';
import { WeatherDataService } from '../weather-data.service';
import { Day } from '../day';
import { Hour } from '../hour';
@Component({
selector: 'app-left-panel',
templateUrl: './left-panel.component.html',
styleUrls: ['./left-panel.component.css']
})
e... |