Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve currencies.js #481

Closed
taoeffect opened this issue Sep 5, 2018 · 0 comments
Closed

Improve currencies.js #481

taoeffect opened this issue Sep 5, 2018 · 0 comments
Labels
App:Frontend Kind:Enhancement Improvements, new features, performance upgrades, etc. Level:Starter Note:Up-for-grabs Good candidates for newcomers, because we *think* nobody is working on currently.

Comments

@taoeffect
Copy link
Member

Problem

Not much thought has been given to the file currencies.js. It was always planned that this file would be rewritten at some point, but one real simple and obvious issue with it is that it has an unnecessary function in it called symbol.

This is the entirety of the file:

const CURRENCIES = {
  'USD': '$',
  'EUR': '€',
  'BTC': 'Ƀ'
}

export const symbol = (code: string) => CURRENCIES[code] || code

export default CURRENCIES

Solution

  • As a minimum, the function, which does a simple lookup, should be removed
  • CURRENCIES should be exported directly, and not as the default export

This way, instead of doing:

import { symbol } from './utils/currencies.js'

// ...

var something = symbol('USD')

You'd do something more like:

import { CURRENCIES } from './utils/currencies.js'

// ...

var something = CURRENCIES.USD
@taoeffect taoeffect added Kind:Enhancement Improvements, new features, performance upgrades, etc. Note:Up-for-grabs Good candidates for newcomers, because we *think* nobody is working on currently. App:Frontend Level:Starter labels Sep 5, 2018
sandrina-p added a commit to sandrina-p/group-income-simple that referenced this issue Sep 6, 2018
taoeffect pushed a commit that referenced this issue Sep 7, 2018
* Contributions - Mount basic ldefault layout

* Contributions - Add nonmonetary method input

* Contributions - Refine list of contributions

* Contributions - Style input to add nonmonetary

* Contributions -NonMonetary ui logic

* revert ListItem.vue

* Contributions - start DRYing contribution component

* Contributions - extract Contribution UI logic from view

* Contributions - Add some comments, adjust pixels and randomize placeholder

* Contributions - updates based on code review

* Contributions - updates based on code review

* Contributions - fix bug on contribution with keyboard enter on edit button to input

* fix #481 improve currencies.js

* Contributions - improve props/conditions readability

* Contributions - refactor i18n to treceiving contribution text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App:Frontend Kind:Enhancement Improvements, new features, performance upgrades, etc. Level:Starter Note:Up-for-grabs Good candidates for newcomers, because we *think* nobody is working on currently.
Projects
None yet
Development

No branches or pull requests

1 participant