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

lzkj-tools

v1.1.1

Published

| api | 作用 | | ----------------- | --------------------------------------- | | getQueryString | 获取地址栏参数 | | isWtsApp | 是否保险 app 环境内 | | ischannel

Downloads

8

Readme

蜡烛科技基础函数介绍

API list

| api | 作用 | | ----------------- | --------------------------------------- | | getQueryString | 获取地址栏参数 | | isWtsApp | 是否保险 app 环境内 | | ischannelB | 是否 B 端 APP 环境 | | isFQYFApp | 是否凤栖云服 app 环境 | | isWtshhrApp | 是否合伙人 app 环境 | | isIOS | 是否 ios 环境 | | isAndroid | 是否安卓环境 | | isMobile | 是否移动端 | | isWeiXin | 是否微信端 | | isWeiXinWork | 是否企业微信端 | | isAL | 是否支付宝环境 | | isBaidu | 是否百度 app 环境 | | isTouTiao | 是否今日头条环境 | | isDouYin | 是否抖音环境 | | isDD | 是否钉钉环境 | | isIphonex | 是否 iphonex 环境 | | getAndroidVersion | 获取安卓版本号 | | delQueStr | 删除地址栏参数 | | getcookie | 获取 cookie | | setcookie | 设置 cookie | | setLocal | 设置本地储存,会自动转字符串 | | getLocal | 获取本地储存,会自动转对象 | | getDateSex | 获取身份证对应的性别和年龄 | | cutString | 截取字符串 根据字符是否为圆角字符来记数 | | randomRangeId | 生产一定长度的随机 id | | loadScript | 动态加载 js | | loadJscodeBody | 动态加载 js 代码到 body 尾部 | | loadCss | 动态加载 link 代码 |

getQueryString

getQueryString(name,type) 获取地址栏参数

参数:

  • name:地址栏参数名
  • type:特殊状态,1-反编译中文

代码:

url="https://www.baidu.com/s?wd=lanhu"
let wd = getQueryString('wd');
// => lanhu

isWtsApp

isWtsApp(u) 是否保险 app 环境内

参数:

  • u: useragent 非必传,传值则校验指定 useragent

代码:

console.log(isWtsApp())
// => true/false

ischannelB

ischannelB() 是否 B 端环境

代码:

console.log(ischannelB())
// => true/false

isFQYFApp

isFQYFApp() 是否凤栖云服 app 环境

代码:

console.log(isFQYFApp())
// => true/false

isWtshhrApp

isWtshhrApp() 是否合伙人 app 环境

代码:

console.log(isWtshhrApp())
// => true/false

isIOS

isIOS() 是否 ios 环境

代码:

console.log(isIOS())
// => true/false

isAndroid

isAndroid() 是否 安卓 环境

代码:

console.log(isAndroid())
// => true/false

isMobile

isMobile() 是否移动端

代码:

console.log(isMobile())
// => true/false

isWeiXin

isWeiXin() 是否微信端

代码:

console.log(isWeiXin())
// => true/false

isWeiXinWork

isWeiXinWork() 是否企业微信端

代码:

console.log(isWeiXinWork())
// => true/false

isAL

isAL() 是否支付宝环境

代码:

console.log(isAL())
// => true/false

isBaidu

isBaidu() 是否百度 app 环境

代码:

console.log(isBaidu())
// => true/false

isTouTiao

isTouTiao() 是否今日头条环境

代码:

console.log(isTouTiao())
// => true/false

isDouYin

isDouYin() 是否抖音环境

代码:

console.log(isDouYin())
// => true/false

isDD

isDD() 是否钉钉环境

代码:

console.log(isDD())
// => true/false

isIphonex

isIphonex() 是否 iphonex 环境

代码:

console.log(isIphonex())
// => true/false

getAndroidVersion

getAndroidVersion() 获取安卓版本号

代码:

console.log(getAndroidVersion())
// => 8

delQueStr

delQueStr() 删除地址栏参数

params

  • url-地址
  • ref-删除参数名称

代码:

console.log(delQueStr('https://www.baidu.com/s?wd=lanhu&c=1','c'))
// => https://www.baidu.com/s?wd=lanhu

getcookie

getcookie(name) 获取 cookie

params

  • name-cookie 名称

代码:

console.log(getcookie('c'))
// => 1

setcookie

setcookie(key, val, params) 设置 cookie

params

  • key-cookie 名称
  • val-cookie 值
  • params-其他 cookie 参数

代码:

setcookie('c','1')

setLocal

setLocal(name, value) 设置本地储存,会自动转字符串

params

  • name-名称
  • value-值

代码:

setLocal('c','1')

getLocal

getLocal(name, exp) 获取本地储存,会自动转对象

params

  • name-名称
  • exp-过期时间

代码:

setLocal('c','1');
getLocal('c',1000*2);
setTimeout(()=>{
    getLocal('c',1000*2);
},3000)
// => 1
// => null

getDateSex

getDateSex(num) 获取身份证对应的性别和年龄

params

  • num-身份证号

代码:

getDateSex('**')
// => {age:18,date:"1991-08-08",sex:1}

cutString

cutString(content, length) 截取字符串 根据字符是否为圆角字符来记数

params

  • content-文本内容
  • length-字符长度

代码:

cutString('水电费第三方',6)
cutString('asd',6)
// => 水电费...
// => asd

randomRangeId

randomRangeId(num=8) 生产一定长度的随机 id

params

  • num-字符串长度

代码:

randomRangeId()
// => VDWZZ238

loadScript

loadScript(url, callback) 动态加载 js

params

  • url-js 路径
  • callback-加载成功回调

代码:

loadScript('https://**/nativeApp.min.js',()=>{console.log('nativeApp.min.js加载成功啦')})

loadJscodeBody

loadJscodeBody(url, callback) 动态加载 js

params

  • url-js 路径
  • callback-加载成功回调

代码:

loadJscodeBody('console.log(111)',()=>{console.log('代码加载成功啦')})

loadCss

loadCss(url) 动态加载 link 代码

params

  • url-css 路径

代码:

loadCss('http://***/lib/css/prism.min.css')