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 |
|---|---|---|---|---|---|---|
33f00bd561a7ac8823e646575c99365d1f6ce3ee | TypeScript | BlockCat/DogmaJS | /src/core/effects/DogmaEffect.ts | 2.71875 | 3 |
import DogmaExpressionTree from './DogmExpressionTree';
import Modifier, {DogmaAssociation} from '../modifier/Modifier';
import CacheHandler from '../CacheHandler';
import {DogmaEnvironmentType} from '../modifier/DogmaEnvironment';
import {GroupFilter, TypeFilter} from '../modifier/Filter';
export default clas... |
353520e5941be5777403bf8f9b090fe6c00399a0 | TypeScript | leemit/typescript-demo | /app/src/Line.ts | 3.1875 | 3 | /// <reference path='includes.ts' />
module sample {
'use strict'
export class Line implements Shape, Equality<Line> {
constructor(public start: Point, public end: Point) {
}
draw(context: CanvasRenderingContext2D) {
context.beginPath();
context.moveTo(this.start.x, this.start.y);
... |
4cb9eac913e445bb6aa696d44ce321ca714b59ee | TypeScript | phamhuuan/LibraryClient | /src/reducers/genresReducer.ts | 2.78125 | 3 | import {GenresReducerActionType} from './../@types/action/index';
import {GET_ALL_GENRES_FAIL, GET_ALL_GENRES_RESET_MESSAGE, GET_ALL_GENRES_SUCCESS} from './../actions/ActionType';
import {GenresReducerStateType} from "../@types/reducer";
const initialState: GenresReducerStateType = {
data: [],
getGenresMessage: '',... |
054a0e279bf52a61f56038a917a91a6ce00a782a | TypeScript | felipejsborges/proffy-api | /src/infra/http/validators/users/loginValidator.ts | 2.609375 | 3 | import { Request, Response, NextFunction } from 'express';
import Joi from 'joi';
const loginSchema = Joi.object({
email: Joi.string().email().required(),
password: Joi.string().min(6).required(),
});
export default async function loginValidator(
request: Request,
response: Response,
next: NextFunction,
): Promi... |
9f1c4c42c43b3c28ed1c086cc21be554e7f7d305 | TypeScript | rolesvillesoftware/RolesvilleTools | /dist/src/Exception.d.ts | 2.515625 | 3 | export declare class Exception {
private _message;
private _stackTrace;
private _innerException;
readonly message: string;
readonly stackTrace: string;
readonly innerException: Exception;
readonly error: Error;
constructor(error: Error | Exception | string, innerException?: Error | strin... |
6b1f7a1259a5c613894d8eab0cfc9c74fae4ec2e | TypeScript | JulesCubs/IntroTypeScript | /src/typeVoid.ts | 3.8125 | 4 | //Void
//Explicito
function showInfo(user: any): any {
console.log("User Info", user.id, user.userName, user.firstName);
}
//Inferido
function showFormattedInfo(user: any) {
console.log(
"User Info",
`
id: ${user.id}
username: ${user.userName}
firstname: ${user.firstName}
... |
39ce5c046e4d7f6d4f0fcb28b5cd03d3ee93834d | TypeScript | puneetgupta4java/EmployeeManagementUI | /src/app/state/actions/ems.action.ts | 2.734375 | 3 | import { Action } from '@ngrx/store';
import { Employee } from 'src/app/model/employee.model';
/**
* Enum for EmsUiAction
*/
export enum EmsUiAction {
AddEmployee = '[ems-ui] Add new employee',
AddEmployeeSuccess = '[ems-ui] Add new employee success',
AddEmployeeFailure = '[ems-ui] Add new employee failure',
... |
ba833846dc26b0b9dd95faa2e5a6e011ba242817 | TypeScript | jconnor0078/lotery-app-rest | /src/mongo/models/users.ts | 2.71875 | 3 | import { Schema, model, Document } from "mongoose";
export interface IUser extends Document {
name: string;
lastName: string;
documentType: string;
documentNumber: string;
email: string;
address: string;
birthday: Date;
phone1: string;
phone2?: string;
phone3?: string;
image: string;
imageDocum... |
1a0a2da1bf062a0d67e57b3087428335827fbebb | TypeScript | uwblueprint/BEP | /server/src/api/users/picklists/UserPicklistRouter.ts | 2.609375 | 3 | /**
* Required External Modules and Interfaces
*/
import * as UserPicklistService from './UserPicklistService';
import * as Express from 'express';
/**
* Router Definition
*/
export const userPicklistRouter = Express.Router();
/**
* Controller Definitions
*/
// GET users/:name
userPicklistRouter.get('/:name... |
ba687c0d53c03b7e7f15fab892ef8f8cd17a2e2e | TypeScript | hanzo2001/gi-json | /sources/Nodes/Member.ts | 2.640625 | 3 | /// <reference path="../typings/index.d.ts" />
import {ValueContainer} from "./ValueContainer";
import {ElementParser} from "./Utils";
import {MemberName} from "./MemberName";
export class Member extends ValueContainer implements iMember {
n: iMemberName;
constructor(h: iNodeHash, name: string, input: HTMLElement|V... |
39356f2750b0cb6b804cd7ea8c804b34ce35f4c6 | TypeScript | NDSU-CSA/hack-b0t | /src/commands/fun/zimzam.ts | 2.8125 | 3 | import { Command } from "../command";
import { ICommandParams } from "../../misc/globals";
import fs from "fs";
/**
* Anime
*
* Sends a picture of anime
*
* Category : fun
* Admin : no
* Chat params : none
*/
async function execute(params: ICommandParams) : Promise<void> {
// ignore messages w... |
7e763848ff836cfa1ff37b36d3413d6e6c134024 | TypeScript | filipagh/loopback4-test | /src/models/shop-note.model.ts | 2.609375 | 3 | import {Entity, model, property, hasMany} from '@loopback/repository';
import {Item, ItemWithRelations} from './item.model';
@model()
export class ShopNote extends Entity {
@property({
type: 'number',
id: true,
generated: true,
})
id?: number;
@property({
type: 'string',
required: true,
... |
9de27ca01662273809128b0b2703b722addbd05a | TypeScript | maasencioh/cheminfo-types | /src/core/DoubleArray.d.ts | 2.71875 | 3 | /**
* In order to store an array of numbers we prefer to either use native javascript
* arrays or to use Float64Array
*/
export type DoubleArray = number[] | Float64Array;
|
1a96ca94a6693580d5342878ec3a39b19fa4ee43 | TypeScript | lcmpembroke/TypeScriptCrashCourseUdemy | /01_types.ts | 4.21875 | 4 | let aName: any; // type of any allows different types to be assigned later
aName = 12;
aName = "Tomato";
let aName2 = "Apple";
//aName2 = 12; cannot do this as initial assignment was to a string so it has to remain as a string
let anArray: any[] = ["tea", "coffee", "milk"];
console.log(`anArray initially: ${anArray... |
8e570fcc540a0b4aba55db7dc6280c737751263d | TypeScript | Sxip/express-typescript-boilerplate | /app/Logger.ts | 2.59375 | 3 | import { createLogger, format, transports } from 'winston'
import chalk from 'chalk'
import path from 'path'
/**
* Logger formatter.
*
* @param colorize
*/
const formatter = (colorize: boolean) =>
format.printf(info => {
const content = colorize ? chalk.yellow(JSON.stringify(info)) : JSON.stringify(info)
... |
3eee4b39f386235c6b5a51318461b25d1f9e4881 | TypeScript | kakisoft/PracticeJavaScript | /TypeScript/practice_typescript04.ts | 2.84375 | 3 | /*
★AMD方式でコンパイル
-------------------------------------------------------
tsc practice_typescript04.ts -t ES5 -m amd
※nodeで実行できない
-------------------------------------------------------
'--module' option : 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.
*/
//==================================
// ... |
a0095106a309a8751119f4935cf7317c525df968 | TypeScript | RomaSRS/My-blog | /src/helpers/uniqueId.ts | 2.859375 | 3 | const idCounter: { [prefix: string]: number } = {};
export default function uniqueId(prefix = 'id'): string {
if (!idCounter[prefix]) {
idCounter[prefix] = 0;
}
// eslint-disable-next-line no-plusplus
const id = ++idCounter[prefix];
if (prefix === 'id') {
return `${id}`;
}
return `${prefix}${id... |
1a7ef9f65c205f5d65479c851d723744e7a691e7 | TypeScript | dslming/learningComputerGraphics | /ThreejsLearning/011-webpack-ff91/src/shader/stop_bar_vert.glsl.ts | 2.609375 | 3 | export default
`
varying float brightness;
varying vec2 vUV;
// Normalizes a value between 0 - 1
float normFloat(float n, float minVal, float maxVal){
return max(0.0, min(1.0, (n-minVal) / (maxVal-minVal)));
}
void main() {
vUV = uv;
vec4 realPos = modelMatrix * vec4(position, 1.0);
vec3 realNorm = norma... |
7c4e23587c69e13e0b75922766e8f67d33cea2e9 | TypeScript | IronOnet/codebases | /codebases/coursera.org/static/bundles/goal-setting/utils/computeGoalProgressLevel.ts | 2.65625 | 3 | import { LearnerGoal } from 'bundles/goal-setting/types/LearnerGoal';
import {
GoalNDaysAWeek,
StreakLevels,
FirstAssignmentLevels,
FinishNVideosLevels,
GoalProgressLevels,
} from 'bundles/goal-setting/types/GoalProgressLevels';
import {
GOAL_TYPE_COMPLETE_N_ASSIGNMENTS,
GOAL_TYPE_N_DAY_STREAK,
GOAL_T... |
b572d43e97794c507bf0065e45dae4f366b8d3c9 | TypeScript | my9527/strategies-blockchain | /src/lib/utils.ts | 2.671875 | 3 | import CryptoJS from 'crypto';
import path from 'path';
import fs, { ReadStream, WriteStream } from 'fs';
import uuid from 'uuid';
// import { ApiKey } from '../config';
export function sign(text: string, secret: string, outputType:any = 'base64') {
return CryptoJS
.createHmac('sha256', secret)
.update(text... |
1270feb47eb69c0a4053195fd410ca82f754da41 | TypeScript | ChonyiLama/flashcardApp | /src/app/vocablist-data.service.ts | 2.671875 | 3 | import { Injectable } from '@angular/core';
import { VOCABLIST } from './vocablist-data';
@Injectable({
providedIn: 'root'
})
export class VocablistDataService {
constructor() { }
addWord(name, alt_names, meaning): void {
const word = new Map();
word.set('name', name);
word.set('alt_names', alt_name... |
6a086c115c636cf1943b8c42a2f1f0af56e43551 | TypeScript | Titaye/slate-yjs | /src/apply/node/moveNode.ts | 2.734375 | 3 | import { MoveNodeOperation } from 'slate';
import { SyncDoc, SyncNode } from '../../model';
import { getParent } from '../../path';
import { cloneSyncElement } from '../../utils';
/**
* Applies a move node operation to a SyncDoc.
*
* @param doc
* @param op
*/
export default function moveNode(doc: SyncDoc, op: Mov... |
44e1a0cbee6b5af3b36af96991aed6629ee7737c | TypeScript | Dhumez-Sebastien/trap.js | /src/protocols/Core.ts | 2.953125 | 3 | ///<reference path="./../defLoader.d.ts" />
/**
* Core
*
* @module :: Core
* @description :: The Core class of all Protocols.
*/
class Core {
/**
* The name of protocol
* @type {string}
* @protected
*/
protected _protocolName : string = '';
/**
* Time during which the connec... |
f2df25be43d90fcb31e07e18c466a7ce074389d4 | TypeScript | deguilardi/uqac-8INF871-pong | /3-ECS/src/main.ts | 2.953125 | 3 | import { DisplaySystem } from "./displaySystem";
import { LogicSystem } from "./logicSystem";
import { Resources } from "./resources";
import { ISceneDesc, Scene } from "./scene";
import { ISystem } from "./system";
import * as Utils from "./utils";
// ## Variable *systems*
// Représente la liste des systèmes utilisés... |
990de5f7e5856a68364fbb7eb855a6dcd7ef6527 | TypeScript | sphere-group/pegasus | /api/core/keyboard.ts | 3.03125 | 3 | /*
* Copyright (c) 2014 The Sphere Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of condit... |
4dcea0fa311e5de113cb0651ca5cdb35edefb055 | TypeScript | OntimeLengo/ontime-pm | /src/Task.ts | 2.6875 | 3 | import { EventEmitter } from './EventEmitter';
import { DB } from './db';
interface ITask {
run(): Promise<any>;
destroy(): void;
pause(): Promise<void>;
resume(): Promise<void>;
cancel(): Promise<void>;
}
abstract class Task extends EventEmitter implements ITask {
constructor(private _db: DB) {
supe... |
5eca4dcaf8a4e3d155ca8aeed47cdcba126afcd6 | TypeScript | Ecodev/natural | /projects/natural/src/lib/modules/common/pipes/swiss-date.pipe.ts | 2.75 | 3 | import {Pipe, PipeTransform} from '@angular/core';
import {DatePipe} from '@angular/common';
/**
* A normal DatePipe but with default formatting to be '12.24.2020 23:30' to match the most common use-cases
*/
@Pipe({
name: 'swissDate',
standalone: true,
})
export class NaturalSwissDatePipe extends DatePipe im... |
9abbcb25a6068b5ebf45f54987f3d2cc29050ddd | TypeScript | yszk0123/dali | /src/shared/utils/formatDaliDate.ts | 2.640625 | 3 | function pad(n: number): string {
return n < 10 ? `0${n}` : `${n}`;
}
export default function formatDaliDate(dirtyDate: Date): string {
const year = dirtyDate.getUTCFullYear();
const month = dirtyDate.getUTCMonth();
const date = dirtyDate.getUTCDate();
return `${year}-${pad(month)}-${pad(date)}`;
}
|
95f6b971e941c0674b78d311b09f6386f6d7f32c | TypeScript | AdeThorMiwa/quidax | /api/src/modules/book/dto.ts | 2.734375 | 3 | import { Field, InputType } from '@nestjs/graphql';
import { ApiProperty } from '@nestjs/swagger';
import {
IsArray,
IsDate,
IsInt,
IsNotEmpty,
IsNumber,
IsOptional,
IsString,
Max,
Min,
} from 'class-validator';
@InputType()
class CreateBookDto {
@ApiProperty({
description: 'Book cover name',
... |
3e321ed104cbe8270e003ea05f8bca82f264bae2 | TypeScript | FullScreenShenanigans/LevelEditr | /typings/ObjectMakr.d.ts | 3.296875 | 3 | declare namespace ObjectMakr {
/**
* A tree representing class inheritances, where each key represents
* a class, and its children inherit from that class.
*/
interface IClassInheritance {
[i: string]: IClassInheritance;
}
/**
* Properties for a class prototype, which may be ... |
73b19e73add5feb1d5c3a8b17008f779aad6320f | TypeScript | coderofsalvation/react-admin | /packages/ra-core/src/controller/field/useReferenceArrayFieldController.ts | 2.953125 | 3 | import { useMemo } from 'react';
import get from 'lodash/get';
import { Record, RecordMap, Identifier } from '../../types';
import { useGetMany } from '../../dataProvider';
/**
* @typedef ReferenceArrayProps
* @type {Object}
* @property {Array} ids the list of ids.
* @property {Object} data Object holding the ref... |
e6b5f1b281c5b981a9a7825825c82c23c57f4908 | TypeScript | taktik/typescript-http-client | /src/index.ts | 2.96875 | 3 | import type { Logger } from 'generic-logger-typings'
import FilterChainImpl from './filterChainImpl'
/**
* In order to be an HttpClient, the class should:
* Make a call to the server and returning a response
* Make a simpler call to the server that only returns a part of the response
* Add a filter to its filter l... |
e1eb419187c81a4e3592b21f5964da04f3cf6873 | TypeScript | keshav121992/My_First_Todo_Application_with_Java_SpringBoot_Angular | /src/app/list-todo/list-todo.component.ts | 2.609375 | 3 | import { Component, OnInit } from '@angular/core';
import { TododataService } from '../service/data/tododata.service';
import { Router } from '@angular/router';
export class Todo{
constructor(
public id: Number,
public username: string,
public discription: string,
public targateDate: Date,
publi... |
b64e57ca0a6b07342f7b74c77bb345479ca0ef88 | TypeScript | zcong1993/sequelize-v5-ts-example | /src/index.ts | 2.5625 | 3 | import { syncForce, dump } from './common'
import { User, Post, Tag } from './model'
const run = async () => {
await syncForce()
const user = await User.create(
{
name: 'zcong',
detail: {
gender: 'male'
}
},
{
include: [
{
association: User.association... |
1ac30b2d8e6909a9253c6c8f2d584e49d7083c76 | TypeScript | chistogo/ScalarJS | /src/matrix.ts | 3.421875 | 3 | class Matrix{
protected columnsCount:number;
protected rowsCount:number;
protected data:number[];
// The idea behind this variable is that you can set it to false and get better performance.
// Feature might be removed or expanded in future.
static safe = true;
constructor(matrixData:numb... |
337ed6500b38a46f113cf38fd1ed00ce1dd06c25 | TypeScript | cbrandolino/webvtt.ts | /src/demo/vtt/useCues.ts | 2.671875 | 3 | import { Reducer, useReducer, useEffect, useRef } from 'react'
import { createCuesDiv } from './renderer';
import { parseVtt } from './parser';
import { JsonCue } from '../../lib/types';
interface ICueState {
time:number,
currentCues:Array<JsonCue>,
parsedCues:Array<JsonCue>;
parsedRegions:Array<VTTRegion>;
}
... |
9ae1fe1d0acf17b882a610f794d31b4a75d4c249 | TypeScript | willwsharp/Mallard-Manager | /src/app/core/models/projects/ProjectTask.model.ts | 2.65625 | 3 | import { Validatable } from '../validation/Validatable.interface';
export class ProjectTask implements Validatable {
constructor(public name: string) {}
public isValid(): boolean {
return this.name !== '';
}
}
|
40f950720ef90665784f7848556436925fc595cf | TypeScript | nicolaskr/NotreProjetAngular | /src/app/model/session.ts | 2.734375 | 3 | import { SessionKey } from './session-key';
import { Partie } from './partie';
import { SessionRessource } from './session-ressource';
import { SessionBatiment } from './session-batiment';
import { Compte } from './compte';
export class Session {
constructor(
private _id: SessionKey,
private _def: number,
... |
46d1075f583b9e3fb76633fd02e0d5db0525312a | TypeScript | netochaves/grommet | /src/js/utils/index.d.ts | 2.890625 | 3 | // colors.js
declare const normalizeColor: (
color: string | { dark?: string; light?: string },
theme: object,
required?: boolean
) => string;
export {normalizeColor}
// object.js
export type DeepReadonly<T extends object> = {
readonly [K in keyof T]: T[K] extends object ? DeepReadonly<T[K]> : T[K];
}
export ... |
619870d2f6b6ada0380c9c36f5f7643dabb018d0 | TypeScript | Hebilicious/FloomDeliveryTracker | /generated/prisma-client/prisma-schema.ts | 2.625 | 3 | export const typeDefs = /* GraphQL */ `type AggregateCoordinate {
count: Int!
}
type AggregateOrder {
count: Int!
}
type AggregateOrderUpdate {
count: Int!
}
type AggregateUser {
count: Int!
}
type BatchPayload {
count: Long!
}
type Coordinate {
latitute: Float!
longitude: Float!
}
type CoordinateCo... |
f430a995324edd5ae8bc07a25d78829c20d7c583 | TypeScript | xhackax47/JavaScript-TypeScript | /exos/ex1.ts | 3.171875 | 3 | import { Promise } from 'es6-promise';
console.log('--------------------------- TP TYPESCRIPT ----------------------------');
let noteTab20: Array<number> = [8, 5, 7];
let noteTab10: Array<number> = noteTab20.map((elmt) => elmt / 2);
let intTab1 = [0, 1, 2, 3, 4];
let intTab2 = [5, 6, 7, 8, 9];
let intTab3 = [1... |
88bb6a4837cf227ac3153ec1ee7023b10f70aed9 | TypeScript | JonDotsoy/envuse | /packages/envuse/data-source/statements/components/statement-object/statement-number-object.ts | 2.890625 | 3 | import { BufferCursor } from "../../lib/buffer-cursor";
import { BCharType } from "../../tdo/b-char-type";
import { CharactersKey as k } from "../../tdo/characters-key";
import { b } from "../../lib/to-buffer";
import { StatementObjectTypes } from "../../tdo/statement-object-types";
import { StatementObjectDefinition }... |
75249a2219776c16ffd9fe5a75f1c648076a0142 | TypeScript | udecode/plate | /packages/media/src/image/withImageEmbed.ts | 2.578125 | 3 | import { PlateEditor, Value, WithPlatePlugin } from '@udecode/plate-common';
import { insertImage } from './transforms/insertImage';
import { ImagePlugin } from './types';
import { isImageUrl } from './utils/isImageUrl';
/**
* If inserted text is image url, insert image instead.
*/
export const withImageEmbed = <
... |
bdc97cf275520dacec978e475749421996152672 | TypeScript | guilhermeSousa1/get-a-car | /apps/get-a-car/src/app/core/services/notification/notification.service.ts | 2.546875 | 3 | import { Injectable } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
/**
* Service used to create notifications.
*/
@Injectable({
providedIn: 'root'
})
export class NotificationService {
/**
* Class constructor.
*
* @param snackBar Injection of the MatSnackBar service... |
0d7335cf8f40e3866727c65254c07c06232bd76e | TypeScript | water102/fx-common | /src/format/slugify.ts | 2.8125 | 3 | import { isEmpty } from "ramda";
export const slugify = (text: string): string => {
if (isEmpty(text)) return ''
text = text
.toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with hyphens
.replace(/[^\p{L}\p{N}-]/gu, '') // Remove non-alphanumeric characters except hyphens
.normalize('NFD') //... |
85b00ff6015833abbdd0877f1a128df33841f7cc | TypeScript | radman0x/rl-lib | /rl-ecs/src/lib/components/bang.model.ts | 2.625 | 3 | import { Component } from 'rad-ecs';
export interface BangData {
strength: number;
}
export class Bang extends Component implements BangData {
public readonly strength: number;
constructor(data: BangData) {
super();
Object.assign(this, data);
}
}
|
a80ca7b052010179ff3561fc236e85e44ebdacfe | TypeScript | dvallin/lazy-ecs | /src/spatial/space.ts | 3.40625 | 3 | import { Vector } from "./vector"
import { Option } from "lazy-space"
export interface Space<A> {
get(pos: Vector): Option<A>
set(pos: Vector, objects: A): void
remove(pos: Vector): Option<A>
}
export class DiscreteSpace<A> implements Space<A> {
private readonly objects: Map<string, A> = new Map()
... |
776752e6cf5bbf36f56c7157f1359e0cbfef7ca8 | TypeScript | ljuvtliv/switchdrive | /src/api/routers/switchRouter.ts | 2.5625 | 3 | import { U_TYPE } from "@base/work";
const Router = require('koa-router')
export class SwitchRouter {
router;
constructor(){
this.router = new Router();
//Router defs here, tying into functions on this class
this.router.get('/', function (ctx, next) {
ctx.send('Hello World!')
});
... |
4a684baaf162e4d6703600ae9b98b2d067a5cd66 | TypeScript | skyskyskyha/hearthstone-battlegrounds-tools | /src/renderer/core/hooks/useSurprise.ts | 2.515625 | 3 | import React from 'react'
// @ts-ignore
import Emoji233333 from 'emoji-233333'
const list = [
{
label: 'hbt',
url: 'https://hs.chenyueban.com/hearthstone/images/surprise/logo.png',
},
{
label: 'HBT',
url: 'https://hs.chenyueban.com/hearthstone/images/surprise/logo.png',
},
{
label: '雪之下雪乃... |
2266db3e682798b1d7580e78e9b74ad49e4d2838 | TypeScript | mohitv789/reading-app-api | /src/app/profile/store/profile.actions.ts | 2.53125 | 3 | import { Action } from '@ngrx/store';
import { Image } from '../image.model';
export const SET_IMAGES = '[Function] Set Images';
export const FETCH_IMAGES = '[Functions] Fetch Images';
export const ADD_IMAGE = '[Function] Add Image';
export const UPDATE_IMAGE = '[Function] Update Image';
export const DELETE_IMAGE = '... |
8b90576849612b5185153df92d9e6de5fbe4032c | TypeScript | RGFTheCoder/noted | /src/types/Note.ts | 2.53125 | 3 | export type Note = { name: string; tags: string[]; content: string };
type TagDef = { color: string };
export type NoteData = {
tags: Record<string, TagDef>;
notes: Note[];
};
|
56c19705e4e7cdf4f186c2d444079178a965c61e | TypeScript | edumentab/talks-redux-patterns | /src/v06/redux/lib/types/thunk.ts | 3.140625 | 3 | type ThunkCreatorWithoutOptions<A, S> = () => Thunk<A, S>
type ThunkCreatorWithOptions<A, S, O> = (opts: O) => Thunk<A, S>
export type ThunkCreator<A, S, O = undefined> = O extends undefined
? ThunkCreatorWithoutOptions<A, S>
: ThunkCreatorWithOptions<A, S, O>
export type Thunk<A, S> = (
dispatch: (action: A) =... |
bb71d927e196b6bdccf023e130f2800e6dc6f191 | TypeScript | tomzhang/swim | /swim-system-js/swim-ux-js/@swim/mapbox/main/MapboxProjection.ts | 2.53125 | 3 | // Copyright 2015-2020 SWIM.AI inc.
//
// 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 ... |
f61aabca8cc9c81ac82a1ed75f7619a713a707fa | TypeScript | markmccoid/rn-movietracker | /src/hooks/useWatchProviderData.ts | 2.796875 | 3 | import { useEffect, useState } from "react";
import { movieGetWatchProviders } from "@markmccoid/tmdb_api";
import _ from "lodash";
type ProviderInfo = {
provider: string;
logoURL: string;
providerId: number;
displayPriority: number;
};
export type WatchProvidersType = {
justWatchLink: string;
stream: Prov... |
0a482e1e9f70c08a0177bc51edd82a687eb39621 | TypeScript | dbspt/nodejs-app-example-docker | /src/app/services/example.ts | 2.609375 | 3 | import ExampleModel from "../models/example";
import IExample from '../interfaces/example';
class ExampleService {
public async getInformation(): Promise<IExample[]> {
return await ExampleModel.find({});
}
public async setInformation(data: IExample): Promise<IExample>{
const example = new ExampleModel(d... |
1e91cfb92704e87a21628a080b3c024f56bb6b3f | TypeScript | rjvalencia/au-eva | /src/models/acct-list.ts | 2.6875 | 3 | import { Acct, Annotation } from '../models/acct';
//
export class AcctList extends Array<Acct | Annotation> {
equationSide: string;
listTotal: number;
idToFind;
private constructor() {
super()
}
static create(equationSide: string): AcctList {
return Object.assign(Object.create(AcctList.prototype... |
59f9fc29830585a76b38043820159db4bdcb98d3 | TypeScript | postor/quick-buf | /src/decode.ts | 2.734375 | 3 | import { BitReader } from "./bits"
// import { EncodeUints } from "./encode"
import { ParseConfig, Structure, StructureMeta, StructureMetaItem } from "./Structure"
import { TypeClasses, TypeSizes, TypeValues, ValueTypes } from "./util"
import { VUintReader } from "./VUint"
const UTF8 = new TextDecoder()
// let DecodeU... |
e7316f05e93a3b2b66f352a5b38ea93b68a67fb5 | TypeScript | Nieks1911/PRG04-homework | /CMTTHE04-Week2-oefening1-master/dev/bubble.ts | 3 | 3 | class Bubble {
div: HTMLElement
bubble: HTMLElement
constructor() {
console.log("Blub... blub...")
this.bubble = document.createElement("bubble")
this.bubble.addEventListener("click", () => this.popBubble())
let game = document.getElementsByTagName("game")[0]
gam... |
b50e740c202cc9af6db0d653829483338bbd7005 | TypeScript | wsz7777/kh-tool | /src/base/FileToBase64.ts | 3.21875 | 3 | /**
* 把文件读取成 base64 格式
* @param file 文件对象
*/
export function FileToBase64(file: File): Promise<string | ArrayBuffer | null> {
const reading = new FileReader();
return new Promise((resolve, reject) => {
reading.onload = (event: ProgressEvent<FileReader>) =>
resolve(event?.target?.result || null);
... |
2bf520b23af09e0240945db2530382d27ef7289a | TypeScript | gabliam/gabliam | /packages/web/graphql-core/__tests__/fixtures/resolvers/hero-resolver.ts | 2.671875 | 3 | import { GabResolver } from '@gabliam/graphql-core';
import {
Arg,
Mutation,
Publisher,
PubSub,
Query,
Root,
Subscription,
} from 'type-graphql';
import { Hero } from '../entities/hero';
import { Paginate } from './array-util';
import { HeroInput } from './types/hero-input';
import { PaginatedHero } from ... |
c17735ff57ed7dacdce76dbffdc226b439ae8145 | TypeScript | kscarrot/planting | /src/util/randomArray.test.ts | 2.65625 | 3 | import randomArray from './randomArray'
test('should be empty', () => {
expect(randomArray(-1)).toStrictEqual([])
})
test('should be interger', () => {
expect(randomArray(3.5).length).toBe(3)
})
test('normal case', () => {
expect(randomArray(10).length).toBe(10)
})
|
268ff33fefc6f427ac1afceb930130274b34f10a | TypeScript | KokoDoko/level-editor | /dev/domobject.ts | 2.953125 | 3 | class DOMObject {
public x : number;
public y : number;
public width : number;
public height : number;
public scale : number;
public tag : string;
protected div: HTMLElement;
constructor(x: number, y: number, tag: string) {
this.x = x;
this.y =... |
82ec33f777e0dfd27617347fea99e45f954428bb | TypeScript | zelderus/budget.ts | /src/scripts/models/Accounts.ts | 2.71875 | 3 |
import FormValidator from './FormValidator';
import IconData from './../datas/IconData';
namespace Accounts {
/**
* Счет.
*/
export class AccountEntity implements IClientObjectResponse {
id: string;
title: string;
order: number;
sum: number;
... |
544ac138b366db359bcc045adb0f90ecbde6b908 | TypeScript | GuoBinyong/json-tls | /src/tools.ts | 3.875 | 4 | /**
* 安全地解析字符串,不会抛出错误,返回一个表示解析结果的信息对象
* @param text : string 必需, 一个有效的 JSON 字符串。
* @param reviver ?: function 可选,一个转换结果的函数, 将为对象的每个成员调用此函数。
* @returns {
* parsed: boolean, 表示是否成功解析
* result: string | JSONObject 最终解析的结果,如果成功解析,则该值为解析后的JSON对象,如果未成功解析,则该值为原字符串 text
* } 解析的结果;
*/
export function sa... |
445ceaa9886722c3b62cca6433912acb5b08f8be | TypeScript | pardhuphanikumar/Typescript | /TypeScript-example1/unions.ts | 3.328125 | 3 | interface IPizza {
foodType: 'pizza',
toppings: string[],
crust: string
}
interface Isandwich {
foodType: 'sandwich',
toppings: string[],
bread: string,
}
type Food = Isandwich | IPizza
const myFood: Isandwich = {
bread: 'oeu',
foodType: 'sandwich',
toppings: ['qee', 'a']
}
const myF... |
3cea66e544735bff7fbc121239cab45de089a1cf | TypeScript | banaanihillo/lut_fullstack | /oeypoedalxr.angular/src/app/product-information/product-information.component.ts | 2.5625 | 3 | import {
Component,
OnInit
} from '@angular/core'
import {ActivatedRoute} from "@angular/router"
import {products} from "../products"
import {ShoppingCartService} from "../shopping-cart.service"
@Component({
selector: 'app-product-information',
templateUrl: './product-information.component.html',
s... |
ab754314e5535ceae1063bfceb96c5c51cbee96e | TypeScript | c2cn/san-devtools | /packages/shared/src/Bridge.ts | 2.953125 | 3 | import EventEmitter from './EventEmitter';
import {Message} from '../types';
const BATCH_DURATION = 100;
interface Wall {
listen: (fn: Function) => void;
send: (data: any) => void;
}
export default class Bridge extends EventEmitter {
wall: Wall;
_batchingQueue: any[] = [];
_sendingQueue: any[] = ... |
622dddad6df0410b9d8e860471e007c62cf3d84f | TypeScript | ClemWiz/Error-pattern-NodeJS | /ctrl.ts | 2.96875 | 3 | import { Request, Response } from "express";
import { getUser} from "./logic";
import ApiError, { ErrorLevel } from "./CustomError";
export async function doSomethingWithUser(req: Request, res: Response): Promise<void> {
const userId = checkUserId(req.params.id);
const user = await getUser(userId);
... |
944f5101bc0afe828e86d1f5dd457a4ca74d42d3 | TypeScript | wavevision/class-name | /src/types.ts | 2.859375 | 3 | import { USE_VALUE } from './constants';
export type Props = Record<string, unknown>;
export type State = Props;
export type Parameters<P = Props, S = State> = { props: P; state: S };
export type Modifiers = Array<boolean | string | null | undefined>;
export type ModifierFunction<P = Props, S = State> = (
paramete... |
a9dcf8ef76c7ba4889a7c12bae8f1e407b1f4bde | TypeScript | andymikulski/ai-starter | /src/ai/utils/WaitMillisecondsAction.ts | 2.890625 | 3 | import { Action, BehaviorStatus } from "../base/BehaviorTree";
export class WaitMillisecondsAction extends Action {
constructor(private waitForMS: number | (() => number)) {
super();
}
private waitThreshold: number;
private startTime: number;
onInitialize() {
this.startTime = Date.now();
this.wa... |
efbb7a4f1c70cecf69083ecb5eef374cab092c54 | TypeScript | Renanmacedo/dojo-dotz | /src/app/literal/index.ts | 3.171875 | 3 |
// qualquer string
export function printAnySize(size: string) {}
// aceita somente os tipos informados
//type LiteralTypes = "xs" | "md" | "lg" | "xl";
export function printLiteralSize(size: "xs" | "md" | "lg" | "xl") {}
|
0c0899f121e0c034528275673550c5acfa178af2 | TypeScript | jurajtrappl/Desmond | /data_api/src/core/services/DateTime/IDateTimeService.ts | 3.125 | 3 | import { MilitaryTime } from 'src/core/values/MilitaryTime'
export interface IDateTimeService {
/**
* Returns the given date time as a date string in the format .
* @param dateTime date time to format.
*/
formatDate(dateTime: string): string
/**
* Returns the given date time as a date time string in the fo... |
1bc2d13d439eb34111e221ba64412453f716347b | TypeScript | pedropaiva1/canopus-backend | /src/carousels/carousels.service.ts | 2.59375 | 3 | import {
BadRequestException,
Injectable,
NotFoundException,
} from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { UserEntity } from 'src/users/entities/user.entity';
import { Repository } from 'typeorm';
import { CreateCarouselDto } from './dto/create-carousel.dto';
import { Updat... |
59f331f740ea0049234f2403321561ffe594b170 | TypeScript | ilanddev/javascript-sdk | /src/sdk/model/vm/__json__/vm-power-operation-type.ts | 2.765625 | 3 | /**
* Enumeration of the available power operations for a VM.
*/
export type VmPowerOperation = 'poweron' | 'poweroff' | 'suspend' | 'shutdown' | 'reset' | 'reboot';
|
07e15e875468b48975dfee957e55ac2ea63b5fd1 | TypeScript | andyinthemachine/real-eyes | /src/constants.ts | 2.5625 | 3 | interface iInfo {
name: string,
version: string,
routes: Array<{
controller: string;
description: string;
method: string;
uri: string;
version: string;
body?: any,
}>,
}
const INFO: iInfo = {
name: 'REAL EYES API',
version: '0.0.1',
routes: [
... |
81ec65fa08b9f344db469d6bb8f7919e448ac0e8 | TypeScript | smartshare-labs/react-boilerplate | /src/utils/Greeting.ts | 3.046875 | 3 | import moment from "moment-timezone";
export const getGreetingTime = () => {
const currentTime = moment();
if (!currentTime || !currentTime.isValid()) {
return "Hello";
}
const splitAfternoon = 12; // 24hr time to split the afternoon
const splitEvening = 17; // 24hr time to split the evening
const cur... |
ebb65745917fec7413016400eb4c46bd9012f8aa | TypeScript | lol-matchmaker/riot-hackathon | /src/renderer/ws_messages.ts | 2.890625 | 3 | /** Server -> Client: Not authenticated. */
export interface ChallengeMessage {
type: 'challenge';
/** Challenge token to be set as the summoner's verification string. */
token: string;
}
/** Client -> Server: Ready to be authenticated. */
export interface AuthMessage {
type: 'auth';
accountId: string;
sum... |
8589bd63ba757e6a1f9ade4e19b9d4fbb8bd5c14 | TypeScript | camelCaseDave/xrm-mock | /test/page/step/step.mock.test.ts | 2.640625 | 3 | import { StepMock } from "../../../src/xrm-mock/processflow/step/step.mock";
describe("Xrm.ProcessFlow.Step Mock", () => {
let step: StepMock;
beforeEach(() => {
step = new StepMock("First Name", "firstname", true);
});
it("should instantiate", () => {
expect(step).toBeDefined();
... |
6e26b83c7ef76ff496454e0ba7b3cb8d2794fd94 | TypeScript | greghart/climbing-app | /src/typescript/redux/ducks/util/scopeObject.ts | 3.28125 | 3 | import * as ReduxActions from 'redux-actions';
/**
* Compose an action object to be scoped
*
* @param {object} - An action object to add scope to
* @param {array} - Array of scopes to add
* @returns {function} a new thunk which wraps dispatch in given scope
*/
export default <Payload>(
action: ReduxActions.Act... |
d7bd2fbfcfbe654d9d89a454bbecee25f9e7b9d0 | TypeScript | Zilborg/payload | /src/admin/api.ts | 2.671875 | 3 | import qs from 'qs';
type GetOptions = RequestInit & {
params?: Record<string, unknown>
}
export const requests = {
get: (url: string, options: GetOptions = { headers: {} }): Promise<Response> => {
let query = '';
if (options.params) {
query = qs.stringify(options.params, { addQueryPrefix: true });
... |
1d0f1b6688d4d4d21be59ed5e5b0138c5d188958 | TypeScript | NikaBuligini/react-nb-hooks | /src/utils/useFocus.ts | 2.796875 | 3 | import { useState } from 'react';
type Handlers = {
onFocus: () => void;
onBlur: () => void;
};
export function useFocus(): [boolean, Handlers] {
const [isFocused, setFocus] = useState(false);
const bind = {
onFocus: () => setFocus(true),
onBlur: () => setFocus(false),
};
return [isFocused, bind... |
aeb53539a1d3d79dafd3eead7d7efd1752e9c24e | TypeScript | niuniu384665340/bxjs-base | /framework/plugins/database/index.ts | 2.671875 | 3 | import {Entity, BaseEntity, PrimaryColumn, BeforeInsert, CreateDateColumn, Index, UpdateDateColumn} from '@bxjs/typeorm'
const shortid = require('shortid')
export * from '@bxjs/typeorm'
@Entity()
export abstract class XBaseEntity extends BaseEntity {
// 数据库自增主键存在分布式扩容以及安全隐患在阿里内部不适合使用,改进方案如下:
// 阿里内部安全规范要求id不... |
727b1ec6ca96444409a82cbb9249e944e8e53f4e | TypeScript | soinanataliya/some-components | /src/components/interval/_types.ts | 2.546875 | 3 | export type IntervalsType = {
title: string;
value: number;
isSeen: boolean;
};
|
a854a4b942f9a1f23681e224374daf1b1cd2e8cc | TypeScript | alvarorahul/TypeDocs | /samples/sample.d.ts | 3.546875 | 4 | declare module "E" {
export = Main;
module Main {
/**
* Defines an item.
*/
const item: string;
}
}
declare module "A/B/C" {
/**
* Test module documentation.
*/
module D {
}
/**
* Second test module documentation.
* More information abo... |
80873d6e355b7735667355a28b60a61bc5b1f6ab | TypeScript | iangregsondev/ts-proto | /integration/simple-long/simple-test.ts | 2.71875 | 3 | import { SimpleWithMap } from './simple';
describe('simple', () => {
it('can fromPartial maps', () => {
const s1 = SimpleWithMap.fromPartial({
intLookup: { 1: 2, 2: 1 },
longLookup: { '1': 2, '2': 1 },
});
expect(s1).toMatchInlineSnapshot(`
Object {
"intLookup": Object {
... |
93e3d45300e77384b38c609b51a366c2447f1972 | TypeScript | simple5960/cache | /index.ts | 2.5625 | 3 | export function serviceWorker(swPath:string)
{
if ('serviceWorker' in navigator) {
window.addEventListener('load', function (event) {
navigator.serviceWorker.register(swPath, {
scope: '/'
})
.then(function (registeration) {
... |
d9814719fee813950fb8230ea4102e05dc0c29eb | TypeScript | naoki-sawada/github-release-watcher | /src/updateChecker.ts | 2.8125 | 3 | import axios from "axios";
interface UpdateCheckerOptions {
method?: string;
url: string;
headers?: any;
version: (data: any) => string | Promise<string>;
checker: (version: string) => boolean | Promise<boolean>;
notification: (version: string, subscribed: boolean) => void;
}
const updateChecker = async (... |
21a0cf6041ff9eec18964e4510092d88484987f7 | TypeScript | julien-c/coreml-protobuf-parser | /lib/Log.ts | 2.875 | 3 | import * as colors from 'colors';
import * as util from 'util';
export const c = {
__log: (args: any[], opts: {
color?: colors.Color,
colors?: boolean,
} = {}) => {
const inspectOpts = (opts.colors !== undefined)
? { depth: 20, colors: opts.colors }
: { depth: 20, colors: true }
;
if (process.env.NO... |
f0a47e907c25f225ff7171ad4acbcf8f2f52e3ce | TypeScript | AdinoWayne/VuMucDiThu | /code/999-available-captures-for-rook.ts | 2.828125 | 3 | function numRookCaptures(board: string[][]): number {
var r, c;
var row, col;
rook_search:
for (r = 0; r < 8; r++) {
for (c = 0; c < 8; c++) {
if (board[r][c] == 'R') {
row = r;
col = c;
break rook_search;
}
}
... |
fa2494297b8695813f37a72ecadc2ab94039df68 | TypeScript | isaquielfernandes/node-rest-api | /src/controllers/ForecastController.ts | 2.53125 | 3 | import { Request, Response } from "express";
import { getRepository } from "typeorm";
import { Forecast } from "../entity/Forecast";
import { ForecastService } from "../services/ForecastService";
export default class ForecastController {
public findAll = async (req: Request, res: Response): Promise<Response> => {
... |
24d1070f4631f9db27d701b71efd93a322e55f2d | TypeScript | DPiyumantha/Fast-track-training-with-Krish | /words/src/app/user-input/user-input.component.ts | 2.609375 | 3 | import { Component, OnInit, EventEmitter, Output } from '@angular/core';
@Component({
selector: 'app-user-input',
templateUrl: './user-input.component.html',
styleUrls: ['./user-input.component.scss']
})
export class UserInputComponent implements OnInit {
regex=/[a-z]*[aeiou][a-z]*/gi
inputText: string = '';... |
d22d56bcf5972fb163af5502fd0551e28cb1469c | TypeScript | dannius/rows-code | /src/app/pipes/closest-products.pipe.ts | 2.640625 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { IMileage } from '@lib/mileage';
@Pipe({
name: 'closestProducts',
pure: true,
})
export class ClosestProductsPipe implements PipeTransform {
public transform(products: IMileage[], estimate: number, count: number): any {
return [
...this.getL... |
ee5b8e3feda0fcaa8d3daf805a57f31027793fe5 | TypeScript | ps-aux/deployers | /src/fs/dir/unused/listDir.test.ts | 2.8125 | 3 | import { listDir } from 'src/fs/dir/unused/listDir'
import { DirFileItem } from 'src/fs/types'
import { testDataDir } from 'src/_test'
const expectPath = (f: DirFileItem, end: string) => {
if (!f.absPath.startsWith('/')) {
throw new Error(`Path ${f.absPath} is not absolute`)
}
if (f.localPath.start... |
d53191127f45105e2dd1e8072d36e46460aed113 | TypeScript | CamielJalink/Advent-of-Code-2020 | /day23/part2/src/game.ts | 3.421875 | 3 | import { Cup } from "./cup";
export class Game {
gameState: Map<number, Cup> = new Map();
pickedUpCups: Cup[] = [];
currentCup: Cup;
constructor(gameState: number[]){
const tempGameState: Cup[] = [];
this.currentCup = new Cup(gameState[0]);
tempGameState.push(this.currentCup);
for(let i = 1... |
0aab10b8b15729f01fe5a11b3e47108f71659b69 | TypeScript | taoqili/comlib-pc-normal | /src/datatable/editors/blocks/logic/logic_includes.ts | 2.515625 | 3 | const DataTpt = {
type: 'Array'
}
export default {
name: 'xg.logic_includes',
title: '包含',
data: DataTpt,
render(renderer, data) {
renderer.setStyle('logic_blocks')
renderer.setOutput(true, 'Boolean')
renderer.setInputsInline(true)
renderer.appendValueInput('judged').setCheck(['Array', 'Stri... |
80abea03c7b02566f3e0045df1f3b95e5bf91e7b | TypeScript | maranite/Keylab-Viper | /ts-stubs/ParameterBank.d.ts | 3.265625 | 3 | /** Defines a bank of parameters. */
interface ParameterBank {
/** Gets the number of slots that these remote controls have. */
getParameterCount(): number;
/** Returns the parameter at the given index within the bank.
* @param indexInBank
the parameter index within this bank. Must be ... |
523a998fb09615fccc33bdf6f131889ab19745cc | TypeScript | ChrystianSchutz/Omdb-Api-Search-TypeScript-Redux-Challange | /src/store/actions/itemActions.ts | 2.734375 | 3 | import { MovieListArray } from "../../types/";
export function fetchHasErrored(bool: boolean) {
return {
type: "ITEMS_HAS_ERRORED",
hasErrored: bool,
};
}
export function fetchLoading(bool: boolean) {
return {
type: "ITEMS_IS_LOADING",
isLoading: bool,
};
}
export function fetchSuccess(items:... |
bb8012a565bf2e8274d867fd001c76dcef4ac179 | TypeScript | VugarAhmadov/island.is | /libs/application/templates/family-matters/core/src/utils/index.ts | 2.796875 | 3 | import parse from 'date-fns/parse'
import format from 'date-fns/format'
import is from 'date-fns/locale/is'
import enGB from 'date-fns/locale/en-GB'
import sortBy from 'lodash/sortBy'
import { parsePhoneNumberFromString } from 'libphonenumber-js'
import kennitala from 'kennitala'
import { Address, Child, NationalRegist... |
66a32b8614feeb0450e43834270525585f5360bb | TypeScript | dsharma-learn/workspaces | /angular/Udemy_CompleteGuidetoAngular2/Learning-Angular-2.0-CodeFromClass/class-8_BasicRouting/dev/contacts/contact-list.component.ts | 2.640625 | 3 | import {Component} from "angular2/core";
import {OnInit} from "angular2/core";
import {ContactComponent} from "./contact.component";
import {ContactService} from "./contact.service";
import {Contact} from "./contact";
@Component({
selector: "contact-list",
templateUrl: "../dev/contacts/contact-list.component.html"... |
89cc20ca04161c28e9173428edc64f76d8177c6c | TypeScript | mcorrigan89/mpls-openmic | /src/entity/artist.ts | 2.5625 | 3 | import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
import { Timeslot } from './timeslot';
import { Template } from './template';
@Entity()
export class Artist extends Template {
@PrimaryGeneratedColumn('uuid')
public id: string;
@Column('text', { nullable: true })
public name: stri... |