Remove duplicate utility code via shared formatting module
Consolidate MONTH_NAMES, PALETTE, formatCurrency, formatCurrencyShort, ordinal, and fmt into client/src/utils/formatting.js. Consolidate CONFIG_KEYS into server/src/constants.js. All consumer files updated to import from these shared modules. PaycheckView re-exports formatCurrency, ordinal, and formatPayDate for backward compatibility with existing tests. Nightshift-Task: dead-code Nightshift-Ref: https://github.com/marcus/nightshift
This commit is contained in:
12
server/src/constants.js
Normal file
12
server/src/constants.js
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const CONFIG_KEYS = [
|
||||
'paycheck1_day',
|
||||
'paycheck2_day',
|
||||
'paycheck1_gross',
|
||||
'paycheck1_net',
|
||||
'paycheck2_gross',
|
||||
'paycheck2_net',
|
||||
];
|
||||
|
||||
module.exports = { CONFIG_KEYS };
|
||||
@@ -1,15 +1,7 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const { pool } = require('../db');
|
||||
|
||||
const CONFIG_KEYS = [
|
||||
'paycheck1_day',
|
||||
'paycheck2_day',
|
||||
'paycheck1_gross',
|
||||
'paycheck1_net',
|
||||
'paycheck2_gross',
|
||||
'paycheck2_net',
|
||||
];
|
||||
const { CONFIG_KEYS } = require('../constants');
|
||||
|
||||
const DEFAULTS = {
|
||||
paycheck1_day: 1,
|
||||
|
||||
@@ -2,15 +2,7 @@ const express = require('express');
|
||||
const router = express.Router();
|
||||
const { pool } = require('../db');
|
||||
const { calcPaymentAmount } = require('./financing');
|
||||
|
||||
const CONFIG_KEYS = [
|
||||
'paycheck1_day',
|
||||
'paycheck2_day',
|
||||
'paycheck1_gross',
|
||||
'paycheck1_net',
|
||||
'paycheck2_gross',
|
||||
'paycheck2_net',
|
||||
];
|
||||
const { CONFIG_KEYS } = require('../constants');
|
||||
|
||||
const CONFIG_DEFAULTS = {
|
||||
paycheck1_day: 1,
|
||||
|
||||
Reference in New Issue
Block a user