[Pkg-javascript-commits] [sockjs-client] 226/434: Make the code shorter - use substr instead of array index.

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:15 UTC 2014


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch master
in repository sockjs-client.

commit 0bdfb6d41bb382d57d2fd18e2706eea5d56c31b2
Author: Marek Majkowski <majek04 at gmail.com>
Date:   Tue Nov 29 16:17:53 2011 +0000

    Make the code shorter - use substr instead of array index.
---
 lib/utils.js | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/utils.js b/lib/utils.js
index 17113d8..b9b7918 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -1,13 +1,10 @@
 var utils = {};
-var random_string_chars = ['a','b','c','d','e','f','g','h','i','j',
-                           'k','l','m','n','o','p','q','r','s','t',
-                           'u','v','w','x','y','z',
-                           '0','1','2','3','4','5','6','7','8','9','_'];
+var random_string_chars = 'abcdefghijklmnopqrstuvwxyz0123456789_';
 utils.random_string = function(letters, max) {
     max = max || random_string_chars.length;
     var i, ret = [];
     for(i=0; i < letters; i++) {
-        ret.push( random_string_chars[Math.floor(Math.random() * max)] );
+        ret.push( random_string_chars.substr(Math.floor(Math.random() * max),1) );
     }
     return ret.join('');
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list