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

haier-methods

v0.0.28

Published

海极网-方法库

Readme

安装

npm i haier-methods

使用

import hmethods from 'haier-methods';
console.log(hmethods.changetime(new Date(), 1));

or

import { changetime } from 'haier-methods';
console.log(changetime(new Date(), 1));

发布

发布:https://x.haier.net/console/ci/flow/detail/font_haier-ui

介绍

| 属性 | 说明 | 参数 | 返回值 | 示例 | |---|---|---|--- |---| | changetime(time,type) | 不同时间格式转换 | time: 时间; type: 返回值类型 | type=1: 2022-11-11 10:30:20;type=2: 2022-11-11;type=3: 2022年11月11日 10:30;type为其他或不传: 2022-11-11 10:30) | — | | getType(data) | 获取数据类型 | data: 传入数据 | String, Number, Boolean, Object ,Array, Function, Null, Undefined | getType('d') | | trim(str) | 去除字符串前后空格 | str: 传入字符串 | 处理后的字符串 | — | | trimParams(obj) | 返回去除对象空属性对象 | obj: 传入对象 | 处理后的对象 | — | | formRuleError() | el-form校验失败自动获取焦点 | 无 | — | — | | cloneDeep(data) | 深拷贝 | data: 传入数据 | 拷贝数据 | — | | exportFunc(url, params, method) | 导出文件(form) | url: 请求地址, params: 传入参数, method: 请求方式(默认post) | 无 | — | | downLoadUrl(url, filename) | 下载链接地址 | url: 链接地址, filename: 文件名称 | 无 | — | | changeCase(str, type) | 字符串大小写 | str: 传入字符串, type: 1:首字母大写 2:首页母小写 3:大小写转换 4:全部大写 5:全部小写(默认4)| 转换后数据 | — | | typeJudgment(data, type) | 类型检测 | data: 传入数据, type: 当传入type时则验证类型,返回布尔值,否则则返回传入数据data的类型 | boolean/类型 | — | | uniqueArray(data, key) | 数组去重(支持JSON数组) | data: 传入数据, key: 当数组为json数组时,需要以哪个key的数据来去重。否则可以不传 | 去重后的数组 | — | | downloadBlob(data, fileName) | 下载文件流 | data: 传入数据({data: 具体内容}),fileName:下载文件名 | — | — | | arithmetic.floatMultiply(num1,num2) | 数字运算-解决精度问题:乘法 | num: 传入数字,num1num2 | 运算结果 | — | | arithmetic.floatDivide(num1,num2) | 数字运算-解决精度问题:除法 | num: 传入数字,num1num2 | 运算结果 | — | | arithmetic.floatAdd(num1,num2) | 数字运算-解决精度问题:加法 | num: 传入数字,num1num2 | 运算结果 | — | | arithmetic.floatSub(num1,num2) | 数字运算-解决精度问题:减法 | num: 传入数字,num1num2 | 运算结果 | — | | arithmetic.floatMod(num1,num2) | 数字运算-解决精度问题:取余 | num: 传入数字,num1*num2 | 运算结果 | — | | loading.start() | 打开loading | — | — | — | | loading.end() | 关闭loading | — | — | — | | generateUuid(type) | 返回type + 随机字符串id | type: 字符串 | type + 随机字符串id | generateUuid(), generateUuid('text') | | fileSuffixType(fileName, otherName) | 根据文件名称返回文件类型 | fileName: 文件名(需带后缀),otherName: 无法判断类型时返回值(默认是文件后缀名) | 文件类型 | — | | numberToChinese(num, type) | 整数转汉字 | num: 数据或字符串,type: 默认不传;type='case'b表示大写 | 转换结果 | — | | storage.set(key, value, category = LOCAL, expired, cpath) | 缓存设置 | category可选:local\session\cookie, expired和cpath存储cookie时使用 | — | storage.set('name', '张三') | | storage.get(key, category = LOCAL) | 缓存查询 | — | — | storage.get('name') | | storage.clear(category = LOCAL) | 缓存清空 | — | — | storage.clear('cookie') | | storage.remove(key, category = LOCAL) | 缓存删除 | — | — | storage.remove('name') | | executeCopy(text) | 复制文本 | text: 需要复制的文本 | — | executeCopy('复制内容') |