From 8cf26fd2a12c6c23e558955bdbff6bece92d593d Mon Sep 17 00:00:00 2001 From: rafael Date: Tue, 13 Aug 2013 09:10:36 +0200 Subject: [PATCH] limited slicing implementation --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 7d95278..1875afc 100644 --- a/index.js +++ b/index.js @@ -17,7 +17,11 @@ function Buffer(subject, encoding, offset) { // Are we slicing? if (typeof offset === 'number') { this.length = coerce(encoding); - this.offset = offset; + // slicing works, with limitations (no parent tracking/update) + // check https://github.com/toots/buffer-browserify/issues/19 + for (var i = 0; i < this.length; i++) { + this[i] = subject.get(i+offset); + } } else { // Find the length switch (type = typeof subject) { -- 2.34.1