# shortfield

> Make short a long string, concatenated with three dots

Latest version **2.2.1** (published 2025-01-21) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 35/100 (D)** — status: maintenance-mode.

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

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2025-01-21 |
| First published | 2021-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 1 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | alessandro.arici@gmail.com |
| Maintainers | sineverba |
| Keywords | npm, package, string |

## Links

- npm: https://www.npmjs.com/package/shortfield
- Repository: https://github.com/sineverba/npm-pkg-shortfield
- Homepage: https://github.com/sineverba/npm-pkg-shortfield#readme
- Issues: https://github.com/sineverba/npm-pkg-shortfield/issues
- npm.io page: https://npm.io/package/shortfield

## Dependencies (1)

- [npm](https://npm.io/package/npm.md) ^10.8.1

## 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

- 2.2.1 (latest) — 2025-01-21
- 2.2.0 — 2024-01-08
- 2.1.0 — 2023-07-21
- 2.0.0 — 2023-02-23
- 1.2.0 — 2023-01-07
- 1.1.1 — 2022-01-30
- 1.0.0 — 2021-02-28
- 0.3.0 — 2021-02-16
- 0.2.0 — 2021-02-16
- 0.1.0 — 2021-02-09

## README

| CI / CD | Status |
| ------- | ------ |
| NPM | [![npm version](https://badge.fury.io/js/shortfield.svg)](https://badge.fury.io/js/shortfield) |
| Semaphore CI | [![Build Status](https://sineverba.semaphoreci.com/badges/npm-pkg-shortfield/branches/master.svg)](https://sineverba.semaphoreci.com/projects/npm-pkg-shortfield) |
| Circle CI | [![CircleCI](https://circleci.com/gh/sineverba/npm-pkg-shortfield.svg?style=svg)](https://circleci.com/gh/sineverba/npm-pkg-shortfield) |
| Coverall | [![Coverage Status](https://coveralls.io/repos/github/sineverba/npm-pkg-shortfield/badge.svg?branch=master)](https://coveralls.io/github/sineverba/npm-pkg-shortfield?branch=master) |
| SonarCloud | [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=npm-pkg-shortfield&metric=alert_status)](https://sonarcloud.io/dashboard?id=npm-pkg-shortfield) |

`shortfield` returns a string truncated after X characters (default 10), concatenated with "..." (three dots).

Useful in tables with long strings.

E.g. "This is a long string" will return "This is a ..."

## Installation
`npm install shortfield`

## Usage

```js
import { Shortener } from "shortfield";

var shorted = Shortener("This is a long string"); // default length is 10
console.log(shorted); // returns This is a ...

var shorted = Shortener("This is a long string", 4);
console.log(shorted); // returns This...
```

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