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 |
|---|---|---|---|---|---|---|
a50260b604133f94a9018129adacba926844054d | TypeScript | JLL32/js-algorithms-data-structures | /src/data-structures/linked-lists/double-linked-list.ts | 4.0625 | 4 | class Node<T> {
constructor(
public value: T,
public next: Node<T> | null = null,
public previous: Node<T> | null = null) { }
}
class LinkedList<T> {
head: Node<T>;
tail: Node<T>;
length: number;
constructor(value: T) {
this.head = {
value: value,
next: null,
previous: null,
};
this.tail = t... |
f565c24e8e62ae6ad12bda9af019f2452c536e29 | TypeScript | Augani/hire-me | /src/utils/utils.ts | 2.5625 | 3 |
export async function Http(
request: RequestInfo,
options?: any
): Promise<any> {
const response = await fetch(request, options);
const body = await response.json();
return body;
}
interface ITokens {
accessToken: string;
groupId: string;
institutionId: string;
}
const Tokens: ITo... |
d576c1b2a1119979bb2a4618c5e013ca108310f6 | TypeScript | appliedblockchain/parser-combinators | /then.ts | 2.671875 | 3 | import type { Parser as P } from './types/parser.js'
export const then =
<A, B>(a: P<A>, f: (_: A) => P<B>): P<B> =>
input => {
const [ s, r ] = a(input)
return f(r)(s)
}
export default then
|
310f11ec2d4bdc7742eef8287307e2610c918fe9 | TypeScript | daxingyou/Mafia | /client20689/client514/PalaceWar/src/core/component/RewardFly.ts | 2.578125 | 3 | /**
* 奖励物品icon、文字飘动动画
* author dmj
* date 2017/9/27
* @class RewardFly
*/
class RewardFly extends BaseDisplayObjectContainer
{
private _tw:egret.Tween;
private _temScale:number = 0.6;
public constructor()
{
super();
}
public init(icon:string,message:string,itemtype:number=0):void
{
SoundManager.playE... |
6fca8b20614f52b8591200832a911869ed641224 | TypeScript | ivaylopivanov/wamp-server | /test/all/message.ts | 2.671875 | 3 | import { expect } from 'chai';
import { SocketMessageInterface } from '../../src/interfaces';
import Message from '../../src/message';
describe('Message', () => {
it('Should get parsed message', () => {
const ar: any[] = [
1,
'com.some.realm',
{},
];
const msg: string = JSON.stringify(... |
ba33dbb7306090615f96cceb9e0791b07042af0d | TypeScript | HajoAhoMantila/io-ts-builder | /tests/IoTsBuilder.test.ts | 3.09375 | 3 | import * as t from 'io-ts'
import { IoTsBuilder } from '../src'
const Order = t.type({
description: t.string,
id: t.number
})
type IOrder = t.TypeOf<typeof Order>
describe('io-ts-builder', () => {
it('should build a valid object', () => {
const order: IOrder = IoTsBuilder(Order)
.id(4)
.descrip... |
ef9c294542b66ac3d31571502bbd9ed72a02749f | TypeScript | NGromann/Preproc | /src/lib/ExpressionParser.ts | 3.0625 | 3 | import { Expression, ExpressionType } from './Expression';
const openingExpr = /\{\{/g;
const closingExpr = /\}\}/g;
const quoteExpr = /(?<!\\)\"/g;
const expressionFilterTypeMap: { [regex: string]: number } = {
"^\\s*else if ([\\s\\S]*)\\s*$" : ExpressionType.ElseCondition, // [\\s\\S] workaround for missing dot... |
758a2731dffb20aac6672569ef4f6a8d644afcb1 | TypeScript | Spiffo/frontend-1 | /src/tools/filter-repositories-by-input.ts | 2.640625 | 3 | import { Repository } from "../data/common";
export function filterRepositoriesByInput(
repositories: Repository[],
filter: string
): Repository[] {
const _lowcaseFilter = stringify(filter);
return repositories.filter(
(_repo) =>
stringify(_repo.name)?.includes(_lowcaseFilter) ||
stringify(_rep... |
41a67c0e12769404af4587a31644a95638ba8b69 | TypeScript | djr-taureau/angular8-ngrx-monorepo | /libs/shared/src/lib/models/state/utilities.ts | 3 | 3 | import { Observable, combineLatest } from 'rxjs';
import { map as rxMap } from 'rxjs/operators'
import { assoc, assocPath, pipe, values } from 'ramda';
import { LoadDataStatus, DataState } from './entity-state';
import { indexByProp } from '../../utility/object';
/**
* Helper method to set the status in State;
*/
co... |
0607b65c34a3ede305f78188e1c5931853acc610 | TypeScript | hanFengSan/eHunter | /src/platform/eh/parser/IntroHtmlParser.ts | 2.71875 | 3 | import { ImgPageInfo } from '../../../../core/bean/ImgPageInfo'
import { ThumbInfo, ThumbMode } from '../../../../core/bean/ThumbInfo'
// a parser for album's intro page
export class IntroHtmlParser {
private html: HTMLElement;
private reqUrl: string;
constructor(html, reqUrl) {
this.html = docume... |
b35f2207bc468e8b18a54bfb5c6436356756bd0f | TypeScript | shamirshahul/user-interfaces | /libs/organisation/src/lib/desk.class.ts | 2.734375 | 3 |
export class Desk {
/** ID of the desk also map_id */
public readonly id: string;
/** Name of the desk */
public readonly name: string;
/** Whether desk is available / bookable */
public readonly bookable: boolean;
/** Zone/Level of the desk */
public readonly zone: any;
/** Group/D... |
159f209bc6515b6703641f994df53d36eb401e06 | TypeScript | MehdiSaeedifar/ag-grid | /charts-packages/ag-charts-community/src/chart/markerLabel.ts | 2.5625 | 3 | import { Group } from "../scene/group";
import { Text, FontStyle, FontWeight } from "../scene/shape/text";
import { Square } from "./marker/square";
import { Marker } from "./marker/marker";
import { HdpiCanvas } from "../canvas/hdpiCanvas";
export class MarkerLabel extends Group {
static className = 'MarkerLabel... |
fa2be950bb998c99d3e7757c1ec4a5903b3ff43f | TypeScript | wswebcreation/webdriver-image-comparison | /lib/clientSideScripts/getElementPositionTopScreenNativeMobile.ts | 3 | 3 | import { ElementPosition } from './elementPosition.interfaces';
/**
* Get the element position to the top of the screen of the device, not the top of the webview
* This method is used for Android native and iOS screenshots
*/
export function getElementPositionTopScreenNativeMobile(
element: HTMLElement,
{
i... |
1bc1561fd2cff4a26c17ce63b803e343c09b9223 | TypeScript | EdgarGGamartgo/js-nodejs-concepts | /src/services/Recursiveness/company.ts | 3.0625 | 3 | export const myCompany = {
sales: [{ name: "Allie", salary: 1000 }, { name: "Allie", salary: 1000 }],
development: {
sites: [{ name: "Jeff", salary: 1000 }, { name: "Mike", salary: 1000 }],
marketing: [{ name: "Sophie", salary: 1000 }, { name: "Edgar", salary: 1000 }],
maintanance: {
legacy: [{ na... |
de74babc28a75f26496525eb117cd75bbd6ffed1 | TypeScript | TrySpace/babylonjs-typescript-webpack-starter | /src/shark.ts | 2.703125 | 3 | import { AbstractMesh, WaterMaterial } from "babylonjs";
import { SceneInstance } from './SceneInstance';
import { BehaviorSubject } from 'rxjs';
import { SharkMesh } from "./Meshes";
export class Shark {
private _sharkMesh: AbstractMesh;
private _waterMaterial: WaterMaterial;
public swimming: BehaviorSubject<... |
ab0403c38fda9cbe70a207e1a864b03e5a71585f | TypeScript | VEuPathDB/WDKClient | /Client/src/StoreModules/UserPasswordChangeStoreModule.ts | 2.78125 | 3 | import { Action } from 'wdk-client/Actions';
import {
PASSWORD_FORM_UPDATE,
PASSWORD_FORM_SUBMISSION_STATUS
} from 'wdk-client/Actions/UserActions';
export const key = 'passwordChange';
export type State = {
formStatus: 'new' | 'modified' | 'pending' | 'success' | 'error';
errorMessage?: string;
passwordFor... |
1e5c8ac3ac06c0d0ddd4c06c347b8ea860de33a3 | TypeScript | nkohari/nate.io | /src/util/search.ts | 2.921875 | 3 | import escapeStringForRegexp from 'escape-string-regexp';
import {Article} from '@nkohari/apocrypha';
import {Metadata} from 'src/types';
export const search = (
articles: Article<Metadata>[],
query: string | null,
): Article<Metadata>[] => {
const isMatch = (article: Article<Metadata>) => {
// Never match p... |
06a7b580ce46df5da41a97cc02ff9064de4bbd4a | TypeScript | david-driscoll/IxJS | /src/add/iterable-operators/buffer.ts | 2.71875 | 3 | import { Iterable } from '../../iterable';
import { buffer } from '../../iterable/buffer';
Iterable.prototype.buffer = function<T>(count: number, skip?: number): Iterable<T[]> {
return buffer<T>(this, count, skip);
};
declare module '../../Iterable' {
interface Iterable<T> {
buffer(count: number, skip?: numbe... |
086987f4fa36b4378b0d6ad2429a953b30f2c20e | TypeScript | kcvgan/acmevalue | /src/domain/contracts/hooks/useGetContract.ts | 2.625 | 3 | import { useEffect, useState } from 'react';
import { Contract } from '../types/Contract';
import contractsService from '../api/contractsService';
export const useGetContract = (initialId?: string) => {
const [contract, setContract] = useState<Contract | undefined>();
const fetchContract = async (id: string) => ... |
5ff0201ebe5ab73dd3aac6a266bcc1c2d98ad2d3 | TypeScript | frantoribio/Programacion-02-Ejercicios-2021-2022 | /typescript/src/mod/mod-05-09-MSPinzon.ts | 3.1875 | 3 | export default {numeroCifras};
/**
* Función que calcula el número de cifras de un número.
* @param numero El número del que hay que hallar el número de cifras.
* @returns El número de cifras que tiene.
*/
function numeroCifras (numero : number) : number{
let contadorCifras : number = 0;
while(Math.fl... |
fdb7546bf64de9ff6fba343de0395e3937207e6b | TypeScript | Spinnafre/EstudoTypescript | /src/types_annotation/Object.ts | 3.265625 | 3 | const objectA : { readonly name:string,age:number,sex?:string,[key:string]:unknown}={
name:'Davi',
age:19
}
console.log(objectA)
type MyType={
id:number,
name:string,
age:number
}
const peoples:MyType[]=[{id:0,name:"Davi Silva da Penha",age:19},{id:1,name:"Mr X",age:9}]
|
b443504098e4086cc9a609b3c939a55150393f39 | TypeScript | paulstanyer/propertydemo | /client/src/core/paginationViewModel.ts | 2.71875 | 3 | import { makeObservable, observable } from "mobx";
export interface IPaginationViewModel<TResultItem> {
page: number;
itemsPerPage: number;
totalResults: number;
withPagination(results: TResultItem[]): TResultItem[];
}
export abstract class AbstractPaginationViewModel {
@observable page: number;
@observa... |
5c44b235196e68aeac5a6b822b955e8b15348642 | TypeScript | Meduzjam/portal.atm-servis.ru | /static/ng2/src/plan/components/department/detail.ts | 2.65625 | 3 | import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Department } from '../../models';
export type DepartmentInput = Department;
export type SelectOutput = Department;
export type DeleteOutput = Department;
@Component({
selector: 'department-detail',
styles: [`
.selected {
b... |
f0a8042733ef4b81c3ed38a700a7ea569fd4b830 | TypeScript | episodehunter/show-update | /src/red-keep/gql.ts | 2.53125 | 3 | export function gql(strings, ...keys): string {
const lastIndex = strings.length - 1;
return strings.slice(0, lastIndex).reduce((p, s, i) => p + s + keys[i], '') + strings[lastIndex];
}
|
fc94382671f52c5eaa5441bbe5f9c15a25afbb32 | TypeScript | anasjaber/Angular-QueryBuilder | /projects/angular2-query-builder/src/lib/query-builder/query-builder-expression.pipe.ts | 2.828125 | 3 | import {Pipe, PipeTransform, Query} from '@angular/core';
import {QueryBuilderConfig} from "./query-builder.interfaces";
@Pipe({name: 'expressionFormat', pure: false})
export class QueryBuilderExpressionPipe implements PipeTransform {
transform(query: Query, queryConfig: QueryBuilderConfig): string {
return ... |
f85634f81de1f7a4bd23967ff3b0e416bcc8b955 | TypeScript | Litvinov1618/place-me | /src/modules/calculateDefaultPaidDays.ts | 2.96875 | 3 | import CustomDateRange from '../interfaces/CustomDateRange'
import FiniteDateRange from '../interfaces/FiniteDateRange'
const calculateDefaultPaidDays = (dateRange: CustomDateRange) => {
if (dateRange?.endDate) {
return dateRange as FiniteDateRange
}
const date = dateRange.startDate
const lastDayOfMonth =... |
2915495fe54662208265fe655553f8dd766f5c9e | TypeScript | atahanyorganci/jukebox | /src/commands/resume.ts | 2.78125 | 3 | import { Command, CommandContext } from "~/commands/index.js";
import JukeBox from "~/music/jukebox.js";
export class ResumeCommand extends Command {
constructor() {
super({
name: "resume",
description: "Resumes the current song.",
});
}
async run({ message, member,... |
8eed3c6596b0994d28046e366c690c4b485c1cd7 | TypeScript | lnatus/larsnatus.fit | /src/scripts/app/model/training-result.ts | 2.671875 | 3 | namespace LNF {
export namespace Model {
export class TrainingResult {
public restDays: number
public trainDays: number
public doCardio: boolean
public time: number
public isBusy() : boolean {
return (7 - this.restDays > this.time)
}
constructor(restDays: number... |
b7764833f9442a71b5b1a64a99b33eaa3ad6ed2a | TypeScript | JLRiiot/carrete | /src/Util/index.ts | 3 | 3 | const addItemToArray = <T>(item: T, original: T[]): T[] => {
let newArray = original.slice();
newArray.splice(newArray.length - 1, 0, item);
return newArray;
};
const removeItemFromArray = <T>(
item: T,
originalArray: T[],
matchFunction: (value: T, index?: number, array?: T[]) => boolean
): T[] => {
retu... |
f9c3f043d73a21a346c72f943b5317bad2130d13 | TypeScript | ShellWolf/Typescript-Learn-Practice | /src/advanceType/index.ts | 3.984375 | 4 |
// 利用 strictNullChecks: true 监控返回值为undefined时,报错提示
interface Square {
kind: "square", // 这个就是具有辨识性的属性
size: number,
}
interface Rectangle {
kind: "rectangle",
height: number,
width: number,
}
interface Circle {
kind: "circle",
radius: number,
}
interface Triangle {
kind: "triangle",
bottom: number... |
5657ed0e8ab2ccf33876176ed7d9942df78bdbf1 | TypeScript | joeelliott/dotproduct | /ts/model/projectile/Projectile.ts | 3.140625 | 3 | import Entity from 'model/Entity';
import Player from 'model/player/Player';
import Listener from 'Listener';
import Repel from 'model/projectile/Repel';
import Simulation from 'model/Simulation';
abstract class Projectile extends Entity {
protected owner_ : Player;
private level_ : number;
protected lifetime_ :... |
b04615baa47bf71dd1b61616dea53a5678755810 | TypeScript | bitblit/Epsilon | /src/config/inter-api/inter-api-process-mapping.ts | 2.5625 | 3 | /**
* When an event matching the source and type is received, the listed background types will be
* enqueued with the data from the inter-api block being treated as the data block of the background
* task
*/
export interface InterApiProcessMapping {
sourceRegex: string;
typeRegex: string;
disabled: boolean;
... |
a98a9aea6b7b26941d8b90b6314897a961434b85 | TypeScript | AnimeshTimsina/animeshtimsina.github.io | /src/database/services.data.ts | 2.609375 | 3 | import { ReactComponent as DjangoLogo } from "images/Django.svg"
import { ReactComponent as EthereumLogo } from "images/Ethereum.svg"
import { ReactComponent as GraphQLLogo } from "images/GraphQL.svg"
import { ReactComponent as ReactLogo } from "images/React.svg"
import { ReactComponent as FlutterLogo } from "images/fl... |
d3510449435ff16d8c6ca2b9cda0727ecd57445f | TypeScript | fromfeizhou/egretPro | /game/src/app/com_main/src/proxy/TankProxy.ts | 2.625 | 3 | // class TankProxy extends BaseProxy {
// public static tag_resp_open_info_view = false;
// /**购买请求ID */
// public static temp_request_buy: number;
// /**使用请求ID */
// public static temp_request_use: number;
// /**强化请求类型 */
// public static temp_request_strengthen: number;
// public constructor() {
// super... |
11c924d23ef495eee036611bb8e9f910d8e985e3 | TypeScript | cunningt/teiid-komodo | /ui/beetle-lib/src/connections/shared/schema-node.model.spec.ts | 2.625 | 3 | import { SchemaNode } from "./schema-node.model";
describe("SchemaNode", () => {
let schemaNode: SchemaNode;
beforeEach(() => {
schemaNode = null;
});
it("should create, root only", () => {
console.log("========== [SchemaNode] should create, root only");
schemaNode = SchemaNode.create(
{
... |
69ae65c1fa0d4fa68d739bec0302eac1d5e95c4b | TypeScript | DefinitelyTyped/DefinitelyTyped | /types/uint48be/index.d.ts | 3.328125 | 3 | // Type definitions for uint48be 2.0
// Project: https://github.com/mafintosh/uint48be
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/**
* Encode a number as a big endian 48 bit unsigned integer.
... |
fabe19e153177361fd7437faef85a4a945cdf588 | TypeScript | brunoparga/cicero | /src/store/sliceReducers/pageReducer.test.ts | 2.921875 | 3 | import { PageState } from "../../types";
import { pageReducer } from "./pageReducer";
const basePage = {
status: "frontPage",
currentWordIndex: 4,
resultsSaved: false,
guess: { wrongGuess: false, rightGuess: true },
passiveSelected: false,
pluralSelected: false,
revealAnswer: false,
} as PageState;
it(... |
88e3b2b846d167beccd794c48378fc2fe0f63373 | TypeScript | jcowman2/react-ensemble | /packages/react-ensemble/src/utils/TrackUtils/helpers.ts | 3.03125 | 3 | export const clampString = (str: string, len = 30) => {
if (str.length <= len) {
return str;
}
return str.substr(0, len - 3) + "...";
};
export const newId = (kind: string): string => {
const str = Math.random().toString(36);
return `${kind}_${str.substr(2, 8)}`;
};
export const isFunction = (f: unknown... |
07cf5d5651b084cf82e5d74b0fd29acc16007039 | TypeScript | kahummer/opensrp-web | /clients/core/src/store/ducks/locations.ts | 3.046875 | 3 | import { AnyAction, Store } from 'redux';
import SeamlessImmutable from 'seamless-immutable';
/** The reducer name */
export const reducerName = 'locations';
/** Inteface for Location */
export interface Location {
id: string;
label: string;
parent?: string;
node: {
locationId: string;
... |
9f865e1b0b04963bf30fd3b1e8db28b0987be5b4 | TypeScript | Zcating/power-ui | /components/cdk/accordion/accordion-dispatcher.ts | 2.515625 | 3 | import { inject, InjectionKey, onUnmounted, provide, watch } from 'vue';
import { AccordionItemState as AccordionItemState } from './types';
/**
* @description
*
* @date 2020-09-24
* @export
* @class SelectionDispatcher
*/
export class CdkAccordionDispatcher {
static key = Symbol() as InjectionKey<CdkAccor... |
7dddb333b73708dfdc187c0c8f7eb6d9bc81cbc7 | TypeScript | fanneiOZ/sertis-fs-exercise | /packages/back-end/src/cores/mini-blog/repositories/card.repository.ts | 2.515625 | 3 | import {injectable} from "tsyringe";
import {MongoDbAdaptor} from "../../../libs/database/nosql/mongo-db-adaptor";
import {DocumentRepository} from "../../../libs/domain-driven/document-repository";
import {Identifier, Writable} from "../../../libs/domain-driven/interfaces/repository.interface";
import {Card} from "../... |
832cac560378f955cefd1b4fd1aab43724054201 | TypeScript | MikeKoval/genetic-algo2 | /src/generation.ts | 3.0625 | 3 | import { Chromosome } from './chromosome';
import { random } from './random';
export class Generation {
constructor(public chromosomes: Chromosome[], private offSpringPercent: number) {
}
public get averageFitness() {
let sum = 0;
this.chromosomes.forEach(c => sum += c.z);
return... |
03c9f6f766378b9a85178dd3825f9fe7bfa59e78 | TypeScript | tony-lang/cli | /.yalc/tony-lang/src/code_generation/services/ResolvePattern.ts | 2.984375 | 3 | import {
TRANSFORM_IDENTIFIER_PATTERN,
TRANSFORM_REST_PATTERN,
} from '../../constants'
import { INTERNAL_TEMP_TOKEN } from '../GenerateCode'
export class ResolvePattern {
static perform = (pattern: string): [string, string[]] => {
const obj = ResolvePattern.parsePattern(pattern)
return ResolvePattern.... |
41ef17f97e785f3e5b4f30b21f7d3901ca48852f | TypeScript | juliushekkala/ohjelmistoprojekti | /src/readapi.ts | 2.859375 | 3 | import * as datavalid from "./datavalid";
const yaml = require('js-yaml');
const fs = require('fs');
const validUrl = require('valid-url');
//This file is imported to the main plugin file
//Includes functions that check security features of a OPENAPI-file
export class Apicheck {
yaml: any;
constructor(doc... |
8f892a7f4dc2662252a060acc8adc0d64c566def | TypeScript | khellytaguinod/IONIC-Project-Team-iACADEMY | /marathon-app/src/services/auth.ts | 2.703125 | 3 | import firebase from 'firebase';
export class AuthService {
public username: string;
public email: string;
public photoURL: string;
// public id: string;
signup(email: string, password: string, name: string) {
return firebase.auth().createUserWithEmailAndPassword(email, password).then((user) => {
... |
91e4f66bba2d2175b2be29f22a5b53b32361a09c | TypeScript | exercism/typescript | /exercises/practice/rectangles/.meta/proof.ci.ts | 3.109375 | 3 | export function count(diagram: string[]): number {
const rows = diagram.length
const cols = rows ? diagram[0].length : 0
let rectangles = 0
// All possible topleft corners
for (let y = 0; y < rows - 1; y++) {
for (let x = 0; x < cols - 1; x++) {
if (diagram[y].charAt(x) === '+') {
// All p... |
f101d1df9e7d6a382a7102e38cbf81df0bef0f42 | TypeScript | microsoft/fluentui | /packages/react-components/react-avatar/src/components/AvatarGroupPopover/AvatarGroupPopover.types.ts | 2.6875 | 3 | import * as React from 'react';
import type { AvatarSize } from '../Avatar/Avatar.types';
import type { AvatarGroupProps } from '../AvatarGroup/AvatarGroup.types';
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
import type { PopoverProps, PopoverSurface } from '@fluentui/react-po... |
7085b01a77d018b8a12bd5256e99495ac504f193 | TypeScript | FlorianGlt/koala-test | /src/Utils/Interfaces.ts | 2.515625 | 3 | export interface Contract {
id: string;
type: "flight";
flight: {
from: {
name: string;
iata: string;
};
to: {
name: string;
iata: string;
};
number: string;
start: string;
nbOfTravellers: number;
};
}
export interface DetailedContract extends Contract {
pr... |
012bb3e3cddec3bf8500f708ec1d9d96d58f1ada | TypeScript | jaccomeijer/wheelroom | /packages/admin-theme-switcher/src/lib/theme-switcher-reducer.ts | 2.828125 | 3 | import { ActionTypes, ThemeSwitcherState } from './types'
export const themeSwitcherReducer = (
state: ThemeSwitcherState,
action: ActionTypes
): ThemeSwitcherState => {
switch (action.type) {
case 'SET_ACTIVE_THEME':
return {
...state,
lastThemeId: undefined,
activeThemeId: act... |
b4c1522d6596a9819768304a156e880eb0a5d645 | TypeScript | SimonLoir/SMath | /src/drawer_obj.ts | 2.640625 | 3 | import { $ } from './extjs';
export default class Menu {
constructor() {}
public fdata: any;
public update(fdata: any, object_list: any) {
let container = $('#functions');
container.html('');
let keys = Object.keys(fdata);
keys.forEach(key => {
let item = conta... |
79b39cffcfb2ab04e643cd22923ffb575b754f8f | TypeScript | xDveGax/exo-frontend | /src/app/core/store/user/user.reducer.ts | 2.765625 | 3 | import { AppState } from '@core/store/reducers';
import { UserModel } from '@core/models/user/user.model';
import * as fromActions from './user.action';
export const reducers = {
user: reducer
};
export interface UserState {
user: UserModel;
loggedIntercom: boolean;
}
const initialState: UserState = {
user: ... |
de90319a77fe985e95af20214f359ca75347e094 | TypeScript | CodeChain-io/codechain-keystore-cli | /src/command/delete.ts | 2.53125 | 3 | import { prompt } from "enquirer";
import { CLIError, CLIErrorType } from "../error";
import { Context } from "../types";
import { findMatchingKey } from "../util";
export async function deleteKey(
{ cckey, accountType, networkId }: Context,
address: string
): Promise<void> {
const keys = await cckey[acco... |
2953407f27271db43db10f9fb5459454256f0bac | TypeScript | Bakuenjin/rpg-content-management | /src/managers/ArmorManager.ts | 2.625 | 3 | import { Armor, Attribute } from "@bakuenjin/rpg-core";
import { RawArmor } from "../utils/types";
import ContentManager from "./ContentManager";
export default class ArmorManager extends ContentManager<Armor> {
constructor(attributeManager: ContentManager<Attribute>, armors: RawArmor[]) {
super()
armors.forEach... |
47d5a33a00794d44767023a0ef6439af910016dd | TypeScript | notaphplover/ant-js | /src/api/config/api-query-config.ts | 2.78125 | 3 | import { QueryResult, TMQuery, TQuery } from '../../persistence/primary/query/query-types';
import { Entity } from '../../model/entity';
export interface ApiQueryConfig<TEntity extends Entity, TQueryResult extends QueryResult> {
/**
* True if the query returns an array of results instead of a single result.
*/... |
30139767a32da7b08470b9f46681c0d0aa1beeff | TypeScript | justincohan/angular-chess | /src/app/bishop.ts | 3.046875 | 3 | import { Piece } from './piece';
import { Move } from './move';
export class Bishop extends Piece {
type = 'Bishop';
possibleMoves: Move[] = [
new Move([1, 1], this.canMove, this.applyMove, []),
new Move([2, 2], this.canMove, this.applyMove, [[1, 1]]),
new Move([3, 3], this.canMove, thi... |
284b26e124bcd97a04ff9b93fe580cfe0284cc47 | TypeScript | sdlcldw/oa | /src/app/valldators/valldators.ts | 2.875 | 3 | import { FormControl } from "@angular/forms";
//日期格式Sat Jan 13 2018 12:18:48 GMT+0800
export function dateValidator(date:FormControl):any{
let value = (date.value || '')+'';
var myreg = /^([a-zA-Z]{3})\s([a-zA-Z]{3})\s(\d{2})\s(\d{4}).*/;
let valid = myreg.test(value);
return valid ? null : {date:true}... |
d131855cb5231de7d6e6193a30c99b5168020624 | TypeScript | hubert-associates/speckle-server | /packages/ui-components/src/helpers/layout/components.ts | 2.5625 | 3 | export enum GridListToggleValue {
Grid = 'grid',
List = 'list'
}
export type LayoutTabItem<I extends string = string> = {
title: string
id: I
}
export type LayoutMenuItem<I extends string = string> = {
title: string
id: I
disabled?: boolean
}
|
aac69573cc5b10f4284b8658072353442be09e71 | TypeScript | nicolebarleta/web-425 | /week-3/enhanced-secure-profile-app/src/app/sign-in.guard.ts | 2.515625 | 3 | /**
* Title: sign-in.guard.ts
* Author: Professor Krasso
* Date: 18 January 2021
* Modified by: Marie Nicole Barleta
* Description: CanActive function is used in this file
* This is guarding the app from unauthorized users,
* further authorization will be made at WEB 450 course
*/
import { Injectable } from '@... |
1062f429d461962f0fdf03e215e7867e8ae228a5 | TypeScript | devlev1980/100-Algorithm-s-Challenge | /Lesson-16/arrayMaximalAdjacentDifference.ts | 3.25 | 3 | function arrayMaximalAdjacentDifference(inputArray:number[]):number {
let maxDiffrence = Math.abs(inputArray[0]-inputArray[1]);
console.log(maxDiffrence)
for (let i = 0; i < inputArray.length; i++) {
let absoluteDiff = Math.abs(inputArray[i-1] - inputArray[i])
console.log(inputArray[i-1]);
console.log... |
25a5ab8d60ed15d3902fa2b51680aa94972d8e82 | TypeScript | shanehofstetter/rails-i18n-vscode | /src/keyDetector.ts | 3 | 3 | import { Position, Range, TextDocument } from 'vscode';
import { logger } from './logger';
/**
* Provides functions to detect and transform i18n keys
*/
export class KeyDetector {
/**
* check if i18n key is valid
* @param key i18n to validate
*/
public static isValidI18nKey(key: string): bool... |
4480016f2e17c2ae471ba8e596a5dbada1eed685 | TypeScript | dzibler/types-ol-ext | /@types/ol-ext/util/input/List.d.ts | 2.84375 | 3 | import Base from "./Base";
export interface Options {
className?: string;
options?: any[];
input?: Element;
parent?: Element;
fixed?: boolean;
align?: 'left' | 'right' | 'middle';
}
/** Checkbox input
* @constructor
* @extends {ol_ext_input_Base}
* @param {*} options
* @param {string} [opt... |
f3b51ab87c40671e099616a0225fc78c18f7efd2 | TypeScript | raini-dev/pipes | /src/helpers.ts | 3.15625 | 3 | export type TUnwrap<X> = X extends Promise<infer U> ? U : X
export function extend<T, K>(f: (x: T) => K) {
return function extendTo(x: T): T & K {
return Array.isArray(x)
? (([...x, ...((f(x) as unknown) as any[])] as unknown) as T & K)
: ({ ...x, ...f(x) } as T & K)
}
}
export function tap<T, K>(... |
7bd7ea6e054b4c55c0c96a69fc422aad860f1fd7 | TypeScript | Sarariach/Student-evaluation | /server/src/batches/controller.ts | 2.71875 | 3 | import { JsonController, Get, Param, HttpCode, Body, Post, Authorized, NotFoundError } from 'routing-controllers'
import Batch from './entity'
@JsonController()
export default class BatchController {
// requests all users
@Get('/batches')
async allBatches(){
const batches = await Batch.find()
if (!batche... |
e4ed246f838efc49073158f0e00ed72a6009ac15 | TypeScript | enzg/webgpu-computing-jpeg | /src/index.ts | 2.65625 | 3 | import { decode, encode, RawImageData, BufferLike } from 'jpeg-js'
import * as buffer from 'buffer';
(window as any).Buffer = buffer.Buffer;
document.getElementById('fileinput').onchange = imageSelected;
function imageSelected (event: Event) {
const files = this.files;
if (!files || files.length < 1) {
... |
1457cdf6c7e4ff3a1325e3dd8e0fc1ba7f2412bd | TypeScript | TGlas/tscript | /src/lang/parser/parse_lhs.ts | 2.6875 | 3 | import { ErrorHelper } from "../errors/ErrorHelper";
import { binary_operator_impl } from "./parser_helper";
import { TScript } from "..";
import { simtrue } from "../helpers/sims";
import { Typeid } from "../helpers/typeIds";
import { parse_expression } from "./parse_expression";
export function parse_lhs(state, pare... |
00c9c51d7b706db61a9b271348d6a630688715f7 | TypeScript | tktsai/note_searcher | /vscode/e2e/utils/wait.ts | 2.796875 | 3 | export const waitFor = (check: () => boolean, timeoutMs = 1000, failMessage = 'timed out') => {
return new Promise((resolve, reject) => {
let start = Date.now();
const doCheck = () => {
if (Date.now() - start > timeoutMs) {
reject(failMessage);
}
if (!check()) {
setTimeout(... |
26678d4b599b771ffdb8c17a3efd2250d73a535a | TypeScript | christopherstock/babylon-zero | /src/typescript/de/mayflower/bz/util/String.ts | 3.328125 | 3 |
/** The Moment.js library import. */
const moment:any = require('moment');
/** ****************************************************************************************************************
* Offers extended string functionality.
****************************************************************... |
899a0b072a98659cb08d8a13a5e73fe41216a140 | TypeScript | qathom/asad-lab1 | /backend/src/app/Player.ts | 3.03125 | 3 | export class Player {
// Private id
// Private bank ?
id: string
password: string
bank: number
currentAmountBetted: number
constructor(id: string, password: string, bank: number) {
this.id = id
this.password = password
this.bank = bank
this.currentAmountBetted = 0
}
canBet(amount: nu... |
2a71a7810f9eeedf3293c07542df3955f3713c9e | TypeScript | reduxjs/redux-toolkit | /packages/toolkit/src/getDefaultMiddleware.ts | 2.78125 | 3 | import type { Middleware, AnyAction } from 'redux'
import type { ThunkMiddleware } from 'redux-thunk'
import thunkMiddleware from 'redux-thunk'
import type { ActionCreatorInvariantMiddlewareOptions } from './actionCreatorInvariantMiddleware'
import { createActionCreatorInvariantMiddleware } from './actionCreatorInvaria... |
e88ae66eed62fec8d3c8dbfbbb078cdddea21616 | TypeScript | blackbaud/skyux | /libs/components/theme/src/lib/theming/theme.ts | 3.015625 | 3 | import { SkyThemeMode } from './theme-mode';
import { SkyThemeSpacing } from './theme-spacing';
/**
* Defines properties of a SKY UX theme.
*/
export class SkyTheme {
/**
* The preset themes available in SKY UX.
*/
public static readonly presets = {
default: new SkyTheme(
'default',
'sky-th... |
5854c3d9375ecf26454f203c8e4f00f84b0bc550 | TypeScript | rodskin/frogtown2020 | /src/integration_tests/assertions.test.ts | 2.609375 | 3 | // eslint-disable-next-line node/no-unpublished-import
import puppeteer from "puppeteer";
import Assert from "./assertions";
let browser: puppeteer.Browser | null = null;
const pageGetter = (async () => {
browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setContent(`
<html>... |
c86b7e5a69bd432fa52c90298f50a62246d2fe58 | TypeScript | Rian8337/Alice | /src/localization/interactions/commands/Bot Creators/unbind/translations/UnbindESTranslation.ts | 2.671875 | 3 | import { Translation } from "@alice-localization/base/Translation";
import { UnbindStrings } from "../UnbindLocalization";
/**
* The Spanish translation for the `unbind` command.
*/
export class UnbindESTranslation extends Translation<UnbindStrings> {
override readonly translations: UnbindStrings = {
inv... |
797d63b8bc895b1357ea68097e6c09f5f347b5fb | TypeScript | eddie-englund/CourseBot | /src/bot/commands/moderation/case.ts | 2.828125 | 3 | import { Command } from 'discord-akairo';
import { CourseClient } from '../../client/CourseClient';
import { Message } from 'discord.js';
export default class CaseEdit extends Command {
public client: CourseClient;
public constructor() {
super('case-edit', {
aliases: ['case', 'editcase'],
userPerm... |
1a96f920550509004f0cffa6cb82577d775bd456 | TypeScript | GabrielDertoni/notes | /src/entities/Image.ts | 2.53125 | 3 | import IBlock from "./Block";
export default class Image implements IBlock {
public readonly type = "image";
constructor(protected src?: string) {}
get data() {
return {}
}
} |
dd5a6dad96f6191073096548a7a5f470bb39d349 | TypeScript | waaaave/lsl_fullstack | /typescript/src/user.ts | 3.140625 | 3 | // 不严格
type User = {
name:string;
age:number;
occupation:string;
}
const users:User[] = [
{
name:"wave",
age:17,
occupation:"Chimney sweep"
},
{
name:"刘印",
age:18,
occupation:"Astronaut"
}
]
users.map(user =>`
<li>
$... |
cf0ef3376b3ecfafa24018a7794992a1db9591da | TypeScript | green-fox-academy/Hpeter1988 | /week-04/day-3/comperator/domino.ts | 4.125 | 4 | "use strict";
interface Comparable {
compareTo(other: Comparable): number;
/*
* returns negative number if this is smaller than other
* returns 0 if they are the same
* returns positive number if this is greater than other
*/
}
class Domino implements Comparable {
values: number[];
constructor(val... |
5e9e0fc4c5ad07a70a94c607a29a7caf6b313a70 | TypeScript | kcsry/infotv | /infotv/frontend/src/DatumManager.ts | 3.171875 | 3 | export interface Datum<T = any> {
value: T;
mtime: number;
virtual?: boolean;
}
const datums: Record<string, Datum> = {};
export class DatumManager {
public update(data: Record<string, Datum>) {
Object.assign(datums, data);
}
public setValue<T = any>(key: string, value: T): Datum<T> {... |
98055176102ec02f0d19ac8e494fc85f37ebc14a | TypeScript | DSpace/dspace-angular | /src/app/core/shared/hal-resource.model.ts | 2.703125 | 3 | import { HALLink } from './hal-link.model';
import { deserialize } from 'cerialize';
/**
* Represents HAL resources.
*
* A HAL resource has a _links section with at least a self link.
*/
export class HALResource {
/**
* The {@link HALLink}s for this {@link HALResource}
*/
@deserialize
_links: {
/... |
4feb7def15a5d3b7fbae280d22fd53fdce278ccb | TypeScript | linz/GNSS-Site-Manager | /src/client/app/shared/service-worker/service-worker.service.ts | 2.765625 | 3 | import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { MessageObject } from './messages.interface';
/**
* This class provides the service for the application's service worker that is global to the browser.
*/
@Injectable()
export class ServiceWorkerService {
//... |
c2566e3c2315191f45df8d54a417e3a33596b5a5 | TypeScript | WisdomSpirit/typescript-task-1 | /src/views/common-view.ts | 3.125 | 3 | import { IObservable } from '../utils/observable/types';
import { NewsState } from '../state/news';
import { WeatherState } from '../state/weather';
import { IArticle } from '../state/news/types';
import { IMeasurement } from '../state/weather/types';
export class CommonView {
private readonly weatherCount: number... |
f654ed7d81b31c2a292a05bfce24db71d0093dfe | TypeScript | filipeferreira-dev/neo-tinder-app | /src/pages/home-catalog/crush.model.ts | 2.53125 | 3 | export class Crush {
constructor(
public name: string,
public age: number,
public percent: number,
public description: string,
public image: string
) {
}
} |
fb953c6f78c7b030eeac5751df65f7e5b917803d | TypeScript | tpandseed/get-hitched | /_site/index.ts | 2.734375 | 3 | import { User } from "netlify-identity-widget";
const zeroDay = new Date('2020-09-15T16:20:00');
function userEvent(userObj: User | null) {
window.dispatchEvent(new CustomEvent('user-login', { detail: userObj }));
}
declare var netlifyIdentity: { on: (event: string, user: { (u: User): void; }) => void; };
netli... |
f1fa693f5e1cc75a12e5e8c0d9f5841e09a528bc | TypeScript | veranoo/simple-unsplash-app | /src/reducers/section-reducer.ts | 2.75 | 3 | export const SET_ERROR = 'SET_ERROR';
export const SET_PHOTOS = 'SET_PHOTOS';
export const SET_LOAD_MORE = 'SET_LOAD_MORE';
export const SET_NOT_LOAD_MORE = 'SET_NOT_LOAD_MORE';
export const SET_LOAD_MORE_ERROR = 'SET_LOAD_MORE_ERROR';
export const sectionReducer = (state, action) => {
switch (action.type) {
cas... |
c957c3e325e4cc5585f164dec728fa84f553f4fe | TypeScript | TyTy-cf/hb_pe1_angular | /src/models/yatzee/yahtzee.ts | 3 | 3 | import {Dice} from "./dice";
export class Yahtzee {
private _myDice: Array<Dice> = [];
private _round: number = 0;
throwDice(): void {
this._myDice = [];
for (let i = 1; i <= 5; i++) {
this._myDice.push(new Dice());
}
this.round++;
}
get round(): number {
return this._round;
}
... |
c225e8a77d7725e83d8705ef29a9ba87f121b21e | TypeScript | pedroamaral91/github-api | /packages/api/src/main/decorators/axios-exception-handler.decorator.ts | 2.703125 | 3 | import { Controller } from '@/presentation/protocols/controller'
import { HttpResponse } from '@/presentation/protocols/http'
export class AxiosHttpExceptionHandlerDecorator implements Controller {
constructor (
private readonly controller: Controller
) {}
async handle (request: any): Promise<HttpResponse> ... |
6b105ea93d0809dc3e14d9e07609afffb0cad0d5 | TypeScript | matrix-org/matrix-appservice-bridge | /src/components/event-bridge-store.ts | 2.546875 | 3 | /*
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... |
094faaa34e4f5fc8e05bd6496dc10085ed8340db | TypeScript | vercel/next.js | /packages/next/src/client/router.ts | 2.59375 | 3 | /* global window */
import React from 'react'
import Router from '../shared/lib/router/router'
import type { NextRouter } from '../shared/lib/router/router'
import { RouterContext } from '../shared/lib/router-context'
import isError from '../lib/is-error'
type SingletonRouterBase = {
router: Router | null
readyCal... |
eea1059bc98bc65fe6e65655469812dcedfb8d32 | TypeScript | hhp1614/utils-ts | /src/common/math/thousandth/index.ts | 2.96875 | 3 | /**
* 数字转化为千分位格式
* @description 超大数字会有问题
* @param num 数字
*/
export function thousandth(num: number) {
return (+num).toLocaleString('en-us');
}
|
9543853d9a8ab79f3072ccf3a01f0ff2006312a0 | TypeScript | Cuality/ERC721-Marketplace | /store/scene.ts | 2.515625 | 3 | import { NuxtApp } from 'nuxt'
import { ActionTree, GetterTree, MutationTree } from 'vuex'
import { RootActionTree, RootState } from '../types'
import { SceneState } from '../types/scene'
export const SET_SIZE = 'SET_SIZE'
export const state = (): SceneState => ({
width: 500,
height: 500
})
export const getters: ... |
3fefec20b1cd13969922a250565d82e6e7ada0d4 | TypeScript | vikramIde/airgap-coin-lib | /src/protocols/cosmos/CosmosCoin.ts | 2.8125 | 3 | import { JSONConvertible, RPCConvertible } from './CosmosTransaction'
export interface CosmosCoinJSON {
denom: string
amount: string
}
export class CosmosCoin implements JSONConvertible, RPCConvertible {
private static readonly supportedDenominations = ['uatom']
public readonly denom: string
public readonly... |
a74ac79e6137315b7d0265acaeb46acf0da50a12 | TypeScript | xiangbin0712/ying-datastructures-algorithms | /src/core/datastructures/linkedList/doublyLinkedList.ts | 3.40625 | 3 | 'use strict'
import { DLLNode } from 'core/node'
import LinkedList from './linkedList'
/**
* 双向链表(DoublyLinkedList):双向链表与普通链表的区别在于,双向链表是双向的....有点废话
*/
export default class DoublyLinkedList<T> extends LinkedList<T> {
public head: DLLNode<T> | undefined // 表头
public tail: DLLNode<T> | undefined // 表尾
const... |
3bd67b3c2b94b36506be06ac19b1a6f34f9f0200 | TypeScript | ArthurAkhmerov/sd-olimpiad | /src/app/services/domains.service.ts | 2.59375 | 3 | import { Injectable } from '@angular/core';
import { Cell } from 'app/classes/Cell';
import { colorPalette } from 'app/constants/colorPalette';
@Injectable()
export class DomainsService {
visitedCells: boolean[][];
currentRow: Cell[];
currentCell:Cell;
currentColor: string;
c: number;
r: number;
domains... |
4edbe1a25df371b2b9ddbeb97452d2b300a9a5b9 | TypeScript | marynashapoval/project-catalog | /my-project/frontend/src/app/helpers/queryStatusCheck.ts | 2.53125 | 3 | export class QueryStatusCheck {
static showData(parsedData: any) {
const checkStatus = (res: any) => {
if (res.status >= 200 && res.status < 300) {
return res;
}
return parsedData(res).then((res: any) => {
throw res;
});
... |
7e04bfe1983096543dd84f116dfd9ea3f460ee43 | TypeScript | taksenov/ui-nucleons | /src/helpers/__test__/scroll-to-child.test.ts | 2.578125 | 3 | import { scrollToChild } from '../scroll-to-child';
const makeRectangleMock = jest.fn((left, top, width, height) => ({
left,
top,
right: left + width,
bottom: top + height,
}));
const getBoundingClientRect = makeRectangleMock;
describe('scrollToChild', () => {
let child;
let parent;
it('test scrollToC... |
5f1fcb9f1e96eaaa7ba006239e0da40477a10284 | TypeScript | shazam2064/angular-course2 | /angular-rpg-master/src/app/models/item.ts | 2.78125 | 3 | import {EntityObject} from './base-entity';
import {ItemCategories, ITemplateItem} from './game-data/game-data.model';
/**
* An instance of a template item that has been created.
*/
export interface Item extends ITemplateItem, EntityObject {
/**
* The ID of the entity that this item is equipped by (if any)
*... |
43814a360325876048914e13325a4053324d2920 | TypeScript | jasminmif/big-sir | /src/hooks/useIsFocused.ts | 2.671875 | 3 | import { MutableRefObject, useEffect, useState } from 'react';
function useIsFocused(ref: MutableRefObject<HTMLDivElement | null>) {
const [isFocused, setIsFocused] = useState(false);
useEffect(() => {
const listener = (event: any) => {
if (!ref.current || ref.current.contains(event.target)) {
ev... |
75450dfb2fa15812adcde14af4475fab49f67f36 | TypeScript | ecelustka/cactus-homework | /backend/nodejs/src/helpers/modify-cactus.ts | 2.671875 | 3 | import type { MongoClient } from 'mongodb'
import type { Request, Response } from 'express'
import type { CactusItem, DbResponse } from '../types'
import { bodyOk } from './body-ok'
import dbConnection from './mongo-connect'
// Update item in db
const updateData = async (data: CactusItem): Promise<DbResponse> => {
... |
9706a6e092454c2a8579dcde89763df63c77ad34 | TypeScript | kbespalyi/CarInventory | /app/cars/car-detail-edit/my-image-add-remove/my-image-add-remove.component.ts | 2.578125 | 3 | import { Component, EventEmitter, Input, Output } from "@angular/core";
import * as imagePicker from "nativescript-imagepicker";
/* ***********************************************************
* The MyImageAddRemove custom component uses an imagepicker plugin to let the user select
* an image and provides custom l... |
82748efae587e380866c246e92c5c4158707f865 | TypeScript | RobinBuschmann/angular-typescript | /src/at-angular.ts | 2.890625 | 3 | // Support AMD require
// and SystemJS import
declare module 'at' {
export = at;
}
module at {
'use strict';
/* tslint:disable:no-any */
export interface IClassAnnotationDecorator {
(target: any): void;
(t: any, key: string, index: any): void;
}
/* tslint:disable:no-any */
... |
358f73daa794c4fff023ca79b940bb300a2ed69a | TypeScript | uhyo/masaospace | /src/api/series.ts | 2.703125 | 3 | ///<reference path="../node.d.ts" />
import express = require('express');
import Controller from '../controllers/index';
import util = require('../util');
import { SeriesQuery } from '../data';
class C {
route(router: express.Router, c: Controller): void {
// シリーズを作成する
// IN name: シリーズ名
// IN descripti... |