indexof-limited

v1.1.13
JavaScript library to find the first occurence of a substring inside a long string limited to initial and end position
indexof index of string substring search limited

indexof-limited

MIT License Build Status

NPM status

JavaScript library to find the first occurence of a substring inside a long string limited to initial and end position. It works in the same way as String.prototype.indexOf when no end limit specified. Otherwise it searches only until the end limit (the entire substring must be within the limit).

install

npm install --save indexof-limited

usage

const indexOf = require('indexof-limited');

const longtext = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua';
const substring = 'consectetur';

expect(indexOf(longtext, substring, 10, 15)).to.equal(-1);
npm i indexof-limited

Metadata

  • MIT
  • Whatever
  • oprogramador
  • released 3/19/2023

Downloads

Maintainers