https://github.com/jamie-yang/tars-utils
前端常用工具方法库 🚀
https://github.com/jamie-yang/tars-utils
es2015 functional-programming javascript utils
Last synced: 6 months ago
JSON representation
前端常用工具方法库 🚀
- Host: GitHub
- URL: https://github.com/jamie-yang/tars-utils
- Owner: Jamie-Yang
- Created: 2020-01-09T16:39:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-13T15:30:22.000Z (over 2 years ago)
- Last Synced: 2025-03-18T14:47:16.508Z (7 months ago)
- Topics: es2015, functional-programming, javascript, utils
- Language: JavaScript
- Homepage:
- Size: 289 KB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 简介
> TARS: 取自电影《星际穿越》中智能机器人的角色名。
tars-utils 是一个前端常用工具方法库,整理了在前端项目里高频使用的 utils 方法,所有方法均以简洁易读的 es2015+ 语法实现。
欢迎直接引用本库,也欢迎查看并选用本项目里个别方法的实现。
## 文档
TODO
## 示例
```js
const chunk = tars.chunk([1, 2, 3, 4], 2); // => [[1, 2], [3, 4]]const hashParams = tars.getHashParams('https://g.com#a=1&b=2'); // => { a:1, b:2 }
```## 安装
[](https://npmjs.org/package/tars-utils)
### 使用 npm 安装
```bash
npm install tars-utils --save
``````js
import tars from 'tars-utils';
```单个功能导入,有利于打包工具进行 TreeShaking:
```js
import { randomColor } from 'tars';
```### HTML 引入
```html
```
使用 `tars` 为全局变量
```html
tars.isIOS(); // => true or false
```
## 下载
- [tars-utils.js](https://raw.githubusercontent.com/Jamie-Yang/tars-utils//master/dist/tars-utils.js)
- [tars-utils.min.js](https://raw.githubusercontent.com/Jamie-Yang/tars-utils//master/dist/tars-utils.min.js) , [source map](https://raw.githubusercontent.com/Jamie-Yang/tars-utils//master/dist/tars-utils.min.js.map)## 开源协议
MIT License