Files
zoff/server/node_modules/shortid/package.json
2015-06-19 19:43:58 +02:00

63 lines
12 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"name": "shortid",
"version": "2.2.2",
"description": "Amazingly short non-sequential url-friendly unique id generator.",
"main": "lib/index.js",
"scripts": {
"test": "grunt test"
},
"keywords": [
"short",
"tiny",
"id",
"uuid",
"bitly",
"shorten",
"mongoid",
"shortid",
"tinyid"
],
"homepage": "https://github.com/dylang/shortid",
"author": {
"name": "Dylan Greene",
"email": "dylang@gmail.com"
},
"repository": {
"type": "git",
"url": "https://github.com/dylang/shortid.git"
},
"browser": {
"./lib/util/cluster-worker-id.js": "./lib/util/cluster-worker-id-browser.js",
"./lib/random/random-byte.js": "./lib/random/random-byte-browser.js"
},
"devDependencies": {
"chai": "^2.2.0",
"envify": "^3.4.0",
"grunt": "^0.4.5",
"grunt-browserify": "^3.6.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-jshint": "^0.11.1",
"grunt-contrib-uglify": "^0.8.1",
"grunt-mocha-test": "^0.12.7",
"grunt-notify": "^0.4.1",
"grunt-open": "^0.2.3",
"grunt-release": "^0.12.0",
"grunt-templates-dylang": "^1.0.10",
"load-grunt-tasks": "^3.1.0",
"mocha": "^2.2.1",
"time-grunt": "^1.1.0"
},
"license": "MIT",
"readme": "## shortid [![Build Status](http://img.shields.io/travis/dylang/shortid.svg)](https://travis-ci.org/dylang/shortid) [![shortid](http://img.shields.io/npm/dm/shortid.svg)](https://www.npmjs.org/package/shortid)\n\n> Amazingly short non-sequential url-friendly unique id generator.\n\n\n\n\n\n\n\n\nShortId creates amazingly short non-sequential url-friendly unique ids. Perfect for url shorteners, MongoDB and Reddis ids, and any other id users might see.\n\n * By default 7-14 url-friendly characters: `A-Z`, `a-z`, `0-9`, `_-`\n * Non-sequential so they are not predictable.\n * Supports `cluster` (automatically), custom seeds, custom alphabet.\n * Can generate any number of ids without duplicates, even millions per day.\n * Perfect for games, especially if you are concerned about cheating so you don't want an easily guessable id.\n * Apps can be restarted any number of times without any chance of repeating an id.\n * Popular replacement for Mongo ID/Mongoose ID.\n * Works in Node, io.js, and web browsers.\n * Includes [Mocha](http://visionmedia.github.com/mocha/) tests.\n\n\n\n### Usage\n\n```js\nvar shortid = require('shortid');\n\nconsole.log(shortid.generate());\n//PPBqWA9\n```\n\nMongoose Unique Id\n```js\n_id: {\n type: String,\n unique: true,\n 'default': shortid.generate\n},\n```\n\n\n\n### Browser Compatibility\n\nThe best way to use `shortid` in the browser is via [browserify](http://browserify.org/) or [webpack](http://webpack.github.io/).\n\nThese tools will automatically only include the files necessary for browser compatibility.\n\nAll tests will run in the browser as well:\n\n```bash\n## build the bundle, then open Mocha in a browser to see the tests run.\n$ grunt build open\n```\n\n\n\n### Example\n\n```js\n~/projects/shortid node examples/examples.js\neWRhpRV\n23TplPdS\n46Juzcyx\ndBvJIh-H\n2WEKaVNO\n7oet_d9Z\ndogPzIz8\nnYrnfYEv\na4vhAoFG\nhwX6aOr7\n```\n\n\n#### Real World Examples\n\n`shortId` was created for Node Knockout 2011 winner for Most Fun [Doodle Or Die](http://doodleordie.com).\nMillions of doodles have been saved with `shortId` filenames. Every log message gets a `shortId` to make it easy\nfor us to look up later.\n\nHere are some other projects that use shortId:\n\n* [bevy](https://npmjs.org/package/bevy) - A simple server to manage multiple Node services.\n* [capre](https://npmjs.org/package/capre) - Cross-Server Data Replication.\n* [cordova-build](https://www.npmjs.org/package/cordova-build) - an alternative to phonegap build that runs on your servers/agents.\n* [couchdb-tools](https://www.npmjs.org/package/couchdb-tools) - A library of handy functions for use when working with CouchDB documents.\n* [CleverStack/clever-email](https://github.com/CleverStack/clever-email) - E-mail system for CleverStack.\n* [CloudTypes](https://github.com/ticup/CloudTypes) - JavaScript end2end implementation of the Cloud Types model for Eventual Consistency programming.\n* [dnode-tarantula](https://github.com/jutaz/dnode-tarantula) - an asynchronous rpc and event system for node.js based on dnode-protocol and TCP sockets.\n* [mongoose-url-shortener](https://www.npmjs.org/package/mongoose-url-shortener) - A simple URL Shortening library for NodeJS using Promises/A+ results.\n* [mozilla/smokejumper](https://github.com/mozilla/smokejumper) - The Smoke Jumper project is an effort to bring dead simple, secure, P2P file sharing to Firefox.\n* [shortness](https://npmjs.org/package/shortness) - Node based URL shortener that uses SQLite.\n* [file-db](https://npmjs.org/package/file-db) - Document database that uses directories and files to store its data, supporting nested key-value objects in named collections.\n* [resume-generator](https://www.npmjs.org/package/resume-generator) - Resume Generator.\n* [riffmint](https://npmjs.org/package/riffmint) - Collaboration in musical space.\n* [rap1ds/dippa](https://github.com/rap1ds/dippa) - Dippa Editor A web-based LaTeX editor\n\n\n\n\n### API\n\n`var shortid = require('shortid');`\n\n---------------------------------------\n\n#### `shortid.generate()`\n\n__Returns__ `string` non-sequential unique id.\n\n__Example__\n\n```js\nusers.insert({\n _id: shortid.generate()\n name: ...\n email: ...\n });\n```\n\n---------------------------------------\n\n#### `characters(string)`\n\n__Default:__ `'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_'`\n\n__Returns__ new alphabet as a `string` \n\n__Recommendation:__ If you don't like _ or -, you can to set new characters to use. \n\n__Optional__\n\nChange the characters used.\n\nYou must provide a string of all 64 unique characters. Order is not important.\n\nThe default characters provided were selected because they are url safe.\n\n__Example__\n\n```js\n// use $ and @ instead of - and _\nshortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$@');\n```\n\n```js\n// any 64 unicode characters work, but I wouldn't recommend this.\nshortid.characters('ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ①②③④⑤⑥⑦⑧⑨⑩⑪⑫');\n```\n\n\n---------------------------------------\n\n#### `isValid(id)`\n\n__Returns__ `boolean`\n\nCheck 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.\n\n__Example__\n\n```js\nshortid.isValid('41XTDbE');\n// true\n```\n\n```js\nshortid.isValid('i have spaces');\n// false\n```\n\n---------------------------------------\n\n#### `shortid.worker(integer)`\n\n__Default:__ `process.env.NODE_UNIQUE_ID || 0`\n\n__Recommendation:__ You typically won't want to change this.\n\n__Optional__\n\nIf 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. \nIf you do not do this there is very little chance of two servers generating the same id, but it is theatrically possible \nif 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. \n\n__Example__\n\n```js\nshortId.seed(1000);\n```\n\n---------------------------------------\n\n#### `shortid.seed(float)`\n\n__Default:__ `1`\n\n__Recommendation:__ You typically won't want to change this.\n\n__Optional__\n\nChoose 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.\n\nMost developers won't need to use this, it's mainly for testing ShortId. \n\nIf you are worried about users somehow decrypting the id then use it as a secret value for increased encryption.\n\n__Example__\n\n```js\nshortId.seed(1000);\n```\n\n\n\n\n\n\n### About the Author\n\nHi! Thanks for checking out this project! My name is **Dylan Greene**. When not overwhelmed with my two young kids I enjoy contributing\nto the open source community. I'm also a tech lead at [Opower](http://opower.com). [![@dylang](https://img.shields.io/badge/github-dylang-green.svg)](https://github.com/dylang) [![@dylang](https://img.shields.io/badge/twitter-dylang-blue.svg)](https://twitter.com/dylang)\n\nHere's some of my other Node projects:\n\n| Name | Description | npm Downloads |\n|---|---|---|\n| [`gruntnotify`](https://github.com/dylang/grunt-notify) | Automatic desktop notifications for Grunt errors and warnings using Growl for OS X or Windows, Mountain Lion and Mavericks Notification Center, and Notify-Send. | [![grunt-notify](https://img.shields.io/npm/dm/grunt-notify.svg?style=flat-square)](https://www.npmjs.org/package/grunt-notify) |\n| [`npmcheck`](https://github.com/dylang/npm-check) | Check for outdated, incorrect, and unused dependencies. | [![npm-check](https://img.shields.io/npm/dm/npm-check.svg?style=flat-square)](https://www.npmjs.org/package/npm-check) |\n| [`gruntprompt`](https://github.com/dylang/grunt-prompt) | Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields. | [![grunt-prompt](https://img.shields.io/npm/dm/grunt-prompt.svg?style=flat-square)](https://www.npmjs.org/package/grunt-prompt) |\n| [`rss`](https://github.com/dylang/node-rss) | RSS feed generator. Add RSS feeds to any project. Supports enclosures and GeoRSS. | [![rss](https://img.shields.io/npm/dm/rss.svg?style=flat-square)](https://www.npmjs.org/package/rss) |\n| [`xml`](https://github.com/dylang/node-xml) | Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples. | [![xml](https://img.shields.io/npm/dm/xml.svg?style=flat-square)](https://www.npmjs.org/package/xml) |\n| [`changelog`](https://github.com/dylang/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. | [![changelog](https://img.shields.io/npm/dm/changelog.svg?style=flat-square)](https://www.npmjs.org/package/changelog) |\n| [`gruntattention`](https://github.com/dylang/grunt-attention) | Display attention-grabbing messages in the terminal | [![grunt-attention](https://img.shields.io/npm/dm/grunt-attention.svg?style=flat-square)](https://www.npmjs.org/package/grunt-attention) |\n| [`observatory`](https://github.com/dylang/observatory) | Beautiful UI for showing tasks running on the command line. | [![observatory](https://img.shields.io/npm/dm/observatory.svg?style=flat-square)](https://www.npmjs.org/package/observatory) |\n| [`anthology`](https://github.com/dylang/anthology) | Module information and stats for any @npmjs user | [![anthology](https://img.shields.io/npm/dm/anthology.svg?style=flat-square)](https://www.npmjs.org/package/anthology) |\n| [`gruntcat`](https://github.com/dylang/grunt-cat) | Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi. | [![grunt-cat](https://img.shields.io/npm/dm/grunt-cat.svg?style=flat-square)](https://www.npmjs.org/package/grunt-cat) |\n\n_This list was generated using [anthology](https://github.com/dylang/anthology)._\n\n\n### License\nCopyright (c) 2015 Dylan Greene, contributors.\n\nReleased under the [MIT license](https://tldrlegal.com/license/mit-license).\n\nScreenshots are [CC BY-SA](http://creativecommons.org/licenses/by-sa/4.0/) (Attribution-ShareAlike).\n\n***\n_Generated using [grunt-readme](https://github.com/assemble/grunt-readme) with [grunt-templates-dylang](https://github.com/dylang/grunt-templates-dylang) on Sunday, April 5, 2015._\n_To make changes to this document look in `/templates/readme/`\n\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/dylang/shortid/issues"
},
"_id": "shortid@2.2.2",
"dist": {
"shasum": "b2fbf1fb06fcff4e47de08427b5ed615c1aea2db"
},
"_from": "shortid@",
"_resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.2.tgz"
}