# chart-libs **Repository Path**: yichengliuxu_admin/chart-libs ## Basic Information - **Project Name**: chart-libs - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-11-14 - **Last Updated**: 2022-05-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # chart-libs #### 介绍 chart-lib是一些常用的js方法合集 #### 软件架构 软件架构说明 #### 安装教程 ```shell yarn add -D chart-libs npm install -D chart-libs ``` ```js 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 | | | | | |