Skip to content
Determines whether one string may be found within another string.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
tests
.editorconfig
.eslintignore
.eslintrc.json
.gitignore
.npmignore
.nvmrc
.travis.yml
.uglifyjsrc.json
LICENSE
README.md
badges.html
index.js
package-lock.json
package.json

README.md

Travis status Dependency status devDependency status npm version

string-includes-x

Determines whether one string may be found within another string.

Version: 1.1.0
Author: Xotic750 Xotic750@gmail.com
License: MIT
Copyright: Xotic750

module.exportsboolean

This method determines whether one string may be found within another string, returning true or false as appropriate.

Kind: Exported member
Returns: boolean - true if the given string is found anywhere within the search string; otherwise, false if not.
Throws:

  • TypeError If target is null or undefined.
  • TypeError If searchString is a RegExp.
Param Type Description
string string The target string.
searchString string A string to be searched for within the target string.
[position] number The position within the string at which to begin searching for searchString.(defaults to 0).

Example

var strIncludes = require('string-includes-x');

var str = 'To be, or not to be, that is the question.';

includes(str, 'To be'); // true
includes(str, 'question'); // true
includes(str, 'nonexistent'); // false
includes(str, 'To be', 1); // false
includes(str, ('TO BE'); // false
You can’t perform that action at this time.