Skip to content

Commit

Permalink
Merge pull request #7998 from cfpb/remove-format-usd-ref
Browse files Browse the repository at this point in the history
Use the include format module instead of the format-usd package.
  • Loading branch information
wpears authored Oct 31, 2023
2 parents 175a4be + 69ce321 commit 00e8fbb
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 92 deletions.
Binary file not shown.
Binary file not shown.
4 changes: 1 addition & 3 deletions cfgov/unprocessed/apps/owning-a-home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
"license": "SEE LICENSE IN TERMS.md",
"dependencies": {
"amortize": "1.1.0",
"format-usd": "1.0.1",
"highcharts": "7.2.2",
"jquery": "3.6.0",
"jumbo-mortgage": "3.0.0",
"median": "0.0.2",
"rangeslider-js": "^3.0.2",
"unformat-usd": "0.1.1"
"rangeslider-js": "^3.0.2"
},
"type": "module"
}
10 changes: 0 additions & 10 deletions cfgov/unprocessed/apps/owning-a-home/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ ev-pos@^1.0.1:
resolved "https://registry.yarnpkg.com/ev-pos/-/ev-pos-1.0.1.tgz#8bd7726667dfc3322f7f33e12bfd8a79658f66d0"
integrity sha512-XgzFXHBcgOQ92hDQLT2tjB+jC6tcfiUOn0FdfcwFkq1/5LeYY3ql163ADVpj8e8LKAU5oUo9ro1gq1cXnO8eOA==

[email protected]:
version "1.0.1"
resolved "https://registry.yarnpkg.com/format-usd/-/format-usd-1.0.1.tgz#b5f80cf8d9eab5cf5f94135aa7cee272be5d705c"
integrity sha512-tFCdsZS3MNvrCCEHp7pk98NWOzOOYTzyCdoMNOuwvbtTOCK0g9y178G9LU+YWR5ROtw0MrIB3gjHOJEYC4UeZg==

format-usd@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/format-usd/-/format-usd-0.1.0.tgz#6ff5475a4ddceb6fc5d3d2f93fedd70e2670ad3e"
Expand Down Expand Up @@ -56,8 +51,3 @@ rangeslider-js@^3.0.2:
dependencies:
custom-event "^1.0.1"
ev-pos "^1.0.1"

[email protected]:
version "0.1.1"
resolved "https://registry.yarnpkg.com/unformat-usd/-/unformat-usd-0.1.1.tgz#f9b50e9c5b0a178de1738b4de55537ebd00ab8f7"
integrity sha512-dliIiVhz3dGCEIY1tcHctuv1tZIfU4s4a8s3YFWkoyzjEF2mTbQGbGdqbBi7C3OLI5uh4cSa5bEtnpKltC5f+w==
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import Highcharts from 'highcharts/highstock';
import accessibility from 'highcharts/modules/accessibility';
import more from 'highcharts/highcharts-more';
import numberToMoney from 'format-usd';
import { formatUSD } from '../../../../../js/modules/util/format.js';
import patternFill from 'highcharts/modules/pattern-fill';
import { updateState } from '../dispatchers/update-state.js';

