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

@yongzhiluo/js-tools

v1.0.6

Published

Personal JS tool library

Downloads

3

Readme

@yongzhiluo/js-tools


Installation


Using npm:

npm i --save @yongzhiluo/js-tools

lead into

import _ from '@yongzhiluo/js-tools'
// 或
const _ = requrie('@yongzhiluo/js-tools')

Usage method


“checkType” Methods

_.isNumber(1);
// => true

_.isBoolean(true);
// => true

_.isPlainObject({});
// => true

_.isPromise(Promise.resolve());
// => true

_.isUndefined(undefined);
// => true

_.isNull(null);
// => true

_.isString('1');
// => true

_.isSymbol(Symbol('1'));
// => true

_.isDate(new Date());
// => true

_.isError(new Error('1'));
// => true

_.isFunction(fn);
// => true

_.isEmptyObject({});
// => true

“math” Methods

// 保留小数点几位数, 自动补零, 四舍五入
_.currencyFixed(666.666,2);
// => 666.67

// 加法运算
_.numAdd(66.66,0.111);
// => 66.771

// 减法运算
_.numSub(66.66,0.111);
// => 66.549

// 乘法运算
_.numMul(66.66,0.111);
// => 7.39926

// 除法运算
_.numDiv(66.66,0.111);
// => 600.5405405405405

“localStorage” Methods

// 增加
_.set(key, value);

// 获取
_.get(key);

// 删除
_.remove(key);

// 清除
_.clear();

“String” Methods

// 复制字符串
_.copyString('待复制的字符串', 复制成功后的回调函数)

// 11位手机号码正则验证
_.verifyConfig.isPhoneNum(15688888888)
// => true

// 身份证号码
_.verifyConfig.isIdCard(440100209901010101)
// => true

// 邮箱
_.verifyConfig.isEmail([email protected])
// => true

// 车牌号
_.verifyConfig.isCarNum(粤A88888)
// => true

// 返回手机掩码格式
_.phoneNumMask(13612345678)
// => 136****5678

// 返回身份证掩码格式;前6位和后4位
_.idCardMask(440100209901010101)
// => 440100****0101