diff node_modules/socket.io/lib/util.js @ 69:333afcfd3f3a

added node_modules to project and fixed path to chronometer also added deps to installer script
author tzara <rc-web@kiben.net>
date Sat, 26 Oct 2013 14:12:50 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/node_modules/socket.io/lib/util.js	Sat Oct 26 14:12:50 2013 +0100
@@ -0,0 +1,50 @@
+
+/*!
+ * socket.io-node
+ * Copyright(c) 2011 LearnBoost <dev@learnboost.com>
+ * MIT Licensed
+ */
+
+/**
+ * Module dependencies.
+ */
+
+/**
+ * Converts an enumerable to an array.
+ *
+ * @api public
+ */
+
+exports.toArray = function (enu) {
+  var arr = [];
+
+  for (var i = 0, l = enu.length; i < l; i++)
+    arr.push(enu[i]);
+
+  return arr;
+};
+
+/**
+ * Unpacks a buffer to a number.
+ *
+ * @api public
+ */
+
+exports.unpack = function (buffer) {
+  var n = 0;
+  for (var i = 0; i < buffer.length; ++i) {
+    n = (i == 0) ? buffer[i] : (n * 256) + buffer[i];
+  }
+  return n;
+}
+
+/**
+ * Left pads a string.
+ *
+ * @api public
+ */
+
+exports.padl = function (s,n,c) { 
+  return new Array(1 + n - s.length).join(c) + s;
+}
+