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 🙏

© 2025 – Pkg Stats / Ryan Hefner

chart-libs

v1.1.16

Published

一些常用的js方法合集

Downloads

42

Readme

chart-libs

介绍

chart-lib是一些常用的js方法合集

软件架构

软件架构说明

安装教程

yarn add -D chart-libs
npm install -D chart-libs
import { trim } from 'chart-libs/dist/index';

const str = 'a b c ';

trim(str);

| 方法名 | 参数名称 | 参数类型 | 功能描述 | | ------------------- | ------------------------------------------------------------ | ---------------------------------------- | ------------------------------------ | | trim() | str | String | 去除全部空格 | | stringtoUpperCase() | str | String | 字符串首字母变大写 | | addZero() | str | String | Number | 填0函数 | | setCookie() | name名称,value 内容,day 时间 | name: String, value: String, day: Number | 设置cookie | | trimStart() | str | String | 字符串前面空格去除与替换 | | trimEnd() | str | String | 字符串后面空格去除与替换 | | cutString() | str 要截取的字符串,len 要截取的长度,根据字节计算, suffix 截取前len个后,其余的字符的替换字符,一般用“…” | str: string, len: number, suffix: string | 截取字符串 | | checkCardNo() | idNum 身份证号 | String | 验证身份证号 | | randomString() | len:长度 | Number | 生成随机字符串(可指定长度) | | bank_filter() | bankNum 银行卡号 | String | 银行卡号分割 | | getBase64Size() | base64 | String | 通过base64获取照片存储大小(返回字节) | | getUrlParam() | name:参数名 | String | 从URL中获取指定的参数值 | | formatPhone() | phone 手机号码 | String | 将手机号中间部分替换为星号 | | getStorageItem() | name 字段名称 | String | 查询localStorage | | setStorageItem() | name 名称,content 内容 | name: String, content: String | 存储localStorage | | deleteStorageItem() | name 名称 | String | 删除localStorage | | formatTime() | time 时间戳 fmt 格式 | time: String fmt:String | 时间戳转换 | | loadScript() | url 链接, callback 回调函数 | url: String, callback:Function | 动态加载js | | isSocialCode() | socialCode社会信用代码 | String | 验证统一社会信用代码 | | timeout() | -- | -- | 超时函数 | | checkLength() | str | String | 获取字符串字节长度 | | clone() | Obj | Object | 深拷贝 | | base64ToFile() | base64,filename | base64: String, filename: String | base64转file | | base64ToBlob() | base64 | String | base64转blob | | blobToFile() | blob,fileName | blob: any, fileName: String | blob转file | | | | | |