indexof-limited

1.1.13 • Public • Published

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);

Package Sidebar

Install

npm i indexof-limited

Weekly Downloads

1

Version

1.1.13

License

MIT

Unpacked Size

3.4 kB

Total Files

4

Last publish

Collaborators

  • oprogramador