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 🙏

© 2026 – Pkg Stats / Ryan Hefner

loey-utils

v1.0.1

Published

utils

Downloads

5

Readme

安装

npm install -S loey-utils

工具函数

// 验证邮箱
validateEmail(value),
// 验证身份证
validateIdCard(value), 
// 验证只能输入-、字母、数字、中文
validateCenterlineLetterNumberChinese(value), 
// 验证正整数
validateInteger(value), 
// 验证ip地址
validateIp(value), 
// 验证纬度
validateLat(value), 
// 验证必须有一位数字和字母
validateLetterAndNumber(value), 
// 验证经度
validateLng(value), 
// 验证手机号码
validatePhone(value), 
// 验证车牌号
validatePlateNum(value), 
// 验证前后空格
validatePreAndAfterSpace(value), 
// 验证只能输入_、字母、数字、中文
validateUnderlineLetterNumberChinese(value), 
// 判断数组
isArray(value),
// 判断数字
isNumber(value),
// 判断对象
isObject, 
// 验证英文数字
letterNumber(value), 
// 验证字母中文数字
letterNumberChinese(value), 
// 交换日期/时间
exchangeDateTime(startDate, endDate), 
// 获取当前日期是当月的第几周
getMonthWeek(date), 
sleep, 
sleepSync, 
// 前缀补0
preFixInt(number), 
// 16进制转2进制
hexToBin(),
// 2进制转16进制
binToHex, 
// 四舍五入保留fixed位小数
numberFixed(number, fixed), 
// 84坐标系转百度坐标系
wgs84tobd09(lng, lat), 
// 84坐标系转高德坐标系
wgs84togcj02(lng, lat),
// 高德坐标系转84坐标系
gcj02towgs84(lng, lat), 
// 将经纬度格式转换为度分秒格式
formatDegree(value), 
// 获取两点之间的中间点
getIntermediatePoint(point1: {lng, lat}, point2: {lng, lat}), 
// 在字符串指定位置插入新字符串
insertStr(source, start, newStr), 
// 在经纬度数值最后7位前添加小数点
handleLatLngValue(lng, lat)