repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
faruh-narzullaev/type-script | examples/config/app.ts | <reponame>faruh-narzullaev/type-script
/// <reference path="core.ts" />
enum Codes { OK = 200, NotFound = 404, ServerError = 505 };
// app.ts
class Request implements Http.HttpRequest {
}
|
faruh-narzullaev/type-script | examples/example.ts | <reponame>faruh-narzullaev/type-script
type MyCustomArray = Array<string | number | boolean>;
type MyCustomNumber = number;
var age: MyCustomNumber = 28;
var arr: MyCustomArray = ["string", 5, false];
// синонимы типов
// function readonly<T extends Function>(Target: T): T {
// let newConstructor = function() {... |
faruh-narzullaev/type-script | examples/interfaces/interfaces.ts | <reponame>faruh-narzullaev/type-script
enum Color {Red, Green, White};
interface Car {
engine: string;
color: Color;
mileage?: number;
}
function carAttributes(car: Car): void {
for (let attribute in car) {
console.log(car[attribute]);
}
}
var HondaAccord = {engine: "v6", color: Color.Green};
carAttributes(Ho... |
faruh-narzullaev/type-script | examples/types/types.ts | <filename>examples/types/types.ts
var height: number = 6;
var name: string = "John";
var isHidden: boolean = false;
var list: number[] = [1, 2, 3];
var notSure: any = 5;
function test(name: string, width: number, height: number): void {
// ...
}
|
heri16/Nano-SQL | lib/query/std-query.d.ts | import { NanoSQLInstance, ORMArgs, JoinArgs, DBRow } from "../index";
export interface IdbQuery extends IdbQueryBase {
table: string | any[];
action: string;
actionArgs: any;
state: string;
result: DBRow[];
comments: string[];
}
export interface IdbQueryBase {
queryID?: string;
transacti... |
heri16/Nano-SQL | lib/database/query.d.ts | <reponame>heri16/Nano-SQL<gh_stars>1-10
import { IdbQuery } from "../query/std-query";
import { NanoSQLInstance } from "../index";
import { _NanoSQLStorage, DBRow } from "./storage";
export interface SearchRowIndex {
wrd: string;
rows: {
id: any;
l: number;
i: number[];
}[];
}
/**
*... |
heri16/Nano-SQL | lib/database/storage.d.ts | <gh_stars>1-10
import { DataModel, NanoSQLInstance, NanoSQLConfig, NanoSQLBackupAdapter } from "../index";
import { StdObject } from "../utilities";
export interface DBRow {
[key: string]: any;
}
export interface DBKey {
string: any;
number: any;
}
export interface QueryQ {
add: (table: string, cb: (don... |
heri16/Nano-SQL | src/database/adapter-indexedDB.ts | <reponame>heri16/Nano-SQL
import { NanoSQLStorageAdapter, DBKey, DBRow, _NanoSQLStorage } from "./storage";
import { DataModel } from "../index";
import { setFast } from "lie-ts";
import { StdObject, hash, fastALL, deepFreeze, uuid, timeid, _assign, generateID, intersect } from "../utilities";
import { DatabaseIndex, s... |
heri16/Nano-SQL | src/database/storage.ts | <gh_stars>0
import { Trie } from "prefix-trie-ts";
import { IdbQuery } from "../query/std-query";
import { DataModel, NanoSQLInstance, NanoSQLConfig, NanoSQLBackupAdapter } from "../index";
import { StdObject, hash, fastALL, fastCHAIN, deepFreeze, uuid, intersect, timeid, _assign, generateID, isSafari, isMSBrowser, isO... |
heri16/Nano-SQL | lib/utilities.d.ts | <filename>lib/utilities.d.ts
export declare const Promise: any;
/**
* Standard object placeholder with string key.
*
* @export
* @interface StdObject
* @template T
*/
export interface StdObject<T> {
[key: string]: T;
}
export interface UUID extends String {
}
export interface timeId extends String {
}
export ... |
heri16/Nano-SQL | tests/03-integrity.ts | <filename>tests/03-integrity.ts<gh_stars>1-10
import { NanoSQLInstance } from "../src/index";
import { expect, assert } from "chai";
import "mocha";
import { usersDB, ExampleUsers, ExampleDataModel } from "./data";
describe("Data Integrity", () => {
it("Columns should be force type casted", (done: MochaDone) => {... |
heri16/Nano-SQL | lib/database/index.d.ts | <reponame>heri16/Nano-SQL
import { IdbQuery } from "../query/std-query";
import { NanoSQLPlugin, DBConnect, NanoSQLInstance } from "../index";
export declare class NanoSQLDefaultBackend implements NanoSQLPlugin {
private _store;
parent: NanoSQLInstance;
private _queryPool;
private _queryPtr;
constru... |
heri16/Nano-SQL | tests/14-denormalization.ts | <reponame>heri16/Nano-SQL
import { nSQL, NanoSQLInstance } from "../src/index";
import { expect, assert } from "chai";
import "mocha";
import { usersDB, ExampleUsers, ExampleDataModel } from "./data";
const initStore = (complete: (nSQL: NanoSQLInstance) => void) => {
const nSQL = new NanoSQLInstance();
};
descr... |
PointMeAtTheDawn/screeps | src/creepManager.ts | <reponame>PointMeAtTheDawn/screeps
import * as Config from "config";
import * as harvester from "./role.harvester";
import * as builder from "./role.builder";
import { log } from "./lib/logger/log";
import { profileRecord } from "./lib/Profiler";
import { bodies } from "./creepBodies";
export let creeps: Creep[];
expo... |
PointMeAtTheDawn/screeps | src/creepBodies.ts | export let bodies: CreepBodies = {
300: [WORK, WORK, CARRY, MOVE],
350: [WORK, WORK, CARRY, MOVE, MOVE],
400: [WORK, WORK, CARRY, MOVE, MOVE, MOVE],
450: [WORK, WORK, WORK, CARRY, MOVE, MOVE],
500: [WORK, WORK, WORK, CARRY, MOVE, MOVE, MOVE],
550: [WORK, WORK, WORK, WORK, CARRY, MOVE, MOVE],
... |
PointMeAtTheDawn/screeps | src/mem.ts | <reponame>PointMeAtTheDawn/screeps
import { log } from "./lib/logger/log";
export const MemoryVersion = 1;
export const enum CreepRoles {
ROLE_UNASSIGNED = 0,
ROLE_ALL,
ROLE_BUILDER,
ROLE_MINER
}
export function roleToString(job: CreepRoles): string {
switch (job) {
case CreepRoles.ROLE_BUILDER:
r... |
PointMeAtTheDawn/screeps | src/main.ts | import * as CreepManager from "./creepManager";
// uncomment the following line if you want to use the profiler
import * as Profiler from "lib/Profiler";
// import { profileRecord } from "lib/Profiler";
// import { profile } from "lib/Profiler";
import { log } from "./lib/logger/log";
// Any code written outside the... |
PointMeAtTheDawn/screeps | src/role.harvester.ts | <filename>src/role.harvester.ts
import { log } from "./lib/logger/log";
export function run(creep: Creep): void {
if (creep.memory.working === false) {
if (creep.store.getFreeCapacity() === 0) {
creep.memory.working = true;
_work(creep);
} else {
_moveToHarvest(creep);
}
} else {
... |
PointMeAtTheDawn/screeps | src/role.builder.ts | <gh_stars>0
import { log } from "./lib/logger/log";
export function run(creep: Creep): void {
const spawn = creep.room.find<Spawn>(FIND_MY_SPAWNS)[0];
const source = creep.pos.findClosestByRange<FIND_SOURCES_ACTIVE>(FIND_SOURCES_ACTIVE);
if (creep.memory.working === false) {
if (creep.store.getFreeCapacity(... |
Rico75/ricardoswebconsulting-angular-php | src/app/components/Header.ts | import {Component} from '@angular/core';
import {Store} from '@ngrx/store';
import * as actions from '../actions/index';
import {TodoTextInputComponent} from './TodoTextInput';
@Component({
selector: 'fountain-header',
template: require('./Header.html'),
directives: [TodoTextInputComponent]
})
export class Heade... |
Rico75/ricardoswebconsulting-angular-php | src/index.ts | /// <reference path="../typings/index.d.ts"/>
import 'reflect-metadata';
import 'zone.js/dist/zone';
import {bootstrap} from '@angular/platform-browser-dynamic';
import 'todomvc-app-css/index.css';
import {provideStore, combineReducers} from '@ngrx/store';
import {todos, visibility, initialTodo, initialVisibility} fr... |
Rico75/ricardoswebconsulting-angular-php | src/app/components/Header.spec.ts | <reponame>Rico75/ricardoswebconsulting-angular-php<gh_stars>0
/// <reference path="../../../typings/index.d.ts"/>
import 'zone.js/dist/zone';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import {provideStore} from '@ngrx/store';
import {HeaderComponent} from './Header';
import {By} from '@a... |
Rico75/ricardoswebconsulting-angular-php | src/app/components/MainSection.spec.ts | <filename>src/app/components/MainSection.spec.ts
/// <reference path="../../../typings/index.d.ts"/>
import 'zone.js/dist/zone';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import {Component, Input} from '@angular/core';
import {async, inject, TestComponentBuilder, ComponentFixture, addPro... |
Rico75/ricardoswebconsulting-angular-php | src/routes.ts | /// <reference path="../typings/index.d.ts"/>
import {Component} from '@angular/core';
import {ROUTER_DIRECTIVES, RouterConfig} from '@angular/router';
import {AppComponent} from './app/containers/App';
@Component({
selector: 'fountain-root',
template: '<router-outlet></router-outlet>',
directives: [ROUTER_DIRE... |
DiegoVictor/gorestaurant-web | tests/pages/Dashboard.spec.tsx | <reponame>DiegoVictor/gorestaurant-web
import React from 'react';
import { render, fireEvent, act, waitFor } from '@testing-library/react';
import AxiosMock from 'axios-mock-adapter';
import faker from 'faker';
import { toast } from 'react-toastify';
import api from '../../src/services/api';
import Dashboard from '../... |
DiegoVictor/gorestaurant-web | tests/utils/factory.ts | <reponame>DiegoVictor/gorestaurant-web
import faker from 'faker';
import factory from 'factory-girl';
factory.define(
'Food',
{},
{
id: faker.random.number,
name: faker.name.title,
description: faker.lorem.paragraph,
price: () => String(faker.finance.amount()),
available: true,
image: fak... |
shinshin86/triad-color-js | index.ts | const compColors = require('complementary-colors');
interface RGBObj {
r: number;
g: number;
b: number;
}
type ColorCodeList = Array<string>;
const hexFormat = (hex: string): string => {
return hex.length === 1 ? `0${hex}` : hex;
};
const rgbToHex = ({ r, g, b }: RGBObj): string => {
const rHex = r.toStri... |
takakd/lambda-wrk2 | aws-cdk/test/aws.test.ts | <filename>aws-cdk/test/aws.test.ts
import {expect as expectCDK, haveOutput, haveResource} from '@aws-cdk/assert';
import * as cdk from '@aws-cdk/core';
import * as App from '../lib/lambda-wrk2-service';
import path = require("path");
test('Empty Stack', () => {
// WHEN
const app = new cdk.App();
const prop... |
takakd/lambda-wrk2 | wrk2-cmd/script/src/wrk2cmd.ts | import AWS = require('aws-sdk');
import path = require('path');
import fs = require('fs');
import util = require('util');
import minimist = require('minimist');
import ora = require('ora');
import { readFileSync } from 'fs';
// Key names of AWS CloudFormation Stack Outputs.
// These keys should match keys in cdk scrip... |
takakd/lambda-wrk2 | aws-cdk/bin/aws.ts | <reponame>takakd/lambda-wrk2
#!/usr/bin/env node
import path = require("path");
import "source-map-support/register";
import * as cdk from "@aws-cdk/core";
import {LambdaWrk2Service} from "../lib/lambda-wrk2-service";
// Validate environment variables.
if (!process.env.AWS_STACK_NAME) {
throw new Error('error AWS_... |
takakd/lambda-wrk2 | wrk2-cmd/script/src/index.ts | <filename>wrk2-cmd/script/src/index.ts
import { Argv, Wrk2Cmd } from './wrk2cmd';
// Parse arguments.
const argv = new Argv(process.argv);
// Run command.
const cmd = new Wrk2Cmd(argv);
cmd.run().catch((error: Error) => {
console.error(error);
});
|
takakd/lambda-wrk2 | aws-cdk/lib/lambda-wrk2-service.ts | <filename>aws-cdk/lib/lambda-wrk2-service.ts
import * as cdk from "@aws-cdk/core";
import s3 = require("@aws-cdk/aws-s3");
import lambda = require("@aws-cdk/aws-lambda");
export interface LambdaWrk2ServiceProps extends cdk.StackProps {
// A directory path included Dockerfile of container to deploy.
dockerfileP... |
noccer/omdb | src/models/OMDBModels.ts | // Enums
export enum PlotType {
full = 'full',
short = 'short',
}
export enum DataType {
json = 'json',
xml = 'xml',
}
export enum MediaType {
movie = 'movie',
series = 'series',
episode = 'episode',
}
export enum ResponseType {
true = 'True',
false = 'False',
}
// Outgoing
export t... |
noccer/omdb | src/context/AppContext.tsx | <reponame>noccer/omdb
import * as React from 'react';
import * as store from 'store2';
import { Search, ResponseType } from '../models/OMDBModels';
const favouritesKey = 'favouritesKey';
const omdbApiKey = 'omdbApiKey';
export interface ContextState {
favourites: Search[];
apiKey?: string;
apiModalOpen: ... |
noccer/omdb | src/pages/index.tsx | import * as React from 'react';
import * as store from 'store2';
import Page from '../components/_gatsbyComponents/Page';
import Container from '../components/_gatsbyComponents/Container';
import IndexLayout from '../layouts';
import ApiModal from '../components/ApiModal/ApiModal';
import { Button } from '@rmwc/button... |
noccer/omdb | src/components/Form/SearchForm.tsx | import * as React from 'react';
import * as Yup from 'yup';
import { Formik, FormikProps, Field } from 'formik';
import { SearchFormModel, SearchQuery } from '../../models/OMDBModels';
import SearchFormFooter from './SearchFormFooter';
import TextInput from './TextInput';
//@ts-ignore
import SearchFormStyles from './... |
noccer/omdb | src/components/ApiModal/ApiModal.tsx | import * as React from 'react';
import { Dialog, DialogTitle, DialogContent, DialogButton, DialogActions } from '@rmwc/dialog';
import { Button } from '@rmwc/button';
import { TextField } from '@rmwc/textfield';
import { Context, ContextStateActions } from '../../context/AppContext';
export interface ApiModalProps {}... |
noccer/omdb | src/components/Favourites/Favourite.tsx | import * as React from 'react';
import { Search } from '../../models/OMDBModels';
import { DataTableRow, DataTableCell } from '@rmwc/data-table';
import { Icon } from '@rmwc/icon';
export interface FavouriteProps {
favourite: Search;
onRemove: (ImdbId: string) => void;
}
export default class Favourite extends... |
noccer/omdb | src/components/Form/SearchFormFooter.tsx | import * as React from 'react';
import { FormikProps } from 'formik';
import { SearchFormModel } from '../../models/OMDBModels';
import { Button } from '@rmwc/button';
import { FormField } from '@rmwc/formfield';
export interface SearchFormFooterProps {
formikBag: FormikProps<SearchFormModel>;
}
export default cl... |
noccer/omdb | src/components/Favourites/Favourites.tsx | <gh_stars>0
import * as React from 'react';
import { Context, ContextStateActions } from '../../context/AppContext';
import Favourite from './Favourite';
import {
DataTable,
DataTableContent,
DataTableHead,
DataTableRow,
DataTableHeadCell,
DataTableBody,
DataTableCell,
} from '@rmwc/data-ta... |
noccer/omdb | src/components/_gatsbyComponents/Header.tsx | <reponame>noccer/omdb
import * as React from 'react';
import styled from '@emotion/styled';
import { transparentize } from 'polished';
import { Link } from 'gatsby';
import { heights, dimensions, colors } from '../../styles/variables';
import Container from './Container';
const StyledHeader = styled.header`
heigh... |
noccer/omdb | src/components/AppBar/AppBar.tsx | <reponame>noccer/omdb<gh_stars>0
import * as React from 'react';
import {
TopAppBar,
TopAppBarRow,
TopAppBarSection,
TopAppBarTitle,
TopAppBarFixedAdjust,
TopAppBarActionItem,
} from '@rmwc/top-app-bar';
import { Context, ContextStateActions } from '../../context/AppContext';
export interface ... |
noccer/omdb | src/components/MovieList/MovieList.tsx | <filename>src/components/MovieList/MovieList.tsx<gh_stars>0
import * as React from 'react';
import sortBy from 'lodash.sortby';
import { Search, SearchResult, ResponseType } from '../../models/OMDBModels';
import {
Card,
CardPrimaryAction,
CardMedia,
CardActions,
CardActionButtons,
CardActionBut... |
noccer/omdb | src/utils/OMDBService.ts | <reponame>noccer/omdb<gh_stars>0
import Axios, { AxiosRequestConfig } from 'axios';
import { SearchQuery, PlotType, SearchResult } from '../models/OMDBModels';
const baseUrl = 'http://localhost:8001';
export const apiUrl = 'http://www.omdbapi.com';
const plot = PlotType.short;
const baseConfig: AxiosRequestConfig = ... |
noccer/omdb | src/components/Form/TextInput.tsx | <reponame>noccer/omdb<filename>src/components/Form/TextInput.tsx
import * as React from 'react';
import { FieldProps } from 'formik';
import { TextField } from '@rmwc/textfield';
interface TextInputProps extends FieldProps {
placeholder: string;
type: 'text' | 'number';
onSubmit: () => void;
}
export defa... |
wangyajundev/ycRepo | src/assets/ts/api/integral-mall/api.details.ts | import axios, { domainV3 } from '../../http'
export const apiGetGoodsById = (id: number) => {
return axios.get(`${domainV3}/points/goods/${id}`)
}
export const apiPostGoodsOrder = (id: number) => {
return axios.post(`${domainV3}/points/goods/order`, {
goodsId: id
})
}
|
wangyajundev/ycRepo | src/assets/ts/utils/index.ts | <reponame>wangyajundev/ycRepo<filename>src/assets/ts/utils/index.ts
export const isNull = (str: string): boolean => str === '' || str === 'null' || str === null || str === undefined || str === 'undefined'
export const isEmail: object = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/
export const... |
wangyajundev/ycRepo | src/router/route.ts | <reponame>wangyajundev/ycRepo<gh_stars>0
import Vue, { AsyncComponent } from 'vue'
import Router, { RouteConfig } from 'vue-router'
const Home: AsyncComponent = (): any => import(/* webpackChunkName: 'integral-mall~home' */ '../views/Home.vue')
Vue.use(Router)
const routes: RouteConfig[] = [{
path: '/',
redirect: ... |
wangyajundev/ycRepo | src/types/shims-vue.d.ts | import Vue from 'vue'
declare module 'vue/types/vue' {
interface Vue {
// utils
urlQuery: any
}
}
|
wangyajundev/ycRepo | src/assets/ts/api/api.test.user.ts | import axios from '../http'
export interface IParams {
username: string
password: string
}
export const apiPostSignIn = (params: IParams) => {
return axios.post('/user/signIn', params)
}
export const apiPostSignUp = (params: IParams) => {
return axios.post('/user/signUp', params)
}
export const apiGetRegisterSt... |
wangyajundev/ycRepo | src/filters/index.ts | <reponame>wangyajundev/ycRepo<filename>src/filters/index.ts<gh_stars>0
import Vue from 'vue'
Vue.filter('numFormat', (value: number) => {
const reg = /\d{1,3}(?=(\d{3})+$)/g
return (value + '').replace(reg, '$&,')
})
|
wangyajundev/ycRepo | src/assets/ts/api/integral-mall/api.sign.ts | <filename>src/assets/ts/api/integral-mall/api.sign.ts
import axios, { domainV3 } from '../../http'
export const apiGetList = (page: number, size: number) => {
return axios.get(`${domainV3}/points/sign-in/lottery/bingo?page=${page}&size=${size}`)
}
export const apiPostBingo = (id: number) => {
return axios.post(`${d... |
wangyajundev/ycRepo | src/types/index.d.ts | interface Window {
waves: {
install: any
}
}
declare module '@utils'
declare module '@utils/*'
|
wangyajundev/ycRepo | src/assets/ts/api/integral-mall/api.home.ts | import axios, { domainV3 } from '../../http'
export const apiGetAccountsPoints = () => {
return axios.get(`${domainV3}/points/accounts`)
}
export const apiGetGoods = (page: number, size: number) => {
return axios.get(`${domainV3}/points/goods?page=${page}&size=${size}`)
}
|
wangyajundev/ycRepo | src/router/index.ts | <gh_stars>0
import Vue from 'vue'
import Router, { Route, RouteRecord } from 'vue-router'
import routes from './route'
Vue.use(Router)
const router: Router = new Router({
// mode: 'history',
mode: 'hash',
base: '/',
routes
})
router.beforeEach((to: Route, from: Route, next: Function) => {
next()
})
router.afte... |
wangyajundev/ycRepo | src/main.ts | <reponame>wangyajundev/ycRepo
import Vue, { CreateElement } from 'vue'
import router from './router'
import App from './views/App.vue'
import { getCookie } from '@utils'
import '@directives/focus'
import '@filters'
const VueAnalytics = require('vue-analytics').default
Vue.use(VueAnalytics, {
id: 'UA-45403210-1',
ro... |
wangyajundev/ycRepo | src/assets/ts/api/integral-mall/api.exchangeRecord.ts | <reponame>wangyajundev/ycRepo<gh_stars>0
import axios, { domainV3 } from '../../http'
export const apiGetGoodsOrder = (page: number, size: number) => {
return axios.get(`${domainV3}/points/goods/order?page=${page}&size=${size}`)
}
|
wangyajundev/ycRepo | src/assets/ts/http/index.ts | import axios, { AxiosInstance, AxiosResponse, AxiosRequestConfig } from 'axios'
const XToken = '5<PASSWORD>'
export const domainV3 = 'api/v3'
process.env.NODE_ENV === 'development' && (axios.defaults.headers.XToken = XToken)
axios.defaults.withCredentials = true
const instance: AxiosInstance = axios.create({
b... |
SafelyTyped/generator-safelytyped | generators/create:valueobject/templates/errors/index.ts | <%- typescriptHeader %>
export * from "./Invalid<%= typeName %>Data";
export * from "./Invalid<%= typeName %>DataError"; |
SafelyTyped/generator-safelytyped | generators/create:branded/templates/type/type.ts | <%- typescriptHeader %>
import { Branded } from "@safelytyped/core-types";
/**
* `<%= typeName %>` is a safe type.
*
* At runtime, <%= typeName %> resolves to being just a `<%= baseType %>`.
*
* @category <%= typeName %>
*/
export type <%= typeName %> = Branded<<%= baseType %>, "<%= packageName %>/<%= typeName ... |
SafelyTyped/generator-safelytyped | generators/create:refinedtype/templates/errors/data.ts | <gh_stars>0
<%- typescriptHeader %>
import { DataPath, ExtraPublicData } from "@safelytyped/core-types";
/**
* `Invalid<%- typeName %>Data` defines the data that every
* {@link Invalid<%- typeName %>Error} requires.
*
* @category Errors
*/
export interface Invalid<%- typeName %>Data extends ExtraPublicData {
... |
SafelyTyped/generator-safelytyped | generators/create:valueobject/templates/type/mustBeData.ts | <%- typescriptHeader %>
import {
DataPath,
DEFAULT_DATA_PATH,
mustBe,
OnError,
THROW_THE_ERROR,
} from "@safelytyped/core-types";
import { <%= typeName %>Data } from "./<%= typeName %>Data";
import { validate<%= typeName %>Data } from "./validate<%= typeName %>Data";
/**
* `mustBe<%= typeName %>... |
SafelyTyped/generator-safelytyped | generators/create:branded/templates/errors/error.spec.ts | <reponame>SafelyTyped/generator-safelytyped<filename>generators/create:branded/templates/errors/error.spec.ts
<%- typescriptHeader %>
import { expect } from "chai";
import { describe } from "mocha";
import { Invalid<%= typeName %>Error } from "./Invalid<%= typeName %>Error";
import { DEFAULT_DATA_PATH } from "@safely... |
SafelyTyped/generator-safelytyped | generators/create:refinedtype/templates/type/validateData.ts | <%- typescriptHeader %>
import { AppErrorOr, DataPath } from "@safelytyped/core-types";
import { Invalid<%- typeName %>DataError } from "../Errors";
/**
* `validate<%- typeName %>Data()` is a {@link DataValidator}. Use it to
* prove that the given input is a legal input value for
* {@link make<%- typeName %>}
*
... |
SafelyTyped/generator-safelytyped | generators/create:valueobject/templates/type/isData.ts | <%- typescriptHeader %>
import { IS_DATA_DEFAULT_OPTIONS, isData } from "@safelytyped/core-types";
import { <%= typeName %>Data } from "./<%= typeName %>Data";
import { validate<%= typeName %>Data } from "./validate<%= typeName %>Data";
/**
* `is<%= typeName %>Data()` is a type guard.
*
* @category <%= typeName %... |
SafelyTyped/generator-safelytyped | generators/create:refinedtype/templates/type/type.ts | <reponame>SafelyTyped/generator-safelytyped<filename>generators/create:refinedtype/templates/type/type.ts
<%- typescriptHeader %>
import {
OnErrorOptions,
<%- baseType %>,
THROW_THE_ERROR
} from "@safelytyped/core-types";
import { mustBe<%- typeName %>Data } from "./mustBe<%- typeName %>Data";
/**
* `<%... |
SafelyTyped/generator-safelytyped | generators/create:refinedtype/templates/type/make.ts | <%- typescriptHeader %>
import {
applyFunctionalOptions,
FunctionalOption,
OnErrorOptions,
SmartConstructor,
THROW_THE_ERROR,
} from "@safelytyped/core-types";
import { <%- typeName %> } from "./<%- typeName %>";
/**
* `make<%- typeName %>()` is a smart constructor. It verifies that the
* `inpu... |
SafelyTyped/generator-safelytyped | generators/create:valueobject/templates/errors/error.ts | <%- typescriptHeader %>
import {
AppError,
AppErrorData,
makeHttpStatusCode,
makeStructuredProblemReport
} from "@safelytyped/core-types";
import { MODULE_NAME } from "../defaults/MODULE_NAME";
import { Invalid<%= typeName %>Data } from "./Invalid<%= typeName %>Data";
/**
* `Invalid<%= typeName %>Da... |
SafelyTyped/generator-safelytyped | generators/create:refinedtype/templates/headers/AGPL-3.0-or-later.ts | <gh_stars>0
//
// <%- packageName %>
//
// Copyright (C) <%- copyrightYear %> <%- copyrightHolder %>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// Licen... |
SafelyTyped/generator-safelytyped | generators/create:branded/templates/type/make.ts | <%- typescriptHeader %>
import {
FunctionalOption,
makeNominalType,
OnErrorOptions,
SmartConstructor,
THROW_THE_ERROR,
} from "@safelytyped/core-types";
import { mustBe<%= typeName %>Data } from "./mustBe<%= typeName %>Data";
import { <%= typeName %> } from "./<%= typeName %>";
/**
* `make<%= ty... |
SafelyTyped/generator-safelytyped | generators/create:branded/templates/type/isData.ts | <%- typescriptHeader %>
import { DEFAULT_DATA_PATH, isData } from "@safelytyped/core-types";
import { validate<%= typeName %>Data } from "./validate<%= typeName %>Data";
/**
* `is<%= typeName %>Data()` is a data guard.
*
* @category <%= typeName %>
* @param input
* The input data to validate.
* @returns
* - `... |
SafelyTyped/generator-safelytyped | generators/create:refinedtype/templates/headers/GPL-3.0-or-later.ts | <filename>generators/create:refinedtype/templates/headers/GPL-3.0-or-later.ts
//
// <%- packageName %>
//
// Copyright (C) <%- copyrightYear %> <%- copyrightHolder %>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the... |
SafelyTyped/generator-safelytyped | generators/create:refinedtype/templates/headers/Proprietary.ts | <reponame>SafelyTyped/generator-safelytyped<gh_stars>0
//
// Copyright (c) <%- copyrightYear %>-present <%- copyrightHolder %>.
// All rights reserved.
//
// This software is the intellectual property of the copyright holder. It
// is not open-source software. It is not public domain software.
//
// THIS SOFTWARE IS PR... |
SafelyTyped/generator-safelytyped | generators/create:valueobject/templates/type/data.ts | <reponame>SafelyTyped/generator-safelytyped<filename>generators/create:valueobject/templates/type/data.ts
<%- typescriptHeader %>
/**
* `<%= typeName %>`Data is the input required to make a new
* {@link <%= typeName %>}
*
* @category <%= typeName %>
*/
export interface <%= typeName %>Data {
// @TODO
//
... |
SafelyTyped/generator-safelytyped | generators/create:refinedtype/templates/headers/MIT.ts | //
// MIT License
// Copyright (c) <%- copyrightYear %>-present <%-copyrightHolder %>.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitati... |
SafelyTyped/generator-safelytyped | generators/create:valueobject/templates/headers/GPL-2.0-or-later.ts | <gh_stars>0
//
// <%= packageName %>
//
// Copyright (C) <%= copyrightYear %> <%= copyrightHolder %>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or (at... |
SafelyTyped/generator-safelytyped | generators/create:refinedtype/templates/type/isData.ts | <reponame>SafelyTyped/generator-safelytyped<gh_stars>0
<%- typescriptHeader %>
import { IS_DATA_DEFAULT_OPTIONS, isData } from "@safelytyped/core-types";
import { validate<%- typeName %>Data } from "./validate<%- typeName %>Data";
/**
* `is<%- typeName %>Data()` is a data guard.
*
* @category <%- typeName %>
* @... |
MaxG-Git/DocObject | src/ts/docobject.ts | import { DocObjectDomBind, DocObjectBind, DocObjectBindGen, DocObjectBindAttribute } from './docbind'
import { DocObjectRender } from './docrender'
import DocGen from './docgen'
import runError, {
ROOT_ERROR,
JQUERY_NOT_DETECTED
} from './errors';
/******* GLOBALS *******/
declare global {
interface Win... |
MaxG-Git/DocObject | src/ts/index.ts | <filename>src/ts/index.ts
import { DocObject, DocObjectElement } from "./docobject";
import DocGen from "./docgen";
import {setCursorPos, getCursorPos} from "./utils"
class Bind extends HTMLElement {
constructor() {
super()
this.attachShadow({mode: "open"});
const div = document.createEleme... |
MaxG-Git/DocObject | src/ts/errors.ts | <gh_stars>0
export const ROOT_ERROR = 'ROOT_ERROR'
export const JQUERY_NOT_DETECTED = 'JQUERY_NOT_DETECTED'
export default function runError(error : string, fail=false){
if(error in ERRORS){
if(fail){
throw Error('DocObject: '+ ERRORS[error].message);
}else{
console.error... |
MaxG-Git/DocObject | src/ts/docgen.ts | <gh_stars>0
import {DocObject, DocObjectHTMLLike} from './docobject'
import { DocObjectBindAttribute } from './docbind'
export default class DocGen {
obj ? : DocObject
constructor(obj? : DocObject){
this.obj = obj
return new Proxy(this, {
get:(target, prop ) => ... |
MaxG-Git/DocObject | src/ts/utils.ts | <gh_stars>0
interface Document {
selection: {
}
}
// Credits: https://stackoverflow.com/questions/2897155/get-cursor-position-in-characters-within-a-text-input-field
export function getCursorPos(element : HTMLInputElement) : number {
// if (document.selection) {
// element.focus();
//... |
MaxG-Git/DocObject | src/ts/docbind.ts | import {
DocObjectHTMLLike,
DocObjectConfig
} from './docobject'
import DocGen from './docgen'
export interface DocObjectDomBind extends HTMLElement {
_DocObjectConfig? : DocObjectConfig
}
export interface DocObjectBind {
[key: string] : DocObjectBindFunction
}
export type DocObjectBindGen = ( gen... |
MaxG-Git/DocObject | src/ts/docrender.ts | export interface DocObjectRender extends Array<DocObjectRenderObject>{}
export type DocObjectRenderFunction = ( values:object, prevValues:object)=>void;
export interface DocObjectRenderObject {
clean : DocObjectRenderFunction
action : DocObjectRenderFunction
dep : Array<string>
} |
johntran/docz | core/docz-core/src/types.d.ts | <gh_stars>0
declare module '@sindresorhus/slugify'
declare module 'art-template'
declare module 'common-tags'
declare module 'detect-port'
declare module 'env-dot-prop'
declare module 'find-up'
declare module 'friendly-errors-webpack-plugin'
declare module 'get-pkg-repo'
declare module 'html-minifer'
declare module 'hu... |
johntran/docz | core/docz-theme-default/src/components/ui/Editor/index.tsx | <filename>core/docz-theme-default/src/components/ui/Editor/index.tsx
import * as React from 'react'
import { useMemo, useCallback, useState } from 'react'
import { useConfig, UseConfigObj } from 'docz'
import loadable from '@loadable/component'
import styled from 'styled-components'
import getter from 'lodash/get'
imp... |
johntran/docz | core/docz-theme-default/src/components/ui/Table.tsx | import * as React from 'react'
import styled from 'styled-components'
import { get } from '@utils/theme'
import { mq } from '@styles/responsive'
const Wrapper = styled.div`
overflow-x: auto;
padding: 2px;
margin-bottom: 30px;
${mq({
marginBottom: [20, 40],
maxWidth: ['calc(100vw - 40px)', 'calc(100vw... |
johntran/docz | core/docz-core/src/bundler/plugins.ts | import Config from 'webpack-chain'
import { IgnorePlugin, HotModuleReplacementPlugin } from 'webpack'
import webpackBarPlugin from 'webpackbar'
import friendlyErrorsPlugin from 'friendly-errors-webpack-plugin'
import { minify } from 'html-minifier'
import miniHtmlWebpack from 'mini-html-webpack-plugin'
import manifestP... |
jacqueolson/angular5experiment | src/app/components/app-root/app-root.component.ts | import { Component } from '@angular/core';
import { AppService } from '../../services/app.service';
@Component({
selector: 'app-root',
templateUrl: './app-root.component.html',
styleUrls: ['./app-root.component.css']
})
export class AppRootComponent {
public appUser = '<NAME>';
public constructor(private a... |
jacqueolson/angular5experiment | src/app/services/auth.service.ts | import { Injectable } from '@angular/core';
import { User } from './../models/user';
@Injectable()
export class AuthService {
user: User;
constructor() { }
public login(user: User) {
}
public logout(user: User) {
}
public getToken(): string {
const token = localStorage.getItem(User.name);
... |
jacqueolson/angular5experiment | src/app/services/app.service.ts | <reponame>jacqueolson/angular5experiment
import { Injectable } from '@angular/core';
@Injectable()
export class AppService {
public serviceUser: string;
constructor() {
}
public showServiceUserName(): string {
return this.serviceUser + 'App Service';
}
}
|
jacqueolson/angular5experiment | src/app/models/user.ts | export class User {
Name: string;
Password: string;
}
|
jacqueolson/angular5experiment | src/app/modules/app.module.ts | <gh_stars>0
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { PickingModule } from './picking.module';
import { ShippingModule } from './shipping.module';
import { SharedModule } from './shared.module';
import { AppService } from '../services/app.service';
i... |
jacqueolson/angular5experiment | src/app/components/app-header/app-header.component.ts | import { Component, OnChanges, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-header',
templateUrl: './app-header.component.html',
styleUrls: ['./app-header.component.css']
})
export class AppHeaderComponent implements OnChanges {
@Input() headerUser;
@Output() deleteUser: Ev... |
CharityMutonii/GithubSearch | src/environments/environment.ts | <reponame>CharityMutonii/GithubSearch<filename>src/environments/environment.ts
export const environment = {
production: false,
url: "c8fa04707106a06180b2eda4de6a2f76906102fd",
};
|
CharityMutonii/GithubSearch | src/app/highlight.directive.ts | <gh_stars>0
import { Directive, ElementRef, HostBinding, HostListener } from '@angular/core';
@Directive({
selector: '[appHighlight]'
})
export class HighlightDirective {
constructor(private elem: ElementRef) { }
@HostBinding('style.backgroundColor') backgroundColor = 'transparent';
@HostListener('mouseover... |
CharityMutonii/GithubSearch | src/app/app.component.ts | <reponame>CharityMutonii/GithubSearch
import { Component } from '@angular/core';
import { Repo } from './repo';
import { User } from './user';
import { ServiceService } from './service.service';
import { HttpClient } from '@angular/common/http';
import { environment } from 'src/environments/environment';
@Component({
... |
CharityMutonii/GithubSearch | src/app/service.service.ts | import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Repo } from './repo';
import { User } from './user';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root'
})
export class ServiceService {
user: User;
repo: Repo;
rep... |
Vbubblery/mobx-state-tree | packages/mobx-state-tree/src/core/node/scalar-node.ts | <reponame>Vbubblery/mobx-state-tree<filename>packages/mobx-state-tree/src/core/node/scalar-node.ts
import {
fail,
freeze,
NodeLifeCycle,
Hook,
BaseNode,
AnyObjectNode,
SimpleType,
devMode
} from "../../internal"
import { action } from "mobx"
/**
* @internal
* @hidden
*/
export class ... |
Vbubblery/mobx-state-tree | packages/mobx-state-tree/__tests__/core/object.test.ts | <reponame>Vbubblery/mobx-state-tree
import {
destroy,
detach,
onSnapshot,
onPatch,
onAction,
applyPatch,
applyAction,
applySnapshot,
getSnapshot,
unprotect,
types,
setLivelinessChecking,
getParent,
SnapshotOut,
IJsonPatch,
ISerializedActionCall,
isAliv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.