Expand Down Expand Up @@ -596,12 +596,12 @@ const chartView = {

updateCostOfBorrowingChart: () => {
const totalBorrowingAtGrad = getFinancialValue('debt_totalAtGrad');
const borrowedString = numberToMoney({
const borrowedString = formatUSD({
amount: totalBorrowingAtGrad,
decimalPlaces: 0,
});
const interest10years = getFinancialValue('debt_tenYearInterest');
const interestString = numberToMoney({
const interestString = formatUSD({
amount: interest10years,
decimalPlaces: 0,
});
Expand All @@ -625,7 +625,7 @@ const chartView = {
const max = Math.max(totalCosts * 1.1, totalFunding * 1.1);
const text =
'Your costs<br>' +
numberToMoney({
formatUSD({
amount: totalCosts,
decimalPlaces: 0,
});
Expand Down Expand Up @@ -653,9 +653,9 @@ const chartView = {

updateMaxDebtChart: () => {
const totalDebt = getFinancialValue('debt_totalAtGrad');
const debtString = numberToMoney({ amount: totalDebt, decimalPlaces: 0 });
const debtString = formatUSD({ amount: totalDebt, decimalPlaces: 0 });
const salary = getFinancialValue('salary_annual');
const salaryString = numberToMoney({ amount: salary, decimalPlaces: 0 });
const salaryString = formatUSD({ amount: salary, decimalPlaces: 0 });
const max = Math.max(totalDebt * 1.1, salary * 1.1);

chartView.maxDebtChart.yAxis[0].update({
Expand Down Expand Up @@ -703,17 +703,17 @@ const chartView = {

updateAffordingChart: () => {
const monthlyExpenses = getExpensesValue('total_expenses');
const expensesString = numberToMoney({
const expensesString = formatUSD({
amount: monthlyExpenses,
decimalPlaces: 0,
});
const monthlyPayment = getFinancialValue('debt_tenYearMonthly');
const paymentString = numberToMoney({
const paymentString = formatUSD({
amount: monthlyPayment,
decimalPlaces: 0,
});
const monthlySalary = getFinancialValue('salary_monthly');
const salaryString = numberToMoney({
const salaryString = formatUSD({
amount: monthlySalary,
decimalPlaces: 0,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file contains the 'view' of expenses budget after graduation
import { updateExpense, updateRegion } from '../dispatchers/update-models.js';
import { getExpensesValue } from '../dispatchers/get-model-values.js';
import numberToMoney from 'format-usd';
import { formatUSD } from '../../../../../js/modules/util/format.js';
import { selectorMatches } from '../util/other-utils.js';
import { convertStringToNumber } from '../../../../../js/modules/util/format.js';
import {
Expand Down Expand Up @@ -40,7 +40,7 @@ const expensesView = {
if (!selectorMatches(elem, ':focus')) {
const prop = elem.dataset.expensesItem;
let val = getExpensesValue(prop);
val = numberToMoney({ amount: val, decimalPlaces: 0 });
val = formatUSD({ amount: val, decimalPlaces: 0 });

if (elem.tagName === 'INPUT') {
elem.value = val;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
updateFinancial,
updateFinancialsFromSchool,
} from '../dispatchers/update-models.js';
import numberToMoney from 'format-usd';
import { formatUSD } from '../../../../../js/modules/util/format.js';
import { selectorMatches } from '../util/other-utils.js';
import { updateState } from '../dispatchers/update-state.js';
import { updateUrlQueryString } from '../dispatchers/update-view.js';
Expand Down Expand Up @@ -65,7 +65,7 @@ const financialView = {
} else if (isHours) {
val = Math.round(val * 10) / 10 + ' hours';
} else {
val = numberToMoney({ amount: val, decimalPlaces: 0 });
val = formatUSD({ amount: val, decimalPlaces: 0 });
}

if (elem.tagName === 'INPUT') {
Expand Down
Binary file not shown.
1 change: 0 additions & 1 deletion cfgov/unprocessed/apps/paying-for-college/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"license": "SEE LICENSE IN TERMS.md",
"dependencies": {
"@cfpb/student-debt-calculator": "3.0.2",
"format-usd": "1.0.1",
"jquery": "3.6.1"
},
"type": "module"
Expand Down
5 changes: 0 additions & 5 deletions cfgov/unprocessed/apps/paying-for-college/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
resolved "https://registry.yarnpkg.com/@cfpb/student-debt-calculator/-/student-debt-calculator-3.0.2.tgz#cdc1b048efde249851ecf5df8b5e437949b50012"
integrity sha512-4e68GvtW+SpbwbBHrNXl1ZXppys2304M7RVzpCM3K6O6dUDxSs2yQgYH95Fh/i1d2DZQQCvu7e/gHq96bRgwMw==

[email protected]:
version "1.0.1"
resolved "https://registry.yarnpkg.com/format-usd/-/format-usd-1.0.1.tgz#b5f80cf8d9eab5cf5f94135aa7cee272be5d705c"
integrity sha512-tFCdsZS3MNvrCCEHp7pk98NWOzOOYTzyCdoMNOuwvbtTOCK0g9y178G9LU+YWR5ROtw0MrIB3gjHOJEYC4UeZg==

[email protected]:
version "3.6.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.1.tgz#fab0408f8b45fc19f956205773b62b292c147a16"
Expand Down
60 changes: 0 additions & 60 deletions cfgov/unprocessed/root/code.json
Original file line number Diff line number Diff line change
Expand Up @@ -1190,66 +1190,6 @@
"email": "[email protected]"
}
},
{
"name": "format-usd",
"description": "Convert a number or string to a USD-formatted string",
"repositoryURL": "https://github.com/cfpb/format-usd",
"permissions": {
"licenses": [
{
"name": "Public Domain"
}
],
"usageType": "openSource"
},
"laborHours": -1,
"tags": [
"cfpb"
],
"contact": {
"email": "[email protected]"
}
},
{
"name": "unformat-usd",
"description": "Convert a United States dollar-formatted string into a number.",
"repositoryURL": "https://github.com/cfpb/unformat-usd",
"permissions": {
"licenses": [
{
"name": "Public Domain"
}
],
"usageType": "openSource"
},
"laborHours": -1,
"tags": [
"cfpb"
],
"contact": {
"email": "[email protected]"
}
},
{
"name": "is-money-usd",
"description": "A node module to test for a USD formatted input.",
"repositoryURL": "https://github.com/cfpb/is-money-usd",
"permissions": {
"licenses": [
{
"name": "Public Domain"
}
],
"usageType": "openSource"
},
"laborHours": -1,
"tags": [
"cfpb"
],
"contact": {
"email": "[email protected]"
}
},
{
"name": "owning-a-home-api",
"description": "The API that drives the Buying a House project. ",
Expand Down

0 comments on commit 00e8fbb

Please sign in to comment.