From 5c7da183ae975f54f2949822ce3e73cca16218f0 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 11 Jan 2016 15:56:30 +0100 Subject: [PATCH] remove deprecated buffer.get/.set methods Node.js commit: https://github.com/nodejs/node/commit/101bca988cebce584d5b6098c316a6e7bf 89b69d These have been deprecated since Apr 27, 2013, and the plan was to remove them in "node v0.13". buffer.get(index) is superseded by buffer[index]. buffer.set(index, value) is superseded by buffer[index] = value. These have never been documented at any point in node's history. --- index.js | 12 ------------ test/deprecated.js | 19 ------------------- 2 files changed, 31 deletions(-) delete mode 100644 test/deprecated.js diff --git a/index.js b/index.js index e710e83..ab8388f 100644 --- a/index.js +++ b/index.js @@ -496,18 +496,6 @@ Buffer.prototype.indexOf = function indexOf (val, byteOffset) { throw new TypeError('val must be string, number or Buffer') } -// `get` is deprecated -Buffer.prototype.get = function get (offset) { - console.log('.get() is deprecated. Access using array indexes instead.') - return this.readUInt8(offset) -} - -// `set` is deprecated -Buffer.prototype.set = function set (v, offset) { - console.log('.set() is deprecated. Access using array indexes instead.') - return this.writeUInt8(v, offset) -} - function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 var remaining = buf.length - offset diff --git a/test/deprecated.js b/test/deprecated.js deleted file mode 100644 index 991d614..0000000 --- a/test/deprecated.js +++ /dev/null @@ -1,19 +0,0 @@ -if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false -var B = require('../').Buffer -var test = require('tape') - -test('.get (deprecated)', function (t) { - var b = new B([7, 42]) - t.equal(b.get(0), 7) - t.equal(b.get(1), 42) - t.end() -}) - -test('.set (deprecated)', function (t) { - var b = new B(2) - b.set(7, 0) - b.set(42, 1) - t.equal(b[0], 7) - t.equal(b[1], 42) - t.end() -}) -- 2.34.1