All Projects → FGRibreau → node-truncate

FGRibreau / node-truncate

Licence: other
🐙 Truncate text and keeps urls safe.

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to node-truncate

Shave
💈 Shave is a 0 dep JS plugin that truncates text to fit within an element based on a set max-height ✁
Stars: ✭ 2,113 (+3963.46%)
Mutual labels:  truncate
Voca
The ultimate JavaScript string library
Stars: ✭ 3,387 (+6413.46%)
Mutual labels:  truncate
react-middle-truncate
A React component for intelligently truncating text in the middle of the string.
Stars: ✭ 27 (-48.08%)
Mutual labels:  truncate
react-text-more-less
📃React component to show more text or show less
Stars: ✭ 16 (-69.23%)
Mutual labels:  truncate
strings-truncation
Truncate strings with fullwidth characters and ANSI codes.
Stars: ✭ 45 (-13.46%)
Mutual labels:  truncate
tailwindcss-truncate-multiline
Tailwind CSS plugin to generate truncate multiline utilities
Stars: ✭ 92 (+76.92%)
Mutual labels:  truncate
v-clamp
Vue directive plugin for text truncate
Stars: ✭ 15 (-71.15%)
Mutual labels:  truncate
ngx-line-truncation
An Angular line truncating solution. Truncate text block by given line number and add ellipsis to the end.
Stars: ✭ 13 (-75%)
Mutual labels:  truncate
shear.js
✂️truncate text across DOM nodes
Stars: ✭ 61 (+17.31%)
Mutual labels:  truncate

Truncate

CI Downloads available-for-advisory Twitter Follow Get help on Codementor Slack

Truncate text and keeps urls safe.

NPM

Install the module with: npm install truncate

Usage

// Browser
String.truncate("1234 http://google.com hey :)", 2) === "12…"
// NodeJS
> truncate = require('truncate');
> truncate("1234 http://google.com hey :)", 4);
"1234…"
> truncate("1234 http://google.com hey :)", 4, {ellipsis:null}); // or ellipsis:''
"1234"
> truncate("1234 http://google.com hey :)", 6);
"1234 http://google.com…"
> truncate("1234 http://google.com hey :)", 100);
"1234 http://google.com hey :)"

Changelog

Donate

I maintain this project in my free time, if it helped you please support my work via paypal or bitcoins, thanks a lot!

License

Copyright (c) 2014 Francois-Guillaume Ribreau Licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].