From: James Halliday Date: Wed, 20 Mar 2013 17:56:17 +0000 (-0700) Subject: indexes test passes X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=3a0c010800e1efc87722d0c6c97705dc7d808b86;p=buffer.git indexes test passes --- diff --git a/index.js b/index.js index 1d81be0..d6511fd 100644 --- a/index.js +++ b/index.js @@ -379,14 +379,19 @@ function Buffer(subject, encoding, offset) { for (var i = 0; i < this.length; i++) { if (subject instanceof Buffer) { this.parent[i + this.offset] = subject.readUInt8(i); + this[i] = subject.readUInt8(i); } else { this.parent[i + this.offset] = subject[i]; + this[i] = subject[i]; } } } else if (type == 'string') { // We are a string this.length = this.write(subject, 0, encoding); + for (var i = 0; i < this.length; i++) { + this[i] = this.parent[i]; + } } }