1.0.1 • Published 5 years ago

inside-string v1.0.1

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

Inside string Travis CI Build Status

Check if a string is inside another string but not on the edge.

NPM Badge

Install

npm install inside-string

Usage

const insideString = require("inside-string");

insideString("abc", "a");
//=> false

insideString("abc", "b");
//=> true

insideString("abc", "c");
//=> false

insideString("abcdef", "c", 2); // Setting edge to 2
//=> true

insideString("abcdef", "e", 2, 1); // Setting left edge to 2 and right edge to 1
//=> true

API

insideString(string, stringToCheck, sides?)

string

Type: string

The string to search.

stringToCheck

Type: string

The string to check for.

sides

Type: number\ Default: 1

The amount of characters inwards from the left and right edges of the string to search.

insideString(string, stringToCheck, leftSide?, rightSide?)

string

Type: string

The string to search.

stringToCheck

Type: string

The string to check for.

leftSide

Type: number\ Default: 1

The amount of characters inward from the left edge of the string to search.

rightSide

Type: number\ Default: leftSide

The amount of characters inward from the right edge of the string to search.