From 349bad9ea3b2eea0acb0317778311c3019d9ef95 Mon Sep 17 00:00:00 2001 From: James Halliday Date: Wed, 20 Mar 2013 12:07:09 -0700 Subject: [PATCH] fill with 0s for Buffer(num) --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index 7e61f58..aa62bdc 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,7 @@ function Buffer(subject, encoding, offset) { if (!(this instanceof Buffer)) { return new Buffer(subject, encoding, offset); } + this.parent = this; var type; @@ -46,6 +47,10 @@ function Buffer(subject, encoding, offset) { } else if (type == 'string') { // We are a string this.length = this.write(subject, 0, encoding); + } else if (type === 'number') { + for (var i = 0; i < this.length; i++) { + this[i] = 0; + } } } } -- 2.34.1