# hoolinks

> 主要封装一些一些通用的工具函数方法，如http请求(get,post),实体映射，store操作类等。

Latest version **0.1.5** (published 2019-04-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install hoolinks
pnpm add hoolinks
yarn add hoolinks
bun add hoolinks
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2019-04-15 |
| First published | 2019-04-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 61.5 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Author | duanguang |
| Maintainers | duanguang |
| Keywords | hoolinks, utils, request |

## Links

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

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^0.18.0
- [warning](https://npm.io/package/warning.md) ^3.0.0
- [invariant](https://npm.io/package/invariant.md) ^2.2.4
- [json-mapper-object](https://npm.io/package/json-mapper-object.md) ^0.0.6

## Recent versions

- 0.1.5 (latest) — 2019-04-15

## README

# hoolinks
主要封装一些一些通用的工具函数方法，如http请求(get,post),实体映射,操作类等。

 # use 
 ```
npm install hoolinks --save 
 or
yarn add hoolinks
 ```
# API
- request
  ```js
  import {post,get} from 'hoolinks/request';
  get('url',parms,headerOptions) //返回值:Promise
  post('url',parms,headerOptions) // 返回值:Promise

  ```
- [json-mapper-object](https://github.com/duanguang/json-mapper-object.git)
  ```js
  import {JsonProperty,MapperEntity} from 'legions/json-mapper-object';
  ```

- [observable-promise(vuex)](http://192.168.200.59:4873/)
  ```js
  //结合vuex使用
  import {observablePromise} from "hoolinks/observable-promise"; //主要用于统一前端数据体结构 
  ```  

- [observable-promise(mobx)](http://192.168.200.59:4873/)
  ```js
  //结合mobx使用
  import {observablePromise,ObservableTempState} from "hoolinks/mobx"; //主要用于统一前端数据体结构 

    @observable obRepositoryList=observablePromise();//初始化
    @observable obAddResult=new ObservableTempState();//初始化 临时变量 用完需要初始化 可通过实例上面clear方法进行初始化

    this.obRepositoryList=observablePromise(getRepositoryList(repoName,page,pageSize));//参数传递一个Promise 一般直接是service接口

    this.obRepositoryList=new ObservableTempState(getRepositoryList(repoName,page,pageSize));//参数传递一个Promise 一般直接是service接口
  ```  

- [promise-action](http://192.168.200.59:4873/)
  ```js
  import { PromiseAction } from 'hoolinks/promise-action';  //vue 发送dispatch

  new PromiseAction().set(dispatch,type,promise) 
  // dispatch vuex 底层dispatch函数,
  // type action 类型 值为字符串
  // promise 接口请求 值为一个promise  此操作vuex state数据类型一定要是 observablePromise 生成的对象

  ``` 

- [date-format](http://192.168.200.59:4873/)
  ```js
  import { formatDate,formatDateToFriendly,formatDurationToFriendly,isLeapYear,countDays,getLastDay} from 'hoolinks/date-format';  
  formatDate(date,fmt);//
  formatDateToFriendly(date)
  formatDurationToFriendly(number) 数字
  isLeapYear(date)
  countDays(date,date1)//两时间间隔天数
  getLastDay(date)
  ```   

- [str-format](http://192.168.200.59:4873/)
  ```js
  import { amount,number,formatLocaleString,formatTrim} from 'hoolinks/str-format'; 

  amount(value);//
  number(value,size)
  formatLocaleString(value)//千位分割
  formatTrim(str)//首尾去除空格
  ```  
- [download](http://192.168.200.59:4873/)
  ```js
  import {download} from 'hoolinks/download'; 

  download(urls);//
  ```    
- [cookie](http://192.168.200.59:4873/)
  ```js
  import {clearAllCookie,removeCookie,getCookie,setCookie} from 'hoolinks/cookie'; 
  setCookie(name,value,Day);
  clearAllCookie();//
  removeCookie(name);
  getCookie(name);
  ``` 
- [regex](http://192.168.200.59:4873/)
  ```js
  import {RegExChk,validatorType} from 'hoolinks/regex'; 
  validatorType 常规正则验证类型枚举
  RegExChk(type,value);// type可以是常规正则验证类型 validatorType ，或者也可以是一个自定义正则表达式 ： /^[\u0391-\uFFE5]+$/
  ```    

- [form-rule](http://192.168.200.59:4873/)
  ```js
  import {FormRuleProperty,createFormRule} from 'hoolinks/form-rule'; 
  
  class FormInfo{
        @FormRuleProperty({
            required: true,
            name: 'billNo',
            error: '收付单号格式不正确',
            desc: '收付单号',
            trigger:'blur,change',//默认blur,change
            regex:/^[1-9]\d*$/ //自定义验证规则
            validator:(value,error,callback)=>{ //自定义验证规则

            }
        })
        billNo='112';

        @FormRuleProperty({
            required: true,
            name: 'bussinessMan',
            error: '业务员格式不正确',
            desc: '业务员',
        })
        bussinessMan=void 0;

        @FormRuleProperty({
            required: true,
            name: 'saleDate',
            error: '交易日期格式不正确',
            desc: '交易日期',
            type:"array"
        })
        saleDate=void 0;

        @FormRuleProperty({
            required: true,
            name: 'amount',
            error: '总金额格式不正确',
            desc: '总金额',
        })
        amount=void 0;

        @FormRuleProperty({
            required: true,
            name: 'settleType',
            desc: '结算方式',
        })
        settleType=void 0;

        @FormRuleProperty({
            required: true,
            name: 'filePath',
            desc: '附件',
        })
        filePath=void 0;
   }

   class FormInfoRule extends FormInfo{
        constructor(){
            super();
            createFormRule(FormInfo,this);
        }
   
   }
  ```    
# Licensing
MIT license

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