Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Put together a PR addressing some of the things I've seen in the library in terms of layout and code styling etc.
Some context to this PR
Try and keep consistency, this includes things such as the positioning of brackets, the use of semi colons, and the types of quotes that you're using. Using a linter such as ESLint (even in the default state) would wipe out these issues entirely.
On the back of this, be sure to remove any unecessary whitespace that is in the file. Your idea will be able to do this for you automatically when you save if you enable it in the settings.
Remember the acronym DRY, Don't Repeat Yourself. In each of the methods that the user has access to, you were writing the same two lines; retrieve the JSON file from the disk, and then parse it. By moving those two lines out into their own function, this reduces the amount of duplicated code and keep also reduces the number of lines in each of those functions. You could take this a bit further and make some of those just single-line functions, but I'll leave that up to you.
Whenever possible, use triple equals instead of just the double equals. This also includes instances when you're doing negative checking (
2 == '3' // true 2 === '3' // false
It's good to see that you're willing to use array methods such as
I believe there are instances where you could
If you need anymore explanation, feel free to comment here or message me on Discord.