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

Make esmock slightly smaller #153

Merged
merged 8 commits into from
Sep 19, 2022
Merged

Conversation

iambumblehead
Copy link
Owner

@iambumblehead iambumblehead commented Sep 18, 2022

These changes are made for fun while waiting for someone to call me today. Basically, this PR should make esmock slightly smaller and more readable.

A recursive function is renamed and an unused param was removed. And many other little micro-optimizations...

-const esmockModulesCreate = async (parent, moduleFileURL, esmockKey, defs, keys, mocks, opt) => {
+const esmockModuleId = async (parent, key, defs, ids, mocks, opt) => {
  // ...
  if (keys.length)
-   return esmockModulesCreate(parent, moduleFileURL, esmockKey, defs, keys.slice(1), mocks, opt)
+   return esmockModuleId(parent, key, defs, ids.slice(1), mocks, opt)
}

Copy link
Collaborator

@tripodsan tripodsan left a comment

Choose a reason for hiding this comment

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

LGTM, judging by the diff

@iambumblehead iambumblehead merged commit fddefc7 into master Sep 19, 2022
@iambumblehead iambumblehead deleted the make-esmock-slightly-smaller branch September 19, 2022 15:34
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.

3 participants