From d27c3ada9500a0c531d5265a20f9ca8dbc7dbea4 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sun, 7 Aug 2016 22:09:15 -0700 Subject: [PATCH] Show warning for unimplemented .lastIndexOf Instead of letting the Uint8Array implementation's .lastIndexOf be exposed, since that one has a different interface. --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 8aa8091..834bea0 100644 --- a/index.js +++ b/index.js @@ -725,6 +725,10 @@ Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { throw new TypeError('val must be string, number or Buffer') } +Buffer.prototype.lastIndexOf = function () { + throw new Error('Not implemented yet. PR welcome! https://github.com/feross/buffer/issues/114') +} + Buffer.prototype.includes = function includes (val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1 } -- 2.34.1