Datasets:

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
7407b094872b697d55601b9d0d0973ed11502ea1
TypeScript
si-saude/saude-app
/src/app/controller/equipe/equipe.builder.ts
2.609375
3
import { Equipe } from './../../model/equipe'; import { ProfissionalSaudeBuilder } from './../profissional-saude/profissional-saude.builder'; import { Profissional } from './../../model/profissional'; import { EmpregadoBuilder } from './../empregado/empregado.builder'; import { Empregado } from './../../model/empre...
0df632c1c35ef800211f3c3b65dac38e2e12bce1
TypeScript
AbdulMoiz8994/NinjaTSPRactice
/src/index.ts
3.890625
4
let names = "Abdul moiz"; let value=12; let isTure=true; names="Abdul Rafay" console.log(names); let arr=["Abdul moiz", "Abdul Rafay", "Abdul Malik" ,"Rizwan"] // we cna not assign the number and any type here arr.push("Abdu basit") arr[0]="Whadan" console.log(arr); let arr1=["Abdul moiz", 1, true]; let arr2: strin...
40ddc16d1ef8921fef8d5bbaededbd58648b42b6
TypeScript
macastilhos/typescript-crud-api
/src/controllers/records.ts
2.6875
3
import { Repository } from 'typeorm'; import { Request, Response } from 'express'; import { validate } from 'class-validator'; export const recordsController = <T>(repository: Repository<T>) => { const wrap = (fn: Function) => { return (req: Request, res: Response) => { fn(req, res).catch((e: Error) => { ...
75c84e6ba0546fa6a4672d65766afd91a9d11201
TypeScript
satyakranthi1/Foodie
/serverless/src/businessLogic/s3Helper.ts
2.515625
3
import * as AWS from 'aws-sdk' import * as AWSXRay from 'aws-xray-sdk' import { createLogger } from '../utils/logger' const bucketName = process.env.IMAGES_S3_BUCKET const urlExpiration = parseInt(process.env.SIGNED_URL_EXPIRATION, 10) const XAWS = AWSXRay.captureAWS(AWS) const logger = createLogger('S3Helper') const...
8c7892621de8601785d953b1c99f72ab9bf519c7
TypeScript
Rawan-Eltobgy/react-redux-saga-typescript-boilerplate
/src/types/action.ts
2.859375
3
import { ActionTypes } from "literals"; import { Action } from 'redux' export interface UserLoginPayload { username: string; password: string; } export interface UserLoginSuccessPayload { loginToken: string; } export interface UserLoginFailurePayload { error: Error; } export interface UserLoginRequest exten...
d801f78e9d4a240b202b713799413e5d37689611
TypeScript
shiqingsong715/solana-program-demo
/src/client/main.ts
2.515625
3
import { LAMPORTS_PER_SOL } from '@solana/web3.js'; import { establishConnection, calculatePayfees, establishPayer, loadProgram, storeNumber, getNumber, } from './demo'; const solPath = 'dist/program/demo.so'; function randNumber(): number { let num = Math.random() * 100; return parseInt(num + ''); }...
b4155f5e6a16d270b90be2d181d25b6b079249a8
TypeScript
estruyf/vscode-front-matter
/src/utils/fieldWhenClause.ts
3.171875
3
import { WhenClause } from './../models/PanelSettings'; import { Field, WhenOperator } from '../models'; import { IMetadata } from '../panelWebView/components/Metadata'; /** * Validate the field its "when" clause * @param field * @param parent * @returns */ export const fieldWhenClause = (field: Field, parent: IM...
75ab80dcd389e3db7e77a2d3ab53a098b668d3da
TypeScript
bgoonz/UsefulResourceRepo2.0
/_GENERAL/FIREBASE/notes/firebase-tools/src/test/extensions/askUserForConsent.spec.ts
2.53125
3
"use strict"; import * as _ from "lodash"; import * as clc from "cli-color"; import * as chai from "chai"; chai.use(require("chai-as-promised")); import * as sinon from "sinon"; import * as askUserForConsent from "../../extensions/askUserForConsent"; import * as iam from "../../gcp/iam"; import * as resolveSource fro...
ca09680c79fe39291bd59567f8d8c748b4cd57a2
TypeScript
destiaarti/inventoryCI
/assets/tinymce/src/core/main/ts/fmt/Preview.ts
2.515625
3
/** * Preview.js * * Released under LGPL License. * Copyright (c) 1999-2017 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ import DOMUtils from '../api/dom/DOMUtils'; import Tools from '../api/util/Tools'; import Schema from '....
337adb0062749fff5c6019309c7806c472b95abe
TypeScript
satriowinarendro/haloarlo.id
/src/lib/image.ts
2.609375
3
export function createSliderImageUrl(images: string[]){ return images.map((image) => { return { source: image } }) }
f2529998d353ec85cbbaf5fcd5a392b1449eb437
TypeScript
Dimi-Dun-Morogh/school-TS
/src/utils.ts
3.046875
3
const logger = { getTimeStamp: (): string => new Date().toISOString(), info(namespace: string, message: string, object?: any) { if (object) { console.log( `[${this.getTimeStamp()}] [INFO] [${namespace}] [${message}]`, object, ); } else { console.log( `[${this.getTim...
994f146076aef6a6da17e5b39c0c22449b7500a1
TypeScript
dolanmiu/docx
/src/file/table/table-width.ts
2.875
3
// http://officeopenxml.com/WPtableWidth.php import { NextAttributeComponent, XmlComponent } from "@file/xml-components"; import { measurementOrPercentValue, Percentage, UniversalMeasure } from "@util/values"; // <xsd:simpleType name="ST_TblWidth"> // <xsd:restriction base="xsd:string"> // <xsd:enumeration value...
7962d2e7b6f12f5e4de87c94d9eb07b200b084f3
TypeScript
JulianNymark/jcoin
/Block.ts
3.03125
3
import { Sha256 } from './sha256'; interface BlockContent { serial: number; previousHash: string; data: string; // ledger goes here guess: string; } export class Block { private content: BlockContent; constructor(content: BlockContent) { this.content = content; } public getRa...
baa17b91b04e1b38714e6b0254958d2e8cd66683
TypeScript
mimittqq/playground
/sort.ts
3.984375
4
/** * `冒泡排序法` * 原理是比较相邻的数, 前一个比后一个大就调换位置, 第一趟比较完后最后一个必定是最大的数 */ export function bubbleSort(arr) { const len = arr.length; for (let i = 1; i < len - 1; i++) { for (let j = 0; j < len - i; j++) { let prev = arr[j]; let next = arr[j+1]; if (prev > next) { [arr[j], arr[j+1]] = [arr[j+1]...
9098397932aa88ed1e1571c30be97b8a94efefb4
TypeScript
Ellesent/react-native-queue
/dist/Models/Worker.d.ts
3.25
3
/** * * Worker Model * */ export default class Worker { /** * * Singleton map of all worker functions assigned to queue. * */ static workers: {}; /** * * Assign a worker function to the queue. * * Worker will be called to execute jobs associated with jobName. ...
67c3ae92aabd107c3a1484e8bac4a7be5b2134d0
TypeScript
KcirePunk/angular-templated
/src/app/services/productos.service.ts
2.53125
3
import { Injectable, ɵConsole } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Producto } from '../interfaces/product.interfaces'; @Injectable({ providedIn: 'root' }) export class ProductosService { loading = true; producto: Producto[] = []; productoFiltrado: Producto[] = [...
e4ee4c7bbde97e78a49c2d383e3cc0b285460b39
TypeScript
keystonejs/keystone
/tests/api-tests/fields/types/fixtures/select/test-fixtures.ts
2.59375
3
import { select } from '@keystone-6/core/fields'; type MatrixValue = typeof testMatrix[number]; export const name = 'Select'; export const typeFunction = select; export const exampleValue = (matrixValue: MatrixValue) => matrixValue === 'enum' ? 'thinkmill' : matrixValue === 'string' ? 'a string' : 1; export const e...
f67fd7887eff077f3104030026ab90a95d629fa8
TypeScript
aohanhe/swallow3-web-admin
/src/views/components/data-dialog/data-dialog-mix.ts
2.703125
3
/** * 数据对话框 共用属性与操作 */ import { Prop, Vue, Component } from 'vue-property-decorator' import { objectCopy } from '@/libs/common-tools.js' import { DataDialogOperts, DataDialogMode } from '@/views/components/data-dialog/data-dialog-def' @Component({ components:{} }) export default class DataDialogMix extends Vue i...
a01bd4ccf5c44a467e600060cbec05918a74eb59
TypeScript
hallh/ngx-segment-analytics
/dist/ngx-segment-analytics.service.d.ts
2.8125
3
import { WindowWrapper } from './ngx-segment-analytics.module'; import { SegmentConfig } from './ngx-segment-analytics.config'; /** @dynamic */ export declare class SegmentService { private w; private doc; private config; /** * @param w Browser window * @param doc Browser DOM * @param con...
79132cf183be7fbb0e8b96c8f1ef27b408e98543
TypeScript
ghnz/react
/src/redux/reducers/layout.slice.reducer.ts
2.515625
3
import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import LayoutMode from '../../enums/LayoutMode'; type IState = { mode: LayoutMode }; const initialState: IState = { mode: LayoutMode.admin }; const layoutSlice = createSlice({ name: 'layout', initialState: initialState, reducers...
9e4d81f67a78955f0dc2050da17bb01ddeef3f54
TypeScript
valpr/adventofcode-2020
/src/day03/part02.ts
3.109375
3
import { readFileSync } from 'fs'; const input = readFileSync('./input.txt', 'utf-8').split('\n').map(line => line.trim()); const slopes = [[1, 1], [1, 3], [1, 5], [1, 7], [2, 1]];//index 0 is y, index 1 is x var treesMultiplied =1; for (var i = 0; i < slopes.length; i++){ var y = 0; var x = 0; var trees...
bda2d8ee97f5472316ffae30a494f5d696ee17a7
TypeScript
rlugojr/phosphor-di
/src/index.ts
3.078125
3
/*----------------------------------------------------------------------------- | Copyright (c) 2014-2015, PhosphorJS Contributors | | Distributed under the terms of the BSD 3-Clause License. | | The full license is in the file LICENSE, distributed with this software. |--------------------------------------------------...
47baae1a7e3d54aebe3e809a0d1226fbe59c5710
TypeScript
stockint/client
/src/Depth.ts
2.703125
3
import * as service from "./service" import { Level } from "./Level" export class Depth { constructor( readonly tick: number, readonly bids: ReadonlyArray<Level>, readonly asks: ReadonlyArray<Level>) { } static load(url: string): Promise<Depth> { return fetch(url).then(async response => await response.json(...
333c4405b6f554307969497867fa0265a0d79163
TypeScript
calebjmatthews/NewSummer
/client/models/seed/adjective.ts
2.921875
3
export default class Adjective implements AdjectiveInterface { word: string; extent: number; constructor(adjective: AdjectiveInterface) { Object.assign(this, adjective); } } interface AdjectiveInterface { word: string; extent: number; }
7f3408c5e0383e3c83a4801801ac392babadead7
TypeScript
lemonmade/quilt
/packages/react-html/source/hooks/viewport.ts
2.9375
3
import {useDomEffect} from './dom-effect.ts'; interface Options { /** * Whether the viewport should cover any physical “notches” of the * user’s device. * * @default true */ cover?: boolean; } /** * Adds a `viewport` `<meta>` tag to the `<head>` of the document. * The viewport directive sets a go...
47774d641d67c29b685b0ba935ec3e36fdf42e6e
TypeScript
jclee/winter_ts
/src/winter/obstacle.ts
2.921875
3
import { Caption } from "./caption.js" import { Entity } from "./entity.js" import { PyEngine, Sprite } from "./winter.js" class Obstacle extends Entity { public flagName: string constructor( engineRef: PyEngine, sprite: Sprite, anim: {[key: string]: [[number, number][][], boolean]} = ...
9a02f2d5dc7999f77cdf628ed1c832ee5ae36799
TypeScript
mayanktechno/angularkudvenkat
/src/app/employee/employee.component.ts
2.515625
3
import { Component, OnInit } from '@angular/core'; import { Employee } from '../model/employeeinterface' // import {EmployeeData} from '../employeedata' import { EmployeeService } from './employee.service'; @Component({ selector: 'app-employee', templateUrl: './employee.component.html', styleUrls: ['./employee.co...
1c2c7c82cfca49dc6721d6700d2b52dcebf02293
TypeScript
MostlyArmless/advent-of-code-2020
/src/problem4.ts
3.0625
3
import { inRange } from "./tools"; const validEyeColors: Set<string> = new Set( [ 'amb', 'blu', 'brn', 'gry', 'grn', 'hzl', 'oth' ] ); class Passport { birthYear: string; issueYear: string; expirationYear: string; height: string; hairColor: string; eyeColor: string;...
ff27ba72ac25ea77b3ba14c15f5df3f1a9a712db
TypeScript
linningmii/react-dag-editor
/packages/ReactDagEditor/src/controllers/TwoFingerHandler.ts
2.703125
3
import * as React from "react"; import { GraphCanvasEvent } from "../models/event"; import { IContainerRect } from "../models/geometry"; import { distance, getContainerCenter } from "../utils"; import { EventChannel } from "../utils/eventChannel"; import { ITouchHandler } from "./TouchController"; /** * debug helpers...
b38d54d1eb8817351c33724b15777acd672c1064
TypeScript
rikshot/testbed
/src/ts/Fractal/Config.ts
2.75
3
import { IRectangle, Rectangle } from 'Sandbox/Rectangle.js'; export interface IConfig { iterations: number; red: number; green: number; blue: number; rectangle: IRectangle; } export class Config { public readonly iterations: number; public readonly red: number; public readonly green:...
c35d941b1093865882fbe70c7b6b52777f317dd8
TypeScript
shahedbd/TypeScriptBasic
/04Function/ArrowFunctions.ts
3.6875
4
// Arrow functions are always anonymous and turn: // (parameters) => {expression} // Named function function add(x, y) { return x + y; } // Call named function console.log(add(5, 10)); var add2 = (x, y) => x + y; console.log(add2(5, 10));
df8f28f2d40417536fd1c8ce1973bd3e9510260e
TypeScript
kenrick95/luxord
/src/timer/switchTimer.test.ts
2.78125
3
import SwitchTimer, { TIMER_ID } from './switchTimer'; const alertSpy = jest .spyOn(window, 'alert') .mockImplementation((...args) => console.info.apply(null, args)); let switchTimer: SwitchTimer; const timerAmount = 1000; const now = performance.now(); const _realPerformanceNow = performance.now; f...
1d691f7f6c54977cb1669b59d4e09f0804b93d4b
TypeScript
daxingyou/H601_CrazyTapHero
/H6017_Code_Client/trunk/GuLongQunXiaZhuan_EUI/src/Model/DataLocal/ShopData.ts
2.53125
3
module Model{ /** * * @author cai_haotian * @Date 2016.2.26 * */ export class ShopData { public constructor(_dy:Model.ShopDyModel,_st:Model.ShopStModel) { this.dy = _dy; this.st = _st; } /** * @商城动态数据 */ public dy:Model.ShopDy...
483cb228e4fe956a095b33054c92a1eda33fbbc2
TypeScript
bzf/glimmer-todo
/src/ui/components/glimmer-todo/component.ts
3.125
3
import Component, { tracked } from "@glimmer/component"; interface TodoItem { title: string; checked: boolean; } enum Filter { Checked, Unchecked, }; type Order = "asc" | "desc"; export default class GlimmerBzf extends Component { @tracked order: Order = "asc"; @tracked showOnlyUnchecked: boolean = fals...
6812d81fefdc1a118ba89202413baba543d2094c
TypeScript
ayuayue/ts-study
/interface/interface.ts
4.78125
5
// 接口 interface person { name: string, age: number, say: () => string } // 实现 person let lili: person = { name: "lili", age: 14, say: () => { return "i am lili"; } }; console.log(lili.name, lili.age, lili.say()); // 联合类型和接口 interface unionInterface { name: string; say: st...
45c3b52d83e3cbbf150a6fe57dba493f09d76afc
TypeScript
yp2005/BWAnimationU5
/src/MulTouch/MulTouchMain.ts
2.59375
3
// 游戏主界面 class MulTouchMain extends ui.MulTouchUI { private configView: MTConfigView; // 配置页 public speed: number = 0; // 转速 public mustStop: boolean = false; constructor() { super(); this.configView = new MTConfigView(this.configBox); this.tip.visible = false; this.set...
857af084eb0348b83eaf9ae0c1eb7aa5158f52a2
TypeScript
DoTriDucBK/DATN_API
/giasu_api/app/utils/Validate.ts
2.53125
3
export const Utils = { checkLogin(params) { if (!params) return false; if (!(params.user_acc_emai && params.user_acc_pass)) return false return true }, checkKeysNotExists(obj: object, keys: string[]) { if (Array.isArray(keys)) { for (let i = 0; i < keys.length; i+...
652624a512a8ee750ad89a7b9ad42f213dd8ec9f
TypeScript
r2moon/arCore
/test/general/BalanceExpireTracker.test.ts
2.5625
3
import { expect } from "chai"; import { ethers } from "hardhat"; import { Contract, Signer, BigNumber, constants } from "ethers"; import { getTimestamp, increase } from "../utils"; let step = BigNumber.from("259200"); function getBucket(expire: BigNumber) : BigNumber { return (expire.div(step)).mul(step); } describe(...
411d4edd85bf82ceec06e1d4c0c7e5224c0d340c
TypeScript
manonet/typing
/src/reducers/focusUserInput.ts
2.84375
3
import { FocusUserInputAction } from '../actions/index'; export type FocusUserInputState = { isUserInputFocused: boolean; }; const initialState: FocusUserInputState = { isUserInputFocused: false, }; export default function focusUserInputReducer( state: FocusUserInputState = initialState, action: FocusUserInpu...
262525cee98a9156d1b2be35726af5ac00384f6e
TypeScript
flocasts/flagpole
/src/flagpole.ts
2.90625
3
import { Suite } from "./suite/suite"; export class Flagpole { public static suites: Suite[] = []; /** * Create a new suite * * @param {string} title * @returns {Suite} * @constructor */ static suite = Flagpole.Suite; static Suite(title: string, callback?: (suite: Suite) => any): Suite { ...
322280f213ac08987a676421a75841068117bbf9
TypeScript
dolthead/topzee
/src/app/services/scoring.service.spec.ts
2.90625
3
import { TestBed } from '@angular/core/testing'; import { ScoringService } from './scoring.service'; import { Die } from '../models/die.model'; const getDice = ([d1, d2, d3, d4, d5]: number[]): Die[] => { return [ { pips: d1, locked: false }, { pips: d2, locked: false }, { pips: d3, locked: false }, ...
9e297c57f3e57c2854d04ff339069ca24e392e80
TypeScript
sushmitha007/angular-learning-unit2
/Lesson2.5.ts
3.15625
3
var a:number =1; var b:number= 2; if(a > b){ console.log("a is more than b") } else{ console.log("b is more than a") }
44d852d06a7ac0f668938ca0a893712369278b72
TypeScript
Holyoneqt/Revolution-Champion
/src/entities/player/Player.ts
3.03125
3
import { QuestDifficulty } from './../../quests/QuestDifficulty'; import * as ko from 'knockout'; import { Entity } from './../Entity'; import { Monster } from './../Monster'; import { Item } from './../../items/Item'; import { Backpack } from './features/Backpack'; import { Quest } from './../../quests/Quest'; import ...
2105fa9e6edfff28335e2fec353978e9c577b407
TypeScript
luizaprata/QuizTime
/src/modules/quiz/types/Quiz.types.ts
2.640625
3
export type DifficultyScore = { hits: number; errors: number }; export interface IWorkspace { id: number; name: string; scores: Realm.Results<IScore>; } export interface IScore { id: number; difficulty: string; hits: number; errors: number; workspace: IWorkspace; }
10b740b86b9469792cdead0d18ffd988689c4b68
TypeScript
tuanzijiang/pizza
/pizza-consumer-web/src/utils/log.ts
2.765625
3
export const info = (tag: string, ...params: any) => { if (process.env.NODE_ENV === 'development') { console.info(`[${tag}]:`, ...params); } }; export const warn = (tag: string, extraInfo: string, ...params: any) => { console.warn(`[${tag}]:${extraInfo}`, ...params); }; export const error = (tag: string, ex...
2414878197c9f83bf564c94b643ed342755a5fe6
TypeScript
chkt/xyzw-rgba
/source/lch.ts
2.65625
3
import { CSS4_ALPHA, CSS4_DELIM, CSS_MAX_DECIMALS, CssLchString, CssOptions, UINT8_TO_PCT, UINT8_TO_UNIT, UNIT_TO_PCT, createNumberOrPercentParser, cssDefaults, cssPrecision, parseCssAlpha, parseCssAngle, parseCssLabLightness } from './parse'; import { align, angle, angleUnit, clamp, interval, toFixed } f...
abb97df513dee1d0bcc0cd2f98b4ec695d310dce
TypeScript
amsdams/your-first-app
/src/app/in-memory-data.service.ts
2.875
3
import { InMemoryDbService } from 'angular-in-memory-web-api'; import { Injectable } from '@angular/core'; import { Product } from './models/models'; @Injectable({ providedIn: 'root', }) export class InMemoryDataService implements InMemoryDbService { createDb() { const products = [ { id: 0, ...
17a8abde329c0f6837b9e99b9ca379c732606cd0
TypeScript
gareththegeek/doom
/doom/src/collisions/lineCollisionResponse.ts
2.640625
3
import { ReadonlyVec2, vec2 } from 'gl-matrix' import { pointIsLeftOfLine } from '../maths/findLineSideForPoint' import { projectPositionOntoLine } from '../maths/projectVectorOntoVector' let v = vec2.create() const getLineNormal = (pout: vec2, start: ReadonlyVec2, end: ReadonlyVec2, side: ReadonlyVec2): void => { ...
e7204b697d48780ca2731a8308fcd547e0cd5803
TypeScript
sijujacobs/impetus_angular7
/src/app/reducers/product.reducer.ts
2.78125
3
import { Action } from "@ngrx/store"; import { IProduct } from "../models/product.model"; import * as ProductActions from "../actions/product.actions"; const initialState: IProduct = { name: "MyProduct", brand: "MyBrand", url: "https://www.google.com/" }; export function productReducer( state: IProduct[] = [i...
8384dd2dea4c2ce7385af0676b5ddebb6db6d52d
TypeScript
ClaudiaFeliciano/Arrow-6
/Scripts/objects/meteor.ts
2.765625
3
module objects { export class Meteor extends objects.AbstractGameObject { // private instance variables private _verticalSpeed: number; private _horizontalSpeed: number; // public properties // constructor constructor() { super("meteor"); this.Start(); } // private metho...
6971dfbcb37eb92a8ea913f3c70429df1782ead0
TypeScript
32bitkid/sci.js
/libs/sci0/src/view.ts
2.65625
3
import { Cel } from '@4bitlabs/screen'; import { repeat } from './repeat'; import { parseCel } from './cel'; export interface ViewGroup { frames: Cel<4>[]; isMirrored: boolean; } export const parseFrom = (source: Uint8Array): ViewGroup[] => { const view = new DataView( source.buffer, source.byteOffset, ...
7c43fd868e9e7c6561b68076c55ed4e49bbf3d61
TypeScript
bjabinn/HealthCheckWcf
/service-chart/src/app/app.component.ts
2.515625
3
import { Component } from '@angular/core'; import { DataService } from './services/data.service'; import { Services } from './models/services'; import { Observable } from 'rxjs'; import { Service } from './models/service'; import { element } from '@angular/core/src/render3'; @Component({ selector: 'app-root', temp...
2e381b71c042821630129c76a847d3ae97293e20
TypeScript
innogames/grpc-web
/test/ts/src/ChunkParser.spec.ts
2.5625
3
import {assert} from "chai"; import {decodeASCII} from "../../../ts/src/ChunkParser"; describe("ChunkParser", () => { describe("decodeASCII", () => { function asciiToBinary(src: string): Uint8Array { const ret = new Uint8Array(src.length); for (let i = 0; i !== src.length; ++i) { ret[i] = src...
1e34ac5ae2839456bc14f24fd7dfc27c0e43f404
TypeScript
krawaller/algol5
/modules/common/utils/possibilities.test.ts
3.171875
3
import { possibilities } from ".."; import { AlgolIfableExpressionAnon } from "../../types"; type PossTest<_T> = { expr: AlgolIfableExpressionAnon<_T>; poss: AlgolIfableExpressionAnon<_T>[]; player?: 0 | 1 | 2; action?: string; ruleset?: string; }; const possTests: PossTest< "FOO" | "BAR" | "BAZ" | "BIN" ...
232bfd27329a783817abb790fc2fd144122affa2
TypeScript
tomekkleszcz/redux-saga-promise-actions
/example/src/actions/auth.ts
2.5625
3
//Action creators import {createPromiseAction} from '../../../dist'; //Replace with redux-saga-promise-actions //Types import {Credentials, TokenPair} from '../types/auth'; /** * signIn promise action declaration * If you want payload to be empty in any stage declare it as undefined. * @type {PromiseActionSet<'SIG...
265132678fae7180d772023f12ffa8abf1290d60
TypeScript
kyle-mccarthy/personal-v1
/src/api/auth/auth.service.ts
2.671875
3
import { Injectable } from '@nestjs/common'; import { JwtService } from '@nestjs/jwt'; import { User } from '@src/api/user/user.entity'; import { UserService } from '@src/api/user/user.service'; import { DecodedPayload } from './dto/decoded-jwt'; import { JwtPayload } from './dto/jwt-payload'; @Injectable() export cl...
a285413d62241cd51fdb219986217d96838e0ed2
TypeScript
samlbest/kitten.js
/src/sprites/imageSprite.ts
2.78125
3
import Sprite from "../graphics/sprite"; import SpriteOptions from "../graphics/spriteOptions"; export default class ImageSprite extends Sprite { constructor(private imagePath: string, spriteOptions: SpriteOptions) { super(spriteOptions); } render(): void { let img = new Image(); img.src = this.imag...
32430d7ca38d6971959b0f16afd8eb118ba55232
TypeScript
staydecent/plugins
/packages/alias/src/index.ts
2.625
3
import { platform } from 'os'; import { PartialResolvedId, Plugin } from 'rollup'; import slash from 'slash'; import { Alias, ResolverFunction, RollupAliasOptions } from '../types'; const VOLUME = /^([A-Z]:)/i; const IS_WINDOWS = platform() === 'win32'; // Helper functions const noop = () => null; function matches(...
a0860681eef6fae5ddab78ba15e9ec216a486dec
TypeScript
muadjb/ReactPeopleFilter
/src/utils/utils.ts
2.890625
3
import { anyPass, isNil, isEmpty } from 'ramda' function unique<T>(xs: ReadonlyArray<T>): ReadonlyArray<T> { return [...new Set(xs)] } const prop = <T, P extends keyof T>(p: P) => (x: T): T[P] => x[p] export function uniqueProps<T, P extends keyof T>(p: P, xs: ReadonlyArray<T>): ReadonlyArray<T[P]> { re...
5a78279aa164045dac4ab79568bb749020b6ab66
TypeScript
eordano/webb
/utils/scene/validation.ts
2.609375
3
import { isArray, isNumber } from 'util' import { AssetDefinition, AssetTagDefinition, ReferenceSystem, CoordinateDefinition, Coordinate, SpawnPointDefinition, Vector3Range, NumberOrRange, Range2, YRotation, UnsanitizedSceneManifest } from './SceneManifestTypes' import { Vector3 } from '../Vector'...
1ea9eeea80068e8a5047f6f2afca52ec04795824
TypeScript
bleshik/blinsky
/src/IdentifiedEntity.ts
2.78125
3
import { is } from 'immutable'; import { CloneWith } from './CloneWith'; import { EqualsHashCode } from './EqualsHashCode'; const hashIt = require('hash-it'); export abstract class IdentifiedEntity<K> extends CloneWith implements EqualsHashCode { readonly id: K; equals(other: any): boolean { return ...
07a8c169fb7b6151bb1145b8e873bcf3228cbda3
TypeScript
wilfoz/web-vpo
/src/app/store/budget-store.ts
2.515625
3
import { Injectable } from '@angular/core'; import { Budget } from '../models/budget'; import { Store } from './store'; import { Context } from '../models/context'; import { Category } from '../models/category'; export class BudgetState { currentBudget?: Budget; totalAvaliable: number; } @Injectable() export clas...
57f19dc5bd8b3e00bd527800e39320516ed4db7e
TypeScript
Leila-karimi/moviehub
/movieHub/src/app/components/shared/groupby.pipe.ts
2.609375
3
import { Pipe, PipeTransform } from '@angular/core'; import { Actor } from '../../models/actor.model' @Pipe({name: 'groupBy'}) export class GroupByPipe implements PipeTransform { transform(value: Array<Actor>, field:string): Array<any> { console.log('field', field) if (value) { const groupedObj = val...
e6c220ede4043aeeebb65112c0220e0a5ab6c16c
TypeScript
zbicin/mindbreaker-phonegap
/src/states/State.ts
2.703125
3
import { StateContext } from './StateContext'; import { UILabel, UIButton, UIElement, UIBitmapLabel, UIBitmapButton } from '../ui'; export abstract class State { public bitmaps: Array<UIBitmapLabel>; public bitmapButtons: Array<UIBitmapButton>; public buttons: Array<UIButton>; public labels: Array<UILa...
91154f4f4b624a21b0203786f1e0613fad804f9b
TypeScript
VaIcorn/Sequelize-Typescript-Example
/controller/util/log.controller.ts
3.265625
3
import * as log4js from 'log4js'; import * as path from 'path'; enum Severity { info, warn, error, debug } export class LogController { private static log: log4js.Logger; /** * Logs an Info-Message to Console * Disabled in Productionmode * @param message The Message that is alw...
3544bf9e2806f2791ced6908176f23fc7a24b86d
TypeScript
dandevs/pipe-x
/src/finishStrategy.ts
3.03125
3
import { noop } from "./utils"; const immediateStrategy: FinishStrategy = () => ({ push: noop, pop: noop, canFinish: true, }); const counterStrategy: FinishStrategy<{counter: number}> = () => ({ counter: 0, get canFinish() { return this.counter <= 0; }, push() { this.counter++; }, pop() { this.cou...
3585433a3f0cd7152efbc34940e0789f9a27ac42
TypeScript
stefanondisponibile/EventStore-Client-NodeJS
/src/events/binaryEvent.ts
2.921875
3
import { v4 as uuid } from "uuid"; import { convertMetadata } from "./convertMetadata"; import { MetadataType } from "./types"; export interface BinaryEventData< Type extends string = string, Metadata extends MetadataType = MetadataType > { id: string; contentType: "application/octet-stream"; type: Type; d...
8885ccb17f60886918dbe5a6cbdcba1c5b5bbb84
TypeScript
lolo1208/cocos2dx-lolo
/src/lolo/utils/Timer.ts
2.9375
3
namespace lolo { /** * 基于帧频的定时器 * 解决丢帧和加速的情况 * @author LOLO */ export class Timer { /**可移除标记的最大次数*/ private static MAX_REMOVE_MARK: number = 5; /**定时器列表(以delay为key, _list[delay] = { list:已启动的定时器列表, removeMark:被标记了可以移除的次数 } )*/ private static _list: Object =...
ff79af8611b92373cc477dcabe545fec07aaee9d
TypeScript
lorenadl/angular4_examples
/typescript/main.ts
4.21875
4
let a: number = 10; // definisce variabile con tipo let b: string = 'Pippo'; // a='pippo'; // errore console.log(a); console.log(b); // arrow function //let log = (msg: string): void => console.log(msg); let log = (msg: string = 'this is the default'): void => console.log(msg); function sum(a: number, b: number):...
a1568f84a7e04c582bd51313d984153e9c87207a
TypeScript
zhaojieyuan/snake
/src/world.ts
3.109375
3
import Point from './point'; import Player from './player'; import beep from './sound'; import { Screen } from './screens'; export interface IWorld { screen: Screen; player: Player; width: number; height: number; food: Point; } const data: IWorld = { screen: Screen.INTRO, player: null, width: 0, height: 0, f...
8634ea8ac31ed201a0ce61a62c01e3d509ba75d1
TypeScript
jenisgadhiya/nestjs-task-app
/src/auth/auth.service.ts
2.578125
3
import { Injectable, UnauthorizedException, Logger } from '@nestjs/common'; import { Userrepository } from './user.repository'; import { InjectRepository } from '@nestjs/typeorm'; import { Usercredentioaldto } from './dto/user-credentioal.dto'; import { JwtService } from '@nestjs/jwt'; import { jwtpayload } from './jwt...
af265c91a7d451d54690d87a3bb1bf9c6b756e8d
TypeScript
IvanBatsin/advanced_jwt_auth
/server/services/userService.ts
2.546875
3
import { UserModel, UserModelDocument } from '../models/User'; import bcrypt from 'bcrypt'; import * as uuid from 'uuid'; import { mailService } from './mailSevice'; import { tokenService } from './tokenService'; import { UserDto } from '../dtos/userDto'; import { ApiError } from '../exeptions/apiError'; type UserServ...
8c4006b036ea42adcbaa59bcf14fad0d4dee62e5
TypeScript
lianghowe/zilswap-webapp
/src/app/utils/hexToRGB.ts
2.921875
3
const hexToRGB = (hex: string): number[] => { let array = hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i , (m, r, g, b) => '#' + r + r + g + g + b + b) .substring(1).match(/.{2}/g) if (array) return array.map(x => parseInt(x, 16)) return [0, 0, 0]; }; export default hexToRGB;
0cb3b943779368944f875001f67862666535738a
TypeScript
helmetjs/helmet
/middlewares/referrer-policy/index.ts
2.890625
3
import type { IncomingMessage, ServerResponse } from "http"; type ReferrerPolicyToken = | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | ""; export interface ReferrerPolicyOpt...
73b22a7c8e6be5201cce2f79d2657a6bf5f889e1
TypeScript
vipe4ka-visko4ka/nest-starter-kit
/src/auth/auth.dto.ts
3.109375
3
import { ValidatorConstraint, ValidatorConstraintInterface, IsEmail, IsString, MinLength, Validate } from 'class-validator'; @ValidatorConstraint({ name: 'password', async: false }) export class PasswordValidation implements ValidatorConstraintInterface { public validate(text: string): boolean ...
1637ca57de340492c59ac9585eafada3970806be
TypeScript
sergeykurilov/MernAuthTS
/backend/middlewares/auth.ts
2.59375
3
import {NextFunction} from "express"; const jwt = require('jsonwebtoken') const User = require('../models/User') const ErrorResponse = require('../utils/ErrorResponse') type AuthorizedRequest = Express.Request & { user: any, headers: { authorization: string } }; exports.protect = async function (req: AuthorizedReque...
b564e9893717598daecfaf2126f9a959f5bcebd7
TypeScript
dimakovalevskyi/chord-editor
/src/app/song.ts
2.6875
3
export interface Song { name: string; author: string; lyrics: Lyrics; } export interface Chord { name: string; offset: number; } export interface Lyrics extends Array<any> { [index: number]: LyricsRow; } export interface LyricsRow { text: string; chords: Array<Chord>; }
c0a6bf3a52ba72014eef420e1e0c0963fdec0833
TypeScript
dzucconi/boredom-client
/src/lib/shuffle.ts
3.453125
3
export const shuffle = <T>(xs: T[]): T[] => { const shuffled = []; const array = xs; while (array.length !== 0) { const randomIndex = Math.floor(array.length * Math.random()); shuffled.push(array[randomIndex]); array.splice(randomIndex, 1); } return shuffled; };
32fced9f195e9f0a61597b1da42ee3efd85d14fd
TypeScript
AbedBadr/TypeScript-Collect-Words
/src/js/index.ts
3.0625
3
let words: string[] = []; let inputElement: HTMLInputElement = <HTMLInputElement>document.getElementById("wordInput"); let showButton: HTMLButtonElement = <HTMLButtonElement>document.getElementById("showButton"); showButton.addEventListener("click", showWords); let saveButton: HTMLButtonElement = <HTMLButtonElement>do...
532dbefd44925ac9764314f071903065b0d141c4
TypeScript
PattonHoffiman/green-house-back-end
/src/modules/plants/services/__tests__/UpdatePlantService.spec.ts
2.5625
3
import 'reflect-metadata'; import { addDays, format } from 'date-fns'; import AppError from '@shared/errors/AppError'; import FakeCacheProvider from '@shared/container/providers/CacheProvider/fakes/FakeCacheProvider'; import UpdatePlantService from '../UpdatePlantService'; import FakePlantsRepository from '../../repos...
72fa89a6eb1f042f2102cdc61f061341f85411c4
TypeScript
Polycapa/angular-migration-tool
/src/analysers/bracket-matcher.ts
3.703125
4
export class BracketMatcher { match(text: string, char: string, index: number): number { let count = 0; let i: number; for (i = index; i < text.length; i++) { if (text.charAt(i) === char) { count++; } else if (text.charAt(i) === this.matchingChar(char)) { count--; } ...
caf5be118ced2c9cf5694f4d95de72b3e48e85e9
TypeScript
cyberixae/generator-example
/src/zomg5.ts
2.796875
3
import { State, Fib, initialState, step, fromState, defaultAmount } from './zomg' function* fibonacci(): Generator<Fib, void, undefined> { let state: State = initialState while(true) { yield fromState(state) state = step(state) } } type GF<A> = () => Generator<A, void, undefined> functi...
4f361b8d0967bba9d105578ad15df01ca035f6ad
TypeScript
erento/nestjs-modules
/modules/common/src/pipes/boolean-validation.pipe.test.ts
2.609375
3
import {BooleanValidationPipe} from './boolean-validation.pipe'; describe('BooleanValidationPipe', (): void => { let pipe: BooleanValidationPipe; beforeEach((): void => { pipe = new BooleanValidationPipe(); }); test.each<[string | undefined, boolean | undefined]>([ ['true', true], ...
ab19c3fd8afc3c7f8dc2311526911f3e8ecd57ab
TypeScript
tycoon69-labs/mobile-wallet
/src/app/auth/shared/auth.service.spec.ts
2.53125
3
import { fakeAsync, tick } from "@angular/core/testing"; import { createServiceFactory, SpectatorService } from "@ngneat/spectator"; import { of } from "rxjs"; import { tap } from "rxjs/operators"; import { StorageProvider } from "@/services/storage/storage"; import { AuthConfig } from "./auth.config"; import { AuthS...
4aee3dca1cdcf38304e4721408d250cbba045c4d
TypeScript
brown-qs/PREACT.andranik-isma
/src/utils/parse-storage-get.ts
2.65625
3
/************************************************************************ * LOCALSTORAGE CACHES USER'S INFORMATION AND USE IT ON LATER SIGN-INS. * * THIS UTIL FUNCTION IS USED TO GET CERTAIN VALUE FROM STORAGE. * ************************************************************************/ export default functio...
44f54355545816f6dd465789ba0c85958fd00938
TypeScript
undecidedapollo/pylot-flow
/src/operators/flatMap/index.ts
3.03125
3
import { NOOP_PASSTHROUGH, hasOrIsIterator, } from "../../shared"; export type FlatMapPredicate = (val: any, i?: number) => any; export default function flatMap(predicate : FlatMapPredicate = NOOP_PASSTHROUGH) { return function* flatMapGenerator(iterator) { let index = 0; for (const val of...
93d67c1fa93a901f56474e1cd01de08eb05832be
TypeScript
Marceau38/generator-jhipster
/app/src/main/webapp/app/shared/model/address.model.ts
2.59375
3
import { ICustomer } from 'app/shared/model/customer.model'; export interface IAddress { id?: number; address1?: string; address2?: string; city?: string; postcode?: string; country?: string; customer?: ICustomer; } export class Address implements IAddress { constructor( public id?: number, pu...
4bfb3e1854bcfb242362dcefb77435e3f0d988cd
TypeScript
aykhanhuseyn/moberries
/src/util/requestHandler.ts
2.703125
3
import axios from 'axios'; export default async function requestHandler( func: Function, params: any[], showError: boolean = true ): Promise<any> { return new Promise(async (resolve, reject) => { try { const { data } = await func(...params); return resolve(data); } catch (e) { let erro...
72dcea7196d0117b151403615d8d9e33b5aa60e0
TypeScript
Torres-ssf/rent-car-api
/src/shared/utils/deleteMultipleFiles.ts
2.59375
3
import fs from 'fs'; export const deleteMultipleFiles = async ( filePaths: string[], ): Promise<unknown> => { return filePaths.map(async filePath => { try { await fs.promises.stat(filePath); } catch { return; } await fs.promises.unlink(filePath); }); };
0b8af3741656e2c606b24f8d76c69fd1685cc511
TypeScript
PoEManager/Backend-Server
/app/server/middleware/request-id.ts
2.796875
3
import winston from 'winston'; import User from '../../model/user'; import MiddlewareFunction from './middleware-function'; /** * Generates an ID for each request in order to track them. * Stores the ID in `req.locals.requestId`. * * @returns The middleware function. */ function makeRequestId(): MiddlewareFunctio...
2d386d6fc3fa40265cb4488b02a4ce1574dc2a02
TypeScript
enterstudio/brackets-git
/src/node/processUtils-test.ts
2.546875
3
/* eslint no-console:0 */ /* eslint-env node */ import * as ProcessUtils from "./process-utils"; /* var pid = 5064; ProcessUtils.getChildrenOfPid(pid, function (err, children) { console.log(children); children.push(pid); children.forEach(function (pid) { ProcessUtils.killSingleProcess(pid); ...
3c76f050decde20c1a6642d2a01781434f3aa889
TypeScript
Stanislav1975/sourcegraph
/shared/src/api/client/services/notifications.ts
2.9375
3
import { Observable, Subject } from 'rxjs' import * as sourcegraph from 'sourcegraph' /** * The type of a notification. * This is needed because if sourcegraph.NotificationType enum values are referenced, * the `sourcegraph` module import at the top of the file is emitted in the generated code. */ export const Not...
38860e8096f1a631c878cd4b0ba275fdd7d482ca
TypeScript
iceycc/daydayup
/设计模式design/3.priciple/1.openclose.ts
3.890625
4
/** * 开放封装原则 对修改关闭,对扩展开放 */ class Customer { constructor(public rank: string) { } } class Product { constructor(public name: string, public price: number) { } //不同的顾客有不同的等级,普通会员 VIP会员 普通顾客,不同的等级打折不一样 cost(customer: Customer) { switch (customer.rank) { case 'member': ...
592078fc53ea984e8d5b9d98bd8f01f1c643610e
TypeScript
aem-design/aemdesign-aem-support
/aemdesign-aem-compose/src/core/js/modules/binder.ts
2.5625
3
import { isAuthorMode } from '@/core/utility/aem' /** * Vue.js components! * * @param {boolean} [force=false] Should the component be forced to load? * @return {Promoise<number>} Number of Vue components that exist */ export async function bindVueComponents(force = false): Promise<number> { const vueElements = ...
07129b8e7664ca3b298382c258861ad3c1063c9e
TypeScript
korobochka/heisenbug-protractor
/demo_ng4/app/app.component.ts
2.609375
3
import { Component } from '@angular/core'; import { Observable } from 'rxjs'; export class NickName { timestamp: Date; nick: string; age: number; result: string; } @Component({ selector: 'names', template: ` <form class="form-inline"> <input [(ngModel)]="nick" type="text" placehold...
ab0077eaad4ac8e43fc321df9fb86a8f974389fe
TypeScript
yasu-s/ng-cli-sample
/src/app/ext/log.interceptor.ts
2.578125
3
import { Injectable } from '@angular/core'; import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; import { tap } from 'rxjs/operators'; /** * */ @Injectable() export class LogInterceptor implements HttpInterceptor { /** ...
6f4587c966e2aba0a0a99899508530cba8245a17
TypeScript
nguyer/aws-sdk-js-v3
/clients/browser/client-fsx-browser/types/BackupRestoring.ts
2.75
3
import { ServiceException as __ServiceException__ } from "@aws-sdk/types"; /** * <p>You can't delete a backup while it's being used to restore a file system.</p> */ export interface BackupRestoring extends __ServiceException__<_BackupRestoringDetails> { name: "BackupRestoring"; } export interface _BackupRestori...
c350849b1ccd7528f67e6b9e13b6f5d80433a216
TypeScript
rashiop/udra-library-api
/src/resources/book/book.type.ts
2.53125
3
import { Document, Model, Types } from 'mongoose'; enum ActiveStatus { A = 'active', D = 'deleted' } interface IBook { title: string; description: string; active_status: ActiveStatus; authors: Types.ObjectId[]; genres: Types.ObjectId[]; publisher: Types.ObjectId; created_by: Types.ObjectId; updated...
fdf4a24d2c72ea3d26369d595533a789d36b55cb
TypeScript
soketi/echo-server
/src/stats/stats-driver.ts
2.9375
3
import { App } from './../app'; export interface StatsDriver { /** * Mark in the stats a new connection. * Returns a number within a promise. */ markNewConnection(app: App): Promise<number>; /** * Mark in the stats a socket disconnection. * Returns a number within a promise. ...
7d270ee5a6123233df399a3fd35ea07b0e863058
TypeScript
glimmerjs/glimmer-vm
/packages/@glimmer/manager/lib/public/template.ts
2.859375
3
import type { TemplateFactory } from "@glimmer/interfaces"; import { debugToString } from '@glimmer/util'; const TEMPLATES: WeakMap<object, TemplateFactory> = new WeakMap(); const getPrototypeOf = Object.getPrototypeOf; export function setComponentTemplate(factory: TemplateFactory, obj: object) { if ( import.m...