# @qietuzi/utils

> A js library for common utils

Latest version **0.0.11** (published 2021-10-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install @qietuzi/utils
pnpm add @qietuzi/utils
yarn add @qietuzi/utils
bun add @qietuzi/utils
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.11 |
| Published | 2021-10-20 |
| First published | 2020-07-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 97 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | qiang |
| Maintainers | qiangqiang93 |
| Keywords | validate |

## Links

- npm: https://www.npmjs.com/package/@qietuzi/utils
- Repository: https://github.com/qiangqiang93/utils
- Homepage: https://github.com/qiangqiang93/utils#readme
- Issues: https://github.com/qiangqiang93/utils/issues
- npm.io page: https://npm.io/package/@qietuzi/utils

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.20
- [core-js](https://npm.io/package/core-js.md) ^3.18.3
- [@babel/polyfill](https://npm.io/package/@babel/polyfill.md) ^7.12.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.0.11 (latest) — 2021-10-20
- 0.0.10 — 2021-10-20
- 0.0.9 — 2021-10-19
- 0.0.8 — 2021-04-06
- 0.0.7 — 2021-04-06
- 0.0.6 — 2021-04-06
- 0.0.5 — 2021-03-11
- 0.0.4 — 2021-01-04
- 0.0.3 — 2020-10-16
- 0.0.2 — 2020-08-03
- 0.0.1 — 2020-07-28

## README

### @qietuzi/utils

A js library for common utils,一个常用工具库

### Install (安装)

```
npm i @qietuzi/utils --save
```

#### arr

a utils to extends window.location

```js
import { arr } from "@qietuzi/utils";
/* 
    @name       findItem
    @desc       arr findItem
    @params     
                arr     Array<any>
                key     string
                val     any
    @return     any     arr item
*/
arr.findItem();
```

#### env

a utils to judge **browser** environment

```js
import { env } from "@qietuzi/utils";

env.system();
// 'unknow' | 'windows' | 'macos' | 'linux' | 'android' | 'ios'

env.systemVersion();

env.engine();
// 'unknow' | 'webkit' | 'gecko' | 'presto' | 'trident'

env.engineVersion();

env.supporter();
// 'unknow' | 'edge' | 'opera' | 'chrome' | 'safari' | 'firefox' | 'opera' | 'iexplore'

env.supporterVersion();

env.platform();

env.shell();
// 'none' | 'wechat' | 'qq' | 'uc' | '360' | '2345' | 'sougou' | 'liebao' | 'maxthon'

env.shellVersion();

env.getEnvs();
// return all
```

#### location

a utils to extends window.location

```js
import { location } from "@qietuzi/utils";
// avoid confilct with window.location
import { location as _locltion } from "@qietuzi/utils";

/* 
    @name       getParam
    @desc       getParam
    @params     
                key     string
                url     string    string[window.location.href]
    @return     string
*/
_locltion.getParam();
/* 
    @name       getParams
    @desc       getParams
    @params     url     string    string[window.location.href]
    @return     {
                    [key: string]: string
                }
    waring: when route is hash route, the url params may have # and strings after #
*/
_locltion.getParams();
/* 
    @name       listParams
    @desc       listParams some times sign needs to keep the sort
    @params     url     string     string[window.location.href]
    @return     Array<{
                    key: string,
                    val: string
                }>
*/
_locltion.listParams();
```

#### lang

a utils to judge **character's** language.

```js
import { lang } from "@qietuzi/utils";
// 获取单个字符所属的语言类型（详情）
// get language of a single character
getLang(s: string): string
// 获取字符串中包含的语言类型
// get a languages list of a string
getLangs(str: string): Array<string>
// 获取字符串中每一个字符的语言类型
// get each character's languages list of a string
getEachLangs(str: string): Array<string>
```

#### number

```js
import { number } from "@qietuzi/utils";
/*
// 数字，数字字符串前补零
// number,number string zero fill
// zeroFill(9)      =>  '09'
// zeroFill(9, 3)   =>  '009'
// warn:最大不可超过2^32,否则会溢出错误
*/
zeroFill(val: number | string, num: number = 2):string
```

---
_Source: https://npm.io/package/@qietuzi/utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
