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

yjy-utils

v1.4.6

Published

前端公共utils库

Downloads

5

Readme

安装

    npm i yjy-utils -S

使用规则

  • 所有方法一起引用
    import * as yjyUtils from 'yjy-utils'
    // 获取sdk方法  除watchRightBtn, refreshPage是callback回调,其他方法返回promise  
    yshUtils.getSDK()
	yshUtils.yjySDK

具体文件介绍

- channel-code.js  各个ua下的 channelCode
- clip-image.js  阿里云图片处理
	* clipImage(url, width, height) 裁剪图片中间部分
    * resizeImage(url, width, height) 图片缩放
- compare-version.js  版本比较
	*versionCompare(version1, version2)  version1>=version2 => true
- date.js  时间
	* dateFormat(timestamp, fmt) 通过时间戳获取格式化日期  dateFormat(1590478470324, 'yyyy年mm月dd日 hh:MM:ss 星期w')  =>  2020年05月26日 15:34:30 星期二"
	* formatDuring(value = 0, fmt = ['天', '小时', '分钟', '秒']) 通过时间戳获取格式化日期  formatDuring(10000) => 2小时46分钟40秒
- handle-string.js  处理字符串
	* changePosition(str = '', num = 0) 后几位换到前面
- host.js  MALL_URL  BESTWEHOTEL_URL  YSH_URL
- load.js 加载文件
	* asyncLoadJs(url) 异步加载
- math-random.js  数字处理
 	* getRamNumber() 随机生成16位16进制
- sensor.js  神策埋点
	* sensorTrack(eventName, params) 神策事件埋点
	* sensorRegisterPage(params) 全局埋点加自定义属性
- storage.js 存储
	* setLocal(key, value)
	* getLocal(key)
	* removeLocal(key)
	* clearLocal()
	* getCookie(key)
- type.js 数据类型
	* assertionType(obj, type) 要进行类型判断的数据  assertionType('0', 'string') =》 true
- ua.js ua判断
- url-params.js url参数处理
	* getParam(key, url) 获取链接上的参数
	* getQueryString(obj)  将json转化成 url参数 url要拼接的参数 {a:1, b:2} => a=1&b=2
	* setParams(key, val,url) 向url中添加参数  url = http:xxx/XXX/?a=1  setParams(url, a, 2) => http:xxx/XXX/?a=1

发布

npm adduser
如果不是第一次发布包,执行以下命令进行登录,同样输入NPM账号,密码和邮箱
npm login
注意:npm adduser成功的时候默认你已经登陆了,所以不需要再进行npm login了
接着先进入项目文件夹下,然后输入以下命令进行发布
npm publish

同步淘宝源
https://npm.taobao.org/sync/yjy-utils