jsfunc
v0.1.9
Published
常用的js func
Readme
Functions
isEmtryObject(obj) ⇒ Boolean
[isEmtryObject 判断Object是否为空对象]
Kind: global function
Returns: Boolean - [返回结果布尔值]
| Param | Type | Description | | --- | --- | --- | | obj | object | [obj] |
objectAssign(obj1, obj2) ⇒ object
[objectAssign Object合并覆盖]
Kind: global function
Returns: object - [description]
| Param | Type | Description | | --- | --- | --- | | obj1 | Object | [被覆盖对象] | | obj2 | Object | [覆盖对象] |
Browser([uaStr]) ⇒ object
放置浏览器相关信息返回
Kind: global function
| Param | Type | Description | | --- | --- | --- | | [uaStr] | string | 测试ua |
setCookie(name, value, day)
[setCookie 设置cookie]
Kind: global function
| Param | Type | Description | | --- | --- | --- | | name | string | [cookie变量名] | | value | string | [cokkie值] | | day | number | [保存时间,单位:天,默认1天] |
getCookie(name) ⇒ string
[getCookie 获取cookie]
Kind: global function
Returns: string - [description]
| Param | Type | Description | | --- | --- | --- | | name | string | [cookie name] |
deleteCookie(name)
[deleteCookie 删除cookie]
Kind: global function
| Param | Type | Description | | --- | --- | --- | | name | string | [name] |
getQueryString(name) ⇒ string
[getQueryString 获取url请求参数]
Kind: global function
| Param | Type | Description | | --- | --- | --- | | name | string | [参数名] |
formatTimeStamp(str, format) ⇒ string
formatTimeStamp 时间格式化转换
Kind: global function
Returns: string - [指定时间格式结果]
| Param | Type | Description | | --- | --- | --- | | str | number | [时间戳] | | format | string | [时间格式,[YY|YYYY]年 [mm|m]月 [dd|d]天 [hh|h]时 [ii|i]分 [ss|s]秒] |
countDown(endTimeStamp, options) ⇒ string
倒计时
Kind: global function
Returns: string - 倒计时结果,小时:分:秒
| Param | Type | Description | | --- | --- | --- | | endTimeStamp | number | 倒计时结束时间戳 | | options | Object | 配置 showDouble,utils,info |
diffTime(label, isStar)
计算代码执行diff时间
Kind: global function
| Param | Type | Description | | --- | --- | --- | | label | * | 日志标识 | | isStar | * | 开始执行时间标记 |
transformImageSize(size, imgsrc) ⇒ string
裁剪cdn图片
Kind: global function
Returns: string - url
| Param | Type | Description | | --- | --- | --- | | size | number | 需要裁剪的尺寸 | | imgsrc | string | 需要裁剪的图片url |
concatClass() ⇒ string
react classname 拼接
Kind: global function
getRelesestage() ⇒ string
判断当前环境
Kind: global function
Returns: string - development || pre_product || localhost || product
adapter(data, distkv)
数据转换器
Kind: global function
| Param | Type | Description | | --- | --- | --- | | data | object | 需要转换的数据 | | distkv | object | 输出的键值对 |
throttling(fn, wait)
节流
Kind: global function
| Param | Type | Description | | --- | --- | --- | | fn | function | 行为函数 | | wait | number | 时间间隔(ms) |
antiShake(fn, wait)
防抖
Kind: global function
| Param | Type | Description | | --- | --- | --- | | fn | function | 行为函数 | | wait | number | 防抖时长(ms) |
