Created
July 24, 2019 13:39
-
-
Save edwardgalligan/1a2690246725a71fb627b8d209d1c1ca to your computer and use it in GitHub Desktop.
What not to do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const resolveObjectPromises = async a => (async b => await Promise.all(Object.keys(a).map(async k => b[k] = await a[k])) && b)({}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an example of a solution to a problem that need not exist.
i.e. a concrete argument for structuring data a certain way, and not structuring data a certain way.
In general, structuring data in a way that is easy to parse is usually the same as structuring data that is easy to create/read/handle.
In this case, the source object is of the form:
This was probably created with specific use-cases in mind looking like:
if this is intended to be your only use-case, these two props shouldn't be on the same object. If you're intending the object to be handled somewhere in code as a single entity, it should look more like: