Skip to content

Instantly share code, notes, and snippets.

View iliyaZelenko's full-sized avatar
😌
Calm

Илья iliyaZelenko

😌
Calm
View GitHub Profile
@iliyaZelenko
iliyaZelenko / truncate.js
Created July 15, 2018 23:23
Vue truncate filter
Vue.filter('truncate', (text, stop = 15, clamp) => {
if (!text) {
return text
}
return text.slice(0, stop) + (stop < text.length ? clamp || '...' : '')
})