Add get/set methods to Buffer
authorRyan Dahl <ry@tinyclouds.org>
Fri, 20 Aug 2010 06:29:06 +0000 (23:29 -0700)
committerRyan Dahl <ry@tinyclouds.org>
Fri, 20 Aug 2010 06:29:06 +0000 (23:29 -0700)
lib/buffer.js

index e9fb033..85c0bfe 100644 (file)
@@ -78,4 +78,12 @@ Buffer.prototype.write = function (string, offset, encoding) {
     default:
       throw new Error('Unknown encoding');
   }
-};
\ No newline at end of file
+};
+
+Buffer.prototype.get = function (index) {
+  return this[index];
+};
+
+Buffer.prototype.set = function (index, value) {
+  return this[index] = value;
+};