Skip to content

Commit d5637e6

Browse files
committedJun 16, 2015
buffer: fix cyclic dependency with util
PR-URL: #1988 Fixes: #1987 Reviewed-By: Roman Reiss <[email protected]>
1 parent 1d79f57 commit d5637e6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
 

‎lib/buffer.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
const binding = process.binding('buffer');
55
const smalloc = process.binding('smalloc');
6-
const util = require('util');
76
const internalUtil = require('internal/util');
87
const alloc = smalloc.alloc;
98
const truncate = smalloc.truncate;
@@ -457,7 +456,7 @@ Buffer.prototype.fill = function fill(val, start, end) {
457456

458457

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

467466

468467
// XXX remove in v0.13
469-
Buffer.prototype.set = util.deprecate(function set(offset, v) {
468+
Buffer.prototype.set = internalUtil.deprecate(function set(offset, v) {
470469
offset = ~~offset;
471470
if (offset < 0 || offset >= this.length)
472471
throw new RangeError('index out of range');

‎test/parallel/test-util.js

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ assert.equal(true, util.isPrimitive(Infinity));
7171
assert.equal(true, util.isPrimitive(NaN));
7272
assert.equal(true, util.isPrimitive(Symbol('symbol')));
7373

74+
// isBuffer
75+
assert.equal(false, util.isBuffer('foo'));
76+
assert.equal(true, util.isBuffer(new Buffer('foo')));
77+
7478
// _extend
7579
assert.deepEqual(util._extend({a:1}), {a:1});
7680
assert.deepEqual(util._extend({a:1}, []), {a:1});

0 commit comments

Comments
 (0)
Please sign in to comment.