determine if a string contains a substring, and return the start and end indexes if it does
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
History.md
Makefile
Readme.md
component.json
index.js

Readme.md

string-contains

determine if a string contains a word.

Installation

Install with component(1):

$ component install bmcmahen/string-contains

API

var contains = require('contains-word');
var string = 'lorem ipsum something poo';
var position = contains(string, 'lorem', 10);
if (position) {
  // position.start = starting index
  // position.end = ending index
}

License

MIT