# and

> Join arrays with commas and »and« before the last item

Latest version **0.0.3** (published 2018-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install and
pnpm add and
yarn add and
bun add and
```

## 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.3 |
| Published | 2018-01-13 |
| First published | 2013-10-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Thomas Rasshofer |
| Maintainers | rasshofer |
| Keywords | and, join |

## Links

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

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2018-01-13
- 0.0.2 — 2018-01-07
- 0.0.1 — 2018-01-07
- 0.0.0 — 2013-10-13

## README

# And

> Join arrays with commas and »and« before the last item

[![Build Status](https://travis-ci.org/rasshofer/and.svg)](https://travis-ci.org/rasshofer/and)
[![Coverage Status](https://coveralls.io/repos/github/rasshofer/and/badge.svg)](https://coveralls.io/github/rasshofer/and)
[![Dependency Status](https://david-dm.org/rasshofer/and/status.svg)](https://david-dm.org/rasshofer/and)
[![Dependency Status](https://david-dm.org/rasshofer/and/dev-status.svg)](https://david-dm.org/rasshofer/and)

## Installation

```shell
npm install and
```

## Usage

```js
const and = require('and');

console.log(and(['John', 'Frank', 'Jimmy'])); // = 'John, Frank & Jimmy'

console.log(and(['John', 'Frank'])); // = 'John & Frank'

console.log(and(['Frank'])); // = 'Frank'

console.log(and(['John', 'Frank', 'Jimmy'], 'and')); // = 'John, Frank and Jimmy'

console.log(and(['John', 'Frank', 'Jimmy'], 'or')); // = 'John, Frank or Jimmy'

console.log(and(['John', 'Frank', 'Jimmy'], 'and', true)); // = 'John, Frank, and Jimmy'
```

## API

`and` accepts the following three parameters.

### `data`

Input data.

Example: `['John', 'Frank', 'Jimmy']`

### `separator`

The separator to be used for the last item.

Example: `and`

Default: `&` (= language-independent)

### `oxfordComma`

Use oxford comma in front of the last separator?

Example: `true` (= `'John, Frank, and Jimmy'`)

Default: `false` (= `'John, Frank and Jimmy'`)

## Changelog

* 0.0.3
  * Fix oxford comma for <3 items
* 0.0.2
  * Fix README
* 0.0.1
  * Initial version

## License

Copyright (c) 2018 [Thomas Rasshofer](http://thomasrasshofer.com/)  
Licensed under the MIT license.

See LICENSE for more info.

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