# util-factory

> A common utils of javascript.

Latest version **0.2.0** (published 2017-12-29) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install util-factory
pnpm add util-factory
yarn add util-factory
bun add util-factory
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2017-12-29 |
| First published | 2017-12-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ansenhuang |
| Maintainers | ansenhuang |
| Keywords | util, javascript |

## Links

- npm: https://www.npmjs.com/package/util-factory
- npm.io page: https://npm.io/package/util-factory

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2017-12-29
- 0.1.1 — 2017-12-28
- 0.1.0 — 2017-12-28
- 0.0.2 — 2017-12-28
- 0.0.1 — 2017-12-26

## README

# util-factory

A common utils of javascript.

## API

### ua

* trident【IE内核】
* webkit【苹果、谷歌内核】
* gecko【火狐内核】
* mobile【是否为移动终端】
* ios【ios终端】
* android【android终端或uc浏览器】
* iPhone【是否为iPhone或者QQHD浏览器】
* iPad【是否iPad】
* safari【是否safari浏览器】
* weixin【是否为微信内置浏览器】
* phoneQQ【手机QQ】
* QQBrowser【QQ浏览器】

### data

* getData【获取对象中任何层级的值】
  * data[object] 原始数据
  * chain[string] 要获取值的链路
  * dft[any] 未获取到值的默认值
* parseJSON【字符串转化为json对象】
  * value[string]
* toArray【类数组转换为数组】
  * args 类数组
  * start=0 截取的位置
* fillArray【创建一个新的填充数组，按顺序排列】
  * start[number] 开始数字
  * end[number] 结束数字

### is

* isObject
* isArray
* isFunc
* isBool
* isNumber
* isString
* isDef【判断是否定义】
* isFormData【是否为formData类型】
* isElement【判断是否为dom元素】
* isPrimitive【判断是否为字符串或数字】
* isSameType【判断是否为相同类型】
  * arg1
  * arg2
* isValid【判断值是否有效，空字符串、undefined、null，都表示无效】
* isEmpty【判断值是否为空，空数组、空对象、空字符串、undefined、null，都表示为空】

### time

* formatDate【将日期对象转换为字符串类型】
  * date 日期对象
  * fmt = 'yyyy-MM-dd hh:mm:ss'
* parseDate【将字符串日期转换为日期对象】
  * fmt

### url

* encodeURL【编码url】
  * url
* decodeURL【解码url】
  * url
* getQuery【获取url中的query参数】
  * name
  * url = window.location.search
  * decode = true
* parseQuery【获取url中的query并转换为对象】
  * url = window.location.search
  * decode = true
* toQuery【对象转换为querystring】
  * params
  * encode = true
* appendQuery【url拼接query参数】
  * url
  * params
  * encode = true
* parseURL【将字符串url转换为对象格式（和浏览器的location一样）】
  * url
* goto【跳转页面】
  * url
  * params[object]

### fn

* animation【即requestAnimationFrame的封装】
  * callback
* copy【复制内容到剪贴板】
  * text
* debounce【防抖函数】
  * callback
  * delay = 100
* throttle【截流函数】
  * callback
  * delay = 100

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