lib/libs/string.js
function randomKey(_numOfBlocks, _blockLength, _mode, _timestamp) {
	var numOfBlocks = _numOfBlocks;
    var blockLength = _blockLength;
    
    if(numOfBlocks === undefined || numOfBlocks < 3) numOfBlocks = 2;
    if(blockLength === undefined || blockLength < 3) blockLength = 2;
    
    var key = "";
    
	for (var i=0; i<numOfBlocks; i++) {
		if(key.length == 0)
			key = randomString(blockLength, _mode);
		else
			key = key + "-" + randomString(blockLength, _mode);
	}
	
	if(_timestamp !== undefined && _timestamp === true)
		key = new Date().getTime() + '-' + key;
	
	return key;
}
function randomKey(_numOfBlocks, _blockLength, _mode, _timestamp) {
	var numOfBlocks = _numOfBlocks;
    var blockLength = _blockLength;
    
    if(numOfBlocks === undefined || numOfBlocks < 3) numOfBlocks = 2;
    if(blockLength === undefined || blockLength < 3) blockLength = 2;
    
    var key = "";
    
	for (var i=0; i<numOfBlocks; i++) {
		if(key.length == 0)
			key = randomString(blockLength, _mode);
		else
			key = key + "-" + randomString(blockLength, _mode);
	}
	
	if(_timestamp !== undefined && _timestamp === true)
		key = new Date().getTime() + '-' + key;
	
	return key;
}
function randomKey ( _numOfBlocks , _blockLength , _mode , _timestamp ) { var numOfBlocks = _numOfBlocks ; var blockLength = _blockLength ; if ( numOfBlocks === undefined || numOfBlocks < 3 ) numOfBlocks = 2 ; if ( blockLength === undefined || blockLength < 3 ) blockLength = 2 ; var key = "" ; for ( var i = 0 ; i < numOfBlocks ; i ++ ) { if ( key . length == 0 ) key = randomString ( blockLength , _mode ) ; else key = key + "-" + randomString ( blockLength , _mode ) ; } if ( _timestamp !== undefined && _timestamp === true ) key = new Date ( ) . getTime ( ) + '-' + key ; return key ; }
Generates a random key of the provided length, and including only
the required characters.
A key is separated by `-`.
Also has the option to timestamp the resulting string at the begining.

@param {int} _numOfBlocks
@param {int} _blockLength
@param {String} _mode
@param {Boolean} _timestamp
@api public
Generates a random key of the provided length and including only the required characters . A key is separated by - . Also has the option to timestamp the resulting string at the begining .