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

qlytools

v1.1.2

Published

``` shell npm install qlytools ```

Readme

qlytools 说明

下载依赖

npm install qlytools

引入依赖

import { isPhone } from 'qlytools'

工具说明

| 函数 | 返回值 | 描述 | 例子 | | ---- | ---- | ---- |---- | | isPhone | true&false| 判断是否是手机号 || | isIDCard | true&false|判断身份证号码|| | isFloat | true&false|判断浮点数|| | isObject | true&false|判断Object|| | isString | true&false|判断String|| | isNumber | true&false|判断Number|| | isAndroid | true&false|判断Android|| | isBrowser | true&false|判断Browser|| | isWeChat | true&false|判断WeChat || | isIOS | true&false|判断IOS || | copyText | true&false|复制文本到剪贴板|| | formatNumber | true&false|数字格式化|| | getPlaceholderImage | string |获取图片占位符|| | roundToDecimal | number |保留 n 位小数|| | removeEmoji | string |从字符串中移除 emoji 字符|| | removeWhitespace | string |从字符串中移除空白字符|| | md5 | string |md5加密||

函数详情

roundToDecimal(value, decimalPlaces, roundType)保留 n 位小数

value:要进行舍入的数字。 decimalPlaces:要保留的小数位数。 roundType:舍入类型,可选值为 'round'(四舍五入,默认)、'floor'(向下舍入)、'ceil'(向上舍入)。

例子

import { roundToDecimal } from 'qlytools';

const originalNumber = 3.14159;

const roundedNumber1 = roundToDecimal(originalNumber, 2);
console.log(roundedNumber1); // 3.14

const roundedNumber2 = roundToDecimal(originalNumber, 2, 'floor');
console.log(roundedNumber2); // 3.14

const roundedNumber3 = roundToDecimal(originalNumber, 2, 'ceil');
console.log(roundedNumber3); // 3.15

removeEmoji(inputString)从字符串中移除 emoji 字符

inputString:传入的数据

例子

import { removeEmoji } from 'qlytools';

const stringWithEmoji = 'Hello 🌍, this is an emoji! 😃';
const stringWithoutEmoji = removeEmoji(stringWithEmoji);

console.log(stringWithoutEmoji); // 'Hello , this is an emoji! ''ceil');

removeWhitespace(inputString)从字符串中移除空白字符

inputString:传入的数据

例子

import { removeWhitespace } from 'qlytools';
const stringWithWhitespace = '  Hello  \tWorld\n!  ';
const stringWithoutWhitespace = removeWhitespace(stringWithWhitespace);

console.log(stringWithoutWhitespace); // 'HelloWorld!'

md5(inputString: string, key: string = '', raw: boolean = false)md5加密

inputString:要进行 MD5 计算的字符串 key 用于创建 HMAC 的密码 raw 是否返回原始数据

例子

import { md5 } from 'qlytools';

const inputString = 'Hello, MD5!';
const key = 'secretKey';
const md5Value = md5(inputString, key);
console.log(md5Value); // 输出 MD5 值的十六进制字符串

isEmail()判断邮箱

例子

import { isEmail } from 'qlytools';

const validEmail = '[email protected]';
const invalidEmail = 'invalid-email';

console.log(`Is ${validEmail} a valid email?`, isValidEmail(validEmail)); // true
console.log(`Is ${invalidEmail} a valid email?`, isValidEmail(invalidEmail)); // false