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

aver-utils

v1.0.7

Published

aver utils for normal developer

Downloads

16

Readme

aver-utils

工具类库,只是单纯的把一些常用的方法工具化。

安装依赖

yarn add aver-utils 或 npm install aver-utils

引入依赖

import aver from 'aver-utils';

接口使用

开启或关闭VConsole

此方法主要针对在手机端浏览器上运行的程序,可以设置开启方便查看调试

// 开启VConsole
aver.setConsole({show: true, callback: function() {
  // VConsole show 为 true 时的初始化完成回调
}});

// 关闭VConsole
aver.setConsole({show: false, callback: function() {
  // VConsole show 为 true 时的初始化完成回调
}});

获取UUID

const UUID = aver.getUUID(); // 195f77c180c23e3f5a8a8f38e4290186

获取浏览器类型

const OStype = aver.getOSType(); // Chrome

获取URL参数

const id = aver.getQueryString("id"); // 获取URL上的id参数

获取设备参数

const device = aver.getDeviceParams(); // {"screenHeight":667,"screenWidth":375,"devicePixelRatio":2}

显示Toast

aver.showToast({
    title: '我是TOAST',
    onHide: function () {
        console.log('Toast加载隐藏了');
    }
})

显示Modal

TODO 待完成

aver.showModal({
    title: '我是标题',
    content: '我是内容',
    closable: true, // 是否可以关闭
    onHide: function () {
        console.log('Modal隐藏了');
    }
})

显示Loading

TODO 待完成

aver.showLoading({
    title: '正在加载',
})

判断字符串是否符合标准

接口可支持-用户名/密码/手机号/身份证/邮箱

// type可传值, phone | password | idcard | username | email
aver.isMatch(type, data);

// 例
aver.isMatch("phone", "13800138000"); // 判断手机格式
aver.isMatch("username", "a12312321"); // 判断用户名,首字母+长度6-20位,字母+数字组合
aver.isMatch("password", "a1231412");  // 判断密码,首字母+长度6-20位,字母+数字组合
aver.isMatch("idcard", "441517745544141251"); // 判断身份证格式
aver.isMatch("email", "[email protected]"); // 判断邮箱格式

所在环境判断

aver.isIOS(); // 是否iOS设备
aver.isAndroid(); // 是否安装设备
aver.isIPhoneX(); // 是否iPhoneX
aver.isIPhoneXR(); // 是否iPhoneXR
aver.isIPhoneXSMax(); // 是否iPhoneXSMax
aver.isMac(); // 是否Mac系统
aver.isWindows(); // 是否Windows系统
aver.isMobile(); // 是否手机
aver.isWeiXin(); // 是否在微信内
aver.isWeiXinMiniProgram(); // 是否在微信小程序内