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

douze-api

v1.1.1

Published

封装一些前端js常用得方法,记录难点

Downloads

6

Readme

下载

npm install douze-api

使用

import Douze from 'douze-api';

api

/**
 * 时间格式化
 * @param {(string|number)} Timestamp
 * @param {String} type 
 * @returns {String} '2023-01-01 01:01:00'
 * year: ["YYYY", 'yyyy'], month: ['MM'],day: ["DD", 'dd'],hour: ["hh", 'HH'],minute: ["mm"],second: ["ss", 'SS'],
 * 
 */
Douze.Time(1672506060000,'YYYY-MM-DD hh:mm:ss');
/**
 * 人性化时间
 * @param {(string|number)} datetime
 */
Douze.formatTime(1672506060000);
/**
 * 多维数组转一维
 * @param {array} list
 * @returns {array} [1,2,3,4]
 */
Douze.Flattening([1,[2,[3],[4]]])

/**
 * url转object,或obj转url
 * @param {object,string} data
 * @param {Boolean} is 是否编码解码
 * @returns {array} name=Douze&age=18  || {name:Douze,age:18}
 */
Douze.UrlToData({name:'Douze',age:18},false)
Douze.UrlToData('name=Douze&age=18 ',false)

/**
 * 字符串大小写转换 
 * @param {string} str
 * @param {number} type  1:首字母大写  2:首字母小写  3:大小写转换  4:全部大写  5:全部小写
 * @returns {string} 'abcd'
 */
Douze.LetterCase('ABCD',5);


/**
 * 字符串大小写转换 
 * @param {string} value
 * @param {string} type 
 * phone =>手机号码
 * tel => 座机
 * card => 身份证
 * pwd =>  密码以字母开头,长度在6~18之间,只能包含字母、数字和下划线
 * postal => 邮政编码
 * QQ => QQ号
 * email => 邮箱
 * money => 金额(小数点2位)
 * IP => Ip
 * date =>  日期时间
 * number =>  数字
 * english => 英文
 * chinese => 中文
 * lower => 小写
 * upper => 大写
 * @returns {Boolean} true || false
 */
Douze.Regular('[email protected]',email)
陆续更新~
有更好的建议可以联系我:
wx:Nine195
qq:1959762008
email:[email protected]
代码地址:https://github.com/nine195/Douze