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

complex-code

v1.2.5

Published

This is random code,exampele:Ru1zaWd2;this is have unix time

Downloads

19

Readme

complex-code

npm


$ npm install complex-code

说明

  • 使用Unix时间戳毫秒来处理,基本保证了唯一性
  • 每毫秒如果数据量处理过大时,无法保证唯一性
  • 基本构成为:Unix时间戳每两位构成一个数字,大于61的将减去61,剩余与61并列放入,最后一个值为随机数(0-61)
  • 因为Unix时间戳过长,导致生成的随机码过于长,最大有可能达到9位
  • 61个值,分别为0-9,a-z,A-Z组成
  • 将Unix时间戳所有数字相加,放置于最后一位
  • 第二位不能和第一位相等,第三位不能和第二位相等,依次类推,只有最后两个相邻有可能相等

使用


const complexCode=require('complex-code');
//如果只有一个参数时,并且为true,则代表使用Unix时间戳构成大小写字母加数字
var code_1=complexCode.code(true);
//如果有两位参数,第一位number类型,代表长度,第二位代表参数,string类型,num:全为数字,string:全为大小写字母,all:三者混合 此种方法有可能有重复值
var code_2=complexCode.code(10,"num");
var code_3=complexCode.code(10,"string");
var code_4=complexCode.code(10,"all");

输出


$ FHzMzHz4SzTX
$ 2347316389
$ JBypcoXjPu
$ ERidFdE1Fu