mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Added shortid for server and unique id's for remote
This commit is contained in:
17
server/node_modules/shortid/lib/decode.js
generated
vendored
Normal file
17
server/node_modules/shortid/lib/decode.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
var alphabet = require('./alphabet');
|
||||
|
||||
/**
|
||||
* Decode the id to get the version and worker
|
||||
* Mainly for debugging and testing.
|
||||
* @param id - the shortid-generated id.
|
||||
*/
|
||||
function decode(id) {
|
||||
var characters = alphabet.shuffled();
|
||||
return {
|
||||
version: characters.indexOf(id.substr(0, 1)) & 0x0f,
|
||||
worker: characters.indexOf(id.substr(1, 1)) & 0x0f
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = decode;
|
||||
Reference in New Issue
Block a user