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

Prettier #55

Closed
wants to merge 7 commits into from
Closed

Prettier #55

wants to merge 7 commits into from

Conversation

a-hariti
Copy link
Collaborator

@a-hariti a-hariti commented Feb 4, 2019

this PR adds prettier to the build system, formats the codebase accordingly, and suggests some code refactoring, feel free to cherry-pick.
fixes #51

tslint-config-prettier is necessary to make prettier play nice with
tslint.
this commit formats src/* and tests/* according to prettier so that it
would be a starting point for all commits from now on ( if not done
prettier would do it anayway once a change occurs in one of those files,
 and cloud the actual change made by that commit)
the function keyword makes code more readable when the function's body
is large, one tends to lose track while reading large arrow functions.

img.onerror = errorHandler
img.onabort = errorHandler
img.src = src
})
}

export const getCounts = (data: Uint8ClampedArray, ignore: string[]): [] => {
const countMap = {}
export function getCounts(data: Uint8ClampedArray, ignore: string[]): [] {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@a-hariti What's the thinking behind changing this to a function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TLDR it is a matter of preference.
I think it is more readable IMHO, arrow functions are more suitable for one-liners like someNumbers.map(n => n*2), but once a functions get as big as this one, it becomes more difficult to keep track of the one you are reading.

@a-hariti a-hariti closed this Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

formatting code with prettier.
2 participants