Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flingyp/flypeng-tool
Integrate a collection of common tools and methods
https://github.com/flingyp/flypeng-tool
javascript tool typescript util vitepress vitest
Last synced: 3 months ago
JSON representation
Integrate a collection of common tools and methods
- Host: GitHub
- URL: https://github.com/flingyp/flypeng-tool
- Owner: flingyp
- License: mit
- Created: 2022-07-22T01:27:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-12T03:29:10.000Z (4 months ago)
- Last Synced: 2024-10-31T10:36:51.771Z (3 months ago)
- Topics: javascript, tool, typescript, util, vitepress, vitest
- Language: TypeScript
- Homepage: https://flingyp.github.io/flypeng-tool/
- Size: 8.74 MB
- Stars: 16
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @flypeng/tool
## ⛳ Introduction
[@flypeng/tool](https://flingyp.github.io/flypeng-tool/) 是一个集成业务中常用的工具函数库。集成封装常用业务函数库,可以极大程度上的提高开发者的效率。
搭建这么一个函数库的灵感来自于 [VueUse](https://vueuse.org/),把每一个工具函数想象成为一个钩子函数去使用。目标就是集成所有常用的工具函数,并且可以轻松使用它。
## 📦 Installation
```bash
npm install @flypeng/tool@latestyarn add @flypeng/tool@latest
pnpm add @flypeng/tool@latest
```## 📚 Usage
### `@flypeng/tool/browser`
集成所有非 `Node Functions` 环境下的工具函数
```ts
import { useRandomInteger, useIsMobile } from '@flypeng/tool/browser';const randomInteger = useRandomInteger(10, 100); // Integer in [10, 100]
```### `@flypeng/tool/node`
集成 Node 环境下的工具函数
```ts
import { useGetCurrentPath, useIsFile } from '@flypeng/tool/node';const isFile = useIsFile(useGetCurrentPath()); // isFile is Boolean
```## ⛏️ Typescript
使用 Typescript 开发时,由于 `@flypeng/tool` 构建设计问题,需要在 `tsconfig.json` 文件中重新指定对应模块包 `browser`、`node` 的类型声明文件路径
```json
{
"compilerOptions": {
"paths": {
"@flypeng/tool/browser": ["node_modules/@flypeng/tool/dist/browser/index.d.ts"],
"@flypeng/tool/node": ["node_modules/@flypeng/tool/dist/node/index.d.ts"]
}
}
}
```## License
[MIT](./LICENSE) License © 2022 [FlingYP](https://github.com/flingyp)