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

js-common-api

v0.8.0

Published

js common api

Downloads

2

Readme

介绍

js常用api

安装

    npm install js-common-api

使用

    import { commaSplit,formatDate,symbolSplit } from "js-common-api";

    console.log(commaSplit("123333345.111",3));// 123,333,345.111

    console.log(formatDate("2014-12-11 22:40:20","yyyy年MM月dd日 HH时mm分ss秒"));//2014年12月11日 22时40分20秒
    console.log(formatDate("2014-12-11 22:40:20","yyyy/MM/dd"));//2014/12/11
    console.log(formatDate(new Date()));//2017-12-06 09:53:59

    console.log(symbolSplit("15200000001",3,"-",false));// 15-200-000-001
    console.log(symbolSplit("15200000001",3,"-",true));// 152-000-000-01

API

函数 | 说明 |参数|返回值 ----|------|------|------ isEmptyObject | 判断对象是否为空|(obj:Object)|boolean isPhoneNum | 判断是否为手机号|(str:String|Number)|boolean isEmail | 判断是否为email|(str:String)|boolean arrayEqual | 判断两个数组是否相等|(array1:Array,array2:Array)|boolean commaSplit | 字符串按照指定的width进行逗号分隔|(str:String,width:Number)|string getURLSearch | 根据key获取URL查询值|(key:String)|string IdCardValidate | 身份证验证|(idCard:String)|boolean maleOrFemalByIdCard | 通过身份证判断是男是女|(idCard:String)|female'-女、'male'-男 deepClone | 深度拷贝|(value:Any)|Any formatDate | 日期格式化|(date:String|Date,format:String)|String symbolSplit | 字符串按照指定width,指定的symbol分隔|(str:String,width:Number, symbol:String,start:Boolean true:从左到右,false:从右到左)|String