repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
QuietWind/find-imports
src/file.ts
<gh_stars>0 import * as fs from "fs"; import * as path from "path"; import * as crypto from "crypto"; import * as Dstore from "data-store"; const store = Dstore("FILENAME"); store.clear(); export const extensions = [".js", ".jsx", ".ts", ".tsx"]; export interface PathOption { baseUrl: string[]; } export functio...
QuietWind/find-imports
lib/index.d.ts
export interface TFindImportsOptions { findChild: boolean; log: boolean; baseUrl: string[]; } export declare function findImports(filename: string, options: TFindImportsOptions): string[]; declare const _default: { findImports: (filename: string, options: TFindImportsOptions) => string[]; findImport...
QuietWind/find-imports
test/files/data.ts
<reponame>QuietWind/find-imports<gh_stars>0 interface TodoItem { title: string; check?: boolean; } const baseData: TodoItem[] = [ { title: "融合知识图谱的文本异构信息网络构建以及在机器学习中的应用" }, { title: "金融反欺诈中,社交网络算法有用吗?" }, { title: "用动态自服务的队列和容量管理来帮助用户" }, { title: "Twitter实时计算平台" }, { title: "周六欢迎致辞" }, { title: "Big d...
QuietWind/find-imports
test/test.ts
<gh_stars>0 import { findImports } from "qw-find-imports"; const strs2 = findImports( "XXXXXXXX/index.js", { findChild: true, log: false, baseUrl: ["XXXXXXXX"] } ); console.log(JSON.stringify(strs2, null, 2));
QuietWind/find-imports
src/find.by.str.ts
<gh_stars>0 import * as babylon from "babylon"; import { default as traverse } from "babel-traverse"; import * as ts from "typescript"; /** * * @param ts_str typescript string * @param filename filename */ function transferTsToJs(ts_str: string, filename: string = "demo.ts"): string { const tsConfig: ts.Compiler...
Pepijn98/AniNotifs
@types/global/index.d.ts
<reponame>Pepijn98/AniNotifs<filename>@types/global/index.d.ts<gh_stars>0 interface String { replaceAll(searchValue: string | RegExp, replaceValue: string): string }
Pepijn98/AniNotifs
src/extensions.ts
String.prototype.replaceAll = function (searchValue: string | RegExp, replaceValue: string): string { // Return if both values are the exact same if (searchValue === replaceValue) return this; // Save string in variable so we don't modify the original string let self = this; // eslint-disable-line @typ...
Pepijn98/AniNotifs
src/feeds.ts
import git from "git-rev-sync"; import settings from "./settings"; import pkg from "@/package.json"; import TurndownService from "turndown"; import { Client } from "eris"; import { FeedItem, ValidateFeed } from "./types"; import { shows, exceptions } from "./anime.json"; // matches anything between v2 and vInfinity co...
Pepijn98/AniNotifs
src/types.ts
// Since rss-feed-emitter has horrible ungly bad types I'll use my own import { Client, Message } from "eris"; import { Item, Meta, Image, Enclosure } from "feedparser"; export interface FeedConfig { url: string; eventName: string; refresh: number; userAgent?: string; } export interface FeedItem exte...
Pepijn98/AniNotifs
src/index.ts
import "./extensions"; import settings from "./settings"; import chalk from "chalk"; import path from "path"; import Collection from "@kurozero/collection"; import FeedEmitter from "rss-feed-emitter"; import Feeds from "./feeds"; import { promises as fs } from "fs"; import { Client, TextChannel } from "eris"; import {...
Pepijn98/AniNotifs
src/commands/ping.ts
<reponame>Pepijn98/AniNotifs import { Command } from "~/types"; export const command: Command = { name: "ping", async run(msg): Promise<void> { await msg.channel.createMessage("Pong!"); } };
Pepijn98/AniNotifs
@types/eris/index.d.ts
<filename>@types/eris/index.d.ts<gh_stars>0 import { Collection as RealCollection } from "@kurozero/collection"; import { Command as RealCommand } from "~/types"; declare module "eris" { interface Client { commands: RealCollection<RealCommand> } }
Pepijn98/AniNotifs
src/utils.ts
import { Channel, GuildChannel, Constants } from "eris"; const { Intents } = Constants; // prettier-ignore export const intents = Intents.guilds | Intents.guildMembers | Intents.guildEmojis | Intents.guildMembers | Intents.guildMessages | Intents.guildMessageReactions; export const isGuildChan...
samuel2749/license_test_ts
src/models/ReviewQuestionModel.ts
<gh_stars>0 import QuestionModel from './QuestionModel'; export default class extends QuestionModel { public wrongAnswer: string[]; constructor(wrongAnswer: string[] = []) { super(); this.wrongAnswer = wrongAnswer; } }
samuel2749/license_test_ts
src/router/index.ts
<filename>src/router/index.ts import Vue from 'vue'; import VueRouter, { RouteConfig } from 'vue-router'; // import Home from '@/views/Home.vue'; // import PM from '@/views/pm/Index.vue'; // import Normal from '@/views/normal/Index.vue'; // import SwiperTest from '@/views/swiper-test/Index.vue'; const Home = () => impo...
samuel2749/license_test_ts
src/constants/QuestionBank.ts
class JsonModel { public title: string; public jsonPath: string; constructor(title = '', jsonPath = '') { this.title = title; this.jsonPath = jsonPath; } } export default class { private jsonModel: JsonModel; constructor(type: string) { this.jsonModel = this.getQuestionLi...
samuel2749/license_test_ts
src/store/index.ts
<reponame>samuel2749/license_test_ts import Vue from 'vue'; import Vuex from 'vuex'; import test from './module1'; Vue.use(Vuex); const SET_DEVICE = 'SET_DEVICE'; export default new Vuex.Store({ state: { isMobile: false, name: '' }, mutations: { SET_DEVICE(state, value) { ...
samuel2749/license_test_ts
src/store/module1.ts
<reponame>samuel2749/license_test_ts<filename>src/store/module1.ts import { Commit } from 'vuex'; const state = { menulist: [], name: 'test' }; const mutations = { // eslint-disable-next-line @typescript-eslint/no-explicit-any saveMenuList(states: any, params: object) { states.menulist = params...
samuel2749/license_test_ts
src/models/QuestionModel.ts
export default class { public no = ''; public question = ''; public option: string[] = []; public answer: string[] = []; }
zealic/vanitygen-hd
test/hd.test.ts
<gh_stars>1-10 import * as assert from 'assert'; import { HD } from '../src'; import { bip32 } from 'bitcoinjs-lib'; describe('HDWallet', function () { it('From mnemonic and get first address', async () => { let wallet = await HD.HDWallet.from('rookie message fee quarter dream shoulder frown lady best wisdom hur...
zealic/vanitygen-hd
src/classic/wallet.ts
import * as bitcoin from 'bitcoinjs-lib'; export interface IWallet { readonly privateKey: Buffer; readonly publicKey: Buffer; readonly address: string; } export class Wallet implements IWallet { private pair: bitcoin.ECPairInterface; constructor() { this.pair = bitcoin.ECPair.makeRandom...
zealic/vanitygen-hd
vanitygen-hd.ts
<reponame>zealic/vanitygen-hd<filename>vanitygen-hd.ts import * as fs from 'fs'; import * as os from 'os'; import * as cluster from 'cluster'; import * as yaml from 'js-yaml'; import { Command } from 'commander'; import { HD } from './src'; function initializeProgram() { let program = new Command(); program...
zealic/vanitygen-hd
src/classic/index.ts
<gh_stars>1-10 import { IWallet, Wallet } from './wallet'; export { IWallet, Wallet };
zealic/vanitygen-hd
src/index.ts
<gh_stars>1-10 import * as Blackhole from './blackhole'; import * as Classic from './classic'; import * as HD from './hd'; export { Blackhole, Classic, HD, };
zealic/vanitygen-hd
src/blackhole/generator.ts
<reponame>zealic/vanitygen-hd<filename>src/blackhole/generator.ts //http://gobittest.appspot.com/ProofOfBurn
zealic/vanitygen-hd
test/classic.test.ts
import * as assert from 'assert'; import { Classic } from '../src'; describe('ClassicWallet', function () { it('From wif', async () => { let fixture = { "brainMnemonic": "?", "WIF": "L1s3Qpc5G8hs8V24FubcdxcBHPVzfwwD4vGWddRijXjejZKwQbyM", "address":"19fMFMdS9bi4CwmXVsbAMgNw9RrsgBUPB3" }; ...
zealic/vanitygen-hd
src/blackhole/wallet.ts
const bs58 = require('bs58check') export interface IWallet { readonly address: string; } const PKH_VERSION = 0; export class Wallet implements IWallet { private _address: string; static fromPublicKeyHash(publicKeyHash: Buffer | string): Wallet { let wallet = <Wallet>Object.create(Wallet.prototyp...
zealic/vanitygen-hd
src/hd/wallet.ts
<reponame>zealic/vanitygen-hd import * as bitcoin from 'bitcoinjs-lib'; import { bip32 } from 'bitcoinjs-lib'; import * as bip39 from 'bip39'; export interface IHDWallet { readonly parent: IHDWallet; readonly mnemonic: string; readonly rootKey: bip32.BIP32Interface; readonly firstAddress: string; ...
zealic/vanitygen-hd
src/hd/generator.ts
<gh_stars>1-10 import { bip32 } from 'bitcoinjs-lib'; import { IHDWallet, HDWallet, HDMWallet } from './wallet'; import { HDWalletMatcher } from './matcher'; export class HDWalletGenerator { private bits: number; private cosigners: bip32.BIP32Interface[]; private coMembers: number; private lastSigner: boolean;...
zealic/vanitygen-hd
src/hd/matcher.ts
import * as _ from 'lodash'; import * as fs from 'fs'; import { IHDWallet } from './wallet'; const PREFIX_P2PHK = '1'; const PREFIX_P2SH = '3'; export class HDWalletMatcher { private commonRules: string[]; private hdRules: string[]; private hdmRules: string[]; setRules(rules: string[], hdRules: strin...
zealic/vanitygen-hd
src/hd/index.ts
import { IHDWallet, HDWallet, HDMWallet } from './wallet'; import { HDWalletGenerator } from './generator'; import { HDWalletMatcher } from './matcher'; export { IHDWallet, HDWallet, HDMWallet, HDWalletMatcher, HDWalletGenerator, };
zealic/vanitygen-hd
test/blackhole.test.ts
<filename>test/blackhole.test.ts import * as assert from 'assert'; import { Blackhole } from '../src'; describe('BlackholeWallet', function () { it('From full zero publicKeyHash', async () => { let fixture = { "publicKeyHash": "0000000000000000000000000000000000000000", "address":"1111111111111111111...
HsiehMinChien/analysis-phone-number
pages/index.tsx
<reponame>HsiehMinChien/analysis-phone-number import React, { useState } from "react"; import { compose } from "redux"; import withApollo from "../lib/with-apollo"; import { withRedux } from "../lib/redux"; import Button from "@material-ui/core/Button"; import Typography from "@material-ui/core/Typography"; import Grid...
HsiehMinChien/analysis-phone-number
pages/resume/about-me.tsx
<reponame>HsiehMinChien/analysis-phone-number import { memo } from 'react'; import ContentContainer from '../../components/content-container'; import DownloadButton from '../../components/download-button'; function AboutMe() { return ( <ContentContainer title="About me" className="about-me"> <div className...
HsiehMinChien/analysis-phone-number
pages/resume/projects.tsx
import { memo } from 'react'; import ContentContainer from '../../components/content-container'; const projectInfoList = [ { title: 'GraphQL demo project', description: 'Use open GraphQL api to build an demo project.', codeUrl: 'https://github.com/HsiehMinChien/graphql-demo-project/', demoUrl: 'https...
HsiehMinChien/analysis-phone-number
graphql/generate_file/index.tsx
import { GraphQLResolveInfo } from 'graphql'; import gql from 'graphql-tag'; import * as React from 'react'; import * as ApolloReactCommon from '@apollo/react-common'; import * as ApolloReactComponents from '@apollo/react-components'; import * as ApolloReactHoc from '@apollo/react-hoc'; export type Maybe<T> = T | null;...
HsiehMinChien/analysis-phone-number
__mocks__/styleMock.ts
export default module.exports = {};
HsiehMinChien/analysis-phone-number
components/clock.tsx
import React from "react"; import { useSelector, shallowEqual } from "react-redux"; import cx from "classnames"; import "./style.styl"; const useClock = () => { return useSelector( (state: any) => ({ lastUpdate: state.lastUpdate, light: state.light }), shallowEqual ); }; const formatTime =...
HsiehMinChien/analysis-phone-number
pages/resume/skills.tsx
import { memo } from 'react'; import ContentContainer from '../../components/content-container'; const skillList = [ 'Javascript', 'Typescript', 'CSS', 'HTML', 'React.js', 'Redux', 'Bootstrap', 'GraphQL', 'Apollo', 'Next.js', 'SASS', 'style-components', 'Stylus', 'Antd(Ant desing)', 'Nigh...
HsiehMinChien/analysis-phone-number
redux/store/index.ts
<filename>redux/store/index.ts import { createStore } from "redux"; const initialState = { lastUpdate: 0, light: false, data: {} }; const reducer = (state = initialState, action: any) => { switch (action.type) { case "TICK": return { ...state, lastUpdate: action.lastUpdate, l...
HsiehMinChien/analysis-phone-number
pages/count-stock-price/index.tsx
<filename>pages/count-stock-price/index.tsx import { useState } from "react"; import cx from "classnames"; import ReactCalander from "react-calendar"; import { InputNumber, Input } from "antd"; import Moment from "moment"; import Big from "big.js"; import "./style.styl"; const PREFIX_CLASS = "count-stock-price-page"; ...
HsiehMinChien/analysis-phone-number
components/download-button/index.tsx
import { memo, useCallback } from 'react'; import { Button, message } from 'antd'; import { DownloadOutlined } from '@ant-design/icons'; import cx from 'classnames'; const PREFIX_CLASS = 'download-button'; function DownloadButton({ className, fileUrl, downloadText, }: { className?: string, fileUrl: string, ...
HsiehMinChien/analysis-phone-number
__tests__/index.test.tsx
<filename>__tests__/index.test.tsx import { shallow } from "enzyme"; import React from "react"; import Clock from "../components/clock"; import { Provider } from "react-redux"; import configureStore from "redux-mock-store"; describe("With Enzyme", () => { const initialState = { lastUpdate: 0, light: false }; cons...
HsiehMinChien/analysis-phone-number
components/drawer/index.tsx
<filename>components/drawer/index.tsx import { withRouter } from "next/router"; import Drawer from "@material-ui/core/Drawer"; import List from "@material-ui/core/List"; import ListItem from "@material-ui/core/ListItem"; import ListItemIcon from "@material-ui/core/ListItemIcon"; import ListItemText from "@material-ui/c...
HsiehMinChien/analysis-phone-number
components/appbar/index.tsx
<reponame>HsiehMinChien/analysis-phone-number import AppBar from "@material-ui/core/AppBar"; import Toolbar from "@material-ui/core/Toolbar"; import Typography from "@material-ui/core/Typography"; import IconButton from "@material-ui/core/IconButton"; import MenuIcon from "@material-ui/icons/Menu"; function CostomizeA...
HsiehMinChien/analysis-phone-number
components/content-container/index.tsx
<gh_stars>1-10 import { memo, ReactNode } from 'react'; import cx from 'classnames'; import './style.styl'; const PREFIX_CLASS = 'content-container'; function ContentContainer({ className, title, children, }: { className?: string, title?: string, children?: ReactNode, }) { return ( <div className={c...
HsiehMinChien/analysis-phone-number
pages/resume/home.tsx
<reponame>HsiehMinChien/analysis-phone-number import { memo } from 'react'; import ContentContainer from '../../components/content-container'; function Home() { return ( <ContentContainer className="home"> <h1>I'm <NAME><span>.</span></h1> <h2>An frontend engineer</h2> </ContentContainer> ); } ...
HsiehMinChien/analysis-phone-number
components/fixed-icon/index.tsx
import { ForwardRefExoticComponent, memo } from 'react'; import cx from 'classnames'; import './style.styl'; const PREFIX_CLASS = 'fixed-icon'; function FixedIcon({ className, IconComponent, onClickIcon, }: { className: string, IconComponent: ForwardRefExoticComponent<any>, onClickIcon: () => void, }) { ...
HsiehMinChien/analysis-phone-number
pages/resume/index.tsx
<gh_stars>1-10 import { useState, useCallback, memo } from 'react'; import { Modal, Switch } from 'antd'; import cx from 'classnames'; import { SettingOutlined } from '@ant-design/icons'; import FixedIcon from '../../components/fixed-icon'; import Home from './home'; import AboutMe from './about-me'; import ExperienceA...
HsiehMinChien/analysis-phone-number
pages/resume/experience.tsx
import { memo } from 'react'; import { Timeline } from 'antd'; import ContentContainer from '../../components/content-container'; function ExperienceAndEducation() { return ( <ContentContainer title="Experience & Education" className="experience"> <Timeline mode="left"> <Timeline.Item>Aug 2019 - cu...
HsiehMinChien/analysis-phone-number
pages/_app.tsx
import Head from "next/head"; import "antd/dist/antd.css"; const metaList = ["description", "keywords", "title", "name"]; export default function MyApp({ Component, pageProps, }: { Component: any; pageProps: any; }) { return ( <> <Head> <title><NAME> personal demo projects</title> ...
HsiehMinChien/analysis-phone-number
components/paper.tsx
import React from "react"; import cx from "classnames"; import Paper from "@material-ui/core/Paper"; const PREFIX_CLASS = "customize-paper"; const CustomizedPaper = ({ className, children }: { className?: string; children: any; }) => { return ( <Paper className={cx(PREFIX_CLASS, className)} variant="out...
tashian/google-auth-library-nodejs
src/index.ts
/** * Copyright 2017 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
Baoyuantop/wasmed
test/parser.spec.ts
import { depsParser } from "../rpc/parser"; describe("deps parser test", () => { const modules = [ { name: "A", path: "target/wasm32-unknown-unknown/release/actor.wasm", deps: [] }, { name: "B", path: "target/wasm32-unknown-unknown/release/actor.wasm", deps: ["A"] ...
Baoyuantop/wasmed
storage/index.ts
<filename>storage/index.ts export * from "./json"; export * from "./wasm"; export * from "./cbmap";
Baoyuantop/wasmed
debug/index.ts
<filename>debug/index.ts import * as util from "util"; import { getWasmExport } from "../storage"; import { log } from "../utils/log"; export const print = (wasmName: string) => { return function print (ptr: number, length: number) { const wasm_exports = getWasmExport(wasmName); log().star(ptr, length, "from...
Baoyuantop/wasmed
storage/cbmap.ts
const cbmap = new Map(); type MapPayload = { cb: number; user_data: number; moduleName: string; funcName: string; }; export const getIndex = (index: number) => { return cbmap.get(index); }; export const setIndex = (index: number, payload: MapPayload) => { cbmap.set(index, payload); };
Baoyuantop/wasmed
sqlite/index.ts
import * as sqlite from "sqlite3"; import * as protobuf from "protobufjs"; import { getWasmExport } from "../storage"; import { getValue, setValue, getValueByBytes } from "../utils"; import { log } from "../utils/log"; const db = new sqlite.Database("test.db"); export const _sql_run_callback = (moduleName: string) ...
Baoyuantop/wasmed
utils/index.ts
<filename>utils/index.ts import * as util from "util"; import { wasm_modules_amount } from "../index"; import { log } from "../utils/log"; import { event } from "../rpc/parser"; import { getContract, runContract } from "../contract"; import { getWasmExport } from "../storage"; export const setValue = (moduleName: str...
Baoyuantop/wasmed
notify/index.ts
<reponame>Baoyuantop/wasmed<gh_stars>0 import { socket } from "../rpc/server"; export const sendResponseSync = ({ code, index, result, jsonrpc = "2.0" }: RPCResponse) => { const response = { jsonrpc, code, index, result, }; socket.send(JSON.stringify(response)); };
Baoyuantop/wasmed
fs/index.ts
<reponame>Baoyuantop/wasmed import * as fs from "fs"; import * as util from "util"; import { getWasmExport } from "../storage"; export const _read_file_callback = (ptr: number, path_length: number, fn: number, addr: number) => { const wasm_exports = getWasmExport(); const value = wasm_exports.memory.buffer.slice(p...
Baoyuantop/wasmed
utils/log.ts
import * as signale from "signale"; signale.config({ displayFilename: true, displayTimestamp: true, }); export const log = () => { return signale; };
Baoyuantop/wasmed
notify/callback.ts
<gh_stars>0 import { log } from "../utils/log"; import { getIndex, getWasmExport } from "../storage"; import { sendResponseSync } from "./index"; const __callback_u32 = (index: number, result: number) => { }; const __callback_i32 = (index: number, result: number) => { if (index > 10) { log().info(index, result...
Baoyuantop/wasmed
storage/wasm.ts
<filename>storage/wasm.ts import { log } from "../utils/log"; const modulesList: ParseModuleList = []; let curWasm: string; export const getWasmExport = (name?: string): any => { const wasmName = name || curWasm; log().info(`get ${wasmName} module exports`); const curModule = modulesList.find(item => item.nam...
Baoyuantop/wasmed
contract/index.ts
import { getWasmExport } from "../storage"; import { log } from "../utils/log"; const contractList: any[] = []; export const getContract = async (moduleName: string, ptr: number, length: number) => { const wasm_exports = getWasmExport(moduleName); const buffer = wasm_exports.memory.buffer.slice(ptr, ptr + length)...
Baoyuantop/wasmed
rpc/handler.ts
<reponame>Baoyuantop/wasmed<gh_stars>0 import { IMessage } from "websocket"; import { isModuleExist, getWasmExport, isMethodExits, getCurMethod } from "../storage"; import { log } from "../utils/log"; import { setValueByBytes } from "../utils/index"; export let requestCache: RequestCache[] = []; export const handler...
Baoyuantop/wasmed
rpc/parser.ts
<reponame>Baoyuantop/wasmed import { promises as fs } from "fs"; import * as events from "events"; import { initModule } from "../index"; import { log } from "../utils/log"; export const event = new events.EventEmitter(); export const loadJson = async (folder: string) => { try { const filesName = await fs.read...
Baoyuantop/wasmed
request/index.ts
<gh_stars>0 import axios from "axios"; import { getWasmExport } from "../storage"; import { getValue, setValue } from "../utils"; export const _request_callback = (moduleName: string) => { return function _request_callback (ptr: number, path_length: number, fn: number, addr: number) { const wasm_exports = getWa...
Baoyuantop/wasmed
storage/json.ts
<reponame>Baoyuantop/wasmed<filename>storage/json.ts let methodsList: any = {}; export const initMethodsList = (list: any) => { methodsList = list; }; export const isMethodExits = (moduleName: string, methodName: string) => { const curModule = methodsList[moduleName]; return curModule.map((item: any) => item.n...
Baoyuantop/wasmed
global.d.ts
<reponame>Baoyuantop/wasmed type Modules = Module[]; type Module = { name: string; path: string; deps: string[]; }; type Method = { name: string; module: string; ty: "async" | "sync"; arguments: Arg[]; return: Return; }; type Arg = { name: string; type: ValueType; }; type Return = { type: Valu...
Baoyuantop/wasmed
index.ts
<reponame>Baoyuantop/wasmed import * as fs from "fs"; import { mw_rt } from "./notify/callback"; import { print } from "./debug"; import { _read_file_callback } from "./fs"; import { _request_callback } from "./request"; import { _sql_run_callback, _sql_query_callback, _sql_operate_callback } from "./sqlite"; import ...
Baoyuantop/wasmed
rpc/server.ts
import { server, connection } from "websocket"; import * as http from "http"; import { handler } from "./handler"; import { loadJson, wasmParser } from "./parser"; import { log } from "../utils/log"; import { initMethodsList } from "../storage"; export let socket: connection; // For Make Test export const startTest ...
starsoft35/quark
src/util/device.ts
<gh_stars>0 // 是否为移动端设备 export const isMobileDevice = () => { const r = window.matchMedia('(max-width: 768px)'); return r && r.matches; };
starsoft35/quark
src/page/Welcome/constant.ts
<gh_stars>0 export const TAGS = [ '天擎', '明月', '鬼谋', '魅影', '星瞳', '楼兰', '妖狐', '世界和平', '汉江之虎', '倾城', '白发', '独狼', '卷毛', '小楼一夜', '黑衣', '紫眸', '斜眉', '温良如玉', '狂拽龙少', '贵公子', '铁血', '天下有敌', '杀手', '光辉岁月', '西南狼', '不死鸟', '女诸葛', '书生', '光芒万丈', '相...
starsoft35/quark
src/store/list-demo/reducer.ts
<filename>src/store/list-demo/reducer.ts import { combineReducers, Reducer } from 'redux'; import { getQuxListReducer } from '../base'; import { ID } from './constant'; import { IPageState } from './type'; const listReducer = getQuxListReducer(ID); export default combineReducers({ listState: listReducer, }) as Redu...
starsoft35/quark
src/store/type.ts
<reponame>starsoft35/quark import { IAppState, APP_CONSTANT } from './app'; import { IListDemoState, LIST_DEMO_CONSTANT } from './list-demo'; export interface IRootReducer { [APP_CONSTANT.ID]: IAppState; [LIST_DEMO_CONSTANT.ID]: IListDemoState; } export type GetStateFunc = () => IRootReducer;
starsoft35/quark
src/component/PageLoading.tsx
<reponame>starsoft35/quark import React, { FC } from 'react'; import { Spin } from '@vdfor/react-component'; const Index: FC = () => <Spin />; export default Index;
starsoft35/quark
src/store/app/type.ts
<reponame>starsoft35/quark import { SectionStateEnum } from '@vdfor/util'; export interface IAppRouteState { path: string; id?: string; // 当前路由页面ID标识 uiStatus: SectionStateEnum; } export interface IAppState { routeState: IAppRouteState; }
starsoft35/quark
src/page/Welcome/index.tsx
<filename>src/page/Welcome/index.tsx import React, { useState, useRef, useEffect, useCallback, FC } from 'react'; import { getRandomRound } from '@vdfor/util'; import { goPage } from '@/util'; import { TAGS } from './constant'; import styles from './index.less'; const getTagText = (): string => TAGS[getRandomRound(0, ...
starsoft35/quark
src/store/app/index.ts
<reponame>starsoft35/quark import * as APP_CONSTANT from './constant'; import * as appAction from './action'; export { default as appReducer } from './reducer'; export { IAppRouteState, IAppState } from './type'; export { APP_CONSTANT, appAction };
starsoft35/quark
src/util/index.ts
<reponame>starsoft35/quark export * from './tool'; export * from './check'; export * from './request'; export * from './history'; export * from './device'; export { default as vconsoleInit } from './vconsole';
starsoft35/quark
src/page/Home/api.ts
import { request } from '@/util'; import { API_BASE_URL } from '@/constant'; export const loadUsersApi = () => request(`${API_BASE_URL}/user?role=1`, { method: 'GET', });
starsoft35/quark
config/env.ts
<reponame>starsoft35/quark import pkg from '../package.json'; // 用于应用运行的环境变量 const APP_CONFIG = { development: { REACT_APP_API_BASE_URL: 'https://mock.vdfor.top/v0', }, production: { REACT_APP_API_BASE_URL: 'https://mock.vdfor.top/v0', }, }; // 运行环境 const nodeEnv = process.env.NODE_ENV || 'production'...
starsoft35/quark
src/page/Home/index.tsx
import React, { FC, useEffect } from 'react'; import { Button } from 'antd-mobile'; import { loadUsersApi } from './api'; import styles from './index.less'; const Home: FC = () => { useEffect(() => { const loadUsers = async () => { try { await loadUsersApi(); } catch (error) { ...
starsoft35/quark
src/component/MobileWrapper.tsx
<gh_stars>0 import React, { PropsWithChildren } from 'react'; import { Spin } from '@vdfor/react-component'; import { SectionStateEnum } from '@vdfor/util'; import { SectionStateComponent } from '.'; interface IMobileWrapperProps extends PropsWithChildren<any> { uiStatus?: SectionStateEnum; } export default ({ uiSt...
starsoft35/quark
src/store/store.ts
import { createStore, applyMiddleware, compose, Reducer } from 'redux'; import thunk from 'redux-thunk'; import { request } from '@/util'; import rootReducer from './rootReducer'; const composeEnhancers = typeof window === 'object' && (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? (window as any).__REDUX...
starsoft35/quark
src/store/list-demo/index.ts
import * as LIST_DEMO_CONSTANT from './constant'; import * as listDemoAction from './action'; export { default as listDemoReducer } from './reducer'; export { listDemoAction, LIST_DEMO_CONSTANT }; export { IPageState as IListDemoState, IListDataItem as IListDemoListDataItem } from './type';
starsoft35/quark
config/config.ts
<filename>config/config.ts<gh_stars>0 import { defineConfig } from 'umi'; import fs from 'fs'; import path from 'path'; import lessParse from 'less-var-parse'; import pxToViewPort from 'postcss-px-to-viewport'; import getReactAppEnvs from './env'; import routes from './routes'; const nodeEnv = process.env.NODE_ENV || ...
starsoft35/quark
src/store/base/list/type.ts
<gh_stars>0 import { SectionStateEnum } from '@vdfor/util'; export interface IListBasicState { pageSize: number; pageNum: number; hasMore: boolean; loadMoreLoading: boolean; refreshLoading: boolean; status: SectionStateEnum; } export interface IQuxListState extends IListBasicState { data: any[]; }
starsoft35/quark
src/util/check.ts
// china mobile phone number regx export const validPhoneRegx = /^1[0-9]{10}$/; // email // eslint-disable-next-line export const validEmailRegx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; // get file stuffix export const fileSuffixMatchRegx = /\.[^.]+$/;
starsoft35/quark
src/constant/index.ts
export * from './httpCode'; export * from './env';
starsoft35/quark
src/util/history.ts
<filename>src/util/history.ts import { history } from 'umi'; export const goPage = (url: string, replace = false) => { if (replace) { history.replace(url); return; } history.push(url); }; export const goBack = () => history.goBack(); export const jumpExternalUrl = (url: string, replace = false) => { ...
starsoft35/quark
src/app.ts
/** * 运行时配置 * https://umijs.org/zh/guide/runtime-config.html#%E4%B8%BA%E4%BB%80%E4%B9%88%E6%9C%89%E8%BF%90%E8%A1%8C%E6%97%B6%E9%85%8D%E7%BD%AE%EF%BC%9F */ import React from 'react'; import { store, appAction } from '@/store'; import Index from './index'; export const onRouteChange = ({ location: { pathna...
starsoft35/quark
src/component/ListWrapper.tsx
<reponame>starsoft35/quark<gh_stars>0 import React, { PropsWithChildren, CSSProperties } from 'react'; import { SkeletonList } from '@vdfor/react-component'; import styled from 'styled-components/macro'; import { SectionStateEnum, pxTransform } from '@vdfor/util'; import { StyledCenter, SectionStateComponent } from '.'...
starsoft35/quark
src/store/base/list/action.ts
import { Dispatch } from 'redux'; import { SectionStateEnum, LoadActionEnum } from '@vdfor/util'; import { cancelHttpCode } from '@/constant'; import { REFRESH_LIST_FAIL, REFRESH_LIST_REQUEST, REFRESH_LIST_SUCCESS, RESET_LIST_FAIL, RESET_LIST_REQUEST, RESET_LIST_SUCCESS, LOAD_MORE_LIST_SUCCESS, LOAD_MOR...
starsoft35/quark
src/store/list-demo/type.ts
import { IListBasicState } from '../base'; export interface IListDataItem { id: string; num: number; title: string; text: string; imgUrl: string; createAt: number; } export interface IListState extends IListBasicState { data: IListDataItem[]; } export interface IPageState { listState: IListState; }
starsoft35/quark
src/store/base/list/reducer.ts
<reponame>starsoft35/quark import { produce } from 'immer'; import { AnyAction } from 'redux'; import { SectionStateEnum } from '@vdfor/util'; import { REFRESH_LIST_FAIL, REFRESH_LIST_REQUEST, REFRESH_LIST_SUCCESS, RESET_LIST_FAIL, RESET_LIST_REQUEST, RESET_LIST_SUCCESS, LOAD_MORE_LIST_SUCCESS, LOAD_MOR...
starsoft35/quark
src/store/index.ts
export { default as store } from './store'; export * from './base'; export * from './app'; export * from './type'; /* business start */ export { listDemoAction, LIST_DEMO_CONSTANT, IListDemoListDataItem } from './list-demo';
starsoft35/quark
src/store/list-demo/api.ts
<filename>src/store/list-demo/api.ts import { request } from '@/util'; import { API_BASE_URL } from '@/constant'; interface ILoadListApiData { pageNum: number; pageSize: number; status: string; } export const loadListApi = (params: ILoadListApiData, requestTaskName: string): Promise<any> => request(`${API_BAS...
starsoft35/quark
src/util/tool.ts
import { pxTransform as pxTransformUtil } from '@vdfor/util'; /** * copy from https://github.com/ant-design/ant-design-pro/blob/master/src/components/_utils/pathTools.js */ // /userinfo/2144/id => ['/userinfo','/useinfo/2144,'/userindo/2144/id'] export const urlToList = (url: string) => { const urllist = url.split...