Skip to content

Set getHash and formatters if undefined#86

Merged
Setogit merged 1 commit intomasterfrom
fallback-to-md5
Sep 3, 2016
Merged

Set getHash and formatters if undefined#86
Setogit merged 1 commit intomasterfrom
fallback-to-md5

Conversation

@Setogit
Copy link
Copy Markdown
Contributor

@Setogit Setogit commented Sep 2, 2016

connect to #85

@Setogit Setogit self-assigned this Sep 3, 2016
@Setogit Setogit changed the title Fall back to md5 if getHash is undefined Set getHash and formatters if undefined Sep 3, 2016
@Setogit Setogit merged commit d86dfd9 into master Sep 3, 2016
@Setogit Setogit deleted the fallback-to-md5 branch September 3, 2016 05:57
@bajtos
Copy link
Copy Markdown
Member

bajtos commented Sep 5, 2016

@Setogit now that you are initializing getHash and formatters lazily, it is no longer necessary to initialize them at load time and these two lines can be removed:

formatters: new MapCache(),
getHash: memoize(md5),

    global.STRONGLOOP_GLB = {
      // ...
      formatters: new MapCache(),
      getHash: memoize(md5),
      // ...
  };

Thoughts?

@Setogit
Copy link
Copy Markdown
Contributor Author

Setogit commented Sep 6, 2016

@bajtos: right. it's not required. I kept it because I wanted to show the intended global.STRONGLOOP_GLB structure rather than hiding it in the lazy coding. But, not religious either; i don't mind replacing the two lines with comments. In general, I prefer documenting as code (including test code) to textual comments.

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.

2 participants