1.0.5 • Published 2 months ago

rl-utils v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

实用方法

使用方法

1、安装

npm i rl-utils

2、使用一

import {**} from "rl-utils"

使用二

import * as rlUtils from "rl-utils"

该库包含以下方法

一、TypeValidate type:Object

  • isString:字符串验证
  • isBoolean:Boolean验证
  • isNumber:Number验证
  • isNull:Null验证
  • isUndefined:Undefined验证
  • isFunction:Function验证
  • isArray:Array验证
  • isObject:Object验证
  • isDate:Date验证
  • isSymbol:Symbol验证
  • isQuoteType:引用类型判断

    import {TypeValidate} from "rl-utils";                 
    const isStr=TypeValidate.isString('about');   
    const {isString,isBoolean,isNumber,isNull}=TypeValidate;

二、ArgCheck type:Object

  • asyncDiffType:异步参数类型比较
  • syncDiffType:同步参数类型比较
  • asyncDiffVal:异步参数值比较
  • syncDiffVal:同步参数值比较

    import {ArgCheck} from "rl-utils";              
    ArgCheck.asyncDiffType('about','about').then(res=>{console.log(res)});  
    const {asyncDiffType,syncDiffType,asyncDiffVal,syncDiffVal}=ArgCheck;

三、timer type:Object

  • formatting:兼容ios时间格式
  • getDate:获取日期
  • dateDiff:日期对比

    import {timer} from "rl-utils";  
    const formatting=timer.formatting('2022-01-01');  
    const {formatting,getDate,dateDiff}=timer;

四、NumberComputed type:Object

  • toNumber:转换Number类型
  • toPrice:金额,保留2位小数点
  • computedConent:计算内容
  • add:加法
  • sub:减法
  • mul:乘法
  • div:除法

    import {NumberComputed} from "rl-utils";  
    const add=NumberComputed.add(1.33,3.14);  
    const {toNumber,toPrice,computedConent,add,sub,mul,div}=NumberComputed;

五、getUUID type:Function

获取请求的UUID,指定长度和进制,如


    import {getUUID} from "rl-utils";  

六、JsonToString type:Function

JSON转String


七、StringToJSON type:Function

String转JSON


八、deepClone type:Function

深拷贝


九、findKey type:Function

对象-通过value得到key


十、logError type:Function

错误打印


十一、logWarn type:Function

警告打印


十二、arrDeWeight type:Function

数组(对象)去重


十三、arrDeWeightB type:Function

数组(对象)去重


十四、arrDeWeightC type:Function

数组(对象)去重


十五、openApp type:Function

打开App


十六、copy type:Function

复制方法


十七、debounce type:Function

防抖


十八、throttle type:Function

节流


十九、apiPath type:Function

路径拼接


    import {apiPath} from "rl-utils";  
    const basePath=apiPath('http://dev.com')
    const imgUpload=basePath('/img/upload')

二十、arraySort type:Function

数组排序


二十一、imgCompress type:Function

图片压缩


    import {imgCompress} from "rl-utils";  
    imgCompress.then(res=>{
        debugger
    })

二十二、createQrURL type:Function

生成二维码链接


二十三、downLoad type:Function

下载


二十四、getQuery type:Function

获取路由参数


二十五、encode type:Function

编码


二十六、decode type:Function

解码


    欢迎交流(QQ:466027219)   
    待更新...
1.0.5

2 months ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago