Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

locale-includes

1.0.1 • Public • Published

localeIncludes()

npm npm bundle size (minified)

String.prototype.includes() but using localeCompare.

Install

npm i locale-includes

Syntax

localeIncludes(string, searchString[, options])

Parameters

  • string (string)
    A string to be searched within.

  • searchString (string)
    A string to be searched for within string.

  • options (object) - Optional
    An object with some or all of the following properties:

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"});
// true

See also

String.prototype.includes()
String.prototype.localeCompare()

Install

npm i locale-includes

DownloadsWeekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

5.69 kB

Total Files

4

Last publish

Collaborators

  • avatar