Created
March 26, 2019 21:04
-
-
Save firminochangani/5195708b88bb95fe59ad33d488c64f21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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