chore: move filters into their own file
This commit is contained in:
12
packages/search-site/src/filters.mjs
Normal file
12
packages/search-site/src/filters.mjs
Normal file
@@ -0,0 +1,12 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
Vue.filter('capitalize', value => {
|
||||
if (!value) return '';
|
||||
const v = value.toString();
|
||||
return v.charAt(0).toUpperCase() + v.slice(1);
|
||||
});
|
||||
|
||||
Vue.filter('round', (value, digits = 2) => {
|
||||
const v = parseFloat(value, 10);
|
||||
return Math.round(v * (10 * digits)) / (10 * digits);
|
||||
});
|
||||
@@ -1,19 +1,9 @@
|
||||
import Vue from 'vue';
|
||||
import Router from 'vue-router';
|
||||
import './filters.mjs';
|
||||
|
||||
Vue.use(Router);
|
||||
|
||||
Vue.filter('capitalize', value => {
|
||||
if (!value) return '';
|
||||
const v = value.toString();
|
||||
return v.charAt(0).toUpperCase() + v.slice(1);
|
||||
});
|
||||
|
||||
Vue.filter('round', (value, digits = 2) => {
|
||||
const v = parseFloat(value, 10);
|
||||
return Math.round(v * (10 * digits)) / (10 * digits);
|
||||
});
|
||||
|
||||
const router = new Router({
|
||||
mode: 'history',
|
||||
routes: [
|
||||
|
||||
Reference in New Issue
Block a user