1.0.3 • Published 3 years ago
@12joan/locale-includes v1.0.3
localeIncludes()
String.prototype.includes() but using localeCompare.
Install
npm i locale-includesSyntax
localeIncludes(string, searchString[, options])Parameters
string(string)
A string to be searched within.searchString(string)
A string to be searched for withinstring.options(object) - Optional
An object with some or all of the following properties:position(number) - Default: 0
The position withinstringat which to begin searching forsearchString.locales(string|array)
Passed through as thelocalesparameter toString.prototype.localeCompare().Any other property
Passed through in theoptionsparameter toString.prototype.localeCompare().
Return value
- (bool)
Whether the search string is found anywhere within the given string or not.
Examples
import {localeIncludes} from `locale-includes`;
localeIncludes("Abcdef", "cde");
// true
localeIncludes("Abcdef", "cde", {position: 3});
// false
localeIncludes("àḃḉdÉf", "bCde", {usage: "search", sensitivity: "base"});
// trueSee also
1.0.3
3 years ago