summaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.js')
-rw-r--r--src/main.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.js b/src/main.js
index 8585f897..ca17b958 100644
--- a/src/main.js
+++ b/src/main.js
@@ -85,6 +85,16 @@ Vue.filter('formatTime', function (value) {
}
});
+Vue.filter('truncate', function (text, length, suffix) {
+ const arrRaw = text.split(' ');
+ const arr = arrRaw.filter((word) => word !== '');
+ if (arr.length > length) {
+ return arr.splice(0, length).join(' ') + suffix;
+ } else {
+ return text;
+ }
+});
+
// Plugins
Vue.use(AlertPlugin);
Vue.use(BadgePlugin);