Skip to content

feature: Buffer.lastIndexOf

Rodrigo Muino Tomonari requested to merge github/fork/dcposch/master into master

Fixes #4604 (closed)

work done

  • Added support for Buffer.lastIndexOf to match Buffer.indexOf
  • Can search for a string, another Buffer, or a specific byte value, consistent with Buffer.indexOf
  • For specific byte values, behavior is consistent with Uint8Array.lastIndexOf, which is now shadowed by Buffer.lastIndexOf, so existing code should continue to work
  • Added test cases

work left to do

  • Optimization. The implementation of reverse search in string_search.cc is naive and just uses a double for loop. Ideally we'd adapt BoyerMooreSearch to support reverse search, so that lastIndexOf will be equally fast as indexOf

Merge request reports

Loading