https://github.com/sderosiaux/text-ellipsis
Cut off a string if too long
https://github.com/sderosiaux/text-ellipsis
cut javascript text-ellipsis
Last synced: 8 months ago
JSON representation
Cut off a string if too long
- Host: GitHub
- URL: https://github.com/sderosiaux/text-ellipsis
- Owner: sderosiaux
- License: mit
- Created: 2015-09-14T23:12:51.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-21T12:44:20.000Z (over 10 years ago)
- Last Synced: 2025-08-18T13:25:50.433Z (10 months ago)
- Topics: cut, javascript, text-ellipsis
- Language: JavaScript
- Homepage:
- Size: 156 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# text-ellipsis [](https://travis-ci.org/chtefi/text-ellipsis)
> Cut off a string if too long
## Why
You always want to cut off long strings.
## Install
```shell
$ npm install --save text-ellipsis
```
## Usage
```js
var ellipsis = require('text-ellipsis');
var short = ellipsis('a very long text', 10);
console.log(short);
// "a very ..."
var short = ellipsis('a very long text', 10, { side: 'start' });
console.log(short);
// "...ng text"
var short = ellipsis('a very long text', 10, { ellipsis: ' END' });
console.log(short);
// "a very END"
```