# this-and-that

> Use the list patterns from CLDR for rendering lists of items in a locale-specific format

Latest version **2.0.0** (published 2021-02-13) · BSD license · 0 weekly downloads

## Install

```sh
npm install this-and-that
pnpm add this-and-that
yarn add this-and-that
bun add this-and-that
```

## 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 | 2.0.0 |
| Published | 2021-02-13 |
| First published | 2018-06-21 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 553.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Andreas Lind |
| Maintainers | papandreou |

## Links

- npm: https://www.npmjs.com/package/this-and-that
- Repository: https://github.com/papandreou/this-and-that
- Homepage: https://github.com/papandreou/this-and-that#readme
- Issues: https://github.com/papandreou/this-and-that/issues
- npm.io page: https://npm.io/package/this-and-that

## Recent versions

- 2.0.0 (latest) — 2021-02-13
- 1.0.3 — 2018-08-28
- 1.0.2 — 2018-06-21
- 1.0.1 — 2018-06-21
- 1.0.0 — 2018-06-21

## README

# this-and-that

Render a list of items as dictated by the locale. The formats are extracted from
[the
CLDR](http://cldr.unicode.org/development/development-process/design-proposals/list-formatting).

## Installation

```
npm install this-and-that
```

## Syntax

```js
thisAndThat(itemsArray, localeId = 'en-US', format = 'default')
```

The `format` parameter can be either `default`, `or`, `standardShort`, `unit`,
`unitNarrow`, or `unitShort`.

Returns a string with the formatted list items.

## Examples

```js
const thisAndThat = require('this-and-that');

// Default list format in American English:
console.log(thisAndThat(['foo', 'bar', 'quux'], 'en-US'));
// foo, bar, and quux

// The "or" format:
console.log(thisAndThat(['foo', 'bar', 'quux'], 'en-US', 'or'));
// foo, bar, or quux

// The "default" format in Arabic:
console.log(thisAndThat(['foo', 'bar', 'quux'], 'ar'));
// foo، bar، وquux

// The "unitShort" format in Arabic:
console.log(thisAndThat(['foo', 'bar', 'quux'], 'ar', 'unitShort'));
// foo، وbar، وquux
```

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