Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
buffer: fix cyclic dependency with util
  • Loading branch information
brendanashworth committed Jun 16, 2015
commit c6c706fa80f887be57327d88dc2caa03f1e4a876
5 changes: 2 additions & 3 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

const binding = process.binding('buffer');
const smalloc = process.binding('smalloc');
const util = require('util');
const internalUtil = require('internal/util');
const alloc = smalloc.alloc;
const truncate = smalloc.truncate;
Expand Down Expand Up @@ -457,7 +456,7 @@ Buffer.prototype.fill = function fill(val, start, end) {


// XXX remove in v0.13
Buffer.prototype.get = util.deprecate(function get(offset) {
Buffer.prototype.get = internalUtil.deprecate(function get(offset) {
offset = ~~offset;
if (offset < 0 || offset >= this.length)
throw new RangeError('index out of range');
Expand All @@ -466,7 +465,7 @@ Buffer.prototype.get = util.deprecate(function get(offset) {


// XXX remove in v0.13
Buffer.prototype.set = util.deprecate(function set(offset, v) {
Buffer.prototype.set = internalUtil.deprecate(function set(offset, v) {
offset = ~~offset;
if (offset < 0 || offset >= this.length)
throw new RangeError('index out of range');
Expand Down
4 changes: 4 additions & 0 deletions test/parallel/test-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ assert.equal(true, util.isPrimitive(Infinity));
assert.equal(true, util.isPrimitive(NaN));
assert.equal(true, util.isPrimitive(Symbol('symbol')));

// isBuffer
assert.equal(false, util.isBuffer('foo'));
assert.equal(true, util.isBuffer(new Buffer('foo')));

// _extend
assert.deepEqual(util._extend({a:1}), {a:1});
assert.deepEqual(util._extend({a:1}, []), {a:1});
Expand Down