Added shortid for server and unique id's for remote

This commit is contained in:
Kasper Rynning-Tønnesen
2015-06-19 19:43:58 +02:00
parent 8b4cb5964d
commit 7e96a1d0dc
19 changed files with 740 additions and 7 deletions

17
server/node_modules/shortid/lib/decode.js generated vendored Normal file
View 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;