Vue filter to ensure USD formatting prepended with a $. Could be even more terse by refactoring decimalPrice and returning one line, but more legible?
import Vue from 'vue'; Vue.filter( 'currency', value => { if ( ! value ) { return '' } const decimalPrice = Number( value ).toFixed( 2 ); return decimalPrice.toString().padStart( ( decimalPrice.length + 1 ), '$' ); });