Skip to content

Instantly share code, notes, and snippets.

@flowck
Created March 26, 2019 21:04
Show Gist options
  • Save flowck/5195708b88bb95fe59ad33d488c64f21 to your computer and use it in GitHub Desktop.
Save flowck/5195708b88bb95fe59ad33d488c64f21 to your computer and use it in GitHub Desktop.
// main.js
import Vue from "vue";
/**
* numberToUSD: It format numbers into the USD currency format.
* @param {number} value
* @returns {string} value
*/
Vue.filter("numberToUSD", value => {
return value ? `$${value.toLocaleString("en-US")}` : "$0.0";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment