JSPM

simple-unique

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 72
  • Score
    100M100P100Q56993F
  • License MIT

完全随机生成唯一字符串 · 超轻量 | Completely random generation of unique strings · Ultra-lightweight

Package Exports

  • simple-unique
  • simple-unique/dist/unique.cjs.js
  • simple-unique/dist/unique.esm.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-unique) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

语言: 中文 English

Simple-Unique

完全随机生成唯一字符串 · 超轻量

Version MIT License

简介

完全随机生成唯一字符串 · 超轻量

压缩大小: 320~ Byte

gzip 大小: 200~ bit

安装

Using npm:

npm install simple-unique --save

Using jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/simple-unique/dist/unique.min.js"></script>

Using unpkg CDN:

<script src="https://unpkg.com/simple-unique/dist/unique.min.js"></script>

使用案例

Node.js

const unique = require('simple-unique')
const arr1 = [unique(), unique()]
const arr2 = [unique(true), unique(true)]

console.log(arr1[0] === arr1[1], arr1) // false [ 'wps9v86i1icltz0y1yub', 'g1wozldayykvszuh2xyq' ]
console.log(arr2[0] === arr2[1], arr2) // false [ '2ljb1nu94l4e6y49oa2w.dp8ftwjtlzv', 'wmuogoa3lt1g45ycq0o.o7auhvika2' ]

浏览器

<script src="https://cdn.jsdelivr.net/npm/simple-unique/dist/unique.min.js"></script>
<script>
  const arr1 = [unique(), unique()]
  const arr2 = [unique(true), unique(true)]

  console.log(arr1[0] === arr1[1], arr1) // false [ 'wps9v86i1icltz0y1yub', 'g1wozldayykvszuh2xyq' ]
  console.log(arr2[0] === arr2[1], arr2) // false [ '2ljb1nu94l4e6y49oa2w.dp8ftwjtlzv', 'wmuogoa3lt1g45ycq0o.o7auhvika2' ]
</script>