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

yh_tool_beta

v1.0.1

Published

yh_基础函数库

Readme

安装

npm install yh_tool_beta@latest --save

说明

初步版本 仅用于安装测试

现有方法

    /**
     * ReplaceAll 替换字符串 中出现的 字符 编译时注释 node 不支持 replaceAll
     * @param data  要操作的源 string
     * @param oring  要替换的 string
     * @param template  替换后的 string
     */
    export function ReplaceAll(data: string, oring: string, template: string): string;
    /**
     * 下载文件方法
     * @param content  下载地址
     * @param filename  文件名 传了也可能没用
     */
    export function FunDownload(content: string, filename?: string): void;
    /**
     * 绑定点击事件 上传导入文件
     * @param  uploadUrl 上传地址
     * @param  options  可能要携带的参数
     */
    export function ExportFn(uploadUrl: string, options?: {}): Promise<any>;
    /**
     *  根据str  获取文件名
     * @param  str 文件名
     * @param scheme 后台名字加密规则
     */
    export function GetUrlName(str: string, scheme?: string): string;
    /**
     * 禁用此刻以后时间 配合elementui 使用
     * @param date 时间
     */
    export function DisabledDateAfter(date: Date): boolean;
    /**
     * 禁用今日之前时间 配合elementui 使用
     * @param date  时间
     */
    export function DisabledDateBefore(date: Date): boolean;
    /**
     * 参数 升序传入  start_time --> end_time --> expire_time
     * @param rest  传参数据有要求
     */
    export const CheckTimeLine: (...rest: (string | number | Date)[]) => boolean;
    /**
     * 常规 富文本标签替换
     * @param str 要替换的富文本
     * @param callback  用来补充传参的callback 接受处理后的 content
     */
    export function GetTarg(str: string, callback?: Function): string;
    /**
     * 重置搜索参数
     * @param  obj 对象类型传入
     */
    export function ResetSearch(obj: Object): any;
    /**
     *  * 指定排序的比较函数  默认降序
     * es   var sortObj = infoObj.sort(compare("age"));
     * @param property  要排序的数组
     * @param type  DESC  AESC 降序升序
     */
    export function Compare(property: any, type?: string): (obj1: any, obj2: any) => number;
    /**
     * 解决Vue Template模板中无法使用可选链的问题
     * @param obj object 或者 array
     * @param rest  剩余参数 key 值
     * @returns {*}
     */
    export const optionalChaining: (obj: any, ...rest: any[]) => any;
    /**
     * 富文本样式优化
     * @param {*} className 类名
     * @param {*} content 内容
     */
    export function SetRichStyle(content: string, className?: string): string;
    /**
     * 删除对象 null '' 属性
     * @param {*} object
     */
    export function DeleteObject(object: any): any;
    /**
     * 递归展开json tree
     * @param pam 要展开的对象树
     * @param key 节点的 key
     */
    export function TreeFlat(pam: any, key?: string): Promise<any>;


    import { Checkcheme } from "src/schame";
    /**
     * 密码校验
     * @param pwd
     * @param message
     */
    export function PassWorldCheck(pwd: string, message?: string | boolean): Checkcheme | boolean;
    /**
     * 手机号校验
     * @param phone  手机号
     * @param message  校验失败提示信息 也可以布尔值 true false
     */
    export function PhoneCheck(phone: number | string, message?: string | boolean): Checkcheme | boolean;
    /**
     * 姓名校验
     * @param name  手机号
     * @param message  校验失败提示信息
     */
    export function NameCheck(name: string, message?: string | boolean): Checkcheme | boolean;
    /**
     * PageNum 分页 页码 极值处理
     * @param num  传入页码 或者 输入的数字
     * @param max  最大页码传入
     */
    export function PageNum(num: number, max: number): number;
    export function PasswordCheck(pwd: string): string;


    /**
     * 日期格式化
     * 使用方法:Dateformat.format(date,'yyyy-MM-dd hh:mm:ss');
     */
    export let Dateformat: () => void;

        /** 合法uri **/
        validateURL(textval: any): boolean;
        /** 全小写字母 **/
        validateLowerCase(str: any): boolean;
        /** 全大写字母 **/
        validateUpperCase(str: any): boolean;
        /** 大小写字母 **/
        validatAlphabets(str: any): boolean;
        /** 空值 **/
        validateEmpty(str: any): boolean;
        /** 最多两位小数数字--纯整数通过,超过两位小数返回false **/
        validateDecimalTwo(str: any): boolean;
        /** 包含中文 **/
        validatIncludeChinese(str: any): boolean;
        /** 判断是否纯汉字 **/
        isCharacter(str: any): boolean;
        /** 行首行尾去空格 **/
        validatSpace(str: any): any;
        /** Email **/
        validatEmail(str: any): boolean;
        /** Email **/
        validatEmail(str: any): boolean;
        /** QQ号码 **/
        validatQQ(str: any): boolean;
        /** 微信号 **/
        validatWechat(str: any): boolean;
        /** 车牌号 **/
        validatCarNumber(str: any): boolean;
        /** 邮政编码 **/
        validatZipCode(str: any): boolean;
        /** 身份证 **/
        validatIDCard(str: any): boolean;
        /** 手机号 **/
        validatPhone(str: any): boolean;
        /** 用户名正则,4到16位(字母,数字,下划线,减号) **/
        validatUserName(str: any): boolean;
        validatUserName1(str: any): boolean;
        /** 密码强度正则, 接收 密码 和 强度(low、middle、strong), 返回对象 **/
        validatUserPwd(str: any, level: any): {
            validat: any;
            status: string;
        };
        validPassword(str: any): boolean;
        validatePwdSame(str1: any, str2: any): boolean;
        /** IPv4地址 **/
        validatIPv4(str: any): boolean;
        /** 十六进制颜色 **/
        validatHex16(str: any): boolean;
        /** 日期,只检测年月日不含时间,可判断2月29,如:1980/08/08   1980-08-08 **/
        validatDate(str: any): boolean;
        /** 日期和时间,可判断2月29,如:1980/08/08 08:08:08   1980-08-08 8:8:8 **/
        validatDateTime(str: any): boolean;