1.2.1 • Published 5 years ago

previous-index-of v1.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Find the index of a specific char-sequence in a string at a given offset.

Installation

NPM
$ npm i previous-index-of
Yarn
$ yarn add previous-index-of

Usage

const previousIndexOf = require('previous-index-of');

// previousIndexOf(sourceString: <string>, target: <string>, offset: <number|undefined>)
previousIndexOf('baz bam boo foo bam', 'bam', 12); // 4
previousIndexOf('baz bam boo foo bam', 'bam');     // 16
previousIndexOf('baz bam boo foo bam', 'da');      // -1
previousIndexOf('baz bam boo foo bam', 'bam', {}); // 16
previousIndexOf('baz bam boo foo bam', null);      // -1
previousIndexOf(null, 'abc');                      // -1

Running tests

$ npm install -d && npm test
1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago