# locale-compare-shim

> polyfill for String.localeCompare

Latest version **0.0.1** (published 2018-07-16) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install locale-compare-shim
pnpm add locale-compare-shim
yarn add locale-compare-shim
bun add locale-compare-shim
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2018-07-16 |
| First published | 2018-07-16 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ozguryazilimas |
| Keywords | javascript, node, string, locale, compare |

## Links

- npm: https://www.npmjs.com/package/locale-compare-shim
- Repository: https://github.com/ozguryazilimas/locale-compare-polyfill
- Homepage: https://github.com/ozguryazilimas/locale-compare-polyfill#readme
- Issues: https://github.com/ozguryazilimas/locale-compare-polyfill/issues
- npm.io page: https://npm.io/package/locale-compare-shim

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2018-07-16

## README

# locale-compare-shim

This project is a fork of [locale-compare-polyfill](https://github.com/jeppeburchardt/locale-compare-polyfill) with turkish support which is not maintained anymore.

Polyfill for String.localeCompare

localeCompare is not supported in Safari and most mobile browsers. Only 2.345 bytes.

## locales

Currently only supports Turkish, Danish, Norwegian, Swedish and Finish, but more locales can easily be generated (take a look at src/generator.js). 

## install

```
npm install locale-compare-shim
npm test
```

## usage

```
'ø'.localeCompare('p') // -1
'ø'.localeCompare('p', 'da') // 1 a positive value: in danish, ø sorts after p
```

## syntax

`referenceStr.localeCompare(compareString[, locales[, options]])`

### compareString

The string against which the referring string is compared

### locales

A string with a BCP 47 language tag. Currently only supports `tr`, `da`, `nb`, `se` and `fi`. 

### options

No polyfill support yet.

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