# locale-includes

> String.prototype.includes() but using localeCompare.

Latest version **1.0.6** (published 2023-11-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install locale-includes
pnpm add locale-includes
yarn add locale-includes
bun add locale-includes
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2023-11-18 |
| First published | 2020-02-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Maintainers | idmadj |
| Keywords | localeincludes, locale, includes, contains, string, localecompare, search, filter, match, diacritics, accents, case, insensitive, i18n, esm, module |

## Links

- npm: https://www.npmjs.com/package/locale-includes
- Repository: https://github.com/idmadj/locale-includes
- Homepage: https://github.com/idmadj/locale-includes#readme
- Issues: https://github.com/idmadj/locale-includes/issues
- npm.io page: https://npm.io/package/locale-includes

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.6 (latest) — 2023-11-18
- 1.0.5 — 2023-01-09
- 1.0.4 — 2022-10-11
- 1.0.3 — 2022-03-30
- 1.0.2 — 2021-09-19
- 1.0.1 — 2020-02-15
- 1.0.0 — 2020-02-15

## README

# localeIncludes()
[![npm](https://img.shields.io/npm/v/locale-includes.svg)](https://www.npmjs.com/package/locale-includes)
![npm bundle size (minified)](https://img.shields.io/bundlephobia/min/locale-includes.svg)

[`String.prototype.includes()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes) but using [`localeCompare`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare).


## Install
```sh
npm i locale-includes
```


## Syntax
```js
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:

  + `position` (number) - *Default: 0*  
    The position within `string` at which to begin searching for `searchString`.

  + `locales` (string|array)  
    Passed through as the `locales` parameter to [`String.prototype.localeCompare()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#Parameters).

  + *Any other property*  
    Passed through in the `options` parameter to [`String.prototype.localeCompare()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#Parameters).

### Return value
+ (bool)  
  Whether the search string is found anywhere within the given string or not.


## Examples
```js
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()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes)  
[`String.prototype.localeCompare()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare)

---
_Source: https://npm.io/package/locale-includes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
