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 |
|---|---|---|---|---|---|---|
930997c02a20093484160af46a09b8dd5fffe09b | TypeScript | bc-krishsenthilraj/checkout-sdk-js | /src/coupon/map-to-internal-coupon.ts | 2.625 | 3 | import Coupon from './coupon';
import InternalCoupon from './internal-coupon';
const couponTypes = [
'per_item_discount',
'percentage_discount',
'per_total_discount',
'shipping_discount',
'free_shipping',
];
export default function mapToInternalCoupon(coupon: Coupon): InternalCoupon {
return {... |
e9aea511d58bc36a141a5f1d22949c08aa83af89 | TypeScript | fabiolarobles1/los-reyes-de-la-punta-backend | /src/entities/students.entity.ts | 2.6875 | 3 | import { Exclude } from 'class-transformer/decorators';
import { Entity, Column, PrimaryGeneratedColumn, BeforeInsert } from 'typeorm';
import * as bcrypt from 'bcrypt';
import { classToPlain } from 'class-transformer';
import { StudentResponseInterface } from '../students/interfaces/student.response.interface';
@Enti... |
091597c8790bab76f2c4e6b55e16b77d0043755f | TypeScript | codeVirtuoso21/MySolutions-codesignal | /!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!/V/variable-name/index.ts | 2.640625 | 3 | export function variableName(name: string): boolean {
return /^[a-z_][a-z_0-9]*$/i.test(name);
}
|
afe11e98ac0ef00f63ffb3330506e639e6c1401b | TypeScript | tomtiao/TodoList-frontend | /src/util/TodoRequest.ts | 2.78125 | 3 | import { Todo, TodoPartial } from '../Todo/Todo'
import { InvalidRequestError, NetworkError, NotFoundError } from '../util/AppMessage'
const TODO_API = '/todo'
async function getTodos (mode: 'all' | 'keyword' = 'all', kw?: string): Promise<Todo[]> {
let requestURL = `${TODO_API}`
if (mode === 'all') {
requestU... |
dde8a0478fa9720e71ad2939f17aeab6f2b07199 | TypeScript | satanTime/ng-mocks | /libs/ng-mocks/src/lib/mock-helper/mock-helper.stub-member.ts | 2.578125 | 3 | import helperExtractPropertyDescriptor from '../mock-service/helper.extract-property-descriptor';
export default <T extends object>(
instance: T & { __ngMocks__source?: object },
key: any,
value: any,
encapsulation?: 'get' | 'set',
): any => {
const def = helperExtractPropertyDescriptor(instance, key) ?? {};... |
af8de1413d6a0def9532949fa6ee037d68385cb1 | TypeScript | mohitbagra/azure-devops-extensions | /src/Common/ServiceWrappers/HostPageLayoutService.ts | 2.515625 | 3 | import {
CommonServiceIds,
IDialogOptions,
IHostPageLayoutService,
IMessageDialogOptions,
IPanelOptions
} from "azure-devops-extension-api/Common/CommonServices";
import * as SDK from "azure-devops-extension-sdk";
let hostPageLayoutService: IHostPageLayoutService;
export async function getHostPage... |
37e69bede8bbc0485856039dcd2ed446f71894b6 | TypeScript | juanfalconcodigo/Graphql-Proyect-2 | /src/resolvers/mutation.ts | 2.5625 | 3 | import {IResolvers} from 'graphql-tools';
import { courses } from '../data/data.store';
const mutation:IResolvers={
Mutation:{
addCourse(__:void,{course}):any{
const id=String(courses.length+1);
const newCourse={
id,
...course,
review... |
0d3f215ea4ff434e1d7154f391efec97b5b47751 | TypeScript | manken/needle | /main/annotations/lazy.ts | 2.71875 | 3 | import { v4 as uuid } from 'uuid';
import { Newable } from '../contracts/contracts';
import { getRootInjector } from '../core/util.functions';
/**
* The @Lazy annotation allows you inject a Lazy<T> into a given parameter.
*
* constructor(@Lazy(MyInjectableType) myLazy: LazyInstance<MyInjectableType>){
* const ins... |
a192f420fc714dcdaf4a66b65bf4c5d35f3bc39c | TypeScript | hugodutka/www-dom2 | /front/src/utils/relax/jsx.ts | 3.203125 | 3 | export const JSX = {
createElement: (tag, attrs = {}, ...children) => {
attrs = attrs || {};
var elem: HTMLElement;
if (typeof tag === "string") {
// if an HTML tag was passed, simply create a matching element
elem = Object.assign(document.createElement(tag), attrs);
} else {
// if s... |
290e14a85ac8de0ba02b7d7995cbace5baefaced | TypeScript | dmit-git/angular-brewcraft | /client/src/app/dashboard/my-recipe/my-recipe.component.ts | 2.65625 | 3 | import { Component, OnInit } from '@angular/core';
import { Recipe, RecipeService } from '../../services';
@Component({
selector: 'app-my-recipe',
templateUrl: './my-recipe.component.html',
styleUrls: ['./my-recipe.component.css']
})
export class MyRecipeComponent implements OnInit {
recipes: Recipe[];
con... |
f1eacebe51b636610e6521675caabaf510389efc | TypeScript | dongchenchen/analysis_middleware | /src/index.ts | 2.84375 | 3 | /**
* @author dididong
* @description 入口页支持纯获取数据、绘制折线图、绘制饼图、绘制表格、绘制昨日数据
*
* @param DataRequest {busi:业务id,tmpl:模板id, args:查询参数(json字符串)}
*/
import { DataRequest, ShowConfig, AnalysisConfig } from './common/config';
import { Controller } from './controller/controller';
export default class AnalysisMiddleware {
p... |
355c6c9b9883008d6e582f65e8113921ab8e85e7 | TypeScript | SocialGouv/pass-emploi-api | /src/building-blocks/types/result-api.ts | 2.734375 | 3 | import { ErreurHttp } from './domain-error'
import { DateTime } from 'luxon'
export type ResultApi<Data = void> = SuccessApi<Data> | FailureApi
export type SuccessApi<Data = void> = {
_isSuccess: true
data: Data
dateCache?: DateTime
}
export type FailureApi = { _isSuccess: false; error: ErreurHttp }
export func... |
fa680c5570ef663f28fc90c9f3231bded001cda6 | TypeScript | Tinend/cube_trainer | /app/javascript/cube_trainer/app/users/authentication.service.ts | 2.59375 | 3 | import { RailsService } from '../rails/rails.service';
import { Injectable } from '@angular/core';
import { HttpVerb } from '../rails/http-verb';
import { BehaviorSubject, Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { User } from './user';
import { some, none, ofNull, mapOptional, Optional, h... |
99a61e7364ac7a00098621d1cf22cf0aa21583cf | TypeScript | QuocAnhVu/CrosschainFastTransfers | /test/index.ts | 2.625 | 3 | import { Provider } from "@ethersproject/abstract-provider";
import { Signer } from "@ethersproject/abstract-signer";
import { expect } from "chai";
import { ethers } from "hardhat";
import { ethers as eth } from "ethers";
import Web3 from "web3";
import { Bond, BondClaim, ERC20Mintable } from "../typechain";
import ch... |
ae199f636132e690aae742b5d399e28e42149e31 | TypeScript | Wend1go/superpowers-common-plugins | /three/helpers/SelectionBoxRenderer.ts | 2.59375 | 3 | export default class SelectionBoxRenderer {
private mesh: THREE.Mesh;
private target: THREE.Object3D;
constructor(root: THREE.Object3D) {
this.mesh = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), new THREE.MeshBasicMaterial({ color: 0x00ffff, side: THREE.BackSide }));
root.add(this.mesh);
}
setTarg... |
4285cb33abc16d4c152163762928f096071c6875 | TypeScript | leobar37/gsap_exercices | /gsap_01/src/ts/functions.ts | 2.5625 | 3 | export const addSectionCallback = (
timline: TimelineMax,
params: {
start: number;
end: number;
onEnter: () => void;
onLeave: () => void;
onEnterBack: () => void;
onLeaveBack: () => void;
}
) => {
const trackDirection = (animation: TimelineLite) => {
let onUpdate = animation.eventC... |
9fe76322c24b779be3149b033b9b339210d55722 | TypeScript | JoakimLevorsen/statistik-index | /src/data/dec2018.ts | 3.078125 | 3 | export default [`
Which of the following is a standard 99% confidence interval for the theoretical standard deviation σ?
1* [0.20, 0.73]
2 0.57 ± 1.96 · 0.32
3 [0.22, 0.58]
4 [0.05, 0.34]
5 [0.03, 0.53]
----------------------------------- FACIT-BEGIN -----------------------------------
See Method 3.19. Here, n = 1... |
58d6e6dc335d90d69cb853345bf32ed5fcb0f1c0 | TypeScript | johnnyicarus/star-wars-opedia | /src/app/core/reducers/film.reducer.ts | 2.71875 | 3 | import { FilmActions, FilmActionTypes } from '../actions/film.actions';
import { addSearchIfNew, setAddManyState } from '../utils/state.utils';
import { Film } from '../models/film.model';
import { createEntityAdapter, EntityAdapter, EntityState } from '@ngrx/entity';
import { SearchResults } from '../../search/models/... |
dd2c17f1472694b31738b13fd8682e12fae9503e | TypeScript | ggeorgievx/core | /packages/core/src/metrics/metrics/number.ts | 2.546875 | 3 | import { Glue42Core } from "../../../glue";
import { Protocol } from "../types";
import { BaseMetric } from "./base";
import metricTypes from "../const/metric-types";
export class NumberMetric extends BaseMetric<number> implements Glue42Core.Metrics.NumberMetric {
constructor(definition: Glue42Core.Metrics.Metric... |
6b6b97daefc54c43cbf95ab99e5d7c3a1c21b420 | TypeScript | Aydoun/hot-packets | /src/middleware/token-middleware.ts | 2.515625 | 3 | import jwt from "jsonwebtoken";
import { Request, Response, NextFunction } from "express";
export default async (req: Request, res: Response, next: NextFunction) => {
const token = req.headers["x-api-key"] as string;
if (token) {
try {
const decoded = await jwt.verify(token, process.env.TOKEN_SECRET);
... |
aaaf937eb4cdc1e15bfe9ab2114d7921984e218d | TypeScript | CodeKul/ts-brushup-sg-1-3 | /first/ts-oops.ts | 2.640625 | 3 | export class Car {
speed: number;
cost: string;
constructor(
private highSpd = 500
) {
this.speed = 100;
}
} |
33269236d2797f7f950346d465ece0a9157db649 | TypeScript | HymanHuang/angular2-lesson | /examples/service/ts/InputItem.ts | 2.515625 | 3 | import {Component, Output, EventEmitter, ChangeDetectionStrategy} from '@angular/core';
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'input-item',
template: `
<form (ngSubmit)="onSubmit()">
<input type="text" [(ngModel)]="text" name="todo">
<button type="submi... |
210870f866ff8eb9c03a0af47050ed76548ff8db | TypeScript | dogukanucak/Nyx-Bulma | /projects/nyx-bulma/src/lib/common/nyx-elements/nyx-tag/nyx-tag.component.ts | 2.546875 | 3 | import { Component, OnInit, Input } from '@angular/core';
import { BaseElement } from '../../abstracts/nyx-base-element';
import { Bulma } from '../../../decorators/bulma.decorator';
/**
* Nyx Tag Component
* Based on: {@link https://bulma.io/documentation/elements/tag/}
* @example
* Usage Example: ```<nyx-tag t... |
b88627c4c0357daeebb71139951df29b2b5aef49 | TypeScript | risatino/mapboxgl-powerbi | /src/ts/mapboxConverter.ts | 2.6875 | 3 | module powerbi.extensibility.visual {
export module mapboxConverter {
const isTooltip = (role) => {
return role == 'color' || role == 'size' || role == 'tooltips' || role == 'cluster';
}
const checkLngLatValid = (feat) => {
return feat.longitude != undefined && feat.... |
ec9f053bfc6715637a8eb39c0e0ca61ee2c7373d | TypeScript | matyj/fonn-interview | /src/events/services/impl/create-event.service.ts | 2.734375 | 3 | import { BusinessError } from '../../../errors/business.error';
import { Event } from '../../../events/models/event';
import { EventsRepo } from '../../../events/repos/events.repo';
import { DateRangeValidator } from '../../../events/validators/date-range.validator';
import { DateTime } from '../../../utils/date-time';... |
12e3702f61a78fb593bc79e11d80c754d2ad96d7 | TypeScript | Ac-blog/Ac-varok-client-nuxt | /api/request.ts | 2.875 | 3 | /**
* 封装Axios
* 处理请求、响应错误信息
*/
// import { Message } from 'iView'
import axios from 'axios' //引用axios
// create an axios instance
const service = axios.create({
baseURL: 'http://127.0.0.1:7001',
withCredentials: false, // send cookies when cross-domain requests
timeout: 5000 // request timeout
})
// request i... |
4b176bc7a331e6ed0269ac34bd6c8c0d1caf6d2f | TypeScript | Zilborg/payload | /src/collections/requestHandlers/updateByID.ts | 2.59375 | 3 | import { Response, NextFunction } from 'express';
import httpStatus from 'http-status';
import { PayloadRequest } from '../../express/types';
import formatSuccessResponse from '../../express/responses/formatSuccess';
import updateByID from '../operations/updateByID';
export type UpdateResult = {
message: string
do... |
729639e564e816e2d57eb67f3afa77ec9291555a | TypeScript | alexanderstueben/neverdrinkagain | /src/store/actions/TaskActions.ts | 2.515625 | 3 | import { ThunkAction, ThunkDispatch } from 'redux-thunk';
import {
AddTaskActionType,
SetTasksActionType,
SetTasksWithGamemodesActionType, TaskActionTypes, UpdateTaskActionType
} from '../../types/action-types/TaskActionTypes';
// import { Task } from '../../types/models/Task';
import { TaskState } from '../../ty... |
30559de08bccbfda738c66ca4dcd6201e6d26b82 | TypeScript | onthia/seq-image-player | /src/utils/checkLowBattery.ts | 3.015625 | 3 | // 通过setTimeout执行的前后时间差和实际经过的时间差来判断IPhone设备是否处于低电量
// 参数全是基于经验
const OFFSET = 4;
const CHECK_TIME = 30;
const NEED_PASS_RESULT_PERCENTAGE = 0.4;
const INTERVAL = 16;
const checkInterval = (interval: number): boolean => {
return interval > INTERVAL * 2 - OFFSET;
};
const checkPercentage = (checkResult: number[]): b... |
0e3dfb366c6d547485502ce9d329303d40f47f45 | TypeScript | moredrowsy/react-native-sudoku | /src/storage/store/slices/options.slice.ts | 2.5625 | 3 | import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { RootState, AppThunk } from '..';
import * as LocalStorage from '../../local-storage';
import { AppOptions, ThemeNames } from '../../../types';
import { setThemeType } from './theme.slice';
const sliceName = 'options';
const initialState: AppOption... |
34fc3f1e8962c89f626f48049f5dc5b131b2e166 | TypeScript | ElNinjaGaiden/2FAuthLabClient | /src/store/session/reducer.ts | 2.859375 | 3 | import * as session from './actions';
import { ActionType, getType } from 'typesafe-actions';
import { SessionState } from './types';
export type SessionAction = ActionType<typeof session>;
const defaultState: SessionState = {
user: undefined,
passwordVerified: false,
tokenVerified: false
}
const reducer = (st... |
6eb5fb97532870dd01fb4ef35969bd55e981ead8 | TypeScript | eMed-com/amazon-chime-sdk-js | /build/modality/Modality.d.ts | 3.09375 | 3 | export default interface Modality {
/**
* The participant Id
*/
id(): string;
/**
* The base of the Id
*/
base(): string;
/**
* The modality of the Id
*/
modality(): string;
/**
* Check whether the current Id contains the input modality
*/
hasModal... |
4b468d9ca1fdda27822f5e5648b0d93a744248c4 | TypeScript | csj-libs/JSBridge-1 | /bridgejs/src/core/proxy.ts | 2.828125 | 3 | import { Request, Response } from "./models";
const REMOTE_PROXY = "REMOTE_PROXY";
const LOCAL_PROXY = "LOCAL_PROXY";
// Proxy this class is mounted on window for Native calling
class Proxy {
constructor(private readonly listenr: IProxyListener) {
(window as any)[LOCAL_PROXY] = this;
}
/**
* r... |
49aba8db13be95a72becc78f779cf740a945df92 | TypeScript | flurescein/fenya | /src/HtmlAttribute.ts | 2.609375 | 3 | import { VirtualNode } from './VirtualNode'
export class HtmlAttribute extends VirtualNode {
constructor(public name: string, public value: string) {
super()
}
get html(): string {
return `${this.name}="${this.value}"`
}
}
|
5fb4880bb8dd970dfd3cf30bd9948f336970a245 | TypeScript | NSFI/ppfish-components | /source/components/FormHook/rcFieldForm/utils/typeUtil.ts | 3.265625 | 3 | export function toArray<T>(value?: T | T[] | null): T[] {
if (value === undefined || value === null) {
return [];
}
return Array.isArray(value) ? value : [value];
}
|
8d52434d001bbc8a8a84691b1ef89b280eaa456a | TypeScript | mtringel/BikeRentals | /Web.UI/ClientApp/helpers/reduxListDataCache.ts | 3.25 | 3 | /// <summary>
/// Cache for advanced filtered data, where filter is complex object. Subset matching is supported.
/// TData, TItem, TKey and TFilter are expected to be immutable. (We don't clone them, just share the references.)
/// </summary>
import { TypeHelper } from "./typeHelper";
import { ArrayHelper } from "./... |
579a3387b506d6ce769f58a3ec7754112bd019cb | TypeScript | kng83/compound | /src/patterns/structural_patterns/bridge_pattern.ts | 3.640625 | 4 |
interface UIToolkit {
drawBorder(): void;
drawImage(src: string): void;
drawText(text: string): void;
}
//** Wymuszanie by klasa interfejsowa przyjmowala interfejs UIToolKit i metode dostepowo do niego render */
abstract class BasicRender {
constructor(public toolkit: UIToolkit) { }
abstract rend... |
62ae4c2704df9e2de6139d42b99ef3d8b8ce973c | TypeScript | Yanpix/nestjs-app-hybrid | /src/modules/dashboard/services/profile.service.ts | 2.6875 | 3 | import { Injectable } from '@nestjs/common';
import { plainToClass } from 'class-transformer';
import { UserService } from '../../user/user.service';
import { SelectUserDto } from '../../user/dto';
import { ProfileError } from '@exceptions';
@Injectable()
export class ProfileService {
constructor(
... |
91229138db5b81d71383a88824d94521c3ef5dd3 | TypeScript | dingzhichao700/DingProj | /testarpg/src/webgame/modules/scene/view/DamageItem.ts | 2.765625 | 3 |
module egret {
export class DamageItem extends egret.gui.UIComponent{
private imgState:egret.gui.UIAsset;
private boxCon:egret.gui.Group;
public constructor() {
super();
}
public setData(text:string, color:number):void {
if(... |
47290ec61c4cb8b4b788c3294ed92a944f5ee8e9 | TypeScript | source-academy/js-slang | /src/vm/svml-compiler.ts | 2.703125 | 3 | import * as es from 'estree'
import { UNKNOWN_LOCATION } from '../constants'
import { ConstAssignment, UndefinedVariable } from '../errors/errors'
import { parse } from '../parser/parser'
import {
CONSTANT_PRIMITIVES,
generatePrimitiveFunctionCode,
INTERNAL_FUNCTIONS,
PRIMITIVE_FUNCTION_NAMES,
vmPrelude
} fr... |
a9c04bfb276df7b66d5a1e43b82ac79d91be9e41 | TypeScript | elprotto/Angular101 | /1. TypeScript and OOP/Examples/Example 3 - Types/Number.ts | 3.203125 | 3 | let first: number = 123; // number
let second: number = 0x37cf; // hexadecimal
let third: number = 0o377; // octal
let fourth: number = 0b111001; // binary
console.log(first); // 123
console.log(second); // 14287
console.log(third); // 255
console.log(fourth); // 57
|
bf3aa7cb929daed93ed567294668b0fb96e6707e | TypeScript | pitust/ts2c | /tests/numbers/numbers2.ts | 2.703125 | 3 | var n1 = parseInt('3');
console.log(n1);
var n2 = parseInt('2342');
console.log(n2);
var n3 = parseInt(' 3');
console.log(n3);
var n4 = parseInt(' 1212');
console.log(n4);
var n5 = parseInt(' 3 wew');
console.log(n5);
var n6 = parseInt(' 902 wew');
console.log(n6);
var n7 = parseInt(' 12 3 wew');... |
5e69fe4f1940ac256ab839fffd618ea8ac6210b3 | TypeScript | dazejs/daze | /packages/framework/__tests__/src/container/index.spec.ts | 2.828125 | 3 |
import 'reflect-metadata';
import { Container, Injectable } from '../../../src';
import * as symbols from '../../../src/symbol';
it('Container.setInstance', () => {
const App = class { };
Container.setInstance(App);
expect(Container.instance).toBe(App);
});
it('Container.bind and Container.get', () => {
Con... |
798f42218de1b6b0a124596eaf7a08e2d3053f87 | TypeScript | MatthiasKunnen/TypedJSON | /spec/any.spec.ts | 3.109375 | 3 | import {AnyT, jsonArrayMember, jsonMember, jsonObject, jsonSetMember, TypedJSON} from '../src';
describe('AnyT', () => {
describe('on a simple class property', () => {
@jsonObject
class SimplePropertyAny {
@jsonMember(AnyT)
any: any;
@jsonMember(AnyT)
... |
22b14bcdbe2fbe48f7924af769aba3bdbc32aab4 | TypeScript | ColMarek/Sozui | /src/core.ts | 2.78125 | 3 | import * as discordUtils from "./utils/discord";
import * as anilist from "./anilist";
import { Media, MediaType } from "./models/Media";
import { Logger } from "./utils/Logger";
const logger = new Logger();
if (require.main == module) {
parseMessage(":{Black Clover}: and :<<Black Clover>>:").catch(e => console.log... |
62a47a8249c9f96ce09dd85bc76704eb148794ff | TypeScript | uiwjs/react-baidu-map | /packages/types/src/panorama.d.ts | 2.828125 | 3 | /// <reference path="./base.d.ts" />
/// <reference path="./control.d.ts" />
declare namespace BMap {
/**
* 在给定的结点中创建全景
* 此类用来展示某位置的全景视图,可以单独放置在一个div容器中,也可以放在Map类的容器中。
* http://lbsyun.baidu.com/cms/jsapi/reference/jsapi_reference_3_0.html#a8b0
*/
class Panorama {
/**
* 在给定的结点中创建全景
*/
c... |
31dced08e0eb24ed59a6e96578463e6233966b62 | TypeScript | CaoMeiYouRen/node-cq-robot | /dist/utils/timeHelp.d.ts | 3.140625 | 3 | /**
* 格式化时间
* @export
* @param {(Date | number | string)} [date=Date.now()]
* @param {string} [pattern='YYYY-MM-DD HH:mm:ss']
* @returns {string}
*/
export declare function timeFormat(date?: Date | number | string, pattern?: string): string;
/**
*
* 在控制台输出 HH:mm:ss:SSS->msg 格式的消息
* @export
* @param {string} m... |
69208d0a39658663b083c16c9f1589d6b4e90d12 | TypeScript | olaoluwa-98/indicative-compiler | /test/ast-walker.spec.ts | 2.546875 | 3 | /**
* indicative-compiler
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import * as test from 'japa'
import { TreeWalker } from '../src/TreeWalker'
import { rulesParser } from 'indicati... |
5c6d8c3bb9f6140d82189d2d26d2bf14a6e0d235 | TypeScript | brijal1987/typescript-crud | /src/controllers/user.ts | 2.71875 | 3 | import { Request, Response, Router } from 'express';
import { getCustomRepository } from 'typeorm';
import { UserService } from 'src/services/user';
import { UserRepository } from 'src/repositories/user';
import { logger } from '../util/logger';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
// expo... |
68e125a200f7ba592bebab7665d54d81097ee610 | TypeScript | AGhariebiyan/ipsen5 | /src/app/models/role.model.ts | 2.6875 | 3 | export class Role {
id: string;
title: string;
description: string;
canEditCompany: boolean;
constructor(title: string, description: string, canEditCompany: boolean) {
this.title = title;
this.description = description;
this.canEditCompany = canEditCompany;
}
}
|
abeb1fa03027ee87a8c4655157ca7ab5f54ab14a | TypeScript | DevTobias/highlight-ts | /test/markup/nix.ts | 2.53125 | 3 | export default [
`{ stdenv, foo, bar ? false, ... }:
/*
* foo
*/
let
a = 1; # just a comment
b = null;
c = toString 10;
in stdenv.mkDerivation rec {
name = "foo-\${version}";
version = "1.3";
configureFlags = [ "--with-foo2" ] ++ stdenv.lib.optional bar "--with-foo=\${ with stdenv.lib; foo }"
po... |
5a01e6f25d8b82cd9cd550b0163b3489afdc14d7 | TypeScript | khanhtoandng/typescript-crash | /src/3_Tuple.ts | 3.90625 | 4 | // Normal shape
const drink = {
color: "white",
carbonated: true,
sugar: 40,
};
// Tuple
const pepsi: [string, boolean, number] = ["white", true, 50];
// pepsi[0] = false; //error
// Tuple Array
let employee: [number, string][];
employee = [
[1, "Toan"],
[2, "Huynh"],
];
// Using Type Alias
type Drink = [s... |
31d9c17847bb11b053fecb0e07a694eb5df3bcf9 | TypeScript | ConnorFields/netflix-crusher | /src/app/home/home.component.ts | 2.6875 | 3 | import { Component, OnInit } from '@angular/core';
//Service Import
import { VideoImporterService } from '../video-importer.service';
import { VideoHistoryService } from '../video-history.service';
//Model import
import { Video } from '../data-source.model';
@Component({
selector: 'app-home',
templateUrl: './hom... |
cda5bb37104aa542fb518fd6647e7e8a1c400008 | TypeScript | greguz/rxdable | /src/getObservableByStream.spec.ts | 2.71875 | 3 | import test from 'ava'
import { Readable } from 'stream'
import { toArray } from 'rxjs/operators'
import { getObservableByStream } from './index'
test('should work', async t => {
const readable = new Readable({
objectMode: true,
read () {
for (let i = 65; i <= 90; i++) {
this.push(String.from... |
78c7cc9c7d0b355b413fe8d11e0df47e9733218c | TypeScript | jyand/dbmgmt | /doc.ts | 2.96875 | 3 | const FORMID: string = "container" ;
// These are effectively aliases for DOM Methods but with strict typing
export function Id(s: string): HTMLElement | null {
return document.getElementById(s) ;
}
export function Listen (s: string, e, func: EventListener): void {
document.getElementById(s),addEventL... |
280ac6400e82705cbe55daa274bd0ceea2c87d17 | TypeScript | aaronchenhg/varlet | /packages/varlet-ui/types/counter.d.ts | 2.515625 | 3 | import { VarComponent } from './varComponent'
export type CounterValidateTriggers = 'onIncrement' | 'onDecrement' | 'onInputChange' | 'onLazyChange'
export interface CounterProps {
modelValue?: string | number
min?: string | number
max?: string | number
step?: string | number
color?: string
inputWidth?: s... |
30d7b585cd9555fd11a7af9d79dcffae25da9dfd | TypeScript | TheRedLegz/simple_calculator_sia | /script.ts | 3.15625 | 3 | let currentOperation : string = ''
let operand1 : number
let operand2 : number
let isNew : boolean = true
let isOp2Good: boolean = false
function getInput(input : string) {
let output = <HTMLInputElement>document.getElementById("output")
let currentOperationOutput = <HTMLSpanElement>document.getElementById("c... |
fcf55a0452fd99e7244b590713bb665182357b26 | TypeScript | demurgos/stream | /src/lib/concat-bytes.ts | 2.53125 | 3 | import { UintSize } from "semantic-types";
export function concatBytes(chunks: Uint8Array[]): Uint8Array {
let totalSize: UintSize = 0;
for (const chunk of chunks) {
totalSize += chunk.length;
}
const result: Uint8Array = new Uint8Array(totalSize);
let offset: UintSize = 0;
for (const chunk of chunks) ... |
089a63d9813034edad263fb7f3afcb27a6bb4ece | TypeScript | silvioiannone/spa-skeleton | /src/Library/App/Filters/Truncate.ts | 3.546875 | 4 | import { AbstractFilter } from './AbstractFilter';
/**
* This filter truncates the text at the specified amount of characters.
*/
export class Truncate extends AbstractFilter
{
/**
* Run the filter.
*/
public run(): (value: string, ...args: any[]) => string
{
return (value: string, ...a... |
ac39970157600561f23a246e9032bd0b9e022261 | TypeScript | RolandCsibrei/babylonjs-vue-messages-driven-scene | /src/utils/async.ts | 3.109375 | 3 | export async function asyncForEach<T>(array: Array<T>, callback: (item: T, index: number) => Promise<void>) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index)
}
}
|
b7fb9503c91cc4150cdf277f32de6caa9c807073 | TypeScript | cxqntnt/blog-tutorials | /node-webapp-pdf/src/models/address.model.ts | 2.546875 | 3 | import mongoose, { Schema, Document, Model } from 'mongoose';
type AddressDocument = Document & {
firstName: string;
lastName: string;
phoneNumber: string;
country: string;
city: string;
state: string;
street: string;
postalCode: string;
user: string;
};
type AddressInput = {
firstName: AddressDoc... |
8b34fdfcc83004e75d93d40a4756741c375e5b99 | TypeScript | tlekenta/cepik-front | /src/app/pipes/from-to.pipe.ts | 2.671875 | 3 | import { Pipe, PipeTransform } from '@angular/core';
import { Vehicle } from '../model/cep/vehicle';
@Pipe({
name: 'fromToPipe'
})
export class FromToPipe implements PipeTransform {
transform(items: Vehicle[], which: string, filterFrom: number, filterTo: number, maxLength: number): any {
if(!items) {
re... |
cf3c9fa474ee49e4c7748cc9955f4a8dfd6777bc | TypeScript | splinkns/circus | /packages/circus-rs/src/common/CCL/ConnectedComponentLabeling3D26.ts | 2.796875 | 3 | import { CCL3D } from './ccl-types';
/**
* @param array input binary image
* @param width width of array
* @param height height of array
* @param nSlices slice number of array
* @param threshold voxel value of threshold
*/
const CCL: CCL3D = (array, width, height, nSlices, threshold = 0) => {
const [dx, dy, dz... |
54cc4201886da45c1dd18c77ff6a82768d102327 | TypeScript | dedalusmax/dice-and-roll2 | /src/services/textual.service.ts | 2.515625 | 3 | import { Settings } from "../models/settings";
export class TextualService {
static createTextButton(scene: Phaser.Scene, text, x, y, style, action): Phaser.GameObjects.Text {
var item = scene.add.text(x, y, text, style);
item.setOrigin(0.5, 0.5);
item.setInteractive();
item.on('... |
7ddb670a8cf1f09b3488c3c58dd7379df2913c7c | TypeScript | marcindlu993/angular4front | /src/app/models/project.ts | 2.625 | 3 | export interface IProjectDTO {
ProjectId: number;
Name: string;
StartDate: Date;
EndDate: Date;
LastModifyDate: Date;
Comment: string;
}
export class ProjectModel {
ProjectId: number;
Name: string;
StartDate: Date;
EndDate: Date;
LastModifyDate: Date;
Comment: string;
constructor(data: IProj... |
20ed7dfa4ee6eaf0bd5dcefa0c33466b40599ebe | TypeScript | PoEManager/Backend-Server | /app/model/password.ts | 3.296875 | 3 |
import bcrypt from 'bcrypt';
import config from '../core/config';
/**
* A class that creates and compares encrypted passwords.
*/
class Password {
/**
* ```true```, if the salt was already generated, ```false``` if not.
*
* Salt generation only has to take place once.
*/
private static g... |
0d86aa5c783f2c55e9b17c981b738931369b320a | TypeScript | SocialGouv/pass-emploi-api | /test/fixtures/date.fixture.ts | 2.5625 | 3 | import { DateTime } from 'luxon'
export const uneDatetime = (): DateTime =>
DateTime.fromISO('2020-04-06T12:00:00.000Z')
export const uneDatetimeAvecOffset = (): DateTime =>
DateTime.fromISO('2020-04-06T12:00:00.000Z', { setZone: true })
export const uneDatetimeLocale = (): DateTime =>
DateTime.fromISO('2020-0... |
5522944819ddd28c151b6b19db9a10c4ea7ebb07 | TypeScript | ConanSpithoven/PRG8-Game | /dev/Notes/note.ts | 2.984375 | 3 | abstract class Note implements Observer {
//specifiers how the note plays
protected _noteController : NoteController;
protected _element:HTMLElement;
protected _fretID:number;
protected _fret:HTMLElement;
protected _y:number = 0;
protected _gravity:number = 9;
prote... |
b7f233e2758f70c200d9554c6fb21580f96db759 | TypeScript | yxue/cdn_check | /src/util.ts | 2.5625 | 3 | /// <reference path='../typings/index.d.ts' />
import * as dns from "dns";
import * as fs from "fs";
import * as hostile from 'hostile';
import * as child_process from 'child_process';
import * as path from 'path';
import * as md5file from 'md5-file';
export class Util{
public static unique(arr:any[]): any[]{
... |
fc5190de16bb06436c56cac297d3daf26789aca0 | TypeScript | svikashk/daxc | /packages/daxc-i/src/attribute.opts.spec.ts | 2.671875 | 3 | import { expect } from "chai";
import { ATTRIBUTE_OPTS, _matching } from "./attribute.opts";
describe("#attribute.opts.js tests", () => {
describe("#_matching", () => {
it("expect to match values", () => {
// arranges
// acts
const result01 = _matching("val", "val");
const result02 = _ma... |
92d5d504e6a80c1f239fd199cb7afc95b447517f | TypeScript | TBubba/launcher | /tests/src/renderer/uuid.test.ts | 3 | 3 | /* Tests for src/renderer/uuid.test.ts */
import { validateSemiUUID, uuid } from '../../../src/renderer/uuid';
describe('uuid.uuid()', function () {
test('Returns string of proper length?', () => {
expect(uuid()).toHaveLength(36);
});
});
describe('uuid.validateSemiUUID()', function () {
test('Empty string'... |
2caa6f18a47382179c01ac303cb05e12c9734646 | TypeScript | SergeyGrib712/Weather | /src/helpers/mappingForecast.ts | 2.609375 | 3 | import kelvinToCelsius from './kelvinToCelsius';
const mappingForecast = <T extends any>(forecast: any = {}): T => {
return {
temp: kelvinToCelsius(forecast.main?.temp || 0),
feelsLike: kelvinToCelsius(forecast.main?.feels_like || 0),
city: forecast.name || '',
icon: forecast.weathe... |
bf303c2105c5598c13ad6c0ac54df6cc0a9404b6 | TypeScript | keeema/bobrilstrap | /src/utilities/font.ts | 2.8125 | 3 | import * as b from "bobril";
import { createFilledDictionary } from "../../utils/dict";
export type FontWeight = "bold" | "bolder" | "normal" | "light" | "lighter";
export type FontStyle = "normal" | "italic";
export type FontSize = 1 | 2 | 3 | 4 | 5 | 6;
export type LineHeight = 1 | "sm" | "base" | "lg";
export cons... |
8c91a57ef1edfbc1712dfcd256be3470aa7d6283 | TypeScript | nozzlegear/Shopify-Prime | /models/address.ts | 2.921875 | 3 | import { ShopifyObject } from "./base";
export interface Address extends ShopifyObject {
/**
* The mailing address.
*/
address1?: string;
/**
* An additional field for the mailing address.
*/
address2?: string;
/**
* The city.
*/
city?: string;
/**
* Th... |
39ce1d03ea075cbad595da8a602f7451f42fe619 | TypeScript | Scarsniik/readium-desktop | /src/actions/i18n.ts | 2.796875 | 3 | import { Action } from "redux";
export const SET_LOCALE = "SET_LOCALE";
export interface LocaleAction extends Action {
locale: string;
}
export function setLocale(locale: string): LocaleAction {
return {
type: SET_LOCALE,
locale,
};
}
|
ad7e700ee52074cc2c93bc8c551ca66ec7fa068d | TypeScript | ElielC/honeypots-web | /src/hooks/useHasMounted.ts | 2.59375 | 3 | import { useEffect, useState } from "react"
function useHasMounted(): boolean {
const [hasMounted, setHasMounted] = useState<boolean>(false)
useEffect(() => {
setHasMounted(true)
}, [])
return hasMounted
}
export default useHasMounted
|
c52cdab5d3a581b3a2b6d53f63184b3f3a6a39f6 | TypeScript | g00gle/crisp | /app/scripts/framework/framework.ts | 2.8125 | 3 | import { Entity } from '../shared/entity/entity';
export class Framework extends Entity {
/**
* Framework name
*/
public name: string;
/**
* Framework description
*/
public description?: string;
/**
* Creates new Framework object
*/
constructor(
name: string,
description: string =... |
8b5adeb5bf2210c0dd3feab300c7674bcd581461 | TypeScript | acacode/swagger-typescript-api | /tests/spec/discriminator/expected.ts | 2.765625 | 3 | /* eslint-disable */
/* tslint:disable */
/*
* ---------------------------------------------------------------
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
* ## ##
* ## AUTHOR: acacode ##
* ## S... |
cb67f49c2382385ffd26174d76f471bc8f550a3f | TypeScript | delta94/ServiceHero | /servicehero-api/src/user/user.schema.ts | 2.640625 | 3 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import { UserType } from './types';
export type UserDocument = User & Document;
@Schema()
export class User {
id: string;
@Prop({type: String, required: true})
name: string;
@Prop({type: String, required: tr... |
2a2f4b12677766eb5f2d7b99f22d9bdff4881d7e | TypeScript | TheDotLabs/todo-asana-action | /src/utils/utils.ts | 3.0625 | 3 | export function parseContent(content: string, createTask: (username: string, task: string) => void) {
let match;
const regExp: RegExp = /TODO\((?<username>\w+)\): (?<task>.*)/g;
while ((match = regExp.exec(content)) !== null) {
const username = match.groups?.username ?? "";
const task = match.groups?.task... |
b8f035ec7ac29605e74816426e60d79c5b23b1a1 | TypeScript | DarioDiGulio/Ajedrez | /ts/models/HTTPHelper.ts | 3.15625 | 3 | export enum HTTPHelper {
INFO = "info",
SUCCESS = "success",
WARNING = "warning",
ERROR = "errror",
GET = "GET",
HEAD = "HEAD",
POST = "POST",
PUT = "PUT",
DELETE = "DELETE",
CONNECT = "CONNECT",
OPTIONS = "OPTIONS",
TRACE = "TRACE",
PATCH = "PATCH",
}
/**
* isMethodValid
* @param {string} ... |
0ef9c2531050199f67d434212a52a5a0b15a5493 | TypeScript | vdab-pierre/udemyAng | /ng4-complete-guide/src/app/shopping-list/shopping-list.service.ts | 2.640625 | 3 | import { Injectable, EventEmitter } from '@angular/core';
import { Ingredient } from '../shared/ingredient';
@Injectable()
export class ShoppingListService {
ingredientsChanged = new EventEmitter<Ingredient[]>();
private ingredients:Ingredient[]=[
new Ingredient("Apples",5),
new Ingredient("Tomatoes",10)
... |
b21c0130f49876104cb8cf58e88d06e2b37e6d79 | TypeScript | rabelloo/lit | /src/store/createStore.ts | 3.046875 | 3 | import { CaseSetup } from './case-setup';
import { createSlice } from './createSlice';
import { Store } from './store';
import { Subscription } from './subscription';
import { MetaReducer, Reducer, Subscriber } from './types';
/**
* Creates a new `Store` for state that can be subscribed for changes
* and updated imm... |
2457f8cb608b914990b855f8b79766c0175c2786 | TypeScript | skmail/responsive-viewer | /src/utils/state.ts | 2.53125 | 3 | import platform from '../platform'
import { State } from '../reducers/app'
const STORAGE_KEY = 'APP_STATE'
export const loadState = async () => {
try {
const state = await platform.storage.local.get(STORAGE_KEY)
if (!state) {
return {}
}
return state
} catch (e) {
return {}
}
}
export... |
29e92141b6ab08b5757fe3db120518ee511a6c46 | TypeScript | alexeyinkin/neural-tennis-js | /src/app/Color.ts | 3.203125 | 3 | export default class Color {
private readonly red: number;
private readonly green: number;
private readonly blue: number;
constructor (red: number, green: number, blue: number) {
this.red = red;
this.green = green;
this.blue = blue;
}
public getRgb(): string {
... |
7ef6e007b38af0274ae34e593ee0088845682ee2 | TypeScript | chrisxian/oshop | /src/app/model/shopping-cart.ts | 2.96875 | 3 | import { ShoppingCartItem } from "./shopping-cart-item";
import { Product } from ".";
export class ShoppingCart {
public items: ShoppingCartItem[] = [];
constructor(public id: string,
public dateCreated: string,
private itemsArray: { product: Product, quantity: number }[]) {
itemsArra... |
613d0e967eddd180d4b968b5199dbb64458b26bd | TypeScript | bbrunocosta/WeDecode-backend-test | /src/infra/database/mongoose/adapters/spectatorRepository.adapter.spec.ts | 2.71875 | 3 | import MongooseHelper from '../mongoose.Helper'
import MongooseFilmRepositoryAdapter from './filmRepository.adapter'
import MongoSpectatorRepositoryAdapter from './spectatorRepository.adapter'
import env from '../../../../main/config/env'
describe('MongoSpectatorRepositoryAdapter', () => {
beforeAll(async () => {
... |
04a6afc41cf7f906652fbeacd1b5074fcdb1901b | TypeScript | sadri-fertani/slider | /src/app/slider-side.ts | 2.609375 | 3 | import { Component, AfterViewInit, ElementRef, Renderer2, ViewChild, HostListener } from '@angular/core';
export abstract class SliderSide {
public width: number;
public height: number;
@ViewChild('content')
public content: ElementRef;
@HostListener('mousedown', ['$event'])
onMousedown(event)... |
609853db4a30e5298410aa759ae49f256bedec44 | TypeScript | GalenWong/groundy | /test/backend/songstore/songstore.spec.ts | 2.6875 | 3 | import * as os from 'os';
import * as fs from 'fs';
import SongStore from '../../../app/backend/SongStore';
jest.mock('fs');
describe('songstore', () => {
it('getInstance', () => {
expect(SongStore.getInstance()).toBeInstanceOf(SongStore);
});
it('getStorageDirectory', () => {
const tempDir = os.tmpdir... |
a624a4ec66b38147682f8fc7332fcde14f44e8d1 | TypeScript | martin-fabbri/webgl-playground | /react-webgl-viz/src/clientProcess/reactComponents/flowjo-vis/webgl/resource.test.ts | 2.84375 | 3 | import {
HTMLCanvasElementMock,
WebGL2RenderingContextMock
} from './../../../../../tests/webgl2-canvas-mock/index';
import { default as Resource, Handle, IResourceProps, uid } from './resource';
const canvas = new HTMLCanvasElementMock(100, 100);
const gl = new WebGL2RenderingContextMock(canvas);
// tslint:d... |
94c4b9e6160745aa96f1a0fb8f11787445d4d510 | TypeScript | artsy/force | /src/Utils/color.ts | 3.265625 | 3 | export interface RGB {
r: number
g: number
b: number
}
export interface RGBA extends RGB {
a: number
}
export const stringifyRgba = (color: RGBA): string => {
return `rgba(${color.r}, ${color.g}, ${color.b}, ${color.a})`
}
export const compareColors = (color1: RGBA, color2: RGBA): boolean => {
return (
... |
881e542e260779904e0da68ce0780f1072fc8b43 | TypeScript | mhsss/social | /src/api/profile-api.ts | 2.59375 | 3 | import {PhotosType, ProfileType} from "../types/types";
import {instance,APIResponseType} from "./api";
type SavePhotoResponseDataType = {
photos: PhotosType
}
export const profileAPI = {
getProfile(userId: number) {
return instance.get<ProfileType>(`profile/${userId}`).then(resp => resp.data)
},... |
591925f689a1506a079616ed5741f3b3a9434f25 | TypeScript | mswjs/msw | /src/utils/request/pruneGetRequestBody.test.ts | 2.546875 | 3 | /**
* @jest-environment jsdom
*/
import { pruneGetRequestBody } from './pruneGetRequestBody'
test('sets empty GET request body to undefined', () => {
const body = pruneGetRequestBody({
method: 'GET',
body: '',
})
expect(body).toBeUndefined()
})
test('preserves non-empty GET request body', () => {
c... |
50ca9ac163fe19c8f660c14d4e358bda1817f4b0 | TypeScript | retojs/comicvm-dom | /src/dom/Button.test.ts | 2.890625 | 3 | import { Button } from "./Button";
describe("Button", () => {
it("can be created with constructor", () => {
const btn = new Button(
"container",
"label",
(e: MouseEvent) => expect(e).toBeDefined(),
"style-class"
);
expect(btn).toBeDefined();
... |
d6e61097ca0b9fc3b249d02264cde93f1c9d23d6 | TypeScript | enco164/racun-sekvenata | /src/FormulaTree/Atom.ts | 3.015625 | 3 | import {Formula, FormulaType} from './Formula'
import {AtomicFormula} from './AtomicFormula'
import {Valuation} from './Valuation'
import {AtomSet} from "./AtomSet";
/**
* Atom
*/
export class Atom extends AtomicFormula {
private _varNum : string;
constructor(num: string) {
super();
this.... |
4b4b02b7bb4a71f4f8b7fcb8d93d1ca9f8020c3a | TypeScript | spinlud/linkedin-jobs-scraper | /src/scraper/Scraper.ts | 2.640625 | 3 | import { EventEmitter } from "events";
import TypedEmitter from "typed-emitter";
import { IEventListeners } from "./events";
import { LaunchOptions, BrowserLaunchArgumentOptions, BrowserConnectOptions } from "puppeteer";
import { IQuery, IQueryOptions } from "./query";
import { logger } from "../logger/logger";
export... |
7846b87981127fe17e05eb730ec038ef65dc3b4e | TypeScript | rweda/status-site | /client/ts/modules/utility.ts | 3.140625 | 3 | import "bootstrap-notify";
/**
* Static class that provides useful utility methods.
*
* @export
* @class Utility
*/
export class Utility {
/**
* Returns properly formatted GET request query URL.
*
* @static
* @param {string} url - URL of the endpoint
* @param {...[string, string][]} parameters - se... |
ed109194684ffa0933a54826ddc015f977c04678 | TypeScript | pmb0/express-sharp | /src/decorators.ts | 3.34375 | 3 | import 'reflect-metadata'
function makePropertyMapper<T, U>(
prototype: unknown,
key: string,
mapper: (value: U) => T,
) {
Object.defineProperty(prototype, key, {
enumerable: true,
set(value: U) {
Object.defineProperty(this, key, {
enumerable: true,
get() {
return Reflec... |
14f6ced5d856fbe92d68eb6107d8157cdab418b9 | TypeScript | and-forks/opsmap-toolkit | /src/domain/csv/TKCSVReader.ts | 2.578125 | 3 | /* eslint-disable @typescript-eslint/no-explicit-any */
import { parse } from "papaparse";
// ////////////////////////////////////////////////////////////////////////////
// Temaplted Read method for csv inputs
// ////////////////////////////////////////////////////////////////////////////
export async function TKCS... |
d3630a02ce02fb996cfd1857e26e656b38f93163 | TypeScript | cwondany/uke-tabs-creator | /src/app/tab-creation/chord.model.ts | 2.734375 | 3 | export class Chord {
public gNote: string;
public cNote: string;
public aNote: string;
public eNote: string;
constructor(gNote, cNote, aNote, eNote) {
this.gNote = gNote;
this.cNote = cNote;
this.aNote = aNote;
this.eNote = eNote;
}
}
|