number
Formats a string number to a user friendly number using the browser's Intl object. Note that the format will default to the user's browser locale settings based on navigator.language.
Installation
Global install:
import Vue from 'vue';
import { number } from 'vuetensils/src/filters';
Vue.filter('number', number);
Local install:
<script>
import { number } from 'vuetensils/src/filters';
export default {
filters: {
number,
},
};
</script>
Example
Custom Locale
You can specify the locale formatting by passing the filter your target ISO Language Code.
Custom Default Locale
You can specify your own default locale formatting by extending the filter and providing your target ISO Language Code.
import Vue from 'vue';
import { number } from 'vuetensils/src/filters';
const customNumber = str => number(str, 'de-DE');
Vue.filter('number', customNumber);