Skip to content

Commit

Permalink
chore: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
CJY0208 committed Nov 22, 2023
0 parents commit 1b28a09
Show file tree
Hide file tree
Showing 161 changed files with 24,819 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/.history

# production
/**/dist
/**/es
/**/lib
/scripts

# misc
.DS_Store

# umi
.umi
.umi-production
.umi-test
.env.local

# ide
/.vscode
/.idea

.eslintrc.js
15 changes: 15 additions & 0 deletions .fatherrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export default {
cjs: {
type: 'babel',
minify: true,
lazy: true,
},
esm: {
type: 'babel',
},
umd: {
name: 'FexdTools',
sourcemap: true,
},
runtimeHelpers: true,
}
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# dependencies
/node_modules
*/.umi

# production
/build
/dist
/es
/lib

# misc
npm-debug.log*
yarn-debug.log*
yarn-error.log*
9 changes: 9 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
src
.fatherrc.ts
.gitignore
.npmignore
.prettierrc
.npmrc
tsconfig.json
yarn.lock
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"bracketSpacing": true
}
13 changes: 13 additions & 0 deletions .umirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { version } from './package.json'

export default {
mode: 'site',
title: `Fexd Tools`,
logo: '/logo.png',
outputPath: 'docs',
history: { type: 'hash' },
resolve: {
includes: ['documents', 'src'],
},
navs: [null, { title: `v${version}` }],
}
108 changes: 108 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
sidemenu: false
---

# 辅助工具库

## 安装

```bash
pnpm add @fexd/tools
# or
yarn add @fexd/tools
# or
npm install @fexd/tools
```

## 用法示例

```javascript
import { isArray } from '@fexd/tools'
```

## 按需加载

配合 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 实现按需加载,需将 `camel2DashComponentName` 配置关闭

```js
// babel.config.js
module.exports = {
plugins: [
[
'babel-plugin-import',
{
libraryName: '@fexd/tools',
camel2DashComponentName: false,
},
],
],
}
```

## 导出的方法有以下

```javascript
export {
CombJudge, // 组合判断器
EventBus, // EventBus
FrameProcess, // 帧进程,用于制作动画
I18n, // i18nshell 工具原型,多语言工具包
SAS, // [单咨询服务] Single Advisory Service 同一时刻对同一异步请求进行统一等待,不重复发起
ScrollListener, // 滚动监听
Tween, // 缓动函数工具
__, // 自由柯里化
capitalize, // 首字母大写
clamp, // 数值范围限定
classnames, // classnames 库的自实现
copy, // 复制粘贴
curry, // 柯里化
debounce, // 防抖
defaultFrameProcess, // 默认帧进程
delay, // 延时 Promise
first, // 取首个值,可用于对象或数组
flatten, // 数组拍平
get, // 无痛取值,同 ?. 算符
getFormatter, // 格式化工具
globalThis, // globalThis
groupBy, // 对数组进行归类处理
intersection, // 交集
isAndroid, // 是否安卓环境
isArray, // 是否数组
isBoolean, // 是否 Boolean
isDate, // 是否日期类型
isDesktop, // 是否桌面端(PC)
isError, // 是否错误类型
isExist, // 是否存在(非 undefined / null)
isFunction, // 是否函数类型
isIOS, // 是否 iOS 环境
isMobile, // 是否移动端
isNaN, // 是否 NaN
isNull, // 是否 Null
isNumber, // 是否数字类型
isObject, // 是否对象(Array 不算)
isPromiseLike, // 是否 PromiseLike
isString, // 是否字符串
isUndefined, // 是否 undefined
isWKWebview, // 是否 WKWebview 环境
last, // 取首末尾,可用于对象或数组
lock, // 自锁函数
memoize, // 记忆函数
nextTick, // nextTick 的客户端实现
pick, // 选值函数
pickBy, // 自定义选值函数
pipe, // 管道函数,同 |> 算符
preloadImage, // 预渲染指定图片
promiseGuess, // 智能处理 Promise 类型返回值
qs, // qs 库简易实现
random, // 随机函数
run, // 无痛运行
sample, // 样本函数
set, // 无痛属性设置
source, // 在线资源加载
storage, // storage 存取
throttle, // 节流
uniqByKey, // 去重
url, // url 参数取值
value, // 值选择,同 ?? 算符
}
```
36 changes: 36 additions & 0 deletions docs/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<link rel="stylesheet" href="/umi.css" />
<script>
window.routerBase = "/";
</script>
<script>
//! umi version: 3.5.35
</script>
<script>
!(function () {
var e =
navigator.cookieEnabled && void 0 !== window.localStorage
? localStorage.getItem("dumi:prefers-color")
: "auto",
o = window.matchMedia("(prefers-color-scheme: dark)").matches,
t = ["light", "dark", "auto"];
document.documentElement.setAttribute(
"data-prefers-color",
e === t[2] ? (o ? t[1] : t[0]) : t.indexOf(e) > -1 ? e : t[0]
);
})();
</script>
</head>
<body>
<div id="root"></div>

<script src="/umi.js"></script>
</body>
</html>
36 changes: 36 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<link rel="stylesheet" href="/umi.css" />
<script>
window.routerBase = "/";
</script>
<script>
//! umi version: 3.5.35
</script>
<script>
!(function () {
var e =
navigator.cookieEnabled && void 0 !== window.localStorage
? localStorage.getItem("dumi:prefers-color")
: "auto",
o = window.matchMedia("(prefers-color-scheme: dark)").matches,
t = ["light", "dark", "auto"];
document.documentElement.setAttribute(
"data-prefers-color",
e === t[2] ? (o ? t[1] : t[0]) : t.indexOf(e) > -1 ? e : t[0]
);
})();
</script>
</head>
<body>
<div id="root"></div>

<script src="/umi.js"></script>
</body>
</html>
Binary file added docs/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1b28a09

Please sign in to comment.