# truco

> Truncate strings.

Latest version **1.3.1** (published 2015-08-17) · MIT license · 0 weekly downloads

## Install

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

## 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 | 1.3.1 |
| Published | 2015-08-17 |
| First published | 2015-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.12.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Rafael Rinaldi |
| Maintainers | rafaelrinaldi |
| Keywords | truncate, truco, strings, strip |

## Links

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

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

- 1.3.1 (latest) — 2015-08-17
- 1.3.0 — 2015-08-17
- 1.2.0 — 2015-08-14
- 1.1.1 — 2015-07-28
- 1.0.1 — 2015-07-27

## README

# truco [![Build Status](https://travis-ci.org/rafaelrinaldi/truco.svg?branch=master)](https://travis-ci.org/rafaelrinaldi/truco)

> Truncate strings.

<sub>[Truco](https://en.wikipedia.org/wiki/Truco) is a popular trick-taking card game originally from Valencia and Balearic Islands (Spain) and very popular in some countries like Brazil, Argentina, Paraguay and Italy.</sub>

## Install

Via [npm](http://npmjs.com):

```sh
$ npm install truco --save
```

Via [Bower](http://bower.io):

```sh
$ bower install truco --save
```

## Usage

```javascript
var truco = require('truco');

truco('Lorem Ipsum', 5); // Lorem…
truco('Lorem Ipsum', 5, {ellipsis: '***'}); // Lorem***
truco('Lorem Ipsum', 5, {moonwalk: true}); // …Ipsum
```

## API

## `truco(string, [limit], [options])`

### `string`

*Required*  
Type: `string`

The string to be truncated.

### `limit`

Type: `number`  
Default: the total length of `string`

The position where the string should be truncated at.

### `options`

Type: `object`

Custom options.

#### `options.ellipsis`

Type: `string`  
Default: `…`

The symbol that should be placed at the end/beginning of the truncated string.

#### `options.moonwalk` ![moonwalker](http://tgnp.me/wp-content/uploads/2011/10/lunapic_132009218615037_5.gif)

Type: `boolean`  
Default: `false`  

Wether or not to truncate string from the beginning to the end instead of the opposite.

## License

MIT © [Rafael Rinaldi](http://rinaldi.io)

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