Skip to content

Commit 51ecba8

Browse files
committed
Add get/set methods to Buffer
1 parent 0c20c58 commit 51ecba8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/buffer.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,12 @@ Buffer.prototype.write = function (string, offset, encoding) {
7878
default:
7979
throw new Error('Unknown encoding');
8080
}
81-
};
81+
};
82+
83+
Buffer.prototype.get = function (index) {
84+
return this[index];
85+
};
86+
87+
Buffer.prototype.set = function (index, value) {
88+
return this[index] = value;
89+
};

0 commit comments

Comments
 (0)