# truncand

> A utility to truncate list of strings and append remaining count

Latest version **1.0.4** (published 2020-12-16) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-12-16 |
| First published | 2020-01-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Halil Coban |
| Maintainers | hcoban |

## Links

- npm: https://www.npmjs.com/package/truncand
- Repository: https://github.com/HCoban/truncand
- Issues: https://github.com/HCoban/truncand/issues
- npm.io page: https://npm.io/package/truncand

## Recent versions

- 1.0.4 (latest) — 2020-12-16
- 1.0.3 — 2020-07-26
- 1.0.2 — 2020-01-17
- 1.0.1 — 2020-01-17
- 1.0.0 — 2020-01-17

## README

# Truncand

Truncade and join list of strings.

# Usage

```
import truncand from 'truncand';

const list = ["Oksana", "Ada", "Marie", "Rosalind"]
const limit = 3
truncand(list, limit) // returns "Oksana, Ada, Marie and 1 more"
```

You can pass an options to truncand. The default options object is

```
{
  // whether or not add remaining count (eg. 'and 3 more')
  appendRemainingCount: true,
  descriptionPlural: 'more',
  descriptionSingular: 'more',
  oxfordComma: false,
  useAnd: true
}
```

If you want to pass a common descriptor you can do so by
```
const list = ["Oksana", "Ada", "Marie", "Rosalind"]
const limit = 2
truncand(list, limit, { descriptionSingular: "other", descriptionPlural: "others" }) // returns "Oksana, Ada and 2 others"
```

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