-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buffer: refactor to remove some duplicated code in fromObject. #4948
Changes from all commits
88f2a9f
cdaa4ea
c5a886b
e97323d
980f208
ab15735
e16e88b
b274fe1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,13 @@ var c = new Buffer(512); | |
console.log('c.length == %d', c.length); | ||
assert.strictEqual(512, c.length); | ||
|
||
var d = new Buffer([]); | ||
assert.strictEqual(0, d.length); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also add the following: var ui32 = new Uint32Array(4).fill(42);
var b = Buffer(ui32);
assert.deepEqual(ui32, b); This is a test that should have been added previously, so is not technically part of this PR, but might as well add it since we're here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @trevnorris , test is added. |
||
var ui32 = new Uint32Array(4).fill(42); | ||
var e = Buffer(ui32); | ||
assert.deepEqual(ui32, e); | ||
|
||
// First check Buffer#fill() works as expected. | ||
|
||
assert.throws(function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just an aside, all typed arrays could be more quickly handled in C++, but that doesn't concern this PR. at least now it's centralized and will be easier to make the change. :)