From: Feross Aboukhadijeh Date: Mon, 8 Aug 2016 05:09:15 +0000 (-0700) Subject: Show warning for unimplemented .lastIndexOf X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=d27c3ada9500a0c531d5265a20f9ca8dbc7dbea4;p=buffer.git Show warning for unimplemented .lastIndexOf Instead of letting the Uint8Array implementation's .lastIndexOf be exposed, since that one has a different interface. --- 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 }