npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rl-utils

v1.0.5

Published

非常实用的开发方法,支持js(javascript)、ts(typescript)

Downloads

20

Readme

实用方法

使用方法

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)   
    待更新...