dylang/shortid được TopGit xếp vào nhóm dự án mã nguồn mở, với 5.7k sao trên GitHub, viết chủ yếu bằng JavaScript. Short id generator. Url-friendly. Non-predictable. Cluster-compatible.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Amazingly short non-sequential url-friendly unique id generator.
shortid is deprecated, because the architecture is unsafe. we instead recommend Nano ID, which has the advantage of also being significantly faster than shortid
ShortId creates amazingly short non-sequential url-friendly unique ids. Perfect for url shorteners, MongoDB and Redis ids, and any other id users might see.
By default 7-14 url-friendly characters: A-Z, a-z, 0-9, _-
shortId was created for Node Knockout 2011 winner for Most Fun Doodle Or Die.
Millions of doodles have been saved with shortId filenames. Every log message gets a shortId to make it easy
for us to look up later.
Here are some other projects that use shortId:
bevy - A simple server to manage multiple Node services.
capre - Cross-Server Data Replication.
cordova-build - an alternative to phonegap build that runs on your servers/agents.
couchdb-tools - A library of handy functions for use when working with CouchDB documents.
CleverStack/clever-email - E-mail system for CleverStack.
CloudTypes - JavaScript end2end implementation of the Cloud Types model for Eventual Consistency programming.
dnode-tarantula - an asynchronous rpc and event system for node.js based on dnode-protocol and TCP sockets.
mongoose-url-shortener - A simple URL Shortening library for NodeJS using Promises/A+ results.
mozilla/smokejumper - The Smoke Jumper project is an effort to bring dead simple, secure, P2P file sharing to Firefox.
shortness - Node based URL shortener that uses SQLite.
file-db - Document database that uses directories and files to store its data, supporting nested key-value objects in named collections.
resume-generator - Resume Generator.
riffmint - Collaboration in musical space.
rap1ds/dippa - Dippa Editor – A web-based LaTeX editor
Recommendation: If you don't like _ or -, you can to set new characters to use.
Optional
Change the characters used.
You must provide a string of all 64 unique characters. Order is not important.
The default characters provided were selected because they are url safe.
Example
// use $ and @ instead of - and _
shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$@');
// any 64 unicode characters work, but I wouldn't recommend this.
shortid.characters('ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ①②③④⑤⑥⑦⑧⑨⑩⑪⑫');
shortid.isValid(id)
Returnsboolean
Check to see if an id is a valid shortid. Note: This only means the id could have been generated by shortid, it doesn't guarantee it.
Example
shortid.isValid('41XTDbE');
// true
shortid.isValid('i have spaces');
// false
shortid.worker(integer)
Default:process.env.NODE_UNIQUE_ID || 0
Recommendation: You typically won't want to change this.
Optional
If you are running multiple server processes then you should make sure every one has a unique worker id. Should be an integer between 0 and 16.
If you do not do this there is very little chance of two servers generating the same id, but it is theoretically possible
if both are generated in the exact same second and are generating the same number of ids that second and a half-dozen random numbers are all exactly the same.
Example
shortid.worker(1);
shortid.seed(integer)
Default:1
Recommendation: You typically won't want to change this.
Optional
Choose a unique value that will seed the random number generator so users won't be able to figure out the pattern of the unique ids. Call it just once in your application before using shortId and always use the same value in your application.
Most developers won't need to use this, it's mainly for testing ShortId.
If you are worried about users somehow decrypting the id then use it as a secret value for increased encryption.
Example
shortid.seed(1000);
About the Author
Hi! Thanks for checking out this project! My name is Dylan Greene. When not overwhelmed with my two young kids I enjoy contributing
to the open source community. I'm also a tech lead at Opower.
Here's some of my other Node projects:
Name
Description
npm Downloads
npm‑check
Check for outdated, incorrect, and unused dependencies.
grunt‑notify
Automatic desktop notifications for Grunt errors and warnings. Supports OS X, Windows, Linux.
space‑hogs
Discover surprisingly large directories from the command line.
rss
RSS feed generator. Add RSS feeds to any project. Supports enclosures and GeoRSS.
grunt‑prompt
Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields.
xml
Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.
changelog
Command line tool (and Node module) that generates a changelog in color output, markdown, or json for modules in npmjs.org's registry as well as any public github.com repo.
grunt‑attention
Display attention-grabbing messages in the terminal
observatory
Beautiful UI for showing tasks running on the command line.
anthology
Module information and stats for any @npmjs user
grunt‑cat
Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi.
This list was generated using anthology.
License
Copyright (c) 2016 Dylan Greene, contributors.
Released under the MIT license.
Screenshots are CC BY-SA (Attribution-ShareAlike).
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/dylang/shortid là nguồn chính thức.
dylang/shortid có phải mã nguồn mở không?
TopGit chưa ghi nhận license cho dylang/shortid. Phần lớn repo public trên GitHub là mã nguồn mở, nhưng điều khoản khác nhau từng repo — mở file LICENSE để xác nhận.
dylang/shortid có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho dylang/shortid. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
dylang/shortid có trang demo không?
Dự án có trang chủ ở https://www.npmjs.org/package/shortid. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
dylang/shortid còn đang phát triển không?
Commit gần nhất trên dylang/shortid là 1.6 năm trước (theo timestamp GitHub). Repo có 252 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc đầy đủ README ở tab phía trên.
shortid có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về shortid.