# wiz-utils

> wizlong utils package

Latest version **1.0.6** (published 2020-09-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install wiz-utils
pnpm add wiz-utils
yarn add wiz-utils
bun add wiz-utils
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2020-09-29 |
| First published | 2019-09-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 36.1 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| Author | mll |
| Maintainers | molala, xiaohuangmaoth |
| Keywords | wiz, react, utils |

## Links

- npm: https://www.npmjs.com/package/wiz-utils
- Repository: https://gitlab.wizlong.com/sgm2.0/frontend/wiz-utils
- Homepage: https://gitlab.wizlong.com/sgm2.0/frontend/wiz-utils.git
- Issues: https://gitlab.wizlong.com/sgm2.0/frontend/wiz-utils.git
- npm.io page: https://npm.io/package/wiz-utils

## Dependencies (5)

- [xlsx](https://npm.io/package/xlsx.md) ^0.15.4
- [jsencrypt](https://npm.io/package/jsencrypt.md) ^3.0.0-rc.1
- [lodash.debounce](https://npm.io/package/lodash.debounce.md) ^4.0.0
- [lodash.throttle](https://npm.io/package/lodash.throttle.md) ^4.0.0
- [copy-to-clipboard](https://npm.io/package/copy-to-clipboard.md) ^3.3.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2020-09-29
- 1.0.5 — 2020-08-13
- 1.0.4 — 2020-08-13
- 1.0.3 — 2020-08-13
- 1.0.2 — 2020-08-12
- 1.0.1 — 2020-08-10
- 1.0.0 — 2020-06-30
- 0.0.22 — 2020-06-12
- 0.0.19 — 2020-06-12
- 0.0.18 — 2020-06-12
- 0.0.17 — 2019-12-11
- 0.0.16 — 2019-12-11
- 0.0.15-0.0.16 — 2019-12-10
- 0.0.15 — 2019-11-12
- 0.0.14 — 2019-10-22
- … 13 more at https://npm.io/package/wiz-utils/versions

## README

# wiz-utils

## 目录
* [概述](#概述)
* [安装](#安装)
* [使用](#使用)
* [许可证](#许可证)
* [工具介绍](#工具介绍)


## 概述

wiz-utils是wizlong的工具库，主要存放一些公共的工具。

## 安装

npm install git+https://gitlab.wizlong.com/sgm/wiz-utils.git

## 使用

```jsx
    import { log, generateUUID } from 'wiz-utils'
    

    log.info('wiz-utils so good!');
    //17:19:26.565 INFO   wiz-utils so good! 
    
    
    log.info('generateUUID:',generateUUID());
    //17:33:23.112 INFO   generateUUID: a3239a7b-f816-460f-85da-01b1d17c09cb

```

## 许可证

[MIT](http://opensource.org/licenses/MIT) Copyright (c) 2018 - forever Naufal Rabbani

## 工具介绍

* [log](#log)
* [network](#network)
* [dateUtils](#dateUtils)
* [Storage](#storage)
* [Session](#session)
* [getType](#gettype)
* [isType](#istype)
* [generateUUID](#generateuuid)

### log
log是一个在Console输出日志的工具，类似于`console.log('...')`。

#### 用法
```js
    import { log } from 'wiz-utils'

    log.info('输出:', '123');
    log.warn('输出:', {a:123});
    log.error('输出:', ['a',1,()=>{}]);
    log.debug('输出:', new Map());
    log.trace('输出:', e);
```

### network
network是网络检查工具，目前提供了两个方法

#### 用法
1. 获得当前网络状态`getNetworkState`
    ```js
    import { network } from 'wiz-utils'

    if(network.getNetworkState()){
        log.info('网络畅通！')
    }else{
        log.info('断线了！')
    }
    ```
2. 设置网络情况监听`startNetInfoListerner`
    ```js
    import { network } from 'wiz-utils'

    network.startNetInfoListerner((connection) => {
        if (connection) {
            log.info('网络畅通！')
        } else {
            log.info('断线了！')
        }
    });

    ```

### dateUtils
dateUtils是日期格式化工具

#### 用法
```js
    import { dateUtils } from 'wiz-utils'

    dateUtils.formatDate(new Date(),'yyyyMMdd');
        
    dateUtils.formatDate(new Date(),'yyyyMMddhhmmss')
```


### Storage
Storage是window中localStorage的封装

#### 用法

```js
    import { Storage } from 'wiz-utils'

    Storage.setStorage('mll','mll so cool')
    
    Storage.getStorage('mll')
```

### Session
Session是window中sessionStorage的封装

#### 用法

```js
    import { Session } from 'wiz-utils'

    Session.add('mll','mll so cool')

    Session.get('mll')

    Session.getAll()
```

### getType
通过getType可以获得对象的类型，返回的类型有
'Number', 'String', 'Undefined', 'Boolean', 'Object', 'Array', 'Function', 'Null'

#### 用法

```js
    import { log, getType } from 'wiz-utils'

    log.info('“abc” 类型是：',getType('abc'))

    log.info('123 类型是：',getType(123))

    log.info('()=>{} 类型是：',getType(()=>{})))
```

### isType
对比类型是否相同

#### 用法

```js
    import { log, isType } from 'wiz-utils'

    log.info('“abc” 类型是 String 吗？',isType('abc','String'))

    log.info('123 类型是 Number 吗？',isType(123,'Number'))

    log.info('()=>{} 类型是 Undefined 吗？',isType(()=>{},'Undefined')))
```

### generateUUID
通过当前时间生成uuid

#### 用法

```js
    import { log, generateUUID } from 'wiz-utils'

    log.info('generateUUID:',generateUUID())
```

